Skip to content

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. healpy.nside2npix(nside))

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 True indicates a valid pointing and False flags a bad pointing, by default None. If set as None, all the pointings are considered valid

None
solver_type SolverType

The level of map-making solver to construct (\(I\), \(QU\), or \(IQU\)), by default SolverType.IQU

IQU
pol_angles NDArray[number] | None

A 1-d array containing the polarization orientation angles of the detectors for each sample, by default None

None
noise_weights NDArray[number] | None

A 1-d array containing the inverse noise variance for each time sample, by default None. If set as None, the inverse noise variance is set to 1 for each time sample

None
threshold float

The condition number threshold used to flag degenerate or under-sampled pixels, by default 1.0e-5

1e-05
dtype_float DTypeFloat | None

The data type to use for floating point arrays, by default None. If set as None, the data type is inferred from the input noise_weights or pol_angles array. If none of them are supplied, it will be set to np.float64

None
update_pointings_inplace bool

If True, the class will perform operations on the pointings array in-place to save memory. This can modify the input array. If False, the class will create a copy of the original array. By default False

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

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

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 True indicates a valid pointing and

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 npix where True indicates a bad

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
class SharedMemProcessTimeSamples(BaseProcessTimeSamples):
    """An MPI shared-memory optimized data container, analogous to
    [`ProcessTimeSamples`][brahmap.core.ProcessTimeSamples].

    This container utilizes node-level shared-memory windows (via
    [`SharedMemoryManager`][brahmap.mpi.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`][brahmap.core.ProcessTimeSamples]
    container. It manages the shared memory windows and updates them in parallel via a tree-like MPI communication.

    Similar to [`ProcessTimeSamples`][brahmap.core.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
    ----------
    npix : int
        Number of pixels on which the map-making has to be done (e.g.
        `healpy.nside2npix(nside)`)
    pointings : npt.NDArray[np.integer]
        A 1-d array of pixel indices pointing to the sky map for each time sample
    pointings_flag : npt.NDArray[np.bool_] | None, optional
        A 1-d boolean array where `True` indicates a valid pointing and
        `False` flags a bad pointing, by default `None`. If set as `None`,
        all the pointings are considered valid
    solver_type : SolverType, optional
        The level of map-making solver to construct ($I$, $QU$, or
        $IQU$), by default `SolverType.IQU`
    pol_angles : npt.NDArray[np.number] | None, optional
        A 1-d array containing the polarization orientation angles of the
        detectors for each sample, by default `None`
    noise_weights : npt.NDArray[np.number] | None, optional
        A 1-d array containing the inverse noise variance for each time
        sample, by default `None`. If set as `None`, the inverse noise
        variance is set to 1 for each time sample
    threshold : float, optional
        The condition number threshold used to flag degenerate or
        under-sampled pixels, by default `1.0e-5`
    dtype_float : DTypeFloat | None, optional
        The data type to use for floating point arrays, by default
        `None`. If set as `None`, the data type is inferred from the input
        `noise_weights` or `pol_angles` array. If none of them are
        supplied, it will be set to `np.float64`
    update_pointings_inplace : bool, optional
        If `True`, the class will perform operations on the `pointings`
        array in-place to save memory. This can modify
        the input array. If `False`, the class will create a copy of the
        original array. By default `False`
    nproc_reduce : int, optional
        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, optional
        The designated root rank within the node-level shared memory
        communicator responsible for managing the shared memory windows.
        By default `0`
    """

    def __init__(
        self,
        npix: int,
        pointings: npt.NDArray[np.integer],
        pointings_flag: npt.NDArray[np.bool_] | None = None,
        solver_type: SolverType = SolverType.IQU,
        pol_angles: npt.NDArray[np.number] | None = None,
        noise_weights: npt.NDArray[np.number] | None = None,
        threshold: float = 1.0e-5,
        dtype_float: DTypeFloat | None = None,
        update_pointings_inplace: bool = False,
        nproc_reduce: int = 1,
        shared_mem_root: int = 0,
    ):
        self.__nproc_reduce = nproc_reduce
        self.__shared_mem_manager = SharedMemoryManager(
            base_comm=MPI_UTILS.comm,
            nproc_reduce=nproc_reduce,
            node_root=shared_mem_root,
        )
        super().__init__(
            npix=npix,
            pointings=pointings,
            pointings_flag=pointings_flag,
            solver_type=solver_type,
            pol_angles=pol_angles,
            noise_weights=noise_weights,
            threshold=threshold,
            dtype_float=dtype_float,
            update_pointings_inplace=update_pointings_inplace,
        )

    @property
    def nproc_reduce(self) -> int:
        """The size of each sub-communicator group within the node-level
        communicator

        Returns
        -------
        int
            The group size for local reductions
        """
        return self.__nproc_reduce

    @property
    def shared_mem_root(self) -> int:
        """The designated root rank within the node-level shared memory
        communicator

        Returns
        -------
        int
            The root rank
        """
        return self.__shared_mem_manager.node_root

    @property
    def shared_mem_manager(self) -> SharedMemoryManager:
        """The manager class for MPI shared-memory communicators and windows

        Returns
        -------
        SharedMemoryManager
            The shared memory manager object.
        """
        return self.__shared_mem_manager

    def free_shmem_arrays(self) -> None:
        """Frees all allocated shared-memory arrays and windows.

        Returns
        -------
        None
        """
        MPI_UTILS.comm.barrier()
        if hasattr(self, "_SharedMemProcessTimeSamples__shared_mem_manager"):
            self.__shared_mem_manager.free_shared_arrays_all()

    def _allocate_shmem_arrays_node(
        self,
        mgr: SharedMemoryManager,
        dint,
        dfloat,
    ):
        self._observed_pixels, self._win_observed_pixels = mgr.alloc_shared_zeros_node(
            self.npix, dint
        )
        self._old2new_pixel, self._win_old2new_pixel = mgr.alloc_shared_zeros_node(
            self.npix, dint
        )
        self._pixel_flag, self._win_pixel_flag = mgr.alloc_shared_zeros_node(
            self.npix, bool
        )
        self._hit_counts, self._win_hit_counts = mgr.alloc_shared_zeros_node(
            self.npix, dint
        )
        self._weighted_counts, self._win_weighted_counts = mgr.alloc_shared_zeros_node(
            self.npix, dfloat
        )

        if self.solver_type != SolverType.I:
            (
                self._weighted_sin_sq,
                self._win_weighted_sin_sq,
            ) = mgr.alloc_shared_zeros_node(self.npix, dfloat)
            (
                self._weighted_cos_sq,
                self._win_weighted_cos_sq,
            ) = mgr.alloc_shared_zeros_node(self.npix, dfloat)
            (
                self._weighted_sincos,
                self._win_weighted_sincos,
            ) = mgr.alloc_shared_zeros_node(self.npix, dfloat)
            (
                self._one_over_determinant,
                self._win_one_over_determinant,
            ) = mgr.alloc_shared_zeros_node(self.npix, dfloat)

        if self.solver_type == SolverType.IQU:
            self._weighted_sin, self._win_weighted_sin = mgr.alloc_shared_zeros_node(
                self.npix, dfloat
            )
            self._weighted_cos, self._win_weighted_cos = mgr.alloc_shared_zeros_node(
                self.npix, dfloat
            )

    def _compute_weights(
        self,
        pol_angles: npt.NDArray[np.number],
        noise_weights: npt.NDArray[np.number],
    ):
        mgr = self.__shared_mem_manager
        dint = self._pointings.dtype
        dfloat = self.dtype_float

        self._allocate_shmem_arrays_node(
            mgr,
            dint,
            dfloat,
        )

        if self.solver_type != SolverType.I:
            self._sin2phi = np.zeros(self.nsamples, dtype=dfloat)
            self._cos2phi = np.zeros(self.nsamples, dtype=dfloat)

        mgr.fence_comm_all(mgr.node_comm)

        if self.solver_type == SolverType.I:
            self._new_npix = compute_weights_shared.compute_weights_shmem_pol_I(
                npix=self.npix,
                nsamples=self.nsamples,
                pointings=self._pointings,
                pointings_flag=self._pointings_flag,
                noise_weights=noise_weights,
                node_hit_counts=self._hit_counts,
                win_hit_counts=self._win_hit_counts,
                node_weighted_counts=self._weighted_counts,
                win_weighted_counts=self._win_weighted_counts,
                observed_pixels=self._observed_pixels,
                __old2new_pixel=self._old2new_pixel,  # type: ignore
                pixel_flag=self._pixel_flag,
                node_root=mgr.node_root,
                tree_grp_comm=mgr.tree_grp_comm,
                tree_grp_root_comm=mgr.tree_grp_root_comm,
                node_comm=mgr.node_comm,
                node_root_comm=mgr.node_root_comm,
            )

            mgr.fence_comm_all(mgr.node_comm)

        else:
            if self.solver_type == SolverType.QU:
                compute_weights_shared.compute_weights_shmem_pol_QU(
                    npix=self.npix,
                    nsamples=self.nsamples,
                    pointings=self._pointings,
                    pointings_flag=self._pointings_flag,
                    noise_weights=noise_weights,
                    pol_angles=pol_angles,
                    node_hit_counts=self._hit_counts,
                    win_hit_counts=self._win_hit_counts,
                    node_weighted_counts=self._weighted_counts,
                    win_weighted_counts=self._win_weighted_counts,
                    sin2phi=self._sin2phi,
                    cos2phi=self._cos2phi,
                    node_weighted_sin_sq=self._weighted_sin_sq,
                    win_weighted_sin_sq=self._win_weighted_sin_sq,
                    node_weighted_cos_sq=self._weighted_cos_sq,
                    win_weighted_cos_sq=self._win_weighted_cos_sq,
                    node_weighted_sincos=self._weighted_sincos,
                    win_weighted_sincos=self._win_weighted_sincos,
                    one_over_determinant=self._one_over_determinant,
                    node_root=mgr.node_root,
                    tree_grp_comm=mgr.tree_grp_comm,
                    tree_grp_root_comm=mgr.tree_grp_root_comm,
                    node_comm=mgr.node_comm,
                    node_root_comm=mgr.node_root_comm,
                )

            elif self.solver_type == SolverType.IQU:
                compute_weights_shared.compute_weights_shmem_pol_IQU(
                    npix=self.npix,
                    nsamples=self.nsamples,
                    pointings=self._pointings,
                    pointings_flag=self._pointings_flag,
                    noise_weights=noise_weights,
                    pol_angles=pol_angles,
                    node_hit_counts=self._hit_counts,
                    win_hit_counts=self._win_hit_counts,
                    node_weighted_counts=self._weighted_counts,
                    win_weighted_counts=self._win_weighted_counts,
                    sin2phi=self._sin2phi,
                    cos2phi=self._cos2phi,
                    node_weighted_sin_sq=self._weighted_sin_sq,
                    win_weighted_sin_sq=self._win_weighted_sin_sq,
                    node_weighted_cos_sq=self._weighted_cos_sq,
                    win_weighted_cos_sq=self._win_weighted_cos_sq,
                    node_weighted_sincos=self._weighted_sincos,
                    win_weighted_sincos=self._win_weighted_sincos,
                    node_weighted_sin=self._weighted_sin,
                    win_weighted_sin=self._win_weighted_sin,
                    node_weighted_cos=self._weighted_cos,
                    win_weighted_cos=self._win_weighted_cos,
                    one_over_determinant=self._one_over_determinant,
                    node_root=mgr.node_root,
                    tree_grp_comm=mgr.tree_grp_comm,
                    tree_grp_root_comm=mgr.tree_grp_root_comm,
                    node_comm=mgr.node_comm,
                    node_root_comm=mgr.node_root_comm,
                )

            mgr.fence_comm_all(mgr.node_comm)

            if mgr.node_rank == mgr.node_root:
                self._new_npix = compute_weights_shared.get_pixel_mask_pol(
                    solver_type=self.solver_type,
                    npix=self.npix,
                    threshold=self.threshold,
                    hit_counts=self._hit_counts,
                    one_over_determinant=self._one_over_determinant,
                    observed_pixels=self._observed_pixels,
                    __old2new_pixel=self._old2new_pixel,  # type: ignore
                    pixel_flag=self._pixel_flag,
                )
            else:
                self._new_npix = 0

            mgr.fence_comm_all(mgr.node_comm)

            self._new_npix = mgr.node_comm.bcast(self._new_npix, root=mgr.node_root)

    def _repixelization(self):
        mgr = self.__shared_mem_manager
        dint = self._pointings.dtype
        dfloat = self.dtype_float
        new_npix = self._new_npix

        if mgr.node_rank == mgr.node_root:
            if self.solver_type == SolverType.I:
                repixelize.repixelize_pol_I(
                    new_npix=new_npix,
                    observed_pixels=self._observed_pixels,
                    hit_counts=self._hit_counts,
                    weighted_counts=self._weighted_counts,
                )

            elif self.solver_type == SolverType.QU:
                repixelize.repixelize_pol_QU(
                    new_npix=new_npix,
                    observed_pixels=self._observed_pixels,
                    hit_counts=self._hit_counts,
                    weighted_counts=self._weighted_counts,
                    weighted_sin_sq=self._weighted_sin_sq,
                    weighted_cos_sq=self._weighted_cos_sq,
                    weighted_sincos=self._weighted_sincos,
                    one_over_determinant=self._one_over_determinant,
                )

            elif self.solver_type == SolverType.IQU:
                repixelize.repixelize_pol_IQU(
                    new_npix=new_npix,
                    observed_pixels=self._observed_pixels,
                    hit_counts=self._hit_counts,
                    weighted_counts=self._weighted_counts,
                    weighted_sin_sq=self._weighted_sin_sq,
                    weighted_cos_sq=self._weighted_cos_sq,
                    weighted_sincos=self._weighted_sincos,
                    weighted_sin=self._weighted_sin,
                    weighted_cos=self._weighted_cos,
                    one_over_determinant=self._one_over_determinant,
                )

        mgr.fence_comm_all(mgr.node_comm)

        def _realloc_shared(old_arr, old_win, size, dtype):
            new_arr, new_win = mgr.alloc_shared_node(size, dtype)
            if mgr.node_rank == 0:
                new_arr[:] = old_arr[:size]
            new_win.Fence(0)
            mgr.free_shared_array(mgr.node_comm, old_win)
            return new_arr, new_win

        self._observed_pixels, self._win_observed_pixels = _realloc_shared(
            self._observed_pixels,
            self._win_observed_pixels,
            new_npix,
            dint,
        )
        self._hit_counts, self._win_hit_counts = _realloc_shared(
            self._hit_counts,
            self._win_hit_counts,
            new_npix,
            dint,
        )
        self._weighted_counts, self._win_weighted_counts = _realloc_shared(
            self._weighted_counts,
            self._win_weighted_counts,
            new_npix,
            dfloat,
        )

        if self.solver_type != SolverType.I:
            self._weighted_sin_sq, self._win_weighted_sin_sq = _realloc_shared(
                self._weighted_sin_sq,
                self._win_weighted_sin_sq,
                new_npix,
                dfloat,
            )
            self._weighted_cos_sq, self._win_weighted_cos_sq = _realloc_shared(
                self._weighted_cos_sq,
                self._win_weighted_cos_sq,
                new_npix,
                dfloat,
            )
            self._weighted_sincos, self._win_weighted_sincos = _realloc_shared(
                self._weighted_sincos,
                self._win_weighted_sincos,
                new_npix,
                dfloat,
            )
            (
                self._one_over_determinant,
                self._win_one_over_determinant,
            ) = _realloc_shared(
                self._one_over_determinant,
                self._win_one_over_determinant,
                new_npix,
                dfloat,
            )

        if self.solver_type == SolverType.IQU:
            self._weighted_sin, self._win_weighted_sin = _realloc_shared(
                self._weighted_sin,
                self._win_weighted_sin,
                new_npix,
                dfloat,
            )
            self._weighted_cos, self._win_weighted_cos = _realloc_shared(
                self._weighted_cos,
                self._win_weighted_cos,
                new_npix,
                dfloat,
            )

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 (True) or discarded

(`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

dtype of the floating point arrays

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 npix where True indicates a dropped or pathological pixel

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
def get_hit_counts(self) -> np.ma.MaskedArray:
    """Returns hit counts of the pixel indices.

    Returns
    -------
    npt.NDArray[np.integer]
        Hit counts of the pixel indices
    """
    hit_counts = np.ma.masked_array(
        data=np.zeros(self.npix),
        mask=np.logical_not(self._pixel_flag),
        fill_value=-1.6375e30,
    )

    hit_counts[~hit_counts.mask] = self._hit_counts
    return hit_counts

free_shmem_arrays() -> None

Frees all allocated shared-memory arrays and windows.

Returns:

Type Description
None
Source code in brahmap/core/process_time_samples.py
def free_shmem_arrays(self) -> None:
    """Frees all allocated shared-memory arrays and windows.

    Returns
    -------
    None
    """
    MPI_UTILS.comm.barrier()
    if hasattr(self, "_SharedMemProcessTimeSamples__shared_mem_manager"):
        self.__shared_mem_manager.free_shared_arrays_all()