TemplateTags

tom_dataproducts.templatetags.dataproduct_extras.dataproduct_list_for_target(context, target)

Given a Target, returns a list of DataProduct objects associated with that Target

tom_dataproducts.templatetags.dataproduct_extras.dataproduct_list_for_observation_saved(data_products, request)

Given a dictionary of dataproducts from an ObservationRecord, returns the subset that are saved to the TOM. This templatetag paginates the subset of DataProduct, and therefore requires the request to have a ‘page_saved’ key.

This templatetag is intended to be used with the all_data_products() method from a facility, as it returns a dictionary with keys of saved and unsaved that have values of lists of DataProduct objects.

tom_dataproducts.templatetags.dataproduct_extras.dataproduct_list_for_observation_unsaved(data_products)

Given a dictionary of dataproducts from an ObservationRecord, returns a list of the subset that are not saved to the TOM.

This templatetag is intended to be used with the all_data_products() method from a facility, as it returns a dictionary with keys of saved and unsaved that have values of lists of DataProduct objects.

tom_dataproducts.templatetags.dataproduct_extras.dataproduct_list_all(context)

Returns the full list of data products in the TOM, with the most recent first.

tom_dataproducts.templatetags.dataproduct_extras.recent_photometry(target, limit=1)

Displays a table of the most recent photometric points for a target.

tom_dataproducts.templatetags.dataproduct_extras.photometry_for_target(context, target, width=700, height=600, background=None, label_color=None, grid=True)

Renders a photometric plot for a target.

This templatetag requires all ReducedDatum objects with a data_type of photometry to be structured with the following keys in the JSON representation: magnitude, error, filter

Parameters
  • width (int) – Width of generated plot

  • height – Height of generated plot

  • background (str) – Color of the background of generated plot. Can be rgba or hex string.

  • label_color (str) – Color of labels/tick labels. Can be rgba or hex string.

  • grid (bool) – Whether to show grid lines.

tom_dataproducts.templatetags.dataproduct_extras.spectroscopy_for_target(context, target, dataproduct=None)

Renders a spectroscopic plot for a Target. If a DataProduct is specified, it will only render a plot with that spectrum.

tom_dataproducts.templatetags.dataproduct_extras.reduceddatum_sparkline(target, height, spacing=5, color_map=None, limit_y=True, days=32)

Renders a small lightcurve, sometimes referred to as a “sparkline”, that is meant to be placed inline with other elements on a page. The purpose is to give a quick visual representation of the general lightcurve of a target. The plot will only consist of points. There are no axis labels.

Parameters
  • height (int) – Height of generated plot in pixels. No default.

  • spacing (int) – Spacing between individual points in pixels. Default 5.

  • color_map (dict) – A map of ‘r’, ‘g’, ‘i’ to the colors rendered for that filter.

  • limit_y – Whether to limit the y-axis to the min/max of detections. If false, the mix/max will also include

non-detections. Default True. :type limit_y: bool

Parameters

days (int) – The number of days in the past, relative to today, of datapoints to render. Default is 32.