Models

class tom_targets.models.Target(*args, **kwargs)

Class representing a target in a TOM

Parameters
  • identifier (str) – The identifier for this object, e.g. Kelt-16b.

  • name (str) – The name of this target e.g. Barnard’s star.

  • name2 (str) – An alternative name for this target.

  • name3 (str) – An alternative name for this target.

  • 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

  • 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

as_dict()

Returns dictionary representation of attributes, excluding all attributes not associated with the type of this Target.

Returns

Dictionary of key/value pairs representing target attributes

Return type

dict

property extra_fields

Gets all TargetExtra fields associated with this Target, provided the key is defined in settings.py EXTRA_FIELDS

Returns

Dictionary of key/value pairs representing target attributes

Return type

dict

featured_image()

Gets the DataProduct associated with this Target that is a FITS file and is uniquely marked as “featured”.

Returns

DataProduct with tag of fits_file and featured as True

Return type

DataProduct

property future_observations

Gets all observations scheduled for this Target

Returns

List of ObservationRecord objects without a terminal status

Return type

list

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 in settings.py.

Keyword Arguments
  • extras (dict): dictionary of key/value pairs representing target attributes

property tags

Gets all TargetExtra fields associated with this Target, provided the key is NOT defined in settings.py EXTRA_FIELDS

Returns

Dictionary of key/value pairs representing target attributes

Return type

dict

class tom_targets.models.TargetExtra(*args, **kwargs)

Class representing a list of targets in a TOM.

Parameters
  • target – The Target object this TargetExtra is associated with.

  • key (str) – Denotation of the value represented by this TargetExtra object.

  • value (str) – Value of the field stored in this object.

  • float_value (float) – Float representation of the value field for this object, if applicable.

  • bool_value (bool) – Boolean representation of the value field for this object, if applicable.

  • time_value (datetime) – Datetime representation of the value field for this object, if applicable.

save(*args, **kwargs)

Saves TargetExtra model data to the database. In the process, converts the string value of the TargetExtra to the appropriate type, and stores it in the corresponding field as well.

typed_value(type_val)

Returns the value of this TargetExtra in the corresponding type provided by the caller. If the type is invalid, returns the string representation.

Parameters

type_val (str) – Requested type of the TargetExtra value field

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 Target objects associated with this TargetList

  • created (datetime) – The time at which this object was created.