shnitsel.analyze.stats¶
Functions¶
|
Function to calculate the confidence interval for a variable array a. |
|
Calculate the confidence interval from statistics aggregated across the last dimension. |
|
Function to calculate confidence interval data for the input data_array. |
|
Function to calculate the per-time confidence interval of a DataArray that is groupable by the time coordinate. |
|
Isolate the standard per-state properties (energy, forces, permanent dipoles) |
|
Calculate inter-state properties of a dataset for certain observables. |
Module Contents¶
- calc_confidence_interval(data_array, confidence=0.95)¶
Function to calculate the confidence interval for a variable array a.
The result is a numpy array with stacked entries with the lower and upper limits of the confidence interval.
- Parameters:
a (npt.NDArray) – The Numpy array to calculate the confidence interval for.
confidence (float, optional) – The confidence level to get the confidence interval for. Defaults to 0.95.
data_array (numpy.typing.NDArray)
- Raises:
ValueError – Raised if the provided data_array is not one-dimensional
- Returns:
Numpy array with lower and upper bounds of the confidence interval
- Return type:
npt.NDArray
- confidence_interval_aggregate_last_dim(data_array, confidence=0.95)¶
Calculate the confidence interval from statistics aggregated across the last dimension.
For our purposes, this should amount to the trajectory being averaged over.
- Parameters:
data_array (npt.NDArray) – The numpy data array to calculate the confidence interval for.
confidence (float, optional) – The confidence level to use for calculations. Defaults to 0.95.
- Returns:
A numpy array with (lower_bound,upper_bound,mean) of the confidence interval in the last dimension. Otherwise same shape as data_array.
- Return type:
npt.NDArray
- calc_confidence_interval_in_array_dimensions(data_array, dim, confidence=0.95)¶
Function to calculate confidence interval data for the input data_array. Results are then repackaged back into an xr.DataArray, where the dimension bound allows to choose between confidence interval limits and the mean of the distribution.
The dimension denoted by dim will be aggregated across.
- Parameters:
data_array (xr.DataArray) – Input data to have confidence intervals calculated for.
dim (DimName) – Dimension to calculate the confidence interval data from.
confidence (float, optional) – Confidence level for Confidence interval calculation. Defaults to 0.95.
- Returns:
DataArray with coordinate bound with values ‘lower’, ‘upper’, and ‘mean’, which refer to the lower and the upper bound of the confidence interval of this and
- Return type:
xr.DataArray
- time_grouped_confidence_interval(data_array, confidence=0.9)¶
Function to calculate the per-time confidence interval of a DataArray that is groupable by the time coordinate.
- Parameters:
data_array (xr.DataArray) – Data Array for whose data the confidence intervals should be calculated
confidence (float, optional) – The confidence level to calculate the interval bounds for. Defaults to 0.9.
- Returns:
A new Dataset, where variables ‘lower’, ‘upper’ and ‘mean’ contain the lower and upper bounds of the confidence interval in each time step and mean is the mean at each point in time.
- Return type:
xr.Dataset
- get_per_state(frames)¶
Isolate the standard per-state properties (energy, forces, permanent dipoles) from an xr.Dataset, and take their norm over all array dimensions other than ‘state’ so that the resulting variables can be easily plotted against another.
- Parameters:
frames (shnitsel.core.typedefs.Frames) – An xr.Dataset object containing at least ‘energy’, ‘forces’ and ‘dip_perm’ variables
- Returns:
An xr.Dataset object containing only ‘energy’, ‘forces’ and ‘dip_perm’ variables
- Return type:
PerState
- get_inter_state(frames)¶
Calculate inter-state properties of a dataset for certain observables.
Currently calculates inter-state levels of energy differences. Will calculate Differences between the values of these observables indexed by state. If no statecomb dimension exists, will create one.
- Parameters:
frames (Frames) – The basis Dataset to calculate the interstate properties for
- Returns:
A Dataset containing interstate properties
- Return type:
InterState