katcbf_vlbi_resample.vdif_writer module
Encode data to VDIF frames.
- class katcbf_vlbi_resample.vdif_writer.VDIFEncode2Bit(input_data: Stream[DataArray], samples_per_frame: int, threshold: float)
Bases:
objectQuantise and pack values to 2-bit samples.
Values are quantised by comparing the absolute value to threshold. The power levels must already have been adjusted to make this an threshold appropriate.
The output array is in units of VDIF words (32-bit little-endian) rather than samples, and time_bias is also in units of words. Only real-valued unchannelised data is supported.
The input need not have any particular alignment. The output is aligned to the VDIF frame length. This also changes the time_base and introduces up to half a sample of delay (positive or negative) to align to the VDIF sample clock. The amount of the delay depends only on the incoming time_base and time_scale.
- class katcbf_vlbi_resample.vdif_writer.VDIFFormatter(input_data: Stream[DataArray], threads: list[dict[str, Any]], *, station: str | int, samples_per_frame: int)
Bases:
objectEncode data to VDIF frames.
The data must have already been quantised to words and aligned to frames using
VDIFEncode2Bitor similar. The time_base must be on a second boundary.Multiple VDIF threads are supported, provided that they are uniform. The threads argument must contain one element per desired thread, in the order that the thread IDs are to be assigned. The element is a dictionary that is passed to
xarray.DataArray.sel()to select the desired subarray from the input chunks.