Models¶
-
class
tom_targets.models.Target(*args, **kwargs)¶ Class representing a target in a TOM
- Parameters
name (str) – The name of this target e.g. Barnard’s star.
type (datetime) – The type of this target.
created – The time at which this target was created in the TOM database.
modified – The time at which this target was changed in the TOM database.
ra (float) – Right Ascension, in degrees.
dec (float) – Declination, in degrees.
epoch (float) – Julian Years. Max 2100.
parallax (float) – Parallax, in milliarcseconds.
pm_ra (float) – Proper Motion: RA. Milliarsec/year.
pm_dec (float) – Proper Motion: Dec. Milliarsec/year.
galactic_lng (float) – Galactic Longitude in degrees.
galactic_lat (float) – Galactic Latitude in degrees.
distance (float) – Parsecs.
distance_err (float) – Parsecs.
scheme (str) – Orbital Element Scheme
epoch_of_elements (float) – Epoch of elements in JD.
mean_anomaly (float) – Angle in degrees.
arg_of_perihelion (float) – Argument of Perhihelion. J2000. Degrees.
eccentricity (float) – Eccentricity
lng_asc_node (float) – Longitude of Ascending Node. J2000. Degrees.
inclination (float) – Inclination to the ecliptic. J2000. Degrees.
mean_daily_motion (float) – Degrees per day.
semimajor_axis (float) – Semimajor Axis in AU
epoch_of_perihelion (float) – Julian Date.
ephemeris_period (float) – Ephemeris period in days
ephemeris_period_err (float) – Days
ephemeris_epoch (float) – Days
ephemeris_epoch_err (float) – Days
-
save(*args, **kwargs)¶ Saves Target model data to the database, including extra fields. After saving to the database, also runs the hook
target_post_save. The hook run is the one specified insettings.py.- Keyword Arguments
extras (dict): dictionary of key/value pairs representing target attributes
-
validate_unique(*args, **kwargs)¶ Ensures that Target.name and all aliases of the target are unique. Called automatically on save.
-
featured_image()¶ Gets the
DataProductassociated with thisTargetthat is a FITS file and is uniquely marked as “featured”.- Returns
DataProductwith data_product_type offits_fileand featured asTrue- Return type
-
property
names¶ Gets a list with the name and aliases of this target
- Returns
list of all names and TargetName values associated with this target
- Return type
list
-
property
future_observations¶ Gets all observations scheduled for this
Target- Returns
List of
ObservationRecordobjects without a terminal status- Return type
list
-
property
extra_fields¶ Gets all
TargetExtrafields associated with thisTarget, provided the key is defined insettings.pyEXTRA_FIELDS- Returns
Dictionary of key/value pairs representing target attributes
- Return type
dict
Gets all
TargetExtrafields associated with thisTarget, provided the key is NOT defined insettings.pyEXTRA_FIELDS- Returns
Dictionary of key/value pairs representing target attributes
- Return type
dict
-
as_dict()¶ Returns dictionary representation of attributes, excluding all attributes not associated with the
typeof thisTarget.- Returns
Dictionary of key/value pairs representing target attributes
- Return type
dict
-
class
tom_targets.models.TargetName(*args, **kwargs)¶ Class representing an alternative name for a
Target.- Parameters
target – The
Targetobject thisTargetNameis associated with.name (str) – The name that this
TargetNameobject represents.created (datetime) – The time at which this target name was created in the TOM database.
modified (datetime) – The time at which this target name was modified in the TOM database.
-
validate_unique(*args, **kwargs)¶ Ensures that Target.name and all aliases of the target are unique. Called automatically on save.
-
class
tom_targets.models.TargetExtra(*args, **kwargs)¶ Class representing a list of targets in a TOM.
- Parameters
target – The
Targetobject thisTargetExtrais associated with.key (str) – Denotation of the value represented by this
TargetExtraobject.value (str) – Value of the field stored in this object.
float_value (float) – Float representation of the
valuefield for this object, if applicable.bool_value (bool) – Boolean representation of the
valuefield for this object, if applicable.time_value (datetime) – Datetime representation of the
valuefield for this object, if applicable.
-
save(*args, **kwargs)¶ Saves TargetExtra model data to the database. In the process, converts the string value of the
TargetExtrato the appropriate type, and stores it in the corresponding field as well.
-
typed_value(type_val)¶ Returns the value of this
TargetExtrain the corresponding type provided by the caller. If the type is invalid, returns the string representation.- Parameters
type_val (str) – Requested type of the
TargetExtravaluefield- Returns
Requested typed value field of this object
- Return type
float, boolean, datetime, or str
-
class
tom_targets.models.TargetList(*args, **kwargs)¶ Class representing a list of targets in a TOM.
- Parameters
name (str) – The name of the target list
targets – Set of
Targetobjects associated with thisTargetListcreated (datetime) – The time at which this target list was created.
modified (datetime) – The time at which this target list was modified in the TOM database.