Skip to content

omnilab/mpc API reference

Floor
Provider · Omnilab
Version
1.x
Conformance suite
not wired
Verified for real
Its README does not say
Licence
MIT
composer require omnilab/mpc:1.x-dev

Read from the package's own PHP files at the commit ae0078b5a72d: its namespaces, classes, interfaces and enums, their public constants, properties and methods with their PHPDoc, and the options its factories take. Nothing of it is run.

Omnilab\Mpc

  • MpcSource class

    The IAU's Minor Planet Center (data.minorplanetcenter.net): a minor planet, a comet or a natural satellite by its number, its designation (provisional, packed or not, primary or secondary) or its name - its designations, name and naming citation, its orbit as the MPC computes it (the osculating elements with their uncertainties at their epoch, the perihelion, the period, the MOIDs), its absolute magnitude, how it was observed (the observations, oppositions and arc, the uncertainty parameter U); a search of the names; and, outside the contract, its latest observations (observations()).

    6 methods · 3 constants

  • MpcSourceFactory class

    The IAU's Minor Planet Center: minor planets, comets and natural satellites by number, designation or name, their orbits and their observations - no key needed.

    2 options

  • Observation class

    One optical observation of a body as the Minor Planet Center publishes it (outside the contract): when, where on the sky (J2000 / ICRF right ascension and declination, in degrees), how bright in which band, from which observatory (its MPC code: 568 is Maunakea, C51 WISE), how it was made (CCD, CMOS, photographic...), and the 80-column line it was read from.

    2 methods · 9 properties

Omnilab\Mpc

MpcSource class

final class MpcSource extends HttpSource MpcSource.php:34

The IAU's Minor Planet Center (data.minorplanetcenter.net): a minor planet, a comet or a natural satellite by its number, its designation (provisional, packed or not, primary or secondary) or its name - its designations, name and naming citation, its orbit as the MPC computes it (the osculating elements with their uncertainties at their epoch, the perihelion, the period, the MOIDs), its absolute magnitude, how it was observed (the observations, oppositions and arc, the uncertainty parameter U); a search of the names; and, outside the contract, its latest observations (observations()).

No key. The MPC's APIs take their query as a JSON body on a GET (their POST answers 405). Two calls an entity: the Designation Identifier, then the orbit.

const BASE_URI = 'https://data.minorplanetcenter.net/api/'
const MAX_OBSERVATIONS = 1000

The most observations observations() gives at once.

const MAX_PER_PAGE = 100

The most names a search page holds.

MpcSource::__construct()

public function __construct(HttpClientInterface $http, string $baseUri = self::BASE_URI, array $headers = [], float $throttle = 0.0)

MpcSource::getName()

public function getName(): string

MpcSource::capabilities()

public function capabilities(): array

MpcSource::entity()

public function entity(Identifier|string $id): ?Entity

A body by what the Designation Identifier reads: a number (433, its IAU form (433) too), a designation (2004 MN4, K04M04N packed, a comet's 1P or C/2020 F3), a name (Eros); an Identifier of the mpc or the jpl.sbdb scheme (the same designations). A name several bodies share ("Halley": 1P/Halley and (2688) Halley) is null rather than a guess; another base's identifier is refused before any call.

public function search(Query $query): Page

The bodies whose name holds the text, whatever its case, the closest first (the MPC's similarity), one page at a time: each with its designations, name and citation (entity() reads its orbit).

MpcSource::observations()

public function observations(Identifier|string $id, int $limit = 20): array

The body's latest observations, the latest first (outside the contract: an observation has a time and an observatory, not a place the core reads, and the MPC answers every observation of a body at once - Eros's 18,679 in 1.7 MB). Optical observations only, from the 80-column format: a radar's and a satellite's second lines are not read. Empty when the body is unknown.

MpcSourceFactory class

final class MpcSourceFactory extends SourceFactory MpcSourceFactory.php:20

The IAU's Minor Planet Center: minor planets, comets and natural satellites by number, designation or name, their orbits and their observations - no key needed.

options: mailto: 'support@glitchr.io' # in the User-Agent: whom the MPC writes to before it blocks a caller throttle: 0 # seconds between two calls: the MPC publishes no rate base_uri: 'https://data.minorplanetcenter.net/api/'

Options

OptionDefault
throttle0.0
base_uriMpcSource::BASE_URI

Observation class

final readonly class Observation Observation.php:13

One optical observation of a body as the Minor Planet Center publishes it (outside the contract): when, where on the sky (J2000 / ICRF right ascension and declination, in degrees), how bright in which band, from which observatory (its MPC code: 568 is Maunakea, C51 WISE), how it was made (CCD, CMOS, photographic...), and the 80-column line it was read from.

public \DateTimeImmutable $time
public float $ra
public float $dec
public ?float $magnitude
public ?string $band
public string $observatory
public ?string $method
public bool $discovery
public string $line

Observation::__construct()

public function __construct(public \DateTimeImmutable $time, public float $ra, public float $dec, public ?float $magnitude, public ?string $band, public string $observatory, public ?string $method, public bool $discovery, public string $line)

Observation::fromObs80()

public static function fromObs80(string $line): ?self

An optical observation from a line of the MPC's 80-column format; null for a radar's lines, a satellite's or a roving observer's second line, and anything unreadable.