utils
A set of utility functions and constants used for unit conversions and cosmology as well as some generically useful math functions.
K_CMB2K_RJ(freq)
Convert from K_CMB to K_RJ.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
freq
|
float
|
The observing frequency in Hz. |
required |
Returns:
Name | Type | Description |
---|---|---|
K_CMB2K_RJ |
float
|
Conversion factor from K_CMB to K_RJ. |
Source code in witch/utils.py
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
|
beam_double_gauss(dr, fwhm1, amp1, fwhm2, amp2)
Helper function to generate a double gaussian beam.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dr
|
float
|
Pixel size. |
required |
fwhm1
|
float
|
Full width half max of the primary gaussian in the same units as |
required |
amp1
|
float
|
Amplitude of the primary gaussian. |
required |
fwhm2
|
float
|
Full width half max of the secondairy gaussian in the same units as |
required |
amp2
|
float
|
Amplitude of the secondairy gaussian. |
required |
Returns:
Type | Description |
---|---|
beam: Double gaussian beam.
|
|
Source code in witch/utils.py
322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 |
|
bilinear_interp(x, y, xp, yp, fp)
JAX implementation of bilinear interpolation. Out of bounds values are set to 0. Using the repeated linear interpolation method here, see https://en.wikipedia.org/wiki/Bilinear_interpolation#Repeated_linear_interpolation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
Array
|
X values to return interpolated values at. |
required |
y
|
Array
|
Y values to return interpolated values at. |
required |
xp
|
Array
|
X values to interpolate with, should be 1D. Assumed to be sorted. |
required |
yp
|
Array
|
Y values to interpolate with, should be 1D. Assumed to be sorted. |
required |
fp
|
Array
|
Functon values at |
required |
Returns:
Name | Type | Description |
---|---|---|
f |
Array
|
The interpolated values. |
Source code in witch/utils.py
251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 |
|
fft_conv(image, kernel)
Perform a convolution using FFTs for speed with jax.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
image
|
ArrayLike
|
Data to be convolved. |
required |
kernel
|
ArrayLike
|
Convolution kernel. |
required |
Returns:
Name | Type | Description |
---|---|---|
convolved_map |
Array
|
Image convolved with kernel. |
Source code in witch/utils.py
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
|
get_da(z)
Get factor to convert from arcseconds to MPc.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
z
|
ArrayLike
|
The redshift at which to compute the factor. |
required |
Returns:
Name | Type | Description |
---|---|---|
da |
Array
|
Conversion factor from arcseconds to MPc. |
Source code in witch/utils.py
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
|
get_hz(z)
Get the dimensionless hubble constant, h, at a given redshift.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
z
|
ArrayLike
|
The redshift at which to compute h. |
required |
Returns:
Name | Type | Description |
---|---|---|
hz |
Array
|
h at the given z. |
Source code in witch/utils.py
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 |
|
get_nz(z)
Get the critical density at a given redshift.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
z
|
ArrayLike
|
The redshift at which to compute the critical density. |
required |
Returns:
Name | Type | Description |
---|---|---|
nz |
Array
|
Critical density at the given z. This is in units of solar masses per cubic Mpc. |
Source code in witch/utils.py
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
|
tod_hi_pass(tod, N_filt)
High pass a tod with a tophat
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tod
|
Array
|
TOD to high pass. |
required |
N_filt
|
int
|
N_filt of tophat. |
required |
Returns:
Name | Type | Description |
---|---|---|
tod_filtered |
Array
|
High pass filtered TOD |
Source code in witch/utils.py
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 |
|
y2K_CMB(freq, Te)
Convert from compton y to K_CMB.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
freq
|
float
|
The observing frequency in Hz. |
required |
Te
|
float
|
Electron temperature |
required |
Returns:
Name | Type | Description |
---|---|---|
y2K_CMB |
float
|
Conversion factor from compton y to K_CMB. |
Source code in witch/utils.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
|
y2K_RJ(freq, Te)
Convert from compton y to K_RJ.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
freq
|
float
|
The observing frequency in Hz. |
required |
Te
|
float
|
Electron temperature |
required |
Returns:
Name | Type | Description |
---|---|---|
y2K_RJ |
float
|
Conversion factor from compton y to K_RJ. |
Source code in witch/utils.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
|