Symmetrization
The symmetrization module provides tools for processing data to enforce symmetry or antisymmetry. The symmetrize function averages values with their reversed counterparts to create symmetric datasets, while the antisymmetrize function computes the difference between values and their reversed counterparts to create antisymmetric datasets.
symmetrize(dfs, x_column, y_column, minimum, maximum, step)
Symmetrizes the given dataframes by combining them, binning the onto evenly spaced values of x_column between minimum and maximum, and then averaging the y_column values with their reversed counterparts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dfs
|
list[DataFrame]
|
List of dataframes to be symmetrized. |
required |
x_column
|
str
|
The name of the column to be used for filtering and sorting. |
required |
y_column
|
str
|
The name of the column to be symmetrized. |
required |
minimum
|
float
|
The minimum value for filtering the x_column. |
required |
maximum
|
float
|
The maximum value for filtering the x_column. |
required |
step
|
float
|
The step size for binning the x_column values. |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
pd.DataFrame: A new dataframe with symmetrized y_column values. |
Examples:
>>> import quantalyze as qz
>>> df = qz.symmetrize(
>>> dfs=[df1, df2],
>>> x_column='field',
>>> y_column='voltage',
>>> minimum=-14,
>>> maximum=14,
>>> step=0.05,
>>> )
Source code in src/quantalyze/core/symmetrization.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | |
antisymmetrize(dfs, x_column, y_column, minimum, maximum, step)
Antisymmetrizes the given dataframes by combining them, binning the onto evenly spaced values of x_column between minimum and maximum, and then taking the difference between y_column values and their reversed counterparts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dfs
|
list[DataFrame]
|
List of dataframes to be antisymmetrized. |
required |
x_column
|
str
|
The name of the column representing the x-axis. |
required |
y_column
|
str
|
The name of the column representing the y-axis. |
required |
minimum
|
float
|
The minimum value of the x-axis range to consider. |
required |
maximum
|
float
|
The maximum value of the x-axis range to consider. |
required |
step
|
float
|
The step size for binning the x-axis values. |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
pd.DataFrame: A new dataframe with antisymmetrized y-values. |
Examples:
>>> import quantalyze as qz
>>> df = qz.antisymmetrize(
>>> dfs=[df1, df2],
>>> x_column='field',
>>> y_column='voltage',
>>> minimum=-14,
>>> maximum=14,
>>> step=0.05,
>>> )
Source code in src/quantalyze/core/symmetrization.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | |