physped.utils package¶
Submodules¶
physped.utils.config_utils module¶
Module to define utility functions for the configuration.
- physped.utils.config_utils.apply_periodic_conditions_to_the_angle_theta(theta: float)[source]¶
Apply periodic conditions to the angle theta.
- physped.utils.config_utils.initialize_hydra_config(env_name: str) DictConfig [source]¶
Function to initialize the Hydra configuration.
- Parameters:
env_name – The name of the environment. For example: ‘narrow_corridor’, ‘intersecting_paths’, ‘asdz_pf12’, ‘asdz_pf34’, ‘utrecht_pf5’.
- Returns:
The Hydra configuration.
physped.utils.functions module¶
- physped.utils.functions.cartesian_to_polar_coordinates(x: float, y: float) tuple [source]¶
Convert cartesian coordinates to polar coordinates.
Parameters: - x: The x-coordinate. - y: The y-coordinate.
Returns: - A tuple with the polar coordinates
- physped.utils.functions.compose_functions(*functions: Callable[[Any], Any]) Callable[[Any], Any] [source]¶
- physped.utils.functions.get_bin_middle(bins: ndarray) ndarray [source]¶
Return the middle of the input bins.
- Parameters:
bins – The input bins.
- Returns:
The middle of the input bins.
- physped.utils.functions.get_slice_of_multidimensional_matrix(a: ndarray, slice_x: Tuple, slice_y: Tuple, slice_theta: Tuple, slice_r: Tuple) ndarray [source]¶
Get a slice of a multidimensional matrix.
Parameters: a (ndarray): The input multidimensional matrix. slice_x (tuple): The range of indices to slice along the x-axis. slice_y (tuple): The range of indices to slice along the y-axis. slice_theta (tuple): The range of indices to slice along the theta-axis. slice_r (tuple): The range of indices to slice along the r-axis.
Returns: ndarray: The sliced multidimensional matrix.
Raises: ValueError: If the slice values are not in ascending order.
- physped.utils.functions.periodic_angular_conditions(angle: ndarray, angular_bins: ndarray) ndarray [source]¶
Apply periodic boundary conditions to a list of angular coordinates.
- Parameters:
angle – A list of angular coordinates.
angular_bins – An array of bin edges defining the angular grid cells.
- Returns:
The angular coordinates cast to the angular grid.
- physped.utils.functions.polar_to_cartesian_coordinates(rho: float, phi: float) tuple [source]¶
Convert polar coordinates to cartesian coordinates.
Parameters: rho: The radial distance from the origin to the point. phi: The angle in radians.
Returns: - A tuple containing the cartesian coordinate.s
- physped.utils.functions.test_weighted_mean_of_two_matrices(first_matrix: ndarray, counts_first_matrix: ndarray) None [source]¶
Test function for weighted_mean_of_two_matrices.
This function tests whether the weighted average of two matrices is equal to the input values.
Parameters: first_matrix (numpy.ndarray): The first input matrix. counts_first_matrix (numpy.ndarray): The counts matrix corresponding to the first input matrix.
- physped.utils.functions.weighted_mean_of_matrix(field: ndarray, histogram: ndarray, axes: Tuple = (2, 3, 4)) ndarray [source]¶
Calculate the weighted mean of a matrix based on a given histogram.
- Parameters:
field (np.ndarray) – The input matrix.
histogram (np.ndarray) – The histogram used for weighting.
axes (Tuple) – The axes along which to calculate the mean.
is (Default)
- Returns:
The weighted mean of the matrix.
- Return type:
np.ndarray
- physped.utils.functions.weighted_mean_of_two_matrices(first_matrix: ndarray, counts_first_matrix: ndarray, second_matrix: ndarray, counts_second_matrix: ndarray) ndarray [source]¶
Calculates the weighted mean of two matrices.
- Parameters:
first_matrix (numpy.ndarray) – First input matrix.
counts_first_matrix (numpy.ndarray) – Counts for the first input matrix.
second_matrix (numpy.ndarray) – Second input matrix.
counts_second_matrix (numpy.ndarray) – Counts for the second input
matrix.
- Returns:
Weighted mean of the two input matrices.
- Return type: