TaskBase

class baseband_tasks.base.TaskBase(ih, *, ih_samples_per_frame=None, shape=None, sample_rate=None, samples_per_frame=None, **kwargs)[source] [edit on github]

Bases: baseband_tasks.base.BaseTaskBase

Base class of all tasks.

Following the design of baseband stream readers, features properties describing the size, shape, data type, sample rate and start/stop times of the task’s output. Also defines methods to move a sample pointer across the output data in units of either complete samples or time.

This class provides a base _read_frame method that will read a frame worth of data from the underlying stream and pass it on to a task method. Hence, subclasses should define:

task(self, data) : return processed data from one frame.

Parameters
ihstream handle

Handle of a stream reader or another task.

ih_samples_per_frameint, optional

Number of input samples which should be dealt with in one go. If not given, inferred from samples_per_frame; if that is also not given, taken from the underlying stream.

shapetuple, optional

Overall shape of the stream, with first entry the total number of complete samples, and the remainder the sample shape. If not given, the sample shape is that of the underlying stream, and the number of complete samples is inferred from the number of frames implied by ih_samples_per_frame, combined with samples_per_frame. The latter inference also happens if the first entry is -1. If a shape inconsistent with an integer number of frames is given, the task should be able to deal with a partial frame (which, when the sample rate is reduced, will always contain an integer multiple of the reduction factor).

sample_rateQuantity, optional

With units of a rate. If not given, taken from the underlying stream.

samples_per_frameint, optional

Number of samples the task produces per frame. If not given, inferred from the input number of samples using the ratio of the sample_rate passed in and that of the underlying stream.

**kwargs

Possible further arguments and metadata; see BaseTaskBase.