Package cds.moc

Class HealpixMoc

  • All Implemented Interfaces:
    java.lang.Cloneable, java.lang.Comparable, java.lang.Iterable<MocCell>

    public class HealpixMoc
    extends java.lang.Object
    implements java.lang.Iterable<MocCell>, java.lang.Cloneable, java.lang.Comparable
    HEALPix Multi Order Coverage Map (MOC) This object provides read, write and process methods to manipulate an HEALPix Multi Order Coverage Map (MOC) A MOC is used to define a sky region by using HEALPix sky tesselation
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int ASCII
      ASCII encoding format (IVOA REC 1.0 suggestion)
      static int FITS
      FITS encoding format (IVOA REC 1.0 compliante)
      static int INT  
      static int JSON
      JSON encoding format (IVOA REC 1.0 suggestion)
      static int JSON0
      JSON obsoleted encoding format (only reading supported for compatibility)
      static int LONG  
      static int MAXORDER
      Maximal HEALPix order supported by the library
      healpix.essentials.RangeSet rangeSet
      Operations on MOCs
      static int SHORT  
      static java.lang.String VERSION
      Healpix MOC API version number
    • Constructor Summary

      Constructors 
      Constructor Description
      HealpixMoc()
      HEALPix Multi Order Coverage Map (MOC) creation
      HealpixMoc​(int maxLimitOrder)
      Moc Creation with a specified max limitOrder (by default 29)
      HealpixMoc​(int minLimitOrder, int maxLimitOrder)
      Moc Creation with a specified min and max limitOrder (by default 0..29)
      HealpixMoc​(java.io.InputStream in)
      HEALPix Multi Order Coverage Map (MOC) creation and initialisation via a stream
      HealpixMoc​(java.io.InputStream in, int mode)
      HEALPix Multi Order Coverage Map (MOC) creation and initialisation via a stream, either in JSON encoded format , ASCII encoded format or in FITS encoded format
      HealpixMoc​(java.lang.String s)
      HEALPix Multi Order Coverage Map (MOC) creation and initialisation via a string following ASCII or JSON MOC syntax ex JSON: { "order1":[npix1,npix2,...], "order2":[npix3...] } ex basic ASCII: order1/npix1-npix2 npix3 ...
      HealpixMoc​(java.lang.String coordSys, int minLimitOrder, int maxLimitOrder)
      Deprecated.
      Standard MOC must be equatorial
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      boolean add​(int order, long npix)
      Add a MOC pixel Recursive addition : since with have the 3 brothers, we remove them and add recursively their father
      void add​(int order, long[] npixs)
      Add a collection of npix, all of them at the same order.
      void add​(int order, java.util.Collection<java.lang.Long> a)
      Add a collection of npix, all of them at the same order.
      boolean add​(HealpixImpl healpix, double alpha, double delta)
      Add a Moc pixel (at max order) corresponding to the alpha,delta position Recursive addition : since with have the 3 brothers, we remove them and add recursively their father
      void add​(HealpixMoc moc)
      Add directly a full Moc.
      boolean add​(MocCell cell)
      Add a Moc pixel Recursive addition : since with have the 3 brothers, we remove them and add recursively their father
      void add​(java.lang.String s)
      Add a list of MOC pixels provided in a string format (JSON format or basic ASCII format) ex JSON: { "order1":[npix1,npix2,...], "order2":[npix3...] } ex basic ASCII: order1/npix1-npix2 npix3 ...
      protected void addHpix​(java.lang.String s)  
      void checkAndFix()
      Check and fix the consistency of the moc => remove cell redundancies => factorize 4 brothers as 1 father (recursively) => check and fix descendance consistancy [REMOVED => Trim the limitOrder if required ]
      void clear()
      Clear the MOC
      java.lang.Object clone()
      Deep copy
      int compareTo​(java.lang.Object o)  
      HealpixMoc complement()  
      boolean contains​(HealpixImpl healpix, double alpha, double delta)
      Check if the spherical coord is inside the MOC.
      boolean delete​(int order, long npix)
      Remove a MOC pixel
      void delete​(java.lang.String s)
      remove a list of MOC pixels provided in a string format (ex: "order1/npix1-npix2 npix3 ...
      boolean deleteDescendant​(int order, long npix)
      Remove all descendants of a MOC Pixel
      HealpixMoc difference​(HealpixMoc moc)  
      boolean equals​(java.lang.Object moc)
      Equality test
      double getAngularRes()
      Provide the angular resolution (in degrees) of the MOC (sqrt of the smallest pixel area)
      long getArea()
      return the area of the Moc computed in pixels at the most low level
      Array getArray​(int order)
      Provide the Array of a dedicated order
      java.lang.String getCoordSys()
      Return the coordinate system (HEALPix convention: G-galactic, C-Equatorial, E-Ecliptic)
      double getCoverage()
      Return the fraction of the sky covered by the Moc [0..1]
      int getDescendantOrder​(int order, long npix)
      return the order of the first descendant, otherwise -1
      int getLimitOrder()
      Deprecated.
      see getMaxLimitOrder()
      int getMaxLimitOrder()
      Deprecated.
      see getMocOrder()
      int getMaxOrder()
      Provide the greatest order really used by the MOC WARNING: use getMocOrder() to know the MOC resolution
      long getMem()
      Return approximatively the memory used for this moc (in bytes)
      long getMem​(int order)
      Provide the memory used for a dedicated order
      int getMinLimitOrder()
      Provide the minimal limit order supported by the Moc (by default 0)
      int getMocOrder()
      Provide the MOC order.
      long[] getPixLevel​(int order)
      Provide a copy of the pixel list at the specified order (in longs)
      java.lang.String getProperty​(java.lang.String key)
      Provide MOC property value.
      int getSize()
      Provide the number of Healpix pixels (for all MOC orders)
      int getSize​(int order)
      Provide the number of Healpix pixels for a dedicated order
      static int getType​(int order)
      Provide the integer type for a given order
      long getUsedArea()
      Return the number of low level pixels of the Moc
      static long hpix2uniq​(int order, long npix)
      Code a couple (order,npix) into a unique long integer
      HealpixMoc intersection​(HealpixMoc moc)  
      boolean isAllSky()
      Return true if the MOC covers the whole sky
      boolean isAscendant​(int order, long npix)
      True is the MOC pixel is an ascendant
      boolean isDescendant​(int order, long npix)
      True if the MOC pixel is a descendant
      boolean isEmpty()
      Return true if the MOC is empty
      boolean isIn​(int order, long npix)
      True if the MOC pixel is present at this order
      boolean isIncluding​(HealpixMoc moc)
      Fast test for checking if the parameter MOC is totally inside the current MOC object
      boolean isIntersecting​(int order, long npix)
      Fast test for checking if the cell is intersecting the current MOC object
      boolean isIntersecting​(HealpixMoc moc)
      Fast test for checking if the parameter MOC is intersecting the current MOC object
      boolean isInTree​(int order, long npix)
      Deprecated.
      see isIntersecting(...)
      boolean isInTree​(HealpixMoc moc)
      Deprecated.
      see isIntersecting(...)
      boolean isSorted()
      Return true if all Moc level is sorted
      java.util.Iterator<MocCell> iterator()
      Provide an Iterator on the MOC pixel List.
      static long log2​(long nside)  
      java.util.Iterator<java.lang.Long> pixelIterator()
      Provide an Iterator on the low level pixel list covering all the MOC area.
      static long pow2​(long order)  
      HealpixMoc queryCell​(int order, long npix)  
      HealpixMoc queryDisc​(HealpixImpl healpix, double alpha, double delta, double radius)
      Provide Moc pixels totally or partially inside a circle
      void read​(java.io.InputStream in)
      Read HEALPix MOC from a stream Support all MOC syntax: FITS standard or any other old syntax (JSON or ASCII)
      void read​(java.io.InputStream in, int mode)
      Deprecated.
      see read(InputStream)
      void read​(java.lang.String filename)
      Read HEALPix MOC from a file.
      void read​(java.lang.String filename, int mode)
      Deprecated.
      see read(String)
      void readASCII​(java.io.InputStream in)
      Deprecated.
      see read(InputStream)
      void readFits​(java.io.InputStream in)
      Deprecated.
      see read(InputStream)
      void readJSON​(java.io.InputStream in)
      Deprecated.
      see read(InputStream)
      void setCheckConsistencyFlag​(boolean flag)
      Set the check consistency flag.
      void setCoordSys​(java.lang.String coordSys)
      Deprecated.
      Standard MOC must be equatorial
      protected void setCurrentOrder​(int order)  
      void setLimitOrder​(int limitOrder)
      Deprecated.
      see setMaxLimitOrder()
      void setMaxLimitOrder​(int limitOrder)
      Deprecated.
      see setMocOrder(int)
      void setMinLimitOrder​(int limitOrder)
      Set the Min limit order supported by the Moc (by default 0) (and automatically switch on the testConsistency) Any future addition of pixel with order smallest than minLimitOrder will be automatically replaced by the addition of its 4 sons.
      void setMocOrder​(int order)
      Set the limit order supported by the Moc (-1 for Healpix library implementation) (and automatically switch on the testConsistency) Any future addition of pixel with order exceeding limitOrder will be automatically replaced by the addition of the corresponding pixel at the limitOrder.
      void setMocOrder​(java.lang.String mocOrder)
      Set the MOC order.
      void setPixLevel​(int order, int[] val)
      Set the pixel list at the specified order (6<=order<=13 ) (Dedicated for fast initialisation)
      void setPixLevel​(int order, long[] val)
      Set the pixel list at the specified order (order>13 ) (Dedicated for fast initialisation)
      void setPixLevel​(int order, short[] val)
      Set the pixel list at the specified order (order<6) (Dedicated for fast initialisation)
      void setProperty​(java.lang.String key, java.lang.String value)
      MOC propertie setter
      void sort()
      Sort each level of the Moc
      HealpixMoc subtraction​(HealpixMoc moc)  
      java.lang.String todebug()  
      void toHealpixMoc()  
      void toRangeSet()  
      java.lang.String toString()  
      void trim()
      Remove all the unused space (allocation reservation)
      HealpixMoc union​(HealpixMoc moc)  
      static long[] uniq2hpix​(long uniq)
      Uncode a long integer into a couple (order,npix)
      static long[] uniq2hpix​(long uniq, long[] hpix)
      Uncode a long integer into a couple (order,npix)
      void write​(java.io.OutputStream out, int mode)
      Deprecated. 
      void write​(java.lang.String filename)
      Write HEALPix MOC to a file
      void write​(java.lang.String filename, int mode)
      Deprecated. 
      void writeASCII​(java.io.OutputStream out)
      Deprecated.
      see write(OutputStream)
      void writeFits​(java.io.OutputStream out)
      Write HEALPix MOC to an output stream in FITS encoded format
      void writeFITS​(java.io.OutputStream out)
      deprecated
      void writeJSON​(java.io.OutputStream out)
      Write HEALPix MOC to an output stream IN JSON encoded format
      • Methods inherited from class java.lang.Object

        finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Field Detail

      • VERSION

        public static final java.lang.String VERSION
        Healpix MOC API version number
        See Also:
        Constant Field Values
      • FITS

        public static final int FITS
        FITS encoding format (IVOA REC 1.0 compliante)
        See Also:
        Constant Field Values
      • JSON

        public static final int JSON
        JSON encoding format (IVOA REC 1.0 suggestion)
        See Also:
        Constant Field Values
      • ASCII

        public static final int ASCII
        ASCII encoding format (IVOA REC 1.0 suggestion)
        See Also:
        Constant Field Values
      • JSON0

        public static final int JSON0
        JSON obsoleted encoding format (only reading supported for compatibility)
        See Also:
        Constant Field Values
      • MAXORDER

        public static final int MAXORDER
        Maximal HEALPix order supported by the library
        See Also:
        Constant Field Values
      • rangeSet

        public healpix.essentials.RangeSet rangeSet
        Operations on MOCs
    • Constructor Detail

      • HealpixMoc

        public HealpixMoc()
        HEALPix Multi Order Coverage Map (MOC) creation
      • HealpixMoc

        public HealpixMoc​(int maxLimitOrder)
                   throws java.lang.Exception
        Moc Creation with a specified max limitOrder (by default 29)
        Throws:
        java.lang.Exception
      • HealpixMoc

        public HealpixMoc​(int minLimitOrder,
                          int maxLimitOrder)
                   throws java.lang.Exception
        Moc Creation with a specified min and max limitOrder (by default 0..29)
        Throws:
        java.lang.Exception
      • HealpixMoc

        public HealpixMoc​(java.lang.String coordSys,
                          int minLimitOrder,
                          int maxLimitOrder)
                   throws java.lang.Exception
        Deprecated.
        Standard MOC must be equatorial
        Moc Creation with a specified min and max limitOrder (by default 0..29)
        Throws:
        java.lang.Exception
      • HealpixMoc

        public HealpixMoc​(java.lang.String s)
                   throws java.lang.Exception
        HEALPix Multi Order Coverage Map (MOC) creation and initialisation via a string following ASCII or JSON MOC syntax ex JSON: { "order1":[npix1,npix2,...], "order2":[npix3...] } ex basic ASCII: order1/npix1-npix2 npix3 ... order2/npix4 ...
        Parameters:
        s - list of MOC pixels
        Throws:
        java.lang.Exception
      • HealpixMoc

        public HealpixMoc​(java.io.InputStream in)
                   throws java.lang.Exception
        HEALPix Multi Order Coverage Map (MOC) creation and initialisation via a stream
        Parameters:
        in - input stream
        Throws:
        java.lang.Exception
      • HealpixMoc

        public HealpixMoc​(java.io.InputStream in,
                          int mode)
                   throws java.lang.Exception
        HEALPix Multi Order Coverage Map (MOC) creation and initialisation via a stream, either in JSON encoded format , ASCII encoded format or in FITS encoded format
        Parameters:
        in - input stream
        mode - ASCII - ASCII encoded format, JSON encoded format, FITS - Fits encoded format
        Throws:
        java.lang.Exception
    • Method Detail

      • getType

        public static int getType​(int order)
        Provide the integer type for a given order
      • clear

        public void clear()
        Clear the MOC
      • clone

        public java.lang.Object clone()
        Deep copy
        Overrides:
        clone in class java.lang.Object
      • setMinLimitOrder

        public void setMinLimitOrder​(int limitOrder)
                              throws java.lang.Exception
        Set the Min limit order supported by the Moc (by default 0) (and automatically switch on the testConsistency) Any future addition of pixel with order smallest than minLimitOrder will be automatically replaced by the addition of its 4 sons.
        Throws:
        java.lang.Exception
      • setMocOrder

        public void setMocOrder​(int order)
                         throws java.lang.Exception
        Set the limit order supported by the Moc (-1 for Healpix library implementation) (and automatically switch on the testConsistency) Any future addition of pixel with order exceeding limitOrder will be automatically replaced by the addition of the corresponding pixel at the limitOrder. If there is no limitOrder set (-1), an exception will thrown.
        Throws:
        java.lang.Exception
      • setMaxLimitOrder

        public void setMaxLimitOrder​(int limitOrder)
                              throws java.lang.Exception
        Deprecated.
        see setMocOrder(int)
        Set the limit order supported by the Moc (-1 for Healpix library implementation) (and automatically switch on the testConsistency) Any future addition of pixel with order exceeding limitOrder will be automatically replaced by the addition of the corresponding pixel at the limitOrder. If there is no limitOrder set (-1), an exception will thrown.
        Throws:
        java.lang.Exception
      • getMinLimitOrder

        public int getMinLimitOrder()
        Provide the minimal limit order supported by the Moc (by default 0)
      • getMaxLimitOrder

        public int getMaxLimitOrder()
        Deprecated.
        see getMocOrder()
        Provide the limit order supported by the Moc (by default depends of the Healpix library implementation)
      • getMocOrder

        public int getMocOrder()
        Provide the MOC order. By default 29
        Returns:
        Provide the MOC order (by default 29 = HEALPix lib limit)
      • setMocOrder

        public void setMocOrder​(java.lang.String mocOrder)
                         throws java.lang.Exception
        Set the MOC order. By default 29. If the MOC already contains smaller cells, these cells will be replaced by their first parent corresponding to the new MOC order
        Parameters:
        mocOrder - MOC order (best cells order)
        Throws:
        java.lang.Exception
      • getLimitOrder

        public int getLimitOrder()
        Deprecated.
        see getMaxLimitOrder()
      • setLimitOrder

        public void setLimitOrder​(int limitOrder)
                           throws java.lang.Exception
        Deprecated.
        see setMaxLimitOrder()
        Throws:
        java.lang.Exception
      • getCoordSys

        public java.lang.String getCoordSys()
        Return the coordinate system (HEALPix convention: G-galactic, C-Equatorial, E-Ecliptic)
      • setCoordSys

        public void setCoordSys​(java.lang.String coordSys)
        Deprecated.
        Standard MOC must be equatorial
        Specify the coordinate system (HEALPix convention: G-galactic, C-Equatorial, E-Ecliptic)
      • setCurrentOrder

        protected void setCurrentOrder​(int order)
      • getSize

        public int getSize()
        Provide the number of Healpix pixels (for all MOC orders)
        Returns:
        number of pixels
      • getMem

        public long getMem()
        Return approximatively the memory used for this moc (in bytes)
      • getMem

        public long getMem​(int order)
        Provide the memory used for a dedicated order
      • getSize

        public int getSize​(int order)
        Provide the number of Healpix pixels for a dedicated order
      • getArray

        public Array getArray​(int order)
        Provide the Array of a dedicated order
      • getAngularRes

        public double getAngularRes()
        Provide the angular resolution (in degrees) of the MOC (sqrt of the smallest pixel area)
      • getMaxOrder

        public int getMaxOrder()
        Provide the greatest order really used by the MOC WARNING: use getMocOrder() to know the MOC resolution
        Returns:
        greatest MOC order, -1 if no order used
      • setCheckConsistencyFlag

        public void setCheckConsistencyFlag​(boolean flag)
                                     throws java.lang.Exception
        Set the check consistency flag. "true" by default => redundancy check and hierarchy consistency check during addition (=> slower)
        Parameters:
        flag -
        Throws:
        java.lang.Exception
      • getDescendantOrder

        public int getDescendantOrder​(int order,
                                      long npix)
        return the order of the first descendant, otherwise -1
      • add

        public void add​(java.lang.String s)
                 throws java.lang.Exception
        Add a list of MOC pixels provided in a string format (JSON format or basic ASCII format) ex JSON: { "order1":[npix1,npix2,...], "order2":[npix3...] } ex basic ASCII: order1/npix1-npix2 npix3 ... order2/npix4 ... Note : The string can be submitted in several times. In this case, the insertion will use the last current order Note : in JSON, the syntax is not checked ( in fact {, [ and " are ignored)
        Throws:
        java.lang.Exception
      • add

        public void add​(HealpixMoc moc)
                 throws java.lang.Exception
        Add directly a full Moc. Note: The MOC consistency is checked and possibly fixed at the end of the insertion process
        Parameters:
        moc - The Moc to be added
        Throws:
        java.lang.Exception
      • add

        public void add​(int order,
                        long[] npixs)
                 throws java.lang.Exception
        Add a collection of npix, all of them at the same order. Note: The MOC consistency is checked and possibly fixed at the end of the insertion process
        Parameters:
        order - order of insertion
        npixs - list of npix to be inserted
        Throws:
        java.lang.Exception
      • add

        public void add​(int order,
                        java.util.Collection<java.lang.Long> a)
                 throws java.lang.Exception
        Add a collection of npix, all of them at the same order. Note: The MOC consistency is checked and possibly fixed at the end of the insertion process
        Parameters:
        order - order of insertion
        npixs - list of npix to be inserted
        Throws:
        java.lang.Exception
      • add

        public boolean add​(MocCell cell)
                    throws java.lang.Exception
        Add a Moc pixel Recursive addition : since with have the 3 brothers, we remove them and add recursively their father
        Parameters:
        cell - Moc cell
        Returns:
        true if the cell (or its father) has been effectively inserted
        Throws:
        java.lang.Exception
      • add

        public boolean add​(HealpixImpl healpix,
                           double alpha,
                           double delta)
                    throws java.lang.Exception
        Add a Moc pixel (at max order) corresponding to the alpha,delta position Recursive addition : since with have the 3 brothers, we remove them and add recursively their father
        Parameters:
        alpha - , delta position
        Returns:
        true if the cell (or its father) has been effectively inserted
        Throws:
        java.lang.Exception
      • add

        public boolean add​(int order,
                           long npix)
                    throws java.lang.Exception
        Add a MOC pixel Recursive addition : since with have the 3 brothers, we remove them and add recursively their father
        Parameters:
        order - HEALPix order
        npix - Healpix number (-1 if no number => just for memorizing max MocOrder)
        testHierarchy - true if the ascendance and descendance consistance test must be done
        Returns:
        true if something has been really inserted (npix or ascendant)
        Throws:
        java.lang.Exception
      • delete

        public void delete​(java.lang.String s)
        remove a list of MOC pixels provided in a string format (ex: "order1/npix1-npix2 npix3 ... order2/npix4 ...")
      • delete

        public boolean delete​(int order,
                              long npix)
        Remove a MOC pixel
        Parameters:
        order - HEALPix order
        npix - Healpix number
        Returns:
        true if the deletion has been effectively done
      • deleteDescendant

        public boolean deleteDescendant​(int order,
                                        long npix)
        Remove all descendants of a MOC Pixel
        Parameters:
        order -
        npix -
        Returns:
        true if at least one descendant has been removed
      • sort

        public void sort()
        Sort each level of the Moc
      • isSorted

        public boolean isSorted()
        Return true if all Moc level is sorted
      • isInTree

        public boolean isInTree​(int order,
                                long npix)
        Deprecated.
        see isIntersecting(...)
        Fast test for checking if the HEALPix cell is intersecting the current MOC object
      • isInTree

        public boolean isInTree​(HealpixMoc moc)
        Deprecated.
        see isIntersecting(...)
        Fast test for checking if the parameter MOC is intersecting the current MOC object
      • checkAndFix

        public void checkAndFix()
                         throws java.lang.Exception
        Check and fix the consistency of the moc => remove cell redundancies => factorize 4 brothers as 1 father (recursively) => check and fix descendance consistancy [REMOVED => Trim the limitOrder if required ]
        Throws:
        java.lang.Exception
      • isAscendant

        public boolean isAscendant​(int order,
                                   long npix)
        True is the MOC pixel is an ascendant
      • isDescendant

        public boolean isDescendant​(int order,
                                    long npix)
        True if the MOC pixel is a descendant
      • isIn

        public boolean isIn​(int order,
                            long npix)
        True if the MOC pixel is present at this order
      • setProperty

        public void setProperty​(java.lang.String key,
                                java.lang.String value)
                         throws java.lang.Exception
        MOC propertie setter
        Parameters:
        key - => MOCORDER, COORDSYS, MOCTOOL, MOCTYPE, MOCID, DATE, ORIGIN, EXTNAME
        value -
        Throws:
        java.lang.Exception
      • getProperty

        public java.lang.String getProperty​(java.lang.String key)
        Provide MOC property value. Available key properties are: => MOCORDER, COORDSYS, MOCTOOL, MOCTYPE, MOCID, DATE, ORIGIN, EXTNAME
        Parameters:
        key -
        Returns:
      • getCoverage

        public double getCoverage()
        Return the fraction of the sky covered by the Moc [0..1]
      • getUsedArea

        public long getUsedArea()
        Return the number of low level pixels of the Moc
      • getArea

        public long getArea()
        return the area of the Moc computed in pixels at the most low level
      • iterator

        public java.util.Iterator<MocCell> iterator()
        Provide an Iterator on the MOC pixel List. Each Item is a couple of longs, the first long is the order, the second long is the pixel number
        Specified by:
        iterator in interface java.lang.Iterable<MocCell>
      • pixelIterator

        public java.util.Iterator<java.lang.Long> pixelIterator()
        Provide an Iterator on the low level pixel list covering all the MOC area. => pixel are provided in ascending order
      • trim

        public void trim()
        Remove all the unused space (allocation reservation)
      • todebug

        public java.lang.String todebug()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • toRangeSet

        public void toRangeSet()
      • toHealpixMoc

        public void toHealpixMoc()
                          throws java.lang.Exception
        Throws:
        java.lang.Exception
      • isIntersecting

        public boolean isIntersecting​(int order,
                                      long npix)
        Fast test for checking if the cell is intersecting the current MOC object
        Returns:
        true if the intersection is not null
      • isIntersecting

        public boolean isIntersecting​(HealpixMoc moc)
        Fast test for checking if the parameter MOC is intersecting the current MOC object
        Returns:
        true if the intersection is not null
      • isIncluding

        public boolean isIncluding​(HealpixMoc moc)
        Fast test for checking if the parameter MOC is totally inside the current MOC object
        Returns:
        true if MOC is totally inside
      • union

        public HealpixMoc union​(HealpixMoc moc)
                         throws java.lang.Exception
        Throws:
        java.lang.Exception
      • intersection

        public HealpixMoc intersection​(HealpixMoc moc)
                                throws java.lang.Exception
        Throws:
        java.lang.Exception
      • subtraction

        public HealpixMoc subtraction​(HealpixMoc moc)
                               throws java.lang.Exception
        Throws:
        java.lang.Exception
      • complement

        public HealpixMoc complement()
                              throws java.lang.Exception
        Throws:
        java.lang.Exception
      • difference

        public HealpixMoc difference​(HealpixMoc moc)
                              throws java.lang.Exception
        Throws:
        java.lang.Exception
      • isAllSky

        public boolean isAllSky()
        Return true if the MOC covers the whole sky
      • isEmpty

        public boolean isEmpty()
        Return true if the MOC is empty
      • equals

        public boolean equals​(java.lang.Object moc)
        Equality test
        Overrides:
        equals in class java.lang.Object
      • contains

        public boolean contains​(HealpixImpl healpix,
                                double alpha,
                                double delta)
                         throws java.lang.Exception
        Check if the spherical coord is inside the MOC. The coordinate system must be compatible with the MOC coordinate system.
        Parameters:
        alpha - in degrees
        delta - in degrees
        Returns:
        true if the coordinates is in one MOC pixel
        Throws:
        java.lang.Exception
      • queryDisc

        public HealpixMoc queryDisc​(HealpixImpl healpix,
                                    double alpha,
                                    double delta,
                                    double radius)
                             throws java.lang.Exception
        Provide Moc pixels totally or partially inside a circle
        Parameters:
        alpha - circle center (in degrees)
        delta - circle center (in degrees)
        radius - circle radius (in degrees)
        Returns:
        an HealpixMox containing the list of pixels
        Throws:
        java.lang.Exception
      • queryCell

        public HealpixMoc queryCell​(int order,
                                    long npix)
                             throws java.lang.Exception
        Throws:
        java.lang.Exception
      • setPixLevel

        public void setPixLevel​(int order,
                                long[] val)
                         throws java.lang.Exception
        Set the pixel list at the specified order (order>13 ) (Dedicated for fast initialisation)
        Throws:
        java.lang.Exception
      • setPixLevel

        public void setPixLevel​(int order,
                                int[] val)
                         throws java.lang.Exception
        Set the pixel list at the specified order (6<=order<=13 ) (Dedicated for fast initialisation)
        Throws:
        java.lang.Exception
      • setPixLevel

        public void setPixLevel​(int order,
                                short[] val)
                         throws java.lang.Exception
        Set the pixel list at the specified order (order<6) (Dedicated for fast initialisation)
        Throws:
        java.lang.Exception
      • getPixLevel

        public long[] getPixLevel​(int order)
        Provide a copy of the pixel list at the specified order (in longs)
      • read

        public void read​(java.lang.String filename)
                  throws java.lang.Exception
        Read HEALPix MOC from a file. Support all MOC syntax: FITS standard or any other old syntax (JSON or ASCII)
        Parameters:
        filename - file name
        Throws:
        java.lang.Exception
      • read

        public void read​(java.lang.String filename,
                         int mode)
                  throws java.lang.Exception
        Deprecated.
        see read(String)
        Read HEALPix MOC from a file.
        Parameters:
        filename - file name
        mode - ASCII, JSON, FITS encoded format
        Throws:
        java.lang.Exception
      • read

        public void read​(java.io.InputStream in)
                  throws java.lang.Exception
        Read HEALPix MOC from a stream Support all MOC syntax: FITS standard or any other old syntax (JSON or ASCII)
        Throws:
        java.lang.Exception
      • read

        public void read​(java.io.InputStream in,
                         int mode)
                  throws java.lang.Exception
        Deprecated.
        see read(InputStream)
        Read HEALPix MOC from a stream.
        Parameters:
        in - input stream
        mode - ASCII, JSON, FITS encoded format
        Throws:
        java.lang.Exception
      • readASCII

        public void readASCII​(java.io.InputStream in)
                       throws java.lang.Exception
        Deprecated.
        see read(InputStream)
        Throws:
        java.lang.Exception
      • readJSON

        public void readJSON​(java.io.InputStream in)
                      throws java.lang.Exception
        Deprecated.
        see read(InputStream)
        Throws:
        java.lang.Exception
      • readFits

        public void readFits​(java.io.InputStream in)
                      throws java.lang.Exception
        Deprecated.
        see read(InputStream)
        Read HEALPix MOC from an Binary FITS stream
        Throws:
        java.lang.Exception
      • write

        public void write​(java.lang.String filename)
                   throws java.lang.Exception
        Write HEALPix MOC to a file
        Parameters:
        filename - name of file
        Throws:
        java.lang.Exception
      • write

        public void write​(java.lang.String filename,
                          int mode)
                   throws java.lang.Exception
        Deprecated.
        Write HEALPix MOC to a file
        Parameters:
        filename - name of file
        mode - encoded format (JSON or FITS)
        Throws:
        java.lang.Exception
      • write

        public void write​(java.io.OutputStream out,
                          int mode)
                   throws java.lang.Exception
        Deprecated.
        Write HEALPix MOC to an output stream
        Parameters:
        out - output stream
        mode - encoded format (JSON or FITS)
        Throws:
        java.lang.Exception
      • writeASCII

        public void writeASCII​(java.io.OutputStream out)
                        throws java.lang.Exception
        Deprecated.
        see write(OutputStream)
        Write HEALPix MOC to an output stream IN JSON encoded format
        Parameters:
        out - output stream
        Throws:
        java.lang.Exception
      • writeJSON

        public void writeJSON​(java.io.OutputStream out)
                       throws java.lang.Exception
        Write HEALPix MOC to an output stream IN JSON encoded format
        Parameters:
        out - output stream
        Throws:
        java.lang.Exception
      • writeFits

        public void writeFits​(java.io.OutputStream out)
                       throws java.lang.Exception
        Write HEALPix MOC to an output stream in FITS encoded format
        Parameters:
        out - output stream
        Throws:
        java.lang.Exception
      • writeFITS

        public void writeFITS​(java.io.OutputStream out)
                       throws java.lang.Exception
        deprecated
        Throws:
        java.lang.Exception
      • addHpix

        protected void addHpix​(java.lang.String s)
                        throws java.lang.Exception
        Throws:
        java.lang.Exception
      • hpix2uniq

        public static long hpix2uniq​(int order,
                                     long npix)
        Code a couple (order,npix) into a unique long integer
        Parameters:
        order - HEALPix order
        npix - HEALPix number
        Returns:
        Uniq long ordering
      • uniq2hpix

        public static long[] uniq2hpix​(long uniq)
        Uncode a long integer into a couple (order,npix)
        Parameters:
        uniq - Uniq long ordering
        Returns:
        HEALPix order,number
      • uniq2hpix

        public static long[] uniq2hpix​(long uniq,
                                       long[] hpix)
        Uncode a long integer into a couple (order,npix)
        Parameters:
        uniq - Uniq long ordering
        hpix - null for reallocating target couple
        Returns:
        HEALPix order,number
      • pow2

        public static final long pow2​(long order)
      • log2

        public static final long log2​(long nside)
      • compareTo

        public int compareTo​(java.lang.Object o)
        Specified by:
        compareTo in interface java.lang.Comparable