aim2dat.fct.function_comparison

Module to analyze spectra.

Module Contents

Classes

FunctionAnalysis

Class to analyze and compare functions.

class aim2dat.fct.function_comparison.FunctionAnalysis(**kwargs)[source]

Class to analyze and compare functions.

Overview

Properties

allowed_distance_methods

Return allowed distance methods.

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.

Parameters:
  • label_1 (str) – Label of the first dataset.

  • label_2 (str) – Label of the second dataset.

Returns:

float – The correlation.

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).

Parameters:
  • label (str) – Label of the dataset.

  • grid (DiscretizedGrid) – The grid to discretize the function.

Returns:

np.array – Discretized fingerprint.

calculate_distance(label1: str, label2: str, method: str = 'euclidian') float[source]

Calculate the distance between the values of two functions.

Parameters:
  • label1 (str) – Label of the first dataset.

  • label2 (str) – Label of the second dataset.

  • method (str) – The metric to calculate the distance. Defaults to “euclidian”.

Returns:

float – Abs. error

compare_areas(label1: str, label2: str) float[source]

Compare the enclosed areas of two functions.

Parameters:
  • label1 (str) – Label of the first dataset.

  • label2 (str) – Label of the second dataset.

Returns:

float – The ratio of the areas. (A1 / A2)

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).

Parameters:
  • label1 (str) – Label of the first dataset.

  • label2 (str) – Label of the second dataset.

  • grid (DiscretizedGrid) – The grid to discretize the function.

Returns:

float – Similarity.

import_data(data_label: str, x_values: numpy.array, y_values: numpy.array)[source]

Import data into the internal memory.

Parameters:
  • data_label (str) – Label for the internal memory.

  • x_values (np.array) – x-values of the function.

  • y_values (np.array) – y-values of the function.