core
Shared building blocks for beam models and fitting routines.
bessel_term(r, ell_max, i)
Evaluate the normalized Bessel basis function:
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r
|
Float[NDArray, 'ny nx']
|
Radial coordinate. |
required |
ell_max
|
float
|
Maximum multipole scale. |
required |
i
|
int
|
Bessel function order. |
required |
Returns:
| Type | Description |
|---|---|
Float[NDArray, 'ny nx']
|
Bessel basis function
At |
Source code in lat_beams/fitting/core.py
470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 | |
gaussian2d(posmap, a, xi0, eta0, fwhm_xi, fwhm_eta, phi, off)
gaussian2d(posmap: Float[ndmap, '2 ny nx'], a: float, xi0: float, eta0: float, fwhm_xi: float, fwhm_eta: float, phi: float, off: float) -> Float[ndmap, 'ny nx']
gaussian2d(posmap: Float[NDArray, '2 ny nx'], a: float, xi0: float, eta0: float, fwhm_xi: float, fwhm_eta: float, phi: float, off: float) -> Float[NDArray, 'ny nx']
Evaluate a rotated 2D Gaussian beam.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
posmap
|
Float[ndmap, '2 ny nx'] | Float[NDArray, '2 ny nx']
|
Position map in radians. The first element is eta and the second is xi. |
required |
a
|
float
|
Beam amplitude. |
required |
xi0
|
float
|
Beam center along xi, in radians. |
required |
eta0
|
float
|
Beam center along eta, in radians. |
required |
fwhm_xi
|
float
|
FWHM along the xi axis, in radians. |
required |
fwhm_eta
|
float
|
FWHM along the eta axis, in radians. |
required |
phi
|
float
|
Rotation angle of the beam, in radians. |
required |
off
|
float
|
Constant offset added to the beam. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
gauss |
Float[ndmap, 'ny nx'] | Float[NDArray, 'ny nx']
|
Gaussian beam evaluated at |
Source code in lat_beams/fitting/core.py
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 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | |
gaussian2d_deriv(posmap, a, xi0, eta0, fwhm_xi, fwhm_eta, phi, off)
gaussian2d_deriv(posmap: Float[ndmap, '2 ny nx'], a: float, xi0: float, eta0: float, fwhm_xi: float, fwhm_eta: float, phi: float, off: float) -> tuple[Float[ndmap, 'ny nx'], Float[ndmap, '7 ny nx']]
gaussian2d_deriv(posmap: Float[NDArray, '2 ny nx'], a: float, xi0: float, eta0: float, fwhm_xi: float, fwhm_eta: float, phi: float, off: float) -> tuple[Float[NDArray, 'ny nx'], Float[NDArray, '7 ny nx']]
Evaluate a Gaussian beam and its parameter derivatives.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
posmap
|
Float[ndmap, '2 ny nx'] | Float[NDArray, '2 ny nx']
|
Position map in radians. The first element is xi and the second is eta. |
required |
a
|
float
|
Beam amplitude. |
required |
xi0
|
float
|
Beam center along xi, in radians. |
required |
eta0
|
float
|
Beam center along eta, in radians. |
required |
fwhm_xi
|
float
|
FWHM along xi, in radians. |
required |
fwhm_eta
|
float
|
FWHM along eta, in radians. |
required |
phi
|
float
|
Rotation angle of the beam, in radians. |
required |
off
|
float
|
Constant offset of the beam. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
gauss |
Float[ndmap, 'ny nx'] | Float[NDArray, 'ny nx']
|
Gaussian beam evaluated at |
dgauss |
Float[ndmap, '7 ny nx'] | Float[NDArray, '7 ny nx']
|
Derivatives with respect to amplitude, xi center, eta center, xi FWHM, eta FWHM, rotation angle, and offset. |
Source code in lat_beams/fitting/core.py
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | |
gaussian2d_wing(posmap, amp, dx, dy, fwhm_xi, fwhm_eta, phi, off, wing_r0, wing_amp)
gaussian2d_wing(posmap: Float[ndmap, 'ny nx'], amp: float, dx: float, dy: float, fwhm_xi: float, fwhm_eta: float, phi: float, off: float, wing_r0: float, wing_amp: float) -> Float[ndmap, 'ny nx']
gaussian2d_wing(posmap: Float[NDArray, '2 ny nx'], amp: float, dx: float, dy: float, fwhm_xi: float, fwhm_eta: float, phi: float, off: float, wing_r0: float, wing_amp: float) -> Float[NDArray, 'ny nx']
Evaluate a Gaussian beam with a \(r^{-3}\) power-law wing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
posmap
|
Float[ndmap, 'ny nx'] | Float[NDArray, '2 ny nx']
|
Position map in radians. The first component is eta and the second is xi. |
required |
amp
|
float
|
Amplitude of the Gaussian core. |
required |
dx
|
float
|
Beam center in xi. |
required |
dy
|
float
|
Beam center in eta. |
required |
fwhm_xi
|
float
|
FWHM of the Gaussian core along xi. |
required |
fwhm_eta
|
float
|
FWHM of the Gaussian core along eta. |
required |
phi
|
float
|
Rotation angle of the Gaussian core in radians. |
required |
off
|
float
|
Constant offset added to the beam. |
required |
wing_r0
|
float
|
Radius beyond which the Gaussian is replaced by the power-law wing. |
required |
wing_amp
|
float
|
Amplitude of the power-law wing. |
required |
Returns:
| Type | Description |
|---|---|
Float[ndmap, 'ny nx'] | Float[NDArray, 'ny nx']
|
Beam model evaluated at |
Source code in lat_beams/fitting/core.py
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 320 321 322 323 324 325 326 327 328 | |
multipole(theta, mp, sin)
Evaluate a cosine or sine multipole basis function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
theta
|
Float[NDArray, 'ny nx']
|
Polar angle map in radians. |
required |
mp
|
int
|
Multipole order. Must be non-negative. |
required |
sin
|
int
|
Selects the cosine ( |
required |
Returns:
| Type | Description |
|---|---|
Float[NDArray, 'ny nx']
|
Multipole basis evaluated at |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in lat_beams/fitting/core.py
331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 | |
multipole_decomp(base_beam, imap, sigma, n_multipoles, theta, gs=False, check_chisq=False)
Decompose a map into multipoles of a base beam.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
base_beam
|
Float[ndmap, 'ny nx']
|
Base beam used for every multipole term. |
required |
imap
|
Float[ndmap, 'ny nx']
|
Input map to decompose. |
required |
sigma
|
Float[ndmap, 'ny nx']
|
Inverse-variance weights for |
required |
n_multipoles
|
int
|
Number of multipoles to fit. |
required |
theta
|
Float[ndmap, 'ny nx']
|
Polar angle map in radians. |
required |
gs
|
bool
|
If |
False
|
check_chisq
|
bool
|
If |
False
|
Returns:
| Type | Description |
|---|---|
Float[NDArray, 'n_multipoles 2']
|
Fitted amplitudes. The second dimension contains the cosine and sine amplitudes. |
Source code in lat_beams/fitting/core.py
361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 | |
multipole_expansion(base_beam, amps, theta)
Evaluate a multipole expansion of a base beam.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
base_beam
|
Float[ndmap, 'ny nx']
|
Base beam used for every multipole term. |
required |
amps
|
Float[NDArray, 'n_multipoles 2']
|
Cosine and sine amplitudes for each multipole. |
required |
theta
|
Float[ndmap, 'ny nx']
|
Polar angle map in radians. |
required |
Returns:
| Type | Description |
|---|---|
Float[ndmap, 'ny nx']
|
Beam model evaluated using the multipole expansion. |
Source code in lat_beams/fitting/core.py
440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 | |