Class BitsetMask

  • All Implemented Interfaces:
    HealpixMask

    public class BitsetMask
    extends java.lang.Object
    implements HealpixMask
    HealpixMask implementation based on a BitSet representing all the pixels at a given HEALPix order.

    This implementation is not very sophisticated (it doesn't attempt a multi-order representation), but it's fairly efficient as long as the order (resolution) required is modest. A value like 6 is probably reasonable; 49k pixels, 6kbyte storage.

    Since:
    8 Jun 2022
    Author:
    Mark Taylor
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int DEFAULT_ORDER
      Suitable HEALPix order for general use.
    • Constructor Summary

      Constructors 
      Constructor Description
      BitsetMask()
      Constructs a new empty mask with the default order.
      BitsetMask​(int order)
      Constructs a new empty mask with a given order.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addPixel​(int order, long ipix)
      Adds the area corresponding to a HEALPix pixel to this mask.
      HealpixMask.PixelTester createPixelTester()
      Returns an object that can test inclusion in the sky area defined by the current state of this mask.
      int getOrder()
      Returns the HEALPix order of the pixels stored by this mask.
      int[] getPixels()
      Returns an array of the pixels contained by this mask.
      double getSkyFraction()
      Returns the fraction of the sky currently covered by this mask.
      void intersection​(HealpixMask other)
      Narrows this area to represent the intersection of this mask and another compatible mask.
      boolean isEmpty()
      Returns true if this mask's area is empty.
      void union​(HealpixMask other)
      Extends this area to represent the union of this mask and another compatible mask.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DEFAULT_ORDER

        public static final int DEFAULT_ORDER
        Suitable HEALPix order for general use.
        See Also:
        Constant Field Values
    • Constructor Detail

      • BitsetMask

        public BitsetMask()
        Constructs a new empty mask with the default order.
      • BitsetMask

        public BitsetMask​(int order)
        Constructs a new empty mask with a given order.
        Parameters:
        order - HEALPix order
    • Method Detail

      • intersection

        public void intersection​(HealpixMask other)
        Description copied from interface: HealpixMask
        Narrows this area to represent the intersection of this mask and another compatible mask.
        Specified by:
        intersection in interface HealpixMask
        Parameters:
        other - different mask of a type assumed compatible with this one
      • union

        public void union​(HealpixMask other)
        Description copied from interface: HealpixMask
        Extends this area to represent the union of this mask and another compatible mask.
        Specified by:
        union in interface HealpixMask
        Parameters:
        other - different mask of a type assumed compatible with this one
      • getSkyFraction

        public double getSkyFraction()
        Description copied from interface: HealpixMask
        Returns the fraction of the sky currently covered by this mask.
        Specified by:
        getSkyFraction in interface HealpixMask
        Returns:
        sky fraction between 0 and 1
      • addPixel

        public void addPixel​(int order,
                             long ipix)
        Description copied from interface: HealpixMask
        Adds the area corresponding to a HEALPix pixel to this mask.
        Specified by:
        addPixel in interface HealpixMask
        Parameters:
        order - HEALPix order
        ipix - HEALPix pixel index at order order
      • createPixelTester

        public HealpixMask.PixelTester createPixelTester()
        Description copied from interface: HealpixMask
        Returns an object that can test inclusion in the sky area defined by the current state of this mask.
        Specified by:
        createPixelTester in interface HealpixMask
        Returns:
        thread-safe test for sky area inclusion
      • getOrder

        public int getOrder()
        Returns the HEALPix order of the pixels stored by this mask.
        Returns:
        healpix order
      • getPixels

        public int[] getPixels()
        Returns an array of the pixels contained by this mask. This is mainly intended for diagnostic purposes, it may not be very efficient.
        Returns:
        pixel list at this mask's order