golconda.adjustcls module
- class golconda.adjustcls.PowerSpectrum(map, pixelsize)[source]
Bases:
object
Class for calculating power spectrum and generating fields with target power spectrum.
- Parameters:
map (ndarray) – Input map.
pixelsize (float) – Size of each pixel in degrees.
- pixelsize
Size of each pixel in degrees.
- Type:
float
- map_size
Size of the input map.
- Type:
int
- ell_min
Minimum value of ell.
- Type:
float
- ell_max
Maximum value of ell.
- Type:
float
- deltaell
Interval between ell values.
- Type:
int
- nbinsell
Number of ell bins.
- Type:
int
- pixel_size_rad_perpixel
Pixel size in radians per pixel.
- Type:
float
- lpix
Value of lpix.
- Type:
float
- lx
Array of lx values.
- Type:
ndarray
- ly
Array of ly values.
- Type:
ndarray
- l
Array of l values.
- Type:
ndarray
- ell_edges
Array of ell bin edges.
- Type:
ndarray
- generate_field_with_target_cls(input_field, target_cls, target_ells)[source]
Generates a field with the target power spectrum.
Methods
calculate_Cls
(map)Calculates the power spectrum (Cls) of the input map.
generate_field_with_target_cls
(input_field, ...)Generates a field with the target power spectrum.
- calculate_Cls(map)[source]
Calculates the power spectrum (Cls) of the input map.
- Parameters:
map (ndarray) – Input map.
- Returns:
A tuple containing the ell edges, ell bins, and Cls values.
- Return type:
tuple
- generate_field_with_target_cls(input_field, target_cls, target_ells)[source]
Generates a field with the target power spectrum.
- Parameters:
input_field (ndarray) – Input field.
target_cls (ndarray) – Target power spectrum values.
target_ells (ndarray) – Corresponding ell values for the target power spectrum.
- Returns:
Generated field with the target power spectrum.
- Return type:
ndarray
- Raises:
AssertionError – If the lengths of target_cls and target_ells are not equal.
AssertionError – If any value in target_cls is negative.
- class golconda.adjustcls.PowerSpectrumAdjuster(map_shape, pixel_size)[source]
Bases:
object
Methods
adjust_map_cls
(input_map, target_cls, ...)Adjust the input map to match the target power spectrum.
compute_power_spectrum
(image)Compute the 1D power spectrum from a given 2D image.
- adjust_map_cls(input_map, target_cls, target_ells)[source]
Adjust the input map to match the target power spectrum.
Parameters: - input_map: 2D numpy array, the input map. - target_cls: 1D numpy array, the target power spectrum values. - target_ells: 1D numpy array, the target multipole moments.
Returns: - adjusted_map: 2D numpy array, the adjusted map.
- golconda.adjustcls.calculate_Cls_(map, angle, ell_min, ell_max, n_bins)[source]
map: the image from which the angular power spectra (Cls) has to be calculated angle: side angle in the units of degree ell_min: the minimum multipole moment to get the Cls ell_max: the maximum multipole moment to get the Cls n_bins: number of bins in the ells
- golconda.adjustcls.generate_field_with_target_cls_(input_field, angle, target_cls, target_ells, ell_max=40000, n_bins=50)[source]
Adjusts the power spectrum of an input field to match a target power spectrum.
Parameters: - input_field (jax.numpy.ndarray): The input field as a 2D JAX array. - angle (float): The field of view in degrees. - target_cls (jax.numpy.ndarray): Target power spectrum values. - target_ells (jax.numpy.ndarray): Target multipole moments associated with target_cls. - ell_max (int): Maximum multipole moment to consider. - n_bins (int): Number of bins to use for the power spectrum calculation.
Returns: - jax.numpy.ndarray: The adjusted input field, transformed to match the target power spectrum.