Utilities Module
Utility Functions Module
This module contains utility functions for various operations used throughout the COBI package, including logging, coordinate transformations, map operations, and numerical utilities.
Functions
- Logger
Configurable logging class for debugging and information messages
- inrad
Convert angles from degrees to radians
- cli
Compute inverse of array elements (safe for zeros)
- download_file
Download files with progress bar
- deconvolveQU
Deconvolve beam from polarization maps
- change_coord
Transform HEALPix maps between coordinate systems
- slice_alms
Slice spherical harmonic coefficients to new lmax
The module provides essential functionality for: - Logging with configurable verbosity levels - Angular unit conversions - Safe numerical operations (division, inversion) - File downloading with progress tracking - HEALPix map manipulations (coordinate transforms, beam operations) - Spherical harmonic coefficient operations
- class Logger(name, verbose=False)[source]
Bases:
object
- inrad(alpha)[source]
Converts an angle from degrees to radians.
Parameters: alpha (float): The angle in degrees.
Returns: float: The angle in radians.
- cli(cl)[source]
Computes the inverse of each element in the input array cl.
Parameters: cl (np.ndarray): Input array for which the inverse is calculated.
Only positive values will be inverted; zeros and negative values will remain zero.
Returns: np.ndarray: An array where each element is the inverse of the corresponding element in cl,
with zeros or negative values left unchanged.
- Parameters:
cl (numpy.ndarray)
- Return type:
- deconvolveQU(QU, beam)[source]
Deconvolves a beam from a QU map.
Parameters: QU (np.ndarray): The input QU map. beam (np.ndarray): The beam to deconvolve.
Returns: np.ndarray: The deconvolved QU map.
- slice_alms(teb, lmax_new)[source]
Returns the input teb alms sliced to the new lmax.
teb(numpy array): input teb alms lmax_new(int): new lmax
Logger Class
Utility Functions
- inrad(alpha)[source]
Converts an angle from degrees to radians.
Parameters: alpha (float): The angle in degrees.
Returns: float: The angle in radians.
- cli(cl)[source]
Computes the inverse of each element in the input array cl.
Parameters: cl (np.ndarray): Input array for which the inverse is calculated.
Only positive values will be inverted; zeros and negative values will remain zero.
Returns: np.ndarray: An array where each element is the inverse of the corresponding element in cl,
with zeros or negative values left unchanged.
- Parameters:
cl (numpy.ndarray)
- Return type: