pafsim.processor

Submodules

Package Contents

class pafsim.processor.Processor(name: str, **kwargs)

Bases: abc.ABC

Inheritance diagram of pafsim.processor.Processor

The base class for all processors. It is the API for creating new Processor classes A Processor has to implement a shape-property and a plot function.

Base constructor of the Processor. Can not be initiatied as this class is abstract

Parameters:

name (str) – The unique name of theProcessor

property default: str

Returns the default mode of the specific processor.

Returns:

The default mode

Return type:

str

abstract property shape: tuple
Abstract method should return the output array shape.

Needs to be implemented by inherited classes

Returns:

The shape of the output array

Return type:

tuple

property iformat: list

The input format

Returns:

The input format as a list (label)

Return type:

list

property oformat

The output format

Returns:

The output format as a list (label)

Return type:

list

N_INPUT: int = 0
I_FORMAT: list = []
O_FORMAT: list = []
process()
The process method calls the individual processing functions of the Processors.

The actual processing function which should be executed is specified by the Processors mode

Raises:

TypeError – When no pre-processor is set

abstract plot(path: str = '', figsize: tuple = (8, 4))
Abstract method to plot the output array.

Needs to be implemented by inherited classes

Parameters:
  • path (str, optional) – If set stores the plot in the directory. Defaults to “”.

  • figsize (tuple, optional) – Te size of the figure to plot. Defaults to (8,4).

dim(label: str) int

Returns the size of the requested dimension

Parameters:

label (str) – The label of the dimension (e.g. ‘A’, ‘F’, ‘P’)

Raises:

ValueError – When the processor has no dimension of the passed label

Returns:

The size of the dimension

Return type:

int

setPreProcessor(processor)

Connects the processor with a pre-processor

Parameters:

processor (Processor) – Concret object of the pre-processor

load() numpy.ndarray

Method to load a pickled output dataset. This method is used by sub-classes as a ‘mode’

Raises:

ValueError – When the output format does not match with the loaded dataset

Returns:

The dataset which was loaded

Return type:

np.ndarray

class pafsim.processor.Beamformer(name: str, **kwargs)

Bases: pafsim.processor._processor.Processor

Inheritance diagram of pafsim.processor.Beamformer

The Beamformer class forms beams out of voltage data and beam weights The Beamformer expects two inputs, the voltage data of the form of FPAT and the beam weights of the BFPA. The output is shape is FPAT The Beamformer inherits from the Processor class.

Construct a Beamformer object

Parameters:

name (str) – The unique name of the Beamformer

property default: str

Default process function

property shape: tuple

The shape of the output array

Returns:

The shape

Return type:

tuple

N_INPUT = 2
I_FORMAT = [['F', 'P', 'A', 'T'], ['B', 'F', 'P', 'A']]
O_FORMAT = ['F', 'B', 'P', 'T']
setPreProcessor(processor: pafsim.processor._processor.Processor)

Connects the processor with a pre-processor

Parameters:

processor (Processor) – Concret object of the pre-processor

Raises:

TypeError – When the pre-processor is not of type WeightGenerator or Channelizer

ToDo: The beamformer should allow any pre-processor with the matching dimensions.

voltage() numpy.ndarray

Applys the beam weights to the voltage data and forms beams using a general matrix multiplication

Returns:

The output array

Return type:

np.ndarray

plot(path='', figsize=(8, 4))

Plotting function to plot the beamformed time series

Parameters:
  • path (str, optional) – If not set to “” it stores the plot in the given directory. Defaults to “”.

  • figsize (tuple, optional) – Size of the plotted figure. Defaults to (8,4).

class pafsim.processor.WeightGenerator(name: str, **kwargs)

Bases: pafsim.processor._processor.Processor

Inheritance diagram of pafsim.processor.WeightGenerator

The WeightGenerator creates beam weights under the use of ACMs. It uses the Correlator as input, the format is FPAA. The output array are the frequency dependend weights of the form BFPA.

Construct a WeightGenerator object

Parameters:

name (str) – The unique name of theWeightGenerator

kwargs:
beams (int): The number of beams to produce. This parameter is implicitly determined

when using the maxsnr processing

mode (str): maxsnr -> maximum signal-to-noise algorithm (default)

property default: str

Default process function

property shape: tuple

The shape of the output array

Returns:

The shape

Return type:

tuple

N_INPUT = 1
I_FORMAT = [['N', 'F', 'P', 'A', 'A']]
O_FORMAT = ['B', 'F', 'P', 'A']
maxsnr() numpy.ndarray

Processing function to compute beam weight under the use of th maximum signal-to-noise algorithms

Returns:

_description_

Return type:

np.ndarray

random() numpy.ndarray

Processing function creating random weights

Returns:

The output array

Return type:

np.ndarray

zero() numpy.ndarray

Processing function creating zero weights

Returns:

The output array

Return type:

np.ndarray

bypass() numpy.ndarray

Processing function to bypass using a diagonal matrix with ones and zeros

Returns:

The output array

Return type:

np.ndarray

plot(path='', figsize=(8, 4))

Plotting function to plot the amplitude of the beamweight

Parameters:
  • path (str, optional) – If not set to “” it stores the plot in the given directory. Defaults to “”.

  • figsize (tuple, optional) – Size of the plotted figure. Defaults to (8,4).

class pafsim.processor.Channelizer(name: str, **kwargs)

Bases: pafsim.processor._processor.Processor

Inheritance diagram of pafsim.processor.Channelizer

The channelizer takes time series (voltages) and channelizes it. The input is a time series of the form APT The output is a channelized time series of the form FAPT

Construct a Generator object

Parameters:

name (str) – The unique name of theGenerator

kwargs:

taps (int): Number of taps used for the filter. Defaults to 2 channels (int): Number of channels to produce. Defaults to 32 window (str): The window function to apply to the filter. The window function must be known

by scipy.windows.get_window(). Defaults to rectangular

pn (int): Numerater, used when oversampling is desired. Defaults to 1 mode (str): pfb -> polyphase filterbank channelizer (default)

fft -> fourier transform channelizer

property default: str

Default process function

property shape: tuple

The shape of the output array

Returns:

The shape

Return type:

tuple

N_INPUT = 1
I_FORMAT = [['A', 'P', 'T']]
O_FORMAT = ['F', 'A', 'P', 'T']
pfb() numpy.ndarray

Processing function to channelize the data with a Polyphase Filterbank

Returns:

The output array

Return type:

np.ndarray

fft() numpy.ndarray

Processing function to channelize the data with a FFT

Returns:

The output array

Return type:

np.ndarray

plot(path='', figsize=(8, 4))

Plotting function to plot the channeles vs time

Parameters:
  • path (str, optional) – If not set to “” it stores the plot in the given directory. Defaults to “”.

  • figsize (tuple, optional) – Size of the plotted figure. Defaults to (8,4).

class pafsim.processor.Correlator(name: str, **kwargs)

Bases: pafsim.processor._processor.Processor

Inheritance diagram of pafsim.processor.Correlator

The Correlator takes time series data as input and correlates them. The input is a time series of the form APT or FAPT The output is are ACMs of the form NFPAA, where N is the number of ACMs

Construct a Correlator object

Parameters:

name (str) – The unique name of theCorrelator

kwargs:

acc (int): Number of ACMs to create. mode (str): ‘acm’ -> correlate and build covariance matrices (default)

property default: str

Default process function

property shape: tuple

The shape of the output array

Returns:

The shape

Return type:

tuple

N_INPUT = 1
I_FORMAT = [['F', 'A', 'P', 'T']]
O_FORMAT = ['N', 'F', 'P', 'A', 'A']
acm() numpy.ndarray

Processing function to compute the covariances

Returns:

The output array

Return type:

np.ndarray

plot(path='', figsize=(8, 4))

Plotting function to plot the amplitude of covariance matrices. Just a sub-set is randomly chosen

Parameters:
  • path (str, optional) – If not set to “” it stores the plot in the given directory. Defaults to “”.

  • figsize (tuple, optional) – Size of the plotted figure. Defaults to (8,4).

class pafsim.processor.WaveformGenerator(name: str, **kwargs)

Bases: pafsim.processor.Processor

Inheritance diagram of pafsim.processor.WaveformGenerator

The WaveformGenerator generates time series (voltages) of different waveforms (e.g. sine, random).

Construct a WaveformGenerator object :param name: The unique name of theGenerator :type name: str

kwargs:

fs (float): The sampling rate at which to generate the time series [Hz]. Defaults to 1000 Hz duration (float): The duration of the signal [seconds]. Defaults to 1s gain (float): Gain factor to the amplitude of the signal. Defaults to 1 freq (List[float]): When using the sinus mode generates sines at the frequencies [Hz]. defaults to fs / 4 phase (float): When using the sinus mode adds a phase offset [rad]. Defaults to 0 period (float): When using the sweep mode sets the sweep length in seconds. Defaults to duration f0 (float): When using the sweep mode sets the start frequency of the sweep [Hz]. Defaults to fs / 8 f1 (float): When using the sweep mode sets the stop frequency of the sweep [Hz]. Defaults to fs / 4 method (str): When using the sweep mode sets the sweep method. Defaults to ‘linear’ mean (float): When using the noise mode, sets the mean of the signal devitaion (float): When using the noise mode, sets the deviation of the signal from the mean antennas (int): The number of antennas to generate signals for. Defaults to 2 pol (int): The number of polarization to generate signals for. Defaults to 2 mode (str): The waveform mode,

sinus -> Generates addtive sine wave signals (default) sweep -> Generates sweep signals noise -> Generates noise signals rect -> Generates rectangluar signals

property default: str

Default process function

property shape: tuple

The shape of the output array

Returns:

The shape

Return type:

tuple

N_INPUT = 0
I_FORMAT
O_FORMAT = ['A', 'P', 'T']
sinus() numpy.ndarray

Processing function to generate addtive sine waves for a baseband signal

Returns:

The output array

Return type:

np.ndarray

noise() numpy.ndarray

Processing function to generate noise for a baseband signal

Returns:

The output array

Return type:

np.ndarray

sweep() numpy.ndarray

Processing function to generate sweeps for a baseband signal

Returns:

The output array

Return type:

np.ndarray

rect() numpy.ndarray

Processing function to generate rects for a baseband signal

Returns:

The output array

Return type:

np.ndarray

plot(path='', figsize=(8, 4))

Plotting function to plot the time series

Parameters:
  • path (str, optional) – If not set to “” it stores the plot in the given directory. Defaults to “”.

  • figsize (tuple, optional) – Size of the plotted figure. Defaults to (8,4).

class pafsim.processor.Generator(name: str, **kwargs)

Bases: pafsim.processor._processor.Processor

Inheritance diagram of pafsim.processor.Generator

The Generator class generates wideband time series data for all simulated PAF elements. The simulation is based on the read ACMs of the Frontend Simulation. The Generator inherits from the Processor class and can be used as the input for a processing chain.

Construct a Generator object

Parameters:

name (str) – The unique name of theGenerator

kwargs:

dataset (str): Path to an HDF5 file containing the output of the PAF Frontend simulator noise (str): Names of the noise datasets to use for the time series generation signal (str): Names of the signal datasets to use for the time series generation rfi (str): Names of the RFI datasets to use for the time series generation width (int): The length of the time series to generate

property default: str

Default process function

property shape: tuple

The shape of the output array

Returns:

The shape

Return type:

tuple

N_INPUT = 0
I_FORMAT
O_FORMAT = ['A', 'P', 'T']
wideband() numpy.ndarray

Processing function to generate a wideband timeseries output for all PAF elements

Returns:

The output array

Return type:

np.ndarray

plot(path='', figsize=(8, 4))

Plotting function to plot the time series

Parameters:
  • path (str, optional) – If not set to “” it stores the plot in the given directory. Defaults to “”.

  • figsize (tuple, optional) – Size of the plotted figure. Defaults to (8,4).