InversePolyphaseFilterBank

class baseband.tasks.InversePolyphaseFilterBank(ih, response, sn, pad_start=128, pad_end=128, samples_per_frame=None, frequency=None, sideband=None, dtype=None)[source] [edit on github]

Bases: baseband_tasks.base.PaddedTaskBase

Dechannelize a stream produced by a polyphase filter bank.

A polyphase filterbank attempts to make channel responses squarer, by convolving an input timestream with sinc-like function before doing a Fourier transform. This class attempts to deconvolve the signal, given the polyphase filter response. Like in most convolutions, a polyphase filter generally destroys some information, especially for frequencies near the edges of the channels. To optimize the process, Wiener deconvolution is used.

The signal-to-noise ratio required for Wiener deconvolution is a combination of the response-dependent quality with which any signal can be recovered and the quality with which the signal was sampled. For CHIME, where channels are digitized with 4 bits, simulations show that if 3 levels were covering the standard deviation of the input signal, sn=10 works fairly well. For GUPPI, which has 8 bit digitization but a response that strongly suppresses band edges, sn=30 seems a good number.

The deconvolution necessarily works poorly near edges in time, so should be done in overlapping blocks. Required padding is set with pad_start and pad_end (which are in addition to the minimum padding required by the response). Adequate padding depend on response; from simulations, for CHIME a padding of 32 on both sides seems to suffice, while for GUPPI 128 is needed.

Parameters
ihtask or baseband stream reader

Input data stream, with time as the first axis, and Fourier channel as the second.

responsendarray

Polyphase filter. The first dimension is taken to be the number of taps, and the second the number of channels.

snfloat

Effective signal-to-noise ratio; see note above.

pad_start, pad_endint, optional

Extra samples at the start and end to pad the frame being deconvolved; see note above. Default: 128.

samples_per_frameint, optional

Number of complete output samples per frame. Default: inferred from padding such that a minimum efficiency of 75% is reached.

frequencyQuantity, optional

Frequencies for each output channel. Default: inferred from ih (if available).

sidebandarray, optional

Whether frequencies are upper (+1) or lower (-1) sideband. Default: taken from ih (if available).

See also

PolyphaseFilterBank

apply polyphase filter.

baseband_tasks.fourier.fft_maker

to select the FFT package used.

Attributes Summary

closed

complex_data

dtype

Data type of the output.

meta

ndim

Number of dimensions of the output.

offset

sample_rate

Number of complete samples per second.

sample_shape

Shape of a complete sample.

samples_per_frame

Number of samples per frame of data.

shape

Shape of the output.

size

Number of component samples in the output.

start_time

Start time of the output.

stop_time

Time at the end of the output, just after the last sample.

time

Time of the sample pointer's current offset in the output.

Methods Summary

close()

Close task.

read([count, out])

Read a number of complete samples.

seek(offset[, whence])

Change the sample pointer position.

task(data)

Apply the inverse polyphase filter to a frame.

tell([unit])

Current offset in the file.

Attributes Documentation

closed = False
complex_data
dtype

Data type of the output.

meta
ndim

Number of dimensions of the output.

offset = 0
sample_rate

Number of complete samples per second.

sample_shape

Shape of a complete sample.

samples_per_frame

Number of samples per frame of data.

For compatibility with file readers, to help indicate what a nominal chunk of data is.

shape

Shape of the output.

size

Number of component samples in the output.

start_time

Start time of the output.

See also time and stop_time.

stop_time

Time at the end of the output, just after the last sample.

See also start_time and time.

time

Time of the sample pointer’s current offset in the output.

See also start_time and stop_time.

Methods Documentation

close() [edit on github]

Close task.

Note that this does not explicitly close the underlying source; instead, it just deletes the reference to it.

read(count=None, out=None) [edit on github]

Read a number of complete samples.

Parameters
countint or None, optional

Number of complete samples to read. If None (default) or negative, the number of samples left. Ignored if out is given.

outNone or array, optional

Array to store the samples in. If given, count will be inferred from the first dimension; the remaining dimensions should equal sample_shape.

Returns
outndarray of float or complex

The first dimension is sample-time, and the remaining ones are as given by sample_shape.

seek(offset, whence=0) [edit on github]

Change the sample pointer position.

This works like a normal filehandle seek, but the offset is in samples (or a relative or absolute time).

Parameters
offsetint, Quantity, or Time

Offset to move to. Can be an (integer) number of samples, an offset in time units, or an absolute time. For the latter two, the pointer will be moved to the nearest integer sample.

whence{0, 1, 2, ‘start’, ‘current’, or ‘end’}, optional

Like regular seek, the offset is taken to be from the start if whence=0 (default), from the current position if 1, and from the end if 2. One can alternativey use ‘start’, ‘current’, or ‘end’ for 0, 1, or 2, respectively. Ignored if offset is a time.

task(data)[source] [edit on github]

Apply the inverse polyphase filter to a frame.

Padding is removed from the result.

tell(unit=None) [edit on github]

Current offset in the file.

Parameters
unitUnit or str, optional

Time unit the offset should be returned in. By default, no unit is used, i.e., an integer enumerating samples is returned. For the special string ‘time’, the absolute time is calculated.

Returns
offsetint, Quantity, or Time

Offset in current file (or time at current position).