pafsim.processor.generator
Module Contents
- class pafsim.processor.generator.FrontendSimFile(path: str)
Bases:
h5py.File
The FrontendSimFile is class to read ACMs and properties from an HDF5 file produced by the PAF Frontend Simulator. The class inherits from the h5py.File class.
Construct an FrontendSimFile object. File is only opened in read-mode
- Parameters:
path (str) – Path to the HDF5 file
- property nelements: int
Returns the number of elements simulated in the PAF
- Returns:
Number of elements
- Return type:
int
- property npol: int
Returns the number of elements simulated in the PAF
- Returns:
Number of polarisations
- Return type:
int
- signal_base_path = 'acms/signal/{name}/'
- noise_base_path = 'acms/noise/{name}/sys'
- rfi_base_path = 'acms/rfi/{name}'
- view() str
Get structure tree of the hdf5 file
- Returns:
Representation of the structure tree
- Return type:
str
- exists(path: str) bool
Checks is a path in the HDF5 exists
- Parameters:
path (str) – The path to proof existence
- Returns:
True if it exists, otherwise false
- Return type:
bool
- dataset(path: str) numpy.ndarray
Returns a dataset by the given path
- Parameters:
path (str) – The path of the dataset
- Returns:
The data set as a numpy array
- Return type:
np.ndarray
- datasets(base_path: str, names: set, suffix: str = 'acm') List[numpy.ndarray]
- Returns multiple datasets with matching names and suffix within the base path.
- The paths of the datasets is constructed like this:
base_path/names[0]/suffix base_path/names[1]/suffix base_path/names[n]/suffix
- Parameters:
base_path (str) – The base path of the datasets
names (set) – A set or list of names / sub directories
suffix (str, optional) – The data set names. Defaults to “acm”.
- Returns:
_description_
- Return type:
ty.List[np.ndarray]
- signal(names: set, suffix: str = 'acm') List[numpy.ndarray]
Returns datasets of simulated signals with matching names
- Parameters:
names (set) – Set or List of names
suffix (str, optional) – The data set names. Defaults to “acm”.
- Returns:
The datasets, List of numpy arrays
- Return type:
ty.List[np.ndarray]
- noise(names: set, suffix: str = 'acm') List[numpy.ndarray]
Returns datasets of simulated noises with matching names
- Parameters:
names (set) – Set or List of names
suffix (str, optional) – The data set names. Defaults to “acm”.
- Returns:
The datasets, List of numpy arrays
- Return type:
ty.List[np.ndarray]
- rfi(names: set, suffix: str = 'acm') List[numpy.ndarray]
Returns datasets of simulated RFI with matching names
- Parameters:
names (set) – Set or List of names
suffix (str, optional) – The data set names. Defaults to “acm”.
- Returns:
The datasets, List of numpy arrays
- Return type:
ty.List[np.ndarray]
- class pafsim.processor.generator.Generator(name: str, **kwargs)
Bases:
pafsim.processor._processor.Processor
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).