GetSlice¶
- class baseband_tasks.shaping.GetSlice(ih, item)[source] [edit on github]¶
Bases:
ChangeSampleShapeBase
Slice 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
baseband
stream 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
GetItem
index or slice the samples, without slicing the time axis
Reshape
to reshape the samples
Transpose
to transpose sample axes
ReshapeAndTranspose
to reshape the samples and transpose the axes
ChangeSampleShape
to change the samples with a user-supplied function.
Examples
The VDIF example file from
Baseband
has 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.