# Using Obs¶

Obs objects mostly share their functionality with Ephem, but there are some unique features tailored to observational data.

For instance, this class allows you to query observations reported to the Minor Planet Center for a given target:

>>> from sbpy.data import Obs
>>> data = Obs.from_mpc('2019 AA', id_type='asteroid designation') # doctest: +REMOTE_DATA
>>> data # doctest: +REMOTE_DATA +SKIP
number  desig  discovery note1 ...        DEC           mag   band observatory
...        deg           mag
int64    str7     str1    str1 ...      float64       float64 str1     str3
------ ------- --------- ----- ... ------------------ ------- ---- -----------
-- 2019 AA        --    -- ...  42.32416944444445    20.2    G         F51
-- 2019 AA        --    -- ...  42.32879722222223    20.3    G         F51
-- 2019 AA        --    -- ... 42.333225000000006    20.3    G         F51
-- 2019 AA         *    -- ...  46.52321666666666    20.0    w         F51
-- 2019 AA        --    -- ...  46.52748611111111    20.0    w         F51
-- 2019 AA        --    -- ... 46.531755555555556    20.0    w         F51
...     ...       ...   ... ...                ...     ...  ...         ...
-- 2019 AA        --    -- ... 46.706500000000005    20.2    V         033
-- 2019 AA        --    -- ...  46.70652777777778    20.2    V         033
-- 2019 AA        --    -- ...  49.73566111111111    20.1    i         F52
-- 2019 AA        --    -- ...  49.73788888888889    20.1    i         F52
-- 2019 AA        --    -- ...  49.74008611111111    20.1    i         F52
-- 2019 AA        --    -- ... 49.742266666666666    20.2    i         F52


For a given Obs object, supplement allows you to supplement the information content of this object by adding ephemeris data for the target(s) and epochs provided. This function makes use of the query functions that are part of Ephem and allows you to pick a service from which you would like to obtain the data.

>>> data.field_names # doctest: +REMOTE_DATA
<TableColumns names=('number','desig','discovery','note1','note2','epoch','RA','DEC','mag','band','observatory')>
>>> data_sup = data.supplement(id_field='desig') # doctest: +REMOTE_DATA
>>> data_sup.field_names # doctest: +REMOTE_DATA

supplement queries in this case ephemerides from the JPL Horizons system (the default service to be used) and appends the additional data as new columns to the Obs object. Targetnames and epochs are taken from the underlying Obs object and must hence be present there; keyword arguments id_field and epoch_field control the fieldnames from which these information are taken. In order to prevent duplicate column names, the keyword argument modify_fieldnames defines whether field names in the Obs object or in the new Ephem data are to be modified.
Note that services using from_mpc and from_miriade are not optimized for queries of multiple epochs. Hence, using these service will result in long loading times. from_horizons, however, is optimized for this type of query.