aim2dat.fct
¶
Modules to analyze and compare functions (e.g. DOS or spectra).
Submodules¶
Package Contents¶
Classes¶
Class to create an axis to discretize a 1d function i.e. a 2d plot |
|
Class to create a grid to discretize a 1d function i.e. a 2d plot. |
|
Class to analyze and compare functions. |
|
Fingerprint for functions based on the DOS-Fingerprint presented in |
- class aim2dat.fct.DiscretizedAxis(axis_type, **kwargs)[source]¶
Class to create an axis to discretize a 1d function i.e. a 2d plot in a grid. Different methods for the discretization are available.
Overview
¶ x –> y or y –> x.
Axis array. Contains the discrete values.
Specify whether this axis should be used as x or y axis in a grid.
Discretize the specified range.
Check whether the axis is empty.
Tuple specifying the dimensions of the axis (like numpy).
¶ discretize_axis
(**kwargs)Perform the discretization of the specified range.
Change the axis_type: x –> y or y –> x.
- property T : DiscretizedAxis¶
x –> y or y –> x.
- property axis : numpy.array¶
Axis array. Contains the discrete values.
- Returns:¶
np.array – The discretized range.
- property axis_type : str¶
Specify whether this axis should be used as x or y axis in a grid.
- property discretization_method : collections.abc.Callable¶
Discretize the specified range. Can be chosen via a string, accepting the methods specified in _available_discretization_methods or by passing a callable function.
- Returns:¶
Callable – Method to discretize the axis.
- property is_empty : bool¶
Check whether the axis is empty.
- Returns:¶
bool – Whether the axis is empty.
- property shape : tuple¶
Tuple specifying the dimensions of the axis (like numpy).
- Returns:¶
tuple – The shape of the axis.
- discretize_axis(**kwargs) DiscretizedAxis [source]¶
Perform the discretization of the specified range.
- Returns:¶
DiscretizedAxis
- transpose() DiscretizedAxis [source]¶
Change the axis_type: x –> y or y –> x.
- Returns:¶
DiscretizedAxis – Transposed axis.
- class aim2dat.fct.DiscretizedGrid(**kwargs)[source]¶
Class to create a grid to discretize a 1d function i.e. a 2d plot.
Use the plot_grid method to visualize the created grid.
Overview
¶ Return the internal grid as a list of lists.
Check whether the axis is empty.
¶ Create the internal grid which is based on a list of lists.
Plot the grid.
- property grid : list¶
Return the internal grid as a list of lists.
- Returns:¶
type – list: List of lists representing the x-values and discretized y-values.
- property is_empty : bool¶
Check whether the axis is empty.
- Returns:¶
bool – Whether the axis is empty.
- create_grid() DiscretizedGrid [source]¶
Create the internal grid which is based on a list of lists. Each list contains the energy-value (x) as the first argument and the DOS-values (y) as a list in the second argument.
- Returns:¶
DiscretizedGrid – Discretized grid.
- class aim2dat.fct.FunctionAnalysis(**kwargs)[source]¶
Class to analyze and compare functions.
Overview
¶ Return allowed distance methods.
¶ calculate_correlation
(label1, label2)Calculate the pearson-correlation between the values of two functions.
calculate_discrete_fingerprint
(label, grid)Calculate a discretized fingerprint of a function (doi:10.1038/s41597-022-01754-z).
calculate_distance
(label1, label2, method)Calculate the distance between the values of two functions.
compare_areas
(label1, label2)Compare the enclosed areas of two functions.
compare_functions_by_discrete_fingerprint
(label1, label2, grid)Compare two functions based on a discretized fingerprint
import_data
(data_label, x_values, y_values)Import data into the internal memory.
- property allowed_distance_methods : list¶
Return allowed distance methods.
- calculate_correlation(label1: str, label2: str) float [source]¶
Calculate the pearson-correlation between the values of two functions.
- calculate_discrete_fingerprint(label: str, grid: aim2dat.fct.discretization.DiscretizedGrid) numpy.array [source]¶
Calculate a discretized fingerprint of a function (doi:10.1038/s41597-022-01754-z).
-
calculate_distance(label1: str, label2: str, method: str =
'euclidian'
) float [source]¶ Calculate the distance between the values of two functions.
- compare_areas(label1: str, label2: str) float [source]¶
Compare the enclosed areas of two functions.
- compare_functions_by_discrete_fingerprint(label1: str, label2: str, grid: aim2dat.fct.discretization.DiscretizedGrid) float [source]¶
Compare two functions based on a discretized fingerprint (doi:10.1038/s41597-022-01754-z).
- class aim2dat.fct.FunctionDiscretizationFingerprint(grid, **kwargs)[source]¶
Fingerprint for functions based on the DOS-Fingerprint presented in doi:10.1038/s41597-022-01754-z.
Overview
¶ calculate_fingerprint
(x_values, y_values, label)Calculate the fingerprint.
compare_fingerprints
(label_1, label_2)Compare two fingerprints that are stored in the internal memory.
plot_fingerprint
(x_values, y_values)Plot the discretized function and the corresponding grid.
-
calculate_fingerprint(x_values: numpy.array, y_values: numpy.array, label: str =
None
) numpy.array [source]¶ Calculate the fingerprint.
- Parameters:¶
x_values (np.array) – x-values of the function.
y_values (np.array) – y-values of the function. In case it’s a 2D-array, each row will be interpreted as a dataset and the fingerprint is calculated by concatenating the individual fingerprints.
label (str) – Label for the internal memory. Defaults to None.
- Returns:¶
np.array – The discretized fingerprint.
- compare_fingerprints(label_1: str, label_2: str) float [source]¶
Compare two fingerprints that are stored in the internal memory.
-
calculate_fingerprint(x_values: numpy.array, y_values: numpy.array, label: str =