Mrsimulator IO¶
- mrsimulator.save(filename: str, simulator: mrsimulator.simulator.Simulator, signal_processors: Optional[list] = None, params: Optional[lmfit.parameter.Parameters] = None, with_units: bool = True)¶
Serialize the Simulator, list of SignalProcessor, and lmfit Parameters objects to a .mrsim file.
- Parameters
filename (str) – The data is serialized to this file.
sim – Simulator object.
signal_processors – A list of PostSimulator objects corresponding to the methods in the Simulator object. Default is None.
params – lmfit Parameters object. Default is None.
with_units (bool) – If true, physical quantities are represented as string with units. The default is True.
- mrsimulator.dict(simulator: mrsimulator.simulator.Simulator, signal_processors: Optional[list] = None, params: Optional[lmfit.parameter.Parameters] = None, with_units: bool = True)¶
Export the Simulator, list of SignalProcessor, and lmfit Parameters objects to a python dictionary.
- Parameters
sim – Simulator object.
signal_processors – A list of PostSimulator objects corresponding to the methods in the Simulator object. Default is None.
params – lmfit Parameters object. Default is None.
with_units (bool) – If true, physical quantities are represented as string with units. The default is True.
- Returns
Python dictionary
- mrsimulator.load(filename: str, parse_units: bool = True)¶
Load Simulator, list of SignalProcessor and optionally lmfit Parameters objects from the .mrsim file.
- Parameters
filename (str) – The location to the .mrsim file.
parse_units (bool) – If true, parse the dictionary for units. The default is True.
- Returns
Simulator, List[SignalProcessor], Parameters.
- Return type
Ordered List
- mrsimulator.parse(py_dict, parse_units: bool = True)¶
Parse the dictionary object to respective Simulator, SignalProcessor and optionally lmfit Parameters object.
- Parameters
py_dict (dict) – Python dictionary representation of mrsimulator.
parse_units (bool) – If true, parse the dictionary for units. Default is True.
- Returns
Simulator, List[SignalProcessor], Parameters.
- Return type
Ordered List