data_process#
This module contains functions to create bin edges, project data, and calculate axis values.
- artof.data_process.calc_step_norm(bin_edges, proj_axes)#
Calculate normalization factor based on bin edges and projection axes.
- Parameters:
bin_edges (list) – List of bin edges for each axis.
proj_axes (None | list) – List of axes to project onto.
- Returns:
Normalization factor.
- Return type:
float
- artof.data_process.get_axes_values(bin_edges, axes_names, incident_energy=None)#
Calculate axis values from bin edges.
- Parameters:
bin_edges (list) – List of bin edges for each axis.
axes – List of axes names.
photon_energy – Photon energy in eV for binding energy, optional (default is None).
axes_names (list)
incident_energy (float)
- Returns:
List of axis values for each axis.
- Return type:
list[ndarray]
- artof.data_process.get_bin_edges(bin_config, data_id='unknown')#
Create bin edges (limits) for given bin config.
- Parameters:
bin_config (list) – Bin config consisting of three values: [min, max, points].
data_id (str) – Identifier to raise error message with identifier.
- Returns:
List of bin edges.
- Raises:
ValueError – If the number of bins is not given as an int.
- Return type:
ndarray
- artof.data_process.project_data(data, bin_edges, axes, ranges, norm_step_size)#
Project data onto given axes and reorder accordingly.
- Parameters:
data (ndarray) – 3D data to be projected.
bin_edges (list) – List of bin edges for each axis.
proj_axes – List containing all axes onto which the projection is performed, e.g., [0,1].
ranges (list[list, None]) – List of ranges for each axis.
norm_step_size (bool) – Normalize projection with step size.
axes (None | list)
- Returns:
Axes values and list containing the projection (1 or 2D).
- Raises:
RuntimeError – If data is not loaded before projection.
ValueError – If the projection axes are not valid.
- Return type:
ndarray
- artof.data_process.wrap_angle(axis, angle, transformed_data)#
Wrap all values that are within the range of pi - angle to -pi - angle. A copy of data is created.
- Parameters:
axis (int) – Axis to wrap.
angle (float) – Angle in radians to wrap the data.
transformed_data (dict) – Dictionary containing transformed data.
- Returns:
Dictionary with wrapped transformed data.
- Return type:
dict