qudi.util.units.create_formatted_output

qudi.util.units.create_formatted_output(param_dict, num_sig_digits=5)[source]

Display a parameter set nicely in SI units.

Parameters:
param_dictdict

Dictionary with entries being dictionaries with two needed keywords ‘value’ and ‘unit’ and one optional keyword ‘error’. Add the proper items to the specified keywords. Note that if no error is specified, no proper rounding (and therefore displaying) can be guaranteed.

num_sig_digitsint, optional

The number of significant digits will be taken if the rounding procedure was not successful at all. Default is 5.

Returns:
str

A nicely formatted string.

Notes

The absolute tolerance to a zero is set to 1e-18.

Examples

Example of a param dict:

param_dict = {‘Rabi frequency’: {‘value’: 123.43, ‘error’: 0.321, ‘unit’: ‘Hz’},

‘ODMR contrast’: {‘value’: 2.563423, ‘error’: 0.523, ‘unit’: ‘%’}, ‘Fidelity’: {‘value’: 0.783, ‘error’: 0.2222, ‘unit’: ‘’}}

If you want to access the value of the Fidelity, then you can do that via:

>>> param_dict['Fidelity']['value']

or on the error of the ODMR contrast:

>>> param_dict['ODMR contrast']['error']