katcbf_vlbi_resample.utils module

Miscellaneous utilities.

katcbf_vlbi_resample.utils.as_cupy(array: DataArray, blocking: bool = False) DataArray

Convert array to hold a cupy array if necessary.

katcbf_vlbi_resample.utils.concat_time(arrays: Sequence[DataArray]) DataArray

Concatenate datasets in time.

This checks that the arrays are contiguous in time and fixes up the timestamping attribute.

It also has a fast path if there is only one non-empty array in the sequence, in which case that array is returned without making a copy. Note that this means that the original arrays cannot safely be modified, as it will affect the return value.

katcbf_vlbi_resample.utils.fraction_to_time_delta(secs: Fraction, scale: str = 'tai') TimeDelta

Convert a fraction in seconds to a TimeDelta.

katcbf_vlbi_resample.utils.is_cupy(array: DataArray) bool

Determine whether array contains a cupy array.

katcbf_vlbi_resample.utils.isel_time(array: DataArray, index: slice) DataArray

Slice an array along the time axis.

This takes care of adjusting the time_bias attribute of the return value. The slice must have a step size of 1.

katcbf_vlbi_resample.utils.stream_future(value: T, stream: <MagicMock name = 'mock.cuda.Stream.__or__()' id='127957959709504'> = None) Future

Return a Future that is made ready when work on the current CUDA stream is complete.

katcbf_vlbi_resample.utils.time_align(array: DataArray, modulus: int, remainder: int = 0) DataArray | None

Trim the start of an array to ensure alignment in time.

The array is trimmed such that the time_bias of the output satisfies time_bias % modulus == remainder % modulus. If it is not possible to do so with a non-empty array, return None instead.

If no trimming is required, the original array is returned (not a view).