photons.samples module
A formatting-friendly convenience class for 1-D sample data.
- photons.samples.order_of_magnitude(value)[source]
Returns the order of magnitude of value.
- Return type:
- class photons.samples.Rounded(value, precision, type, exponent, suffix)[source]
Bases:
objectRepresents a rounded value.
- class photons.samples.Format(**kwargs)[source]
Bases:
objectFormat specification.
- uncertainty(uncertainty, *, hash=None, type='f', precision=None)[source]
Format uncertainty using the hash, grouping, precision and type fields.
- Parameters:
- Return type:
- Returns:
The uncertainty formatted.
- value(value, *, hash=None, type=None, sign=None, precision=None)[source]
Format value using the sign, hash, grouping, precision and type fields.
- Parameters:
value (
float) – The value to format.hash (
str) – Can be either # or ‘’ (an empty string)type (
str) – Can be one of: e, E, f, F, g, G, nsign (
str) – Can be one of: +, -, ‘ ‘ (a space)precision (
int) – Indicates how many digits should be displayed after the decimal point for presentation types f and F, or before and after the decimal point for presentation types g or G.
- Return type:
- Returns:
The value formatted.
- class photons.samples.Samples(samples=None, *, mean=None, stdev=None, size=None, overload=1e+30)[source]
Bases:
objectConvenience class for a 1-D array of data samples.
Calculates the mean, standard deviation, variance, relative standard deviation and standard deviation of the mean of the samples.
- Parameters:
samples (
Union[str,Sequence[str|int|float],ndarray]) – The samples. If a string then in CSV format.mean (
float) – If specified, then it is not calculated from the samples.stdev (
float) – If specified, then it is not calculated from the samples.size (
int) – If specified, then it is not determined from the samples.overload (
float|None) – For some devices, like a DMM, if the input signal is greater than the present range can measure, the device returns a large value (e.g., 9.9E+37) to indicate a measurement overload. If the absolute value of the mean is greater than overload then the mean and standard deviation become NaN. Setting overload toNonedisables this check.