libs package

Subpackages

Submodules

libs.ConfigHandler module

class libs.ConfigHandler.ConfigHandler

Bases: object

The class manages the loading, writing and managing of the configuration parameters.

Parameters:
  • config (Dict[str, Dict[str, any]]) – Dictionary with the options and their respective values.

  • config_parser (configparser.Configparser) – Configparser object containing the settings from the config.ini file.

config: Dict[str, Dict[str, any]]
config_parser: ConfigParser
static config_template() Dict[str, Dict[str, any]]
static get_config_path(filename='config.ini')
static get_save_files_path()
static isfloat(element: any) bool

Method checks if a string is convertible to float.

Parameters:

element (any) – Possible float value.

Returns:

True when element is convertible to float, false otherwise.

Return type:

bool

load_configfile()
update_config()
write_configfile()

libs.DataHandler module

class libs.DataHandler.DataHandler(objects: List[any] = [], filepath: Path = PosixPath('.'))

Bases: object

Objects of this class hold both the simulation parameters and the measurement data generated by the simulation. The class also provides methods to save and load this data from/to file.

Parameters:

objects (List[any]) – List containing all instances of classes in the simulation with parameters.

static check_series(series: Dict[str, Dict[str, List[float]]])

Checks if the dimensions of the entries match.

Returns:

1 if entries match, 0 otherwise.

Return type:

int

components()

Method returns the objects of type Component in a list.

Returns:

List of objects of type Component.

Return type:

List[Component]

static convert_dict(dictionary: Dict[str, str])
Converts a dictionary with strings as values to the same dictionary with int, float, bool and

np.ndarray values.

Parameters:

dictionary (Dict[str, dict]) – Dictionary with strings only.

Returns:

Dictionary with int, float, bool and np.ndarray values.

Return type:

Dict[str, dict]

deploy_dict(dictionary: Dict[str, any])

Deploy the information stored in a dictionary to the objects list.

Parameters:

dictionary – Dictionary storing the simulation objects.

Type:

Dict[str, any]

field_recorders()

Method returns the objects of type FieldRecorder in a list.

Returns:

List of objects of type FieldRecorder.

Return type:

List[FieldRecorder]

filepath: Path
gmr_sensors()

Method returns the objects of type GMRSensor in a list.

Returns:

List of objects of type GMRSensor.

Return type:

List[GMRSensor]

gui_dict() Dict[str, any]

Method builds a dictionary of all meta and measurement data.

Returns:

Dictionary with all data.

Return type:

Dict[str, any]

load_h5(path: Path) None

Method changes the object list based on data from a HDF5 file.

Parameters:

path (Path) – Path to the file.

load_ini(path: Path) None

Method changes the object list based on data from a ini file.

Parameters:

path (Path) – Path to the ini file.

load_py(path: Path) List[DataHandler]

Method changes the object list based on data from a python file.

Parameters:

path (Path) – Path to the python file.

magnets()

Method returns the objects of type Magnet or UniField in a list.

Returns:

List of objects of type Magnet or UniField.

Return type:

List[Union[Magnet, UniField]]

objects: List[any]
physical_magnets()

Method returns the objects of type Magnet in a list.

Returns:

List of objects of type Magnet.

Return type:

List[Magnet]

physical_sensors()

Method returns the objects of type Sensor in a list.

Returns:

List of objects of type Sensor.

Return type:

List[Sensor]

save_h5(measurement_path: Path) bool

Outputs the parameters and measurement data held by the object to a specified file.

Returns:

True when the process is successful, false otherwise.

Return type:

bool

save_ini() bool
save_py() bool
sensors()

Method returns the objects of type Sensor or FieldRecorder in a list.

Returns:

List of objects of type Sensor or FieldRecorder.

Return type:

List[Union[Sensor, FieldRecorder]]

sim_params()

Method returns the objects of type SimParams in a list.

Returns:

Object in objects list of type SimParams.

Return type:

SimParams

classmethod template()

Initialize the simulation and File parameters when no initial setup file is found.

to_dict() Dict[str, any]

Method builds a dictionary of all meta and measurement data.

Returns:

Dictionary with all data.

Return type:

Dict[str, any]

uni_fields()

Method returns the objects of type UniField in a list.

Returns:

List of objects of type UniField.

Return type:

List[UniField]

update_objects(frames: List[any]) None

The method updates the data contained in the object based on the current gui entries.

Module contents