edges.averaging.lstbin

Functions for doing LST binning on GSData objects.

edges.averaging.lstbin.average_over_times(data: GSData, nsamples_strategy: NsamplesStrategy = NsamplesStrategy.FLAGGED_NSAMPLES, reference_lst: Longitude = <Longitude 12. hourangle>, use_resids: bool | None = None, fill_value: float = 0.0) GSData[source]

Average a GSData object over the time axis.

Parameters:
  • data – The data over which to average.

  • nsamples_strategy – The strategy to use when defining the weights of each sample. See NsamplesStrategy for more information.

  • reference_lst – An LST set as the central LST when finding the new mean LST. All LSTs will be wrapped within 12 hours of this reference before taking the mean.

  • use_resids (bool, optional) – Whether to average the residuals and add them back to the mean model, or simply average the data directly.

  • fill_value (float) – The value to impute when no data exists in a bin.

edges.averaging.lstbin.get_lst_bins(binsize: float, first_edge: float = 0, max_edge: float = 24) ndarray[source]

Determine LST bins given a bin size and first edge, in hours.

This function will return equi-spaced bins starting at first_edge and with width binsize. The last bin will be less than or equal to max_edge, after accounting for wrapping at 24 hours.

Parameters:
  • binsize – The size of the bins in hours.

  • first_edge – The first edge of the first bin.

  • max_edge – The maximum edge of the last bin.

Returns:

np.ndarray – The LST bin edges.

edges.averaging.lstbin.lst_bin(data: GSData, binsize: float = 24.0, first_edge: float = 0.0, max_edge: float = 24.0, in_gha: bool = False, use_model_residuals: bool | None = None, reference_time: float | Time | str = 'mean')[source]

Average data within bins of LST.

Parameters:
  • data – The GSData object to bin.

  • binsize – The size of the LST bins in hours.

  • first_edge – The first edge of the first bin in hours.

  • max_edge – The maximum edge of the last bin in hours, see get_lst_bins().

  • in_gha – Whether to bin in GHA or LST (default).

  • use_model_residuals – Whether to use the model residuals to de-bias the mean in each bin. If True, either model must be provided, or residuals must be specified on the GSData object.

  • reference_time – The JD at which to reference the LSTs to in the output. The JDs of the output will be exactly at the centre of each LST bin, but the _day_ to which they are referenced will be set by the reference_time (all will be within 24 hours of this time). This can be a float (JD), an astropy Time, or one of ‘min’, ‘max’, ‘mean’ or ‘closest’ (default). Options ‘min’, ‘max’ and ‘mean’ will use the corresponding min/max/mean time in the data object to set the reference time.

Returns:

GSData – A new GSData object with the binned data.