katcbf_vlbi_resample.power module
Normalise power level prior to quantisation.
- class katcbf_vlbi_resample.power.MeasurePower(input_data: Stream)
Bases:
ChunkwiseStream[Dataset,DataArray]Measure mean power in each chunk.
It may be beneficial to use
Rechunkprior to this filter to control the chunk size.The output stream contains Datasets rather than DataArrays. The Dataset has members data (containing the original data) and rms (containing the RMS voltages without a time axis).
- class katcbf_vlbi_resample.power.NormalisePower(input_data: Stream[Dataset], scale: float, power: Literal['auto', 'first'] | DataArray = 'auto')
Bases:
ChunkwiseStream[DataArray,Dataset]Normalise power level.
The power level is adjusted so that the standard deviation within each chunk is scale. This is done independently for each time series. It may be beneficial to use
Rechunkprior to this filter to control the chunk size.Subclasses may override
record_rms()to store the RMS values to some form of storage.- Parameters:
input_data – Input data stream. The input chunks must be Datasets with data and rms members, as yielded by
MeasurePower. If power is float, the rms member is not required.scale – Target standard deviation
power –
Method used to determine the power for the normalisation factor. This may be one of
autoUse the values from the rms member of the input chunks.
firstUse the values from the rms member of the first input chunk, for all chunks.
- DataArray
Constant values to use as the power estimates. This must have the same non-time dimensions as the data.
- class katcbf_vlbi_resample.power.RecordPower(input_data: Stream[Dataset])
Bases:
ChunkwiseStream[Dataset,Dataset]Record history of power levels.
This stream should be inserted immediately after
MeasurePower. It passes the chunks through unchanged, but invokes a callback function to save power levels.- abstractmethod record_rms(start: int, length: int, rms: DataArray) None
Record the RMS values.
The base class does nothing. Subclasses may override it to take action.
The rms array is guaranteed to be backed by a numpy array rather than GPU memory. To make this efficient when using cupy (and not block the pipeline to transfer data to the host), there may be some delay between the chunk being iterated and this callback.
- Parameters:
start – Sample index of the first sample in the chunk
length – Number of samples in the chunk
rms – RMS values from the chunk (with non-time dimensions preserved).