Package cds.moc

Class HealpixMoc

java.lang.Object
cds.moc.HealpixMoc
All Implemented Interfaces:
Cloneable, Comparable, Iterable<MocCell>

public class HealpixMoc extends Object implements Iterable<MocCell>, Cloneable, 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 final int
    ASCII encoding format (IVOA REC 1.0 suggestion)
    static final int
    FITS encoding format (IVOA REC 1.0 compliante)
    static final int
     
    static final int
    JSON encoding format (IVOA REC 1.0 suggestion)
    static final int
    JSON obsoleted encoding format (only reading supported for compatibility)
    static final int
     
    static final int
    Maximal HEALPix order supported by the library
    healpix.essentials.RangeSet
    Operations on MOCs
    static final int
     
    static final String
    Healpix MOC API version number
  • Constructor Summary

    Constructors
    Constructor
    Description
    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)
    HEALPix Multi Order Coverage Map (MOC) creation and initialisation via a stream
    HealpixMoc(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
    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(String coordSys, int minLimitOrder, int maxLimitOrder)
    Deprecated.
    Standard MOC must be equatorial
  • Method Summary

    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, Collection<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 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 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
     
    void
    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 the MOC
    Deep copy
    int
     
     
    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
    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
     
    boolean
    Equality test
    double
    Provide the angular resolution (in degrees) of the MOC (sqrt of the smallest pixel area)
    long
    return the area of the Moc computed in pixels at the most low level
    getArray(int order)
    Provide the Array of a dedicated order
    Return the coordinate system (HEALPix convention: G-galactic, C-Equatorial, E-Ecliptic)
    double
    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
    Deprecated.
    see getMaxLimitOrder()
    int
    Deprecated.
    see getMocOrder()
    int
    Provide the greatest order really used by the MOC WARNING: use getMocOrder() to know the MOC resolution
    long
    Return approximatively the memory used for this moc (in bytes)
    long
    getMem(int order)
    Provide the memory used for a dedicated order
    int
    Provide the minimal limit order supported by the Moc (by default 0)
    int
    Provide the MOC order.
    long[]
    getPixLevel(int order)
    Provide a copy of the pixel list at the specified order (in longs)
    Provide MOC property value.
    int
    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
    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
     
    boolean
    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
    Return true if the MOC is empty
    boolean
    isIn(int order, long npix)
    True if the MOC pixel is present at this order
    boolean
    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
    Fast test for checking if the parameter MOC is intersecting the current MOC object
    boolean
    isInTree(int order, long npix)
    Deprecated.
    see isIntersecting(...)
    boolean
    Deprecated.
    see isIntersecting(...)
    boolean
    Return true if all Moc level is sorted
    Provide an Iterator on the MOC pixel List.
    static final long
    log2(long nside)
     
    Provide an Iterator on the low level pixel list covering all the MOC area.
    static final long
    pow2(long order)
     
    queryCell(int order, long npix)
     
    queryDisc(HealpixImpl healpix, double alpha, double delta, double radius)
    Provide Moc pixels totally or partially inside a circle
    void
    Read HEALPix MOC from a stream Support all MOC syntax: FITS standard or any other old syntax (JSON or ASCII)
    void
    read(InputStream in, int mode)
    Deprecated.
    see read(InputStream)
    void
    read(String filename)
    Read HEALPix MOC from a file.
    void
    read(String filename, int mode)
    Deprecated.
    see read(String)
    void
    Deprecated.
    see read(InputStream)
    void
    Deprecated.
    see read(InputStream)
    void
    Deprecated.
    see read(InputStream)
    void
    Set the check consistency flag.
    void
    setCoordSys(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(String mocOrder)
    Set the MOC order.
    void
    setPixLevel(int order, int[] val)
    Set the pixel list at the specified order (6invalid input: '<'=orderinvalid input: '<'=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 (orderinvalid input: '<'6) (Dedicated for fast initialisation)
    void
    setProperty(String key, String value)
    MOC propertie setter
    void
    Sort each level of the Moc
     
     
    void
     
    void
     
     
    void
    Remove all the unused space (allocation reservation)
     
    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(OutputStream out, int mode)
    Deprecated. 
    void
    write(String filename)
    Write HEALPix MOC to a file
    void
    write(String filename, int mode)
    Deprecated. 
    void
    Deprecated.
    see write(OutputStream)
    void
    Write HEALPix MOC to an output stream in FITS encoded format
    void
    deprecated
    void
    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 Details

    • VERSION

      public static final String VERSION
      Healpix MOC API version number
      See Also:
    • FITS

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

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

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

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

      public static final int MAXORDER
      Maximal HEALPix order supported by the library
      See Also:
    • SHORT

      public static final int SHORT
      See Also:
    • INT

      public static final int INT
      See Also:
    • LONG

      public static final int LONG
      See Also:
    • rangeSet

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

    • HealpixMoc

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

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

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

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

      public HealpixMoc(String s) throws 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:
      Exception
    • HealpixMoc

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

      public HealpixMoc(InputStream in, int mode) throws 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:
      Exception
  • Method Details

    • getType

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

      public void clear()
      Clear the MOC
    • clone

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

      public void setMinLimitOrder(int limitOrder) throws 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:
      Exception
    • setMocOrder

      public void setMocOrder(int order) throws 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:
      Exception
    • setMaxLimitOrder

      public void setMaxLimitOrder(int limitOrder) throws 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:
      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(String mocOrder) throws 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:
      Exception
    • getLimitOrder

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

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

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

      public void setCoordSys(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 Exception
      Set the check consistency flag. "true" by default => redundancy check and hierarchy consistency check during addition (=> slower)
      Parameters:
      flag -
      Throws:
      Exception
    • getDescendantOrder

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

      public void add(String s) throws 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:
      Exception
    • add

      public void add(HealpixMoc moc) throws 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:
      Exception
    • add

      public void add(int order, long[] npixs) throws 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:
      Exception
    • add

      public void add(int order, Collection<Long> a) throws 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:
      Exception
    • add

      public boolean add(MocCell cell) throws 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:
      Exception
    • add

      public boolean add(HealpixImpl healpix, double alpha, double delta) throws 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:
      Exception
    • add

      public boolean add(int order, long npix) throws 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:
      Exception
    • delete

      public void delete(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 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:
      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(String key, String value) throws Exception
      MOC propertie setter
      Parameters:
      key - => MOCORDER, COORDSYS, MOCTOOL, MOCTYPE, MOCID, DATE, ORIGIN, EXTNAME
      value -
      Throws:
      Exception
    • getProperty

      public String getProperty(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 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 Iterable<MocCell>
    • pixelIterator

      public Iterator<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 String todebug()
    • toString

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

      public void toRangeSet()
    • toHealpixMoc

      public void toHealpixMoc() throws Exception
      Throws:
      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 Exception
      Throws:
      Exception
    • intersection

      public HealpixMoc intersection(HealpixMoc moc) throws Exception
      Throws:
      Exception
    • subtraction

      public HealpixMoc subtraction(HealpixMoc moc) throws Exception
      Throws:
      Exception
    • complement

      public HealpixMoc complement() throws Exception
      Throws:
      Exception
    • difference

      public HealpixMoc difference(HealpixMoc moc) throws Exception
      Throws:
      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(Object moc)
      Equality test
      Overrides:
      equals in class Object
    • contains

      public boolean contains(HealpixImpl healpix, double alpha, double delta) throws 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:
      Exception
    • queryDisc

      public HealpixMoc queryDisc(HealpixImpl healpix, double alpha, double delta, double radius) throws 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:
      Exception
    • queryCell

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

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

      public void setPixLevel(int order, int[] val) throws Exception
      Set the pixel list at the specified order (6invalid input: '<'=orderinvalid input: '<'=13 ) (Dedicated for fast initialisation)
      Throws:
      Exception
    • setPixLevel

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

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

      public void read(String filename) throws 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:
      Exception
    • read

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

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

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

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

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

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

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

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

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

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

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

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

      public void writeFITS(OutputStream out) throws Exception
      deprecated
      Throws:
      Exception
    • addHpix

      protected void addHpix(String s) throws Exception
      Throws:
      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(Object o)
      Specified by:
      compareTo in interface Comparable