Formatter
Format text for printing in a readable way
_cut_to_significant_digits(number, n)
Cut a number to n significant digits.
Source code in sqil_core/utils/_formatter.py
_sigma_for_confidence(confidence_level)
Calculates the sigma multiplier (z-score) for a given confidence level.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
confidence_level
|
float
|
The desired confidence level (e.g., 0.95 for 95%, 0.99 for 99%). |
required |
Returns:
Type | Description |
---|---|
float
|
The sigma multiplier to use for the confidence interval. |
Source code in sqil_core/utils/_formatter.py
format_number(num, precision=3, unit='', latex=True)
Format a number (or an array of numbers) in a nice way for printing.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
num
|
float | ndarray
|
Input number (or array). Should not be rescaled, e.g. input values in Hz, NOT GHz |
required |
precision
|
int
|
The number of digits of the output number. Must be >= 3. |
3
|
unit
|
str
|
Unit of measurement, by default '' |
''
|
latex
|
bool
|
Include Latex syntax, by default True |
True
|
Returns:
Type | Description |
---|---|
str
|
Formatted number |
Source code in sqil_core/utils/_formatter.py
get_name_and_unit(param_id)
Get the name and unit of measurement of a prameter, e.g. Frequency [GHz].
Parameters:
Name | Type | Description | Default |
---|---|---|---|
param
|
str
|
Parameter ID, as defined in the param_dict.json file. |
required |
Returns:
Type | Description |
---|---|
str
|
Name and [unit] |