Decorator that allows a class function to be called as inplace. It will invalidate the parent object to have only one reference to the Dataset.
Pretty print the dispersion results from returned arrays.
Base pysprint warning class.
This warning is raised when a function applies linear interpolation on the data.
This warning is raised when FFT is called first instead of IFFT. Later on it will be improved. For more details see help(pysprint.FFTMethod.calculate)
This error is raised when invalid type of data encountered when initializing a dataset or inherited object.
This error is raised when a function is not available yet because something needs to be calculated before.
This code is mostly adapted from pandas/pandas/util/_print_versions.py. pandas is licensed under the BSD 3-Clause “New” or “Revised” License. See at: pandas.pydata.org
Print all the relevant information about system and dependecies.
A class to store additional meta property. This can be set to any valid ~collections.abc.Mapping.
- doc (str, optional) – Documentation for the attribute of the class.
- copy (bool, optional) – If
Truethe the value is deepcopied before setting, otherwise it is saved as reference. Default is
Initialize self. See help(type(self)) for accurate signature.
- doc (str, optional) – Documentation for the attribute of the class. Default is
Detect if code is run inside Jupyter or maybe Spyder.
measurement(array, confidence=0.95, silent=False)¶
Give the measurement results with condifence interval assuming the standard deviation is unknown.
- array (ndarray) – The array containing the measured values
- confidence (float, optional) – The desired confidence level. Must be _between 0 and 1.
- silent (bool, optional) – Whether to print results immediately. Default is False.
- mean (float) – The mean of the given array
- conf (tuple-like (interval)) – The confidence interval
>>> import numpy as np >>> from pysprint.utils import measurement >>> a = np.array([123.783, 121.846, 122.248, 125.139, 122.569]) >>> mean, interval = measurement(a, 0.99) 123.117000 ± 2.763022 >>> mean 123.117 >>> interval (120.35397798230359, 125.88002201769642)
The results are printed immediately, because people often don’t use it for further code. Of course, they are also returned if needed.
Find the nearest element in array to value.
- array (np.ndarray-like) – The array to search in.
- value (float) – The value to search.
- value (float) – The closest value in array.
- idx (int) – The index of the closest element.
Pad an array with trailing zeros to be the desired shape