Facilities

Base Facility Class

class tom_observations.facility.GenericObservationFacility

The facility class contains all the logic specific to the facility it is written for. Some methods are used only internally (starting with an underscore) but some need to be implemented by all facility classes. All facilities should inherit from this class which provides some base functionality. In order to make use of a facility class, add the path to TOM_FACILITY_CLASSES in your settings.py.

For an implementation example please see https://github.com/TOMToolkit/tom_base/blob/master/tom_observations/facilities/lco.py

abstract data_products(observation_id, product_id=None)

Using an observation_id, retrieve a list of the data products that belong to this observation. In this case, the LCO module retrieves a list of frames from the LCO data archive.

get_flux_constant()

Returns the astropy quantity that a facility uses for its spectral flux conversion.

abstract get_form(observation_type)

This method takes in an observation type and returns the form type that matches it.

abstract get_observation_status(observation_id)

Return the status for a single observation. observation_id should be able to be used to retrieve the status from the external service.

abstract get_observation_url(observation_id)

Takes an observation id and return the url for which a user can view the observation at an external location. In this case, we return a URL to the LCO observation portal’s observation record page.

abstract get_observing_sites()

Return a list of dictionaries that contain the information necessary to be used in the planning (visibility) tool. The list should contain dictionaries each that contain sitecode, latitude, longitude and elevation.

abstract get_terminal_observing_states()

Returns the states for which an observation is not expected to change.

get_wavelength_units()

Returns the astropy units that a facility uses for its spectral wavelengths

is_fits_facility(header)

Returns True if the FITS header is from this facility based on valid keywords and associated values, False otherwise.

abstract submit_observation(observation_payload)

This method takes in the serialized data from the form and actually submits the observation to the remote api

abstract validate_observation(observation_payload)

Same thing as submit_observation, but a dry run. You can skip this in different modules by just using “pass”

class tom_observations.facility.GenericObservationForm(*args, **kwargs)

This is the class that is responsible for displaying the observation request form. Facility classes that provide a form should subclass this form. It provides some base shared functionality. Extra fields are provided below. The layout is handled by Django crispy forms which allows customizability of the form layout without needing to write html templates: https://django-crispy-forms.readthedocs.io/en/d-0/layouts.html See the documentation on Django forms for more information.

For an implementation example please see https://github.com/TOMToolkit/tom_base/blob/master/tom_observations/facilities/lco.py#L132

observation_payload()

This method is called to extract the data from the form into a dictionary that can be used by the rest of the module. In the base implementation it simply dumps the form into a json string.

Gemini

Las Cumbres Observatory

SOAR