opticam_new.utils.helpers
Functions
|
Convert a camelCase string to snake_case. |
|
Compute the Euclidean distance between two points. |
|
|
|
Log the binning of each file to out_directory/diag/binnings.json. |
|
Logs the filters used in each file to out_directory/diag/filters.json. |
|
Recursively log parameters. |
|
|
|
Sort a dictionary whose keys are filter names in the order of the camera filters (e.g., u/g, r, i/z). |
Module Contents
- opticam_new.utils.helpers.camel_to_snake(string)
Convert a camelCase string to snake_case.
Parameters
- stringstr
The camelCase string to convert.
Returns
- str
The converted snake_case string.
- Parameters:
string (str)
- Return type:
str
- opticam_new.utils.helpers.euclidean_distance(p1, p2)
Compute the Euclidean distance between two points.
Parameters
- p1Tuple[float, float]
The x and y coordinates of the first point.
- p2Tuple[float, float]
The x and y coordinates of the second point.
Returns
- float
The distance.
- Parameters:
p1 (Tuple[float, float])
p2 (Tuple[float, float])
- Return type:
float
- opticam_new.utils.helpers.find_closest_pair(point, points, threshold)
- Parameters:
point (Tuple[float, float])
points (List[Tuple[float, float]])
threshold (int)
- Return type:
numpy.typing.ArrayLike | None
- opticam_new.utils.helpers.log_binnings(file_paths, out_directory)
Log the binning of each file to out_directory/diag/binnings.json.
Parameters
- file_pathsList[str]
The paths to the files.
- out_directorystr
The directory to save the log.
- Parameters:
file_paths (List[str])
out_directory (str)
- Return type:
None
- opticam_new.utils.helpers.log_filters(file_paths, out_directory)
Logs the filters used in each file to out_directory/diag/filters.json.
Parameters
- file_pathsList[str]
The paths to the files.
- out_directorystr
The directory to save the log.
- Parameters:
file_paths (List[str])
out_directory (str)
- Return type:
None
- opticam_new.utils.helpers.recursive_log(param, depth=0, max_depth=5)
Recursively log parameters.
Parameters
- paramAny
The parameter to log.
- depthint, optional
The parameter depth, by default 0.
- max_depthint, optional
The maximum parameter depth, by default 5. This prevents infinite recursion.
Returns
- Any
The logged parameter.
- Parameters:
param (Any)
depth (int)
max_depth (int)
- Return type:
Any
- opticam_new.utils.helpers.plot_catalog(filters, stacked_images, catalogs)
- Parameters:
filters (List[str])
stacked_images (Dict[str, numpy.typing.NDArray])
catalogs (Dict[str, astropy.table.QTable])
- Return type:
Tuple[matplotlib.figure.Figure, List[matplotlib.axes.Axes]]
- opticam_new.utils.helpers.sort_filters(d)
Sort a dictionary whose keys are filter names in the order of the camera filters (e.g., u/g, r, i/z).
Parameters
- dDict[str, Any]
A dictionary with filter names as keys.
Returns
- Dict[str, Any]
The sorted dictionary.
- Parameters:
d (Dict[str, Any])
- Return type:
Dict[str, Any]