drs4.specs.vdif module#

class drs4.specs.vdif.VDIF(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'})})], auto: ~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', 'units': 'Arbitrary unit'})})], integ_time: ~typing.Annotated[~typing.Literal[100, 200, 500, 1000], Spec({'xarrayspecs_use': 'attr'})])[source]#

Bases: AsDataArray

Data specification of DRS4 VDIF.

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

Auto-correlation spectra.

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

Channel number (0-511).

integ_time: Literal[100, 200, 500, 1000], Spec({'xarrayspecs_use': 'attr'})]#

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

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

Version of the data specification.

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.vdif.open_vdif(vdif: PathLike[str] | str, /, *, integ_time: Literal[100, 200, 500, 1000], Spec({'xarrayspecs_use': 'attr'})] | None = None, join: Literal['outer', 'inner', 'left', 'right', 'exact', 'override'] = 'inner') → DataArray[source]#

Open a VDIF file as a DataArray.

Parameters:
  • vdif – Path of input VDIF file.

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

  • join – Method of joining the first- and second-half spectra.

Returns:

DataArray of the input VDIF file.

Raises:
  • RuntimeError – Raised if the spectral integration time cannot be inferred from the VDIF file (frame number).

  • ValueError – Raised if the given (or inferred) spectral integration time is other than 100|200|500|1000 ms.