brahmap.core.SharedMemProcessTimeSamples¶
Bases: BaseProcessTimeSamples
An MPI shared-memory optimized data container, analogous to
ProcessTimeSamples.
This container utilizes node-level shared-memory windows (via
SharedMemoryManager) to store the
pixel-space hit counts and trigonometric weight sums, only once per
compute node, drastically reducing the overall memory footprint compared
to the standard ProcessTimeSamples
container. It manages the shared memory windows and updates them in parallel via a tree-like MPI communication.
Similar to ProcessTimeSamples this
class ingests raw pointing arrays, polarization angles, and noise
weights, and computes the necessary pixel-space representations (such as
hit counts and trigonometric weight sums) required for the iterative
map-making process. It automatically drops unobserved or pathological
pixels to minimize the memory footprint of the container.
After pre-processing, the container object can be used to create pointing operators, block-diagonal preconditioners, etc. as required for map-making.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
npix
|
int
|
Number of pixels on which the map-making has to be done (e.g.
|
required |
pointings
|
NDArray[integer]
|
A 1-d array of pixel indices pointing to the sky map for each time sample |
required |
pointings_flag
|
NDArray[bool_] | None
|
A 1-d boolean array where |
None
|
solver_type
|
SolverType
|
The level of map-making solver to construct (\(I\), \(QU\), or
\(IQU\)), by default |
IQU
|
pol_angles
|
NDArray[number] | None
|
A 1-d array containing the polarization orientation angles of the
detectors for each sample, by default |
None
|
noise_weights
|
NDArray[number] | None
|
A 1-d array containing the inverse noise variance for each time
sample, by default |
None
|
threshold
|
float
|
The condition number threshold used to flag degenerate or
under-sampled pixels, by default |
1e-05
|
dtype_float
|
DTypeFloat | None
|
The data type to use for floating point arrays, by default
|
None
|
update_pointings_inplace
|
bool
|
If |
False
|
nproc_reduce
|
int
|
The size of each sub-communicator group within the node-level
communicator. This container accumulates hit counts and weight sums
into node-level shared memory arrays in chunks defined by this group
size. Within each group/sub-communicator, the accumulation happens
sequentially across the participating MPI processes to ensure
thread-safe updates to the shared memory window, before a final
reduction is performed across group roots. A value higher than 1 is
recommended to reduce memory usage in the intermediate data
reduction steps. By default |
1
|
shared_mem_root
|
int
|
The designated root rank within the node-level shared memory
communicator responsible for managing the shared memory windows.
By default |
0
|
Methods:
| Name | Description |
|---|---|
get_hit_counts |
Returns hit counts of the pixel indices. |
free_shmem_arrays |
Frees all allocated shared-memory arrays and windows. |
Attributes:
| Name | Type | Description |
|---|---|---|
npix |
int
|
Number of pixels on which the map-making has to be done. |
pointings |
NDArray[integer]
|
A 1-d array of pixel indices pointing to the observed sky pixel |
pointings_flag |
NDArray[bool_] | None
|
A 1-d boolean array where |
nsamples |
int
|
The number of time samples processed by the current MPI rank |
nsamples_global |
int
|
The total number of time samples across all MPI ranks |
solver_type |
SolverType
|
The current map-making solver configuration (\(I\), \(QU\), or \(IQU\)) |
threshold |
float
|
The condition number threshold used to flag bad pixels |
dtype_float |
Any
|
The inferred or specified data type for floating point arrays |
observed_pixels |
NDArray[integer]
|
A 1-d array containing the original indices of the pixels that |
pixel_flag |
NDArray[bool_]
|
A 1-d boolean array of size |
bad_pixels |
NDArray[integer]
|
A 1-d array that contains all the pixel indices that will be excluded |
old2new_pixel |
NDArray[integer]
|
A 1-d array mapping old pixel indices to new pixel indices |
weighted_counts |
NDArray[number]
|
A 1-d array accumulating the inverse noise weights per valid pixel |
sin2phi |
NDArray[number]
|
A 1-d array containing \(\sin(2\phi)\) evaluated at the valid time samples |
cos2phi |
NDArray[number]
|
A 1-d array containing \(\cos(2\phi)\) evaluated at the valid time samples |
weighted_sin |
NDArray[number]
|
A 1-d array accumulating the noise-weighted \(\sin(2\phi)\) sum |
weighted_cos |
NDArray[number]
|
A 1-d array accumulating the noise-weighted \(\cos(2\phi)\) sum |
weighted_sin_sq |
NDArray[number]
|
A 1-d array accumulating the noise-weighted \(\sin^2(2\phi)\) sum |
weighted_cos_sq |
NDArray[number]
|
A 1-d array accumulating the noise-weighted \(\cos^2(2\phi)\) sum |
weighted_sincos |
NDArray[number]
|
A 1-d array accumulating the noise-weighted \(\sin(2\phi)\cos(2\phi)\) |
one_over_determinant |
NDArray[number]
|
A 1-d array containing the inverse determinant of the |
new_npix |
int
|
The number of pixels on which the map-making will be done |
nproc_reduce |
int
|
The size of each sub-communicator group within the node-level |
shared_mem_root |
int
|
The designated root rank within the node-level shared memory |
shared_mem_manager |
SharedMemoryManager
|
The manager class for MPI shared-memory communicators and windows |
Source code in brahmap/core/process_time_samples.py
242 243 244 245 246 247 248 249 250 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 320 321 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 352 353 354 355 356 357 358 359 360 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 438 439 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 468 469 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 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 | |
Attributes¶
npix: int
property
¶
Number of pixels on which the map-making has to be done.
Returns:
| Type | Description |
|---|---|
int
|
Number of pixels on which the map-making has to be done |
pointings: npt.NDArray[np.integer]
property
¶
A 1-d array of pixel indices pointing to the observed sky pixel for each time sample
Returns:
| Type | Description |
|---|---|
NDArray[integer]
|
A 1-d array of pixel pointing indices for each time sample |
pointings_flag: npt.NDArray[np.bool_] | None
property
¶
A 1-d boolean array where True indicates a valid pointing and
False flags a bad pointing
Returns:
| Type | Description |
|---|---|
NDArray[bool_]
|
The 1-d array of flags indicating valid ( |
(`False`) time samples
|
|
nsamples: int
property
¶
The number of time samples processed by the current MPI rank
Returns:
| Type | Description |
|---|---|
int
|
Number of samples on current MPI rank |
nsamples_global: int
property
¶
The total number of time samples across all MPI ranks
Returns:
| Type | Description |
|---|---|
int
|
Global number of samples |
solver_type: SolverType
property
¶
The current map-making solver configuration (\(I\), \(QU\), or \(IQU\))
Returns:
| Type | Description |
|---|---|
SolverType
|
Level of map-making: \(I\), \(QU\), or \(IQU\) |
threshold: float
property
¶
The condition number threshold used to flag bad pixels
Returns:
| Type | Description |
|---|---|
float
|
Threshold to used for flagging the pixels in the sky |
dtype_float: Any
property
¶
The inferred or specified data type for floating point arrays
Returns:
| Type | Description |
|---|---|
DTypeFloat
|
|
observed_pixels: npt.NDArray[np.integer]
property
¶
A 1-d array containing the original indices of the pixels that are fully valid for map-making
Returns:
| Type | Description |
|---|---|
NDArray[integer]
|
A 1-d array that contains all the pixel indices that are considered valid for map-making |
pixel_flag: npt.NDArray[np.bool_]
property
¶
A 1-d boolean array of size npix where True indicates a bad
pixel and False flags a valid pixel
Returns:
| Type | Description |
|---|---|
NDArray[bool_]
|
A 1-d boolean array of size |
bad_pixels: npt.NDArray[np.integer]
property
¶
A 1-d array that contains all the pixel indices that will be excluded in map-making.
Returns:
| Type | Description |
|---|---|
NDArray[integer]
|
A 1-d array that contains all the pixel indices that will be excluded in map-making |
old2new_pixel: npt.NDArray[np.integer]
property
¶
A 1-d array mapping old pixel indices to new pixel indices
Returns:
| Type | Description |
|---|---|
NDArray[integer]
|
A 1-d array mapping old pixel indices to new pixel indices |
weighted_counts: npt.NDArray[np.number]
property
¶
A 1-d array accumulating the inverse noise weights per valid pixel
Returns:
| Type | Description |
|---|---|
NDArray[number]
|
A 1-d array accumulating the inverse noise weights per valid pixel |
sin2phi: npt.NDArray[np.number]
property
¶
A 1-d array containing \(\sin(2\phi)\) evaluated at the valid time samples
Returns:
| Type | Description |
|---|---|
NDArray[number]
|
A 1-d array containing \(\sin(2\phi)\) evaluated at the valid time samples |
cos2phi: npt.NDArray[np.number]
property
¶
A 1-d array containing \(\cos(2\phi)\) evaluated at the valid time samples
Returns:
| Type | Description |
|---|---|
NDArray[number]
|
A 1-d array containing \(\cos(2\phi)\) evaluated at the valid time samples |
weighted_sin: npt.NDArray[np.number]
property
¶
A 1-d array accumulating the noise-weighted \(\sin(2\phi)\) sum per valid pixel
Returns:
| Type | Description |
|---|---|
NDArray[number]
|
A 1-d array accumulating the noise-weighted \(\sin(2\phi)\) sum per valid pixel |
weighted_cos: npt.NDArray[np.number]
property
¶
A 1-d array accumulating the noise-weighted \(\cos(2\phi)\) sum per valid pixel
Returns:
| Type | Description |
|---|---|
NDArray[number]
|
A 1-d array accumulating the noise-weighted \(\cos(2\phi)\) sum per valid pixel |
weighted_sin_sq: npt.NDArray[np.number]
property
¶
A 1-d array accumulating the noise-weighted \(\sin^2(2\phi)\) sum per valid pixel
Returns:
| Type | Description |
|---|---|
NDArray[number]
|
A 1-d array accumulating the noise-weighted \(\sin^2(2\phi)\) sum per valid pixel |
weighted_cos_sq: npt.NDArray[np.number]
property
¶
A 1-d array accumulating the noise-weighted \(\cos^2(2\phi)\) sum per valid pixel
Returns:
| Type | Description |
|---|---|
NDArray[number]
|
A 1-d array accumulating the noise-weighted \(\cos^2(2\phi)\) sum per valid pixel |
weighted_sincos: npt.NDArray[np.number]
property
¶
A 1-d array accumulating the noise-weighted \(\sin(2\phi)\cos(2\phi)\) sum per valid pixel
Returns:
| Type | Description |
|---|---|
NDArray[number]
|
A 1-d array accumulating the noise-weighted \(\sin(2\phi)\cos(2\phi)\) sum per valid pixel |
one_over_determinant: npt.NDArray[np.number]
property
¶
A 1-d array containing the inverse determinant of the block-diagonal operator \(P^T diag(N)^{-1} P\)
Returns:
| Type | Description |
|---|---|
NDArray[number]
|
A 1-d array containing the inverse determinant of the block-diagonal operator \(P^T diag(N)^{-1} P\) |
new_npix: int
property
¶
The number of pixels on which the map-making will be done
Returns:
| Type | Description |
|---|---|
int
|
Number of pixels on which the map-making will be done |
nproc_reduce: int
property
¶
The size of each sub-communicator group within the node-level communicator
Returns:
| Type | Description |
|---|---|
int
|
The group size for local reductions |
shared_mem_root: int
property
¶
The designated root rank within the node-level shared memory communicator
Returns:
| Type | Description |
|---|---|
int
|
The root rank |
shared_mem_manager: SharedMemoryManager
property
¶
The manager class for MPI shared-memory communicators and windows
Returns:
| Type | Description |
|---|---|
SharedMemoryManager
|
The shared memory manager object. |
Methods:¶
get_hit_counts() -> np.ma.MaskedArray
¶
Returns hit counts of the pixel indices.
Returns:
| Type | Description |
|---|---|
NDArray[integer]
|
Hit counts of the pixel indices |
Source code in brahmap/base/pts.py
free_shmem_arrays() -> None
¶
Frees all allocated shared-memory arrays and windows.
Returns:
| Type | Description |
|---|---|
None
|
|