edges_analysis.gsdata.gsdata.GSData

class edges_analysis.gsdata.gsdata.GSData(data: np.ArrayLike | Quantity | None, freq_array: np.ArrayLike | Quantity | None, time_array: Time | Longitude, telescope_location, loads=_Nothing.NOTHING, nsamples: np.ArrayLike | Quantity | None = _Nothing.NOTHING, effective_integration_time: un.Quantity[un.s] = <Quantity 1. s>, flags: dict[str, GSFlag] = _Nothing.NOTHING, history: History = _Nothing.NOTHING, telescope_name: str = 'unknown', residuals: np.ArrayLike | Quantity | None = None, data_unit: Literal['power', 'temperature', 'uncalibrated', 'uncalibrated_temp'] = 'power', auxiliary_measurements: dict = _Nothing.NOTHING, time_ranges: Time | Longitude = _Nothing.NOTHING, filename=None, file_appendable=True, name='')[source]

A generic container for Global-Signal data.

Parameters:
  • data (numpy.ndarray) – The data array (i.e. what the telescope measures). This must be a 4D array whose dimensions are (load, polarization, time, frequency). The data can be raw powers, calibrated temperatures, or even model residuals to such. Their type is specified by the data_unit attribute.

  • freq_array (astropy.units.quantity.Quantity) – The frequency array. This must be a 1D array of frequencies specified as an astropy Quantity.

  • time_array (astropy.time.core.Time | astropy.coordinates.angles.core.Longitude) – The time array. This must be a 2D array of shape (times, loads). It can be in one of two formats: either an astropy Time object, specifying the absolute time, or an astropy Longitude object, specying the LSTs. In “lst” mode, there are many methods that become unavailable.

  • telescope_location (astropy.coordinates.earth.EarthLocation) – The telescope location. This must be an astropy EarthLocation object.

  • loads (tuple[str]) – The names of the loads. Usually there is a single load (“ant”), but arbitrary loads may be specified.

  • nsamples (numpy.ndarray) – An array with the same shape as the data array, specifying the number of samples that go into each data point. This is unitless, and can be used with the effective_integration_time attribute to compute the total effective integration time going into any measurement.

  • effective_integration_time (astropy.units.quantity.Quantity) – An astropy Quantity that specifies the amount of time going into a single “sample” of the data.

  • flags (dict[str, edges_analysis.gsdata.gsflag.GSFlag]) – A dictionary mapping filter names to boolean arrays. Each boolean array has the same shape as the data array, and is True where the data is flagged.

  • history (edges_analysis.gsdata.history.History) – A tuple of dictionaries, each of which is a record of a previous processing step.

  • telescope_name (str) – The name of the telescope.

  • residuals (numpy.ndarray | None) – An optional array of the same shape as data that holds the residuals of a model fit to the data.

  • auxiliary_measurements (dict) – A dictionary mapping measurement names to arrays. Each array must have its leading axis be the same length as the time array.

  • filename (pathlib.Path | None) – The filename from which the data was read (if any). Used for writing additional data if more is added (eg. flags, data model).

Methods

__init__(data, freq_array, time_array, ...)

Method generated by attrs for class GSData.

add_flags(filt, flags[, append_to_file])

Append a set of flags to the object and optionally append them to file.

freq_iter()

Returns an iterator over the frequency axis of data-shape arrays.

from_file(filename, **kw)

Create a GSData instance from a file.

get_cumulative_flags([which_flags, ignore_flags])

Returns accumulated flags.

get_flagged_nsamples([which_flags, ignore_flags])

Get the nsamples of the data after accounting for flags.

get_initial_yearday([hours, minutes])

Returns the year-day representation of the first time-sample in the data.

get_moon_azel()

Get the Moon's azimuth and elevation for each time in deg.

get_sun_azel()

Get the Sun's azimuth and elevation for each time in deg.

load_iter()

Returns an iterator over the load axis of data-shape arrays.

read_acq(filename, telescope_location[, name])

Read an ACQ file.

read_gsh5(filename)

Reads a GSH5 file and stores the data in the GSData object.

remove_flags(filt)

Remove flags for a given filter.

time_iter()

Returns an iterator over the time axis of data-shape arrays.

to_lsts()

Converts the time array to LST.

update(**kwargs)

Returns a new GSData object with updated attributes.

write_gsh5(filename)

Writes the data in the GSData object to a GSH5 file.

Attributes

complete_flags

Returns the complete flag array.

flagged_nsamples

Weights accounting for all flags.

gha

The GHA's of the observations.

in_lst

Returns True if the time array is in LST.

lst_array

The local sidereal time array.

lst_ranges

The local sidereal time array.

model

The model of the data.

nflagging_ops

Returns the number of flagging operations.

nfreqs

The number of frequency channels.

nloads

The number of loads.

npols

The number of polarizations.

ntimes

The number of times.

resids

The residuals of the data.

data

freq_array

time_array

telescope_location

loads

nsamples

effective_integration_time

flags

history

telescope_name

residuals

data_unit

auxiliary_measurements

time_ranges

filename

name