GetSlice¶
- class baseband_tasks.shaping.GetSlice(ih, item)[source] [edit on github]¶
Bases:
ChangeSampleShapeBaseSlice a stream and index or slice its samples.
Useful to select part of a stream, possibly in combination with selecting, e.g., a specific frequency band or polariazation.
- Parameters:
- ihtask or
basebandstream reader Input data stream.
- itemslice or tuple of slice, int, or array of int
Anything that can slice a numpy array. Should be a slice for the time axis.
- ihtask or
See also
GetItemindex or slice the samples, without slicing the time axis
Reshapeto reshape the samples
Transposeto transpose sample axes
ReshapeAndTransposeto reshape the samples and transpose the axes
ChangeSampleShapeto change the samples with a user-supplied function.
Examples
The VDIF example file from
Basebandhas 8 threads. To ignore the first and last 10 samples, one could do:>>> import numpy as np, astropy.units as u, baseband >>> from baseband_tasks.shaping import GetSlice >>> fh = baseband.open(baseband.data.SAMPLE_VDIF) >>> gsh = GetSlice(fh, slice(10, -10)) >>> gsh.shape (39980, 8) >>> fh.close()
Methods Summary
task(data)No-op task for default case of no sample slicing.
Methods Documentation
- task(data)[source] [edit on github]¶
No-op task for default case of no sample slicing.
Is overridden in initializer if sample slicing is needed.