drs4.specs.ms module#

class drs4.specs.ms.MS(time: ~typing.Annotated[~xarrayspecs.typing.ArrayLike[~typing.Annotated[~typing.Literal['time'], Spec({'xarrayspecs_dims': <ITSELF>})], ~typing.Annotated[~typing.Literal['M8[ns]'], Spec({'xarrayspecs_dtype': <ITSELF>})]], Spec({'xarrayspecs_use': 'coord'}), Spec({'xarrayspecs_attrs': ReadonlyDict({'long_name': 'Measured time in UTC'})})], chan: ~typing.Annotated[~xarrayspecs.typing.ArrayLike[~typing.Annotated[~typing.Literal['chan'], Spec({'xarrayspecs_dims': <ITSELF>})], ~typing.Annotated[~numpy.int64, Spec({'xarrayspecs_dtype': <ITSELF>})]], Spec({'xarrayspecs_use': 'coord'}), Spec({'xarrayspecs_attrs': ReadonlyDict({'long_name': 'Channel number'})})], freq: ~typing.Annotated[~xarrayspecs.typing.ArrayLike[~typing.Annotated[~typing.Literal['chan'], Spec({'xarrayspecs_dims': <ITSELF>})], ~typing.Annotated[~numpy.float64, Spec({'xarrayspecs_dtype': <ITSELF>})]], Spec({'xarrayspecs_use': 'coord'}), Spec({'xarrayspecs_attrs': ReadonlyDict({'long_name': 'Intermediate frequency', 'units': 'GHz'})})], integ_time: ~typing.Annotated[~xarrayspecs.typing.ArrayLike[~typing.Annotated[~typing.Literal['time'], Spec({'xarrayspecs_dims': <ITSELF>})], ~typing.Annotated[~numpy.int64, Spec({'xarrayspecs_dtype': <ITSELF>})]], Spec({'xarrayspecs_use': 'coord'}), Spec({'xarrayspecs_attrs': ReadonlyDict({'long_name': 'Spectral integration time', 'units': 'ms'})})], signal_sb: ~typing.Annotated[~xarrayspecs.typing.ArrayLike[~typing.Annotated[~typing.Literal['time'], Spec({'xarrayspecs_dims': <ITSELF>})], ~typing.Annotated[~typing.Literal['U4'], Spec({'xarrayspecs_dtype': <ITSELF>})]], Spec({'xarrayspecs_use': 'coord'}), Spec({'xarrayspecs_attrs': ReadonlyDict({'long_name': 'Signal sideband'})})], signal_chan: ~typing.Annotated[~xarrayspecs.typing.ArrayLike[~typing.Annotated[~typing.Literal['time'], Spec({'xarrayspecs_dims': <ITSELF>})], ~typing.Annotated[~numpy.int64, Spec({'xarrayspecs_dtype': <ITSELF>})]], Spec({'xarrayspecs_use': 'coord'}), Spec({'xarrayspecs_attrs': ReadonlyDict({'long_name': 'Signal channel number'})})], state: ~typing.Annotated[~xarrayspecs.typing.ArrayLike[~typing.Annotated[~typing.Literal['time'], Spec({'xarrayspecs_dims': <ITSELF>})], ~typing.Annotated[~typing.Literal['U8'], Spec({'xarrayspecs_dtype': <ITSELF>})]], Spec({'xarrayspecs_use': 'coord'}), Spec({'xarrayspecs_attrs': ReadonlyDict({'long_name': 'Measurement state'})})], auto_usb: ~typing.Annotated[~xarrayspecs.typing.ArrayLike[~typing.Annotated[tuple[~typing.Literal['time'], ~typing.Literal['chan']], Spec({'xarrayspecs_dims': <ITSELF>})], ~typing.Annotated[~numpy.float64, Spec({'xarrayspecs_dtype': <ITSELF>})]], Spec({'xarrayspecs_use': 'data'}), Spec({'xarrayspecs_attrs': ReadonlyDict({'long_name': 'Auto-correlation spectra of USB', 'units': 'Arbitrary unit'})})], auto_lsb: ~typing.Annotated[~xarrayspecs.typing.ArrayLike[~typing.Annotated[tuple[~typing.Literal['time'], ~typing.Literal['chan']], Spec({'xarrayspecs_dims': <ITSELF>})], ~typing.Annotated[~numpy.float64, Spec({'xarrayspecs_dtype': <ITSELF>})]], Spec({'xarrayspecs_use': 'data'}), Spec({'xarrayspecs_attrs': ReadonlyDict({'long_name': 'Auto-correlation spectra of LSB', 'units': 'Arbitrary unit'})})], cross_2sb: ~typing.Annotated[~xarrayspecs.typing.ArrayLike[~typing.Annotated[tuple[~typing.Literal['time'], ~typing.Literal['chan']], Spec({'xarrayspecs_dims': <ITSELF>})], ~typing.Annotated[~numpy.complex128, Spec({'xarrayspecs_dtype': <ITSELF>})]], Spec({'xarrayspecs_use': 'data'}), Spec({'xarrayspecs_attrs': ReadonlyDict({'long_name': 'Cross-correlation spectra of 2SB', 'units': 'Arbitrary unit'})})], chassis: ~typing.Annotated[~typing.Literal[1, 2], Spec({'xarrayspecs_use': 'attr'})], interface: ~typing.Annotated[~typing.Literal[1, 2], Spec({'xarrayspecs_use': 'attr'})])[source]#

Bases: AsDataset

Data specification of DRS4 measurement set.

auto_lsb: float64, Spec({'xarrayspecs_dtype': <ITSELF>})]], Spec({'xarrayspecs_use': 'data'}), Spec({'xarrayspecs_attrs': ReadonlyDict({'long_name': 'Auto-correlation spectra of LSB', 'units': 'Arbitrary unit'})})]#

Auto-correlation spectra of LSB.

auto_usb: float64, Spec({'xarrayspecs_dtype': <ITSELF>})]], Spec({'xarrayspecs_use': 'data'}), Spec({'xarrayspecs_attrs': ReadonlyDict({'long_name': 'Auto-correlation spectra of USB', 'units': 'Arbitrary unit'})})]#

Auto-correlation spectra of USB.

chan: int64, Spec({'xarrayspecs_dtype': <ITSELF>})]], Spec({'xarrayspecs_use': 'coord'}), Spec({'xarrayspecs_attrs': ReadonlyDict({'long_name': 'Channel number'})})]#

Channel number (0-511).

chassis: Literal[1, 2], Spec({'xarrayspecs_use': 'attr'})]#

Chassis number of DRS4 (1|2).

cross_2sb: complex128, Spec({'xarrayspecs_dtype': <ITSELF>})]], Spec({'xarrayspecs_use': 'data'}), Spec({'xarrayspecs_attrs': ReadonlyDict({'long_name': 'Cross-correlation spectra of 2SB', 'units': 'Arbitrary unit'})})]#

Cross-correlation spectra of 2SB (USB x LSB*).

freq: float64, Spec({'xarrayspecs_dtype': <ITSELF>})]], Spec({'xarrayspecs_use': 'coord'}), Spec({'xarrayspecs_attrs': ReadonlyDict({'long_name': 'Intermediate frequency', 'units': 'GHz'})})]#

Intermediate frequency in GHz.

integ_time: int64, Spec({'xarrayspecs_dtype': <ITSELF>})]], Spec({'xarrayspecs_use': 'coord'}), Spec({'xarrayspecs_attrs': ReadonlyDict({'long_name': 'Spectral integration time', 'units': 'ms'})})]#

Spectral integration time in ms.

interface: Literal[1, 2], Spec({'xarrayspecs_use': 'attr'})]#

Interface (IF) number of DRS4 (1|2).

signal_chan: int64, Spec({'xarrayspecs_dtype': <ITSELF>})]], Spec({'xarrayspecs_use': 'coord'}), Spec({'xarrayspecs_attrs': ReadonlyDict({'long_name': 'Signal channel number'})})]#

Signal channel number (0-511|-1).

signal_sb: Literal['U4'], Spec({'xarrayspecs_dtype': <ITSELF>})]], Spec({'xarrayspecs_use': 'coord'}), Spec({'xarrayspecs_attrs': ReadonlyDict({'long_name': 'Signal sideband'})})]#

Signal sideband (USB|LSB|NA).

spec_version: Annotated[int, Spec({'xarrayspecs_use': 'attr'})] = 0#

Version of the data specification.

state: Literal['U8'], Spec({'xarrayspecs_dtype': <ITSELF>})]], Spec({'xarrayspecs_use': 'coord'}), Spec({'xarrayspecs_attrs': ReadonlyDict({'long_name': 'Measurement state'})})]#

Measurement state (Unicode string up to 8 chars.)

time: Literal['M8[ns]'], Spec({'xarrayspecs_dtype': <ITSELF>})]], Spec({'xarrayspecs_use': 'coord'}), Spec({'xarrayspecs_attrs': ReadonlyDict({'long_name': 'Measured time in UTC'})})]#

Measured time in UTC.

drs4.specs.ms.open_csvs(csv_auto: PathLike[str] | str, csv_cross: PathLike[str] | str, /, *, chassis: Literal[1, 2], Spec({'xarrayspecs_use': 'attr'})], interface: Literal[1, 2], Spec({'xarrayspecs_use': 'attr'})], freq_range: Literal['inner', 'outer'], Spec({'xarrayspecs_use': 'attr'})], integ_time: Literal[100, 200, 500, 1000], Spec({'xarrayspecs_use': 'attr'})], signal_sb: Literal['USB', 'LSB'], Spec({'xarrayspecs_use': 'attr'})] | None = None, signal_chan: Annotated[int, Spec({'xarrayspecs_use': 'attr'})] | None = None, state: str | None = None, join: Literal['outer', 'inner', 'left', 'right', 'exact', 'override'] = 'inner') → Dataset[source]#

Open CSV files of auto/cross correlations as a Dataset.

Parameters:
  • csv_auto – Path of input CSV file of auto-correlations.

  • csv_cross – Path of input CSV file of cross-correlation.

  • chassis – Chassis number of DRS4 (1|2).

  • interface – Interface number of DRS4 (1|2).

  • freq_range – Intermediate frequency range (inner|outer).

  • integ_time – Spectral integration time in ms (100|200|500|1000).

  • signal_sb – Signal sideband (USB|LSB). If not specified, NA (missing indicator) will be assigned.

  • signal_chan – Signal channel number (0-511). If not specified, -1 (missing indicator) will be assigned.

  • state – Measurement state (Unicode string up to 8 chars). If not specified, NA (missing indicator) will be assigned.

  • join – Method for joining the CSV files.

Returns:

Dataset of the input CSV files.

Raises:

ValueError – Raised if the given value of either chassis, freq_range, integ_time, or interface is not valid.

drs4.specs.ms.open_vdifs(vdif_usb: PathLike[str] | str, vdif_lsb: PathLike[str] | str, /, *, chassis: Literal[1, 2], Spec({'xarrayspecs_use': 'attr'})], interface: Literal[1, 2], Spec({'xarrayspecs_use': 'attr'})], freq_range: Literal['inner', 'outer'], Spec({'xarrayspecs_use': 'attr'})], integ_time: Literal[100, 200, 500, 1000], Spec({'xarrayspecs_use': 'attr'})] | None = None, signal_sb: Literal['USB', 'LSB'], Spec({'xarrayspecs_use': 'attr'})] | None = None, signal_chan: Annotated[int, Spec({'xarrayspecs_use': 'attr'})] | None = None, state: str | None = None, join: Literal['outer', 'inner', 'left', 'right', 'exact', 'override'] = 'inner') → Dataset[source]#

Open USB/LSB VDIF files as a Dataset.

Parameters:
  • vdif_usb – Path of input USB VDIF file.

  • vdif_lsb – Path of input LSB VDIF file.

  • chassis – Chassis number of DRS4 (1|2).

  • interface – Interface number of DRS4 (1|2).

  • freq_range – Intermediate frequency range (inner|outer).

  • integ_time – Spectral integration time in ms (100|200|500|1000). If not specified, it will be inferred from the VDIF files.

  • signal_sb – Signal sideband (USB|LSB). If not specified, NA (missing indicator) will be assigned.

  • signal_chan – Signal channel number (0-511). If not specified, -1 (missing indicator) will be assigned.

  • state – Measurement state (Unicode string up to 8 chars). If not specified, NA (missing indicator) will be assigned.

  • join – Method for joining the VDIF files.

Returns:

Dataset of the input VDIF files.

Raises:
  • RuntimeError – Raised if USB/LSB spectral integration times are not same.

  • ValueError – Raised if the given value of either chassis, freq_range, integ_time, or interface is not valid.