Utilities

tom_observations.utils.get_sidereal_visibility(target, start_time, end_time, interval, airmass_limit)

Uses astroplan to calculate the airmass for a sidereal target for each given interval between the start and end times.

The resulting data omits any airmass above the provided limit (or default, if one is not provided), as well as any airmass calculated during the day (defined as between astronomical twilights).

Important note: only works for sidereal targets! For non-sidereal visibility, see here: https://github.com/TOMToolkit/tom_nonsidereal_airmass

Parameters
  • start_time (datetime) – start of the window for which to calculate the airmass

  • end_time (datetime) – end of the window for which to calculate the airmass

  • interval (int) – time interval, in minutes, at which to calculate airmass within the given window

  • airmass_limit (int) – maximum acceptable airmass for the resulting calculations

Returns

A dictionary containing the airmass data for each site. The dict keys consist of the site name prepended with the observing facility. The values are the airmass data, structured as an array containing two arrays. The first array contains the set of datetimes used in the airmass calculations. The second array contains the corresponding set of airmasses calculated.

Return type

dict

tom_observations.utils.get_astroplan_sun_and_time(start_time, end_time, interval)

Uses astroplan’s time_grid_from_range to generate an astropy Time object covering the time range.

Uses astropy’s get_sun to generate sun positions over that time range.

If time range is small and interval is coarse, approximates the sun at a fixed position from the middle of the time range to speed up calculations. Since the sun moves ~4 minutes a day, this approximation happens when the number of days covered by the time range * 4 is less than the interval (in minutes) / 2.

Parameters
  • start_time (datetime) – start of the window for which to calculate the airmass

  • end_time (datetime) – end of the window for which to calculate the airmass

  • interval (int) – time interval, in minutes, at which to calculate airmass within the given window

Returns

ra/dec positions of the sun over the time range, time range between start_time and end_time at interval

Return type

astropy SkyCoord, astropy Time