bag.io.sim_data
This module handles simulation data related IO.
Note : when reading data files, we use Numpy to handle the encodings, so BAG encoding settings will not apply.
Module Contents
Classes
Subclass of numpy array that adds sweep parameters attribute. |
Functions
|
Parse the sweep information file and reverse engineer sweep parameters. |
|
Load exported simulation results from the given directory. |
|
Saves the given simulation results dictionary as a HDF5 file. |
|
Read simulation results from HDF5 file. |
Attributes
- class bag.io.sim_data.SweepArray(shape, dtype=float, buffer=None, offset=0, strides=None, order=None)[source]
Bases:
numpy.ndarray
Subclass of numpy array that adds sweep parameters attribute.
- bag.io.sim_data._get_sweep_params(fname)[source]
Parse the sweep information file and reverse engineer sweep parameters.
- Parameters:
fname (str) – the sweep information file name.
- Returns:
swp_list (list[str]) – list of sweep parameter names. index 0 is the outer-most loop.
values_list (list[list[float or str]]) – list of values list for each sweep parameter.
- bag.io.sim_data.load_sim_results(save_dir)[source]
Load exported simulation results from the given directory.
- Parameters:
save_dir (str) – the save directory path.
- Returns:
results – the simulation data dictionary.
most keys in result is either a sweep parameter or an output signal. the values are the corresponding data as a numpy array. In addition, results has a key called ‘sweep_params’, which contains a dictionary from output signal name to a list of sweep parameters of that output.
- Return type: