glasz.kSZ package¶
Submodules¶
glasz.kSZ.beam module¶
- glasz.kSZ.beam.beam_transform_to_profile(B_ell, theta, normalize=False)¶
Given the transform B(ell) of a beam, evaluate its real space angular profile at a given an angle theta in radians. This code is adapted from the pixell library under the utils.py module (https://pixell.readthedocs.io/en/latest/readme.html).
- Parameters:
- Returns:
(float or NDArray[float]): The beam profile at the given angle theta.
- Return type:
profile
- glasz.kSZ.beam.generate_beam_profile(frequency, space='real')¶
This function generates the beam profile for a given frequency. The beam profile is generated by transforming the beam from the multipole space to the real space angular profile. The beam profile returned is a function of the angle theta in radians.
- Parameters:
- Returns:
(Callable): The beam profile as a function of the angle theta in radians.
- Return type:
profile_func
glasz.kSZ.fht module¶
- class glasz.kSZ.fht.RadialFourierTransform(lrange=None, n=512, pad=256)¶
Bases:
object- harm2real(lprof)¶
Perform a backward (harmonic -> real) transform, taking us from the provided harmonic-space radial profile lprof(l) to a real-space profile rprof(r). lprof can take two forms: 1. A function lprof(l) that can be called to evaluate the profile at
arbitrary points.
An array lprof[self.ell] that provides the profile evaluated at the points given by this object’s .l member.
The transform is done along the last axis of the profile. Returns rprof[self.r]. This includes padding, which can be removed using self.unpad
- Parameters:
lprof (
ndarray[Any,dtype[float64]]) – (NDArray[float]): A function that takes in an array of multipoles and returns the harmonic profile.- Returns:
(NDArray[float]): The radial profile.
- Return type:
rprof
- real2harm(rprof)¶
Perform a forward (real -> harmonic) transform, taking us from the provided real-space radial profile rprof(r) to a harmonic-space profile lprof(l). rprof can take two forms: 1. A function rprof(r) that can be called to evaluate the profile at
arbitrary points.
An array rprof[self.r] that provides the profile evaluated at the points given by this object’s .r member.
The transform is done along the last axis of the profile. Returns lprof[self.ell]. This includes padding, which can be removed using self.unpad
- Parameters:
rprof (
ndarray[Any,dtype[float64]]) – (NDArray[float]): A function that takes in an array of radii and returns the radial profile.- Returns:
(NDArray[float]): The harmonic profile.
- Return type:
lprof
- unpad(*arrs)¶
Remove the padding from arrays used by this object. The values in the padded areas of the output of the transform have unreliable values, but they’re not cropped automatically to allow for round-trip transforms. Example:
r = unpad(r_padded) r, l, vals = unpad(r_padded, l_padded, vals_padded)
- Parameters:
arrs (
ndarray[Any,dtype[float64]]) – (NDArray[float]): The array(s) to unpad.- Returns:
(Any): The unpadded array(s).
- Return type:
arrs
glasz.kSZ.pipeline module¶
- glasz.kSZ.pipeline.compute_T_kSZ(rho_2D_beam, rho_2D_beam_annulus, theta_use)¶
A function which takes in a beam convolved 2D density profile and computes the kSZ temperature profile.
- Parameters:
rho_2D_beam (
ndarray[Any,dtype[float64]]) – (NDArray[float]): 2D density profile convolved with beamrho_2D_beam_annulus (
ndarray[Any,dtype[float64]]) – (NDArray[float]): 2D density profile convolved with beam in annulustheta_use (
ndarray[Any,dtype[float64]]) – (NDArray[float]): angular coordinate (lower resolution array extending to theta)
- Returns:
(NDArray[float]): kSZ temperature [μK]
- Return type:
T_kSZ
- glasz.kSZ.pipeline.convolve_density_with_beam(rho_2D, frequency, theta_smooth, theta_use, method='hankel')¶
A function which takes in a 2D density profile and convolves it with a beam profile.
- Parameters:
rho_2D (
ndarray[Any,dtype[float64]]) – (NDArray[float]): 2D density profile (units of g/cm^2)frequency (
str) – (str): frequency of the beam profiletheta_smooth (
ndarray[Any,dtype[float64]]) – (NDArray[float]): angular coordinate (high resolution array extending to 30’)theta_use (
ndarray[Any,dtype[float64]]) – (NDArray[float]): angular coordinate (lower resolution array extending to theta)method (
str) – (str): method to use for convolution. Options are ‘brute_force’ or ‘hankel’.
- Returns:
(NDArray[float]): 2D density profile convolved with beam [units of g/cm^2]
- Return type:
rho_2D_beam
- glasz.kSZ.pipeline.project_density_profile(rho_3D, d_A, los_distance, theta_smooth)¶
A function which takes in a 3D density profile and projects it into a 2D density profile by integrating along the line of sight.
rho_{2D} = int_{rm LOS} rho(sqrt{l^2 + d_A(z)^2 |theta|^2}) dl
- Parameters:
rho_3D (
Callable[[ndarray[Any,dtype[float64]] |float64],ndarray[Any,dtype[float64]] |float64]) – (float or NDArray[float]): 3D density profile [Msun/Mpc^3]d_A (
float) – (float): angular diameter distance at redshift of interest [Mpc]los_distance (
ndarray[Any,dtype[float64]]) – (float or NDArray[float]): radial coordinate [Mpc]theta_smooth (
ndarray[Any,dtype[float64]]) – (NDArray[float]): angular coordinate high resolution array extending to 30 arcmins
- Returns:
(NDArray[float]): 2D density profile [g/cm^2]
- Return type:
rho_2D