mpc

This module contains a wrapper for the mpc interface of the astroquery package

Classes

BatchMPC()

This class provides an interface between observations in the Minor Planet Centre database and Tudat.

class BatchMPC[source]

This class provides an interface between observations in the Minor Planet Centre database and Tudat.

Notes

Currently, transformations between reference frames are not implemented. As such observations are only returned in the J2000 Frame.

Examples

Basic sequence of usage:

Initialise and retrieve data:

>>> MPCcodes = [1, 4] # Ceres and Vesta
>>> batch = BatchMPC()
>>> batch.get_observations(MPCcodes)
>>> batch.filter(epoch_start=datetime.datetime(2016, 1, 1))

Transform to Tudat format: >>> … >>> bodies = environment_setup.create_system_of_bodies(body_settings) >>> observation_collection = batch.to_tudat(bodies=bodies, included_satellites=None)

copy() BatchMPC[source]

Create a copy of the batch, equivalent to copy.copy(batchMPC())

Returns:

Copy of batch.

Return type:

BatchMPC

filter(bands: List[str] | None = None, catalogs: List[str] | None = None, observation_types: List[str] | None = None, observatories: List[str] | None = None, observatories_exclude: List[str] | None = None, epoch_start: float | datetime | None = None, epoch_end: float | datetime | None = None, in_place: bool = True) None | BatchMPC[source]

Filter out observations from the batch.

Parameters:
  • bands (Union[List[str], None], optional) – List of observation bands to keep in the batch, by default None

  • catalogs (Union[List[str], None], optional) – List of star catalogs to keep in the batch. See https://www.minorplanetcenter.net/iau/info/CatalogueCodes.html for the exact encodings used by MPC, by default None

  • observation_types (Union[List[str], None], optional) – List of observation types to keep in the batch, e.g. CCD, Photographic etc. See the Note2 section of the MPC format description: https://www.minorplanetcenter.net/iau/info/OpticalObs.html for the exact encoding, by default None

  • observatories (Union[List[str], None], optional) – List of observatories to keep in the batch, by default None

  • observatories_exclude (Union[List[str], None], optional) – List of observatories to remove from the batch, by default None

  • epoch_start (Union[float, datetime.datetime, None], optional) – Start date to include observations from, can be in python datetime in utc or the more conventional tudat seconds since j2000 in TDB if float, by default None

  • epoch_end (Union[float, datetime.datetime, None], optional) – Final date to include observations from, can be in python datetime in utc or the more conventional tudat seconds since j2000 in TDB if float, by default None

  • in_place (bool, optional) – If true, modify the current batch object. If false returns a new object that is filtered, currect batch remains unmodified, by default True

Raises:
  • ValueError – Is raised if bands, observatories, or observatories_exclude are not list or None.

  • ValueError – Is raised if both observations_exclude and observatories are not None.

Returns:

Returns a new instance of BatchMPC that is filtered.

Return type:

None or BatchMPC

from_astropy(table: QTable, in_degrees: bool = True, frame: str = 'J2000')[source]

Manually input an astropy table with observations into the batch. Usefull when manual filtering from astroquery is required Table must contain the following columns: number - MPC code of the minor planetepoch - in julian daysRA - right ascension in either degrees or radians (degrees is default)DEC - declination in either degrees or radians (degrees is default)band - band of the observation (currently unused)observatory - MPC code of the observatory

Parameters:
  • table (astropy.table.QTable) – Astropy table with the observations

  • in_degrees (bool, optional) – if True RA and DEC are assumed in degrees, else radians, by default True

  • frame (str, optional) – Reference frame. Please note that only J2000 is currently supported , by default “J2000”

from_pandas(table: DataFrame, in_degrees: bool = True, frame: str = 'J2000')[source]

Manually input an pandas dataframe with observations into the batch. Usefull when manual filtering from astroquery is required Table must contain the following columns: number - MPC code of the minor planetepoch - in julian daysRA - right ascension in either degrees or radians (degrees is default)DEC - declination in either degrees or radians (degrees is default)band - band of the observation (currently unused)observatory - MPC code of the observatory

Parameters:
  • table (astropy.table.QTable) – Astropy table with the observations

  • in_degrees (bool, optional) – if True RA and DEC are assumed in degrees, else radians, by default True

  • frame (str, optional) – Reference frame. Please not that only J2000 is currently supported , by default “J2000”

get_observations(MPCcodes: List[str | int], drop_misc_observations: bool = True) None[source]

Retrieve all observations for a set of MPC listed objeccts. This method uses astroquery to retrieve the observations from the MPC. An internet connection is required, observations are cached for faster subsequent retrieval. Removes duplicate and irrelevant observation data by default (see drop_misc_observations).

Parameters:
  • MPCcodes (List[int]) – List of integer MPC object codes for minor planets or and comets.

  • drop_misc_observations (List[int]) – Drops observations made by method: radar and offset (natural satellites). Drops observations made by roaming observers. Drops duplicate listings to denote first observation.

observatories_table(only_in_batch: bool = True, only_space_telescopes: bool = False, exclude_space_telescopes: bool = False, include_positions: bool = False) DataFrame[source]

Returns a pandas DataFrame with information about all MPC observatories, Carthesian positions are only available after running the to_tudat() method.

Parameters:
  • only_in_batch (bool, optional) – Filter out observatories that are not in the batch, by default True

  • only_space_telescopes (bool, optional) – Filter out all observatories except space telescopes, by default False

  • only_space_telescopes – Filter out all space telescopes, by default False

  • include_positions (bool, optional) – Include cartesian positions of the terrestrial telescopes only available after running to_tudat(), by default False

Returns:

Dataframe with information about the observatories.

Return type:

pd.DataFrame

plot_observations_sky(objects: List[str] | None = None, projection: str | None = None, figsize: Tuple[float] = (14.0, 7.0))[source]

Generates a matplotlib figure with the observations’ right ascension and declination over time.

Parameters:
  • objects (Union[List[str], None], optional) – List of specific MPC objects in batch to plot, None to plot all , by default None

  • projection (str, optional) – projection of the figure options are: ‘aitoff’, ‘hammer’, ‘lambert’ and ‘mollweide’, by default “aitoff”

  • figsize (Tuple[float], optional) – size of the matplotlib figure, by default (15, 7)

Returns:

Matplotlib figure with the observations

Return type:

Matplotlib figure

plot_observations_temporal(objects: List[str] | None = None, figsize: Tuple[float] = (9.0, 6.0))[source]

Generates a matplotlib figure with the declination and right ascension over time.

Parameters:
  • objects (Union[List[str], None], optional) – List of specific MPC objects in batch to plot, None to plot all , by default None

  • projection (str, optional) – projection of the figure options are: ‘aitoff’, ‘hammer’, ‘lambert’ and ‘mollweide’, by default “aitoff”

  • figsize (Tuple[float], optional) – size of the matplotlib figure, by default (15, 7)

Returns:

Matplotlib figure with the observations

Return type:

Matplotlib figure

set_weights(weights: list | ndarray | Series)[source]

Manually set weights per observation. Weights are passed to observation collection when .to_tudat() is called. Set the apply_weights_VFCC17 parameter in .to_tudat() to False to avoid overwriting. The order of the weights should match the order found in the .table parameter.

Parameters:

weights (Union[list, np.ndarray, pd.Series]) – Iterable with weights per observation.

Raises:

ValueError – If the size of weights does not match the number of observations in the batch table.

summary()[source]

Produce a quick summary of the content of the batch

to_tudat(bodies: SystemOfBodies, included_satellites: Dict[str, str] | None, station_body: str = 'Earth', add_sbdb_gravity_model: bool = False, apply_weights_VFCC17: bool = True, apply_star_catalog_debias: bool = True, debias_kwargs: dict = {}) ObservationCollection[source]
Converts the observations in the batch into a Tudat compatible format and

sets up the relevant Tudat infrastructure to support estimation.

This method does the following:

1. (By Default) Applies star catalog debiasing and estimation weight calculation.2. Creates an empty body for each minor planet with their MPC code as a name.3. Adds this body to the system of bodies inputted to the method.4. Retrieves the global position of the terrestrial observatories in the batch and adds these stations to the Tudat environment.5. Creates link definitions between each unique terrestrial observatory/ minor planet combination in the batch.6. (Optionally) creates a link definition between each space telescope / minor planet combination in the batch. This requires an addional input.7. Creates a SingleObservationSet object for each unique link that includes all observations for that link.8. (By Default) Add the relevant weights to the SingleObservationSet per observation.8. Returns the observations

Parameters:
  • bodies (environment.SystemOfBodies) – SystemOfBodies containing at least the earth to allow for the placement of terrestrial telescopes

  • included_satellites (Union[Dict[str, str], None], optional) – A dictionary that links the name of a space telescope used by the user with the observatory code in MPC. Used when utilising observations from space telescopes like TESS and WISE. The keys should be the MPC observatory codes. The values should be the bodies’ in the user’s code. The relevant observatory code can be retrieved using the .observatories_table() method, by default None

  • station_body (bool, optional) – Body to attach ground stations to. Does not need to be changed unless the Earth body has been renamed, by default “Earth”

  • station_body – Adds a central_sbdb gravity model to the object, generated using JPL’s small body database. This option is only available for a limited number of bodies and raises an error if unavailable. See tudatpy.numerical_simulation.environment_setup.gravity_field.central_sbdb for more info. Enabled if True, by default False

  • apply_weights_VFCC17 (bool, optional) – Applies the weighting scheme as described in: “Statistical analysis of astrometric errors for the most productive asteroid surveys” by Veres et al. (2017). Overwrites custom weights set through the .set_weights() method if True, by default True

  • apply_star_catalog_debias (bool, optional) – Applies star catalog debiasing as described in: “Star catalog position and proper motion corrections in asteroid astrometry II: The Gaia era” by Eggl et al. (2018), by default True

  • debias_kwargs (dict, optional) – Additional options when applying star catalog debiasing. A different debias file can be set here. Options are set as kwargs using a dictionary, see data._biases.get_biases_EFCC18() for more info, by default dict()

Returns:

ObservationCollection with the observations found in the batch

Return type:

estimation.ObservationCollection

Examples

Using Space Telescopes

Create dictionary to link name in tudat with mpc code in batch:

>> sats_dict = {“C57”:”TESS”} >> obs = batch1.to_tudat(bodies, included_satellites=sats_dict)

property MPC_objects: List[str]

List of MPC objects

property bands: List[str]

List of bands in batch

property bodies_created: dict

Dictionary with the bodies created by to_tudat and details.

property epoch_end: float

Epoch of latest observation in batch in seconds since J2000 TDB

property epoch_start: float

Epoch of oldest observation in batch in seconds since J2000 TDB

property observatories: List[str]

List of observatories in batch

property size: int

Number of observations in batch

property space_telescopes: List[str]

List of satellite_observatories in batch

property table: DataFrame

Pandas dataframe with observation data