Package cds.moc
Class HealpixMoc
java.lang.Object
cds.moc.HealpixMoc
- All Implemented Interfaces:
Cloneable,Comparable,Iterable<MocCell>
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
FieldsModifier and TypeFieldDescriptionstatic final intASCII encoding format (IVOA REC 1.0 suggestion)static final intFITS encoding format (IVOA REC 1.0 compliante)static final intstatic final intJSON encoding format (IVOA REC 1.0 suggestion)static final intJSON obsoleted encoding format (only reading supported for compatibility)static final intstatic final intMaximal HEALPix order supported by the libraryhealpix.essentials.RangeSetOperations on MOCsstatic final intstatic final StringHealpix MOC API version number -
Constructor Summary
ConstructorsConstructorDescriptionHEALPix Multi Order Coverage Map (MOC) creationHealpixMoc(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 streamHealpixMoc(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 formatHealpixMoc(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(String coordSys, int minLimitOrder, int maxLimitOrder) Deprecated.Standard MOC must be equatorial -
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(int order, long npix) Add a MOC pixel Recursive addition : since with have the 3 brothers, we remove them and add recursively their fathervoidadd(int order, long[] npixs) Add a collection of npix, all of them at the same order.voidadd(int order, Collection<Long> a) Add a collection of npix, all of them at the same order.booleanadd(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 fathervoidadd(HealpixMoc moc) Add directly a full Moc.booleanAdd a Moc pixel Recursive addition : since with have the 3 brothers, we remove them and add recursively their fathervoidAdd 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 voidvoidCheck 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 ]voidclear()Clear the MOCclone()Deep copyintbooleancontains(HealpixImpl healpix, double alpha, double delta) Check if the spherical coord is inside the MOC.booleandelete(int order, long npix) Remove a MOC pixelvoidremove a list of MOC pixels provided in a string format (ex: "order1/npix1-npix2 npix3 ...booleandeleteDescendant(int order, long npix) Remove all descendants of a MOC Pixeldifference(HealpixMoc moc) booleanEquality testdoubleProvide the angular resolution (in degrees) of the MOC (sqrt of the smallest pixel area)longgetArea()return the area of the Moc computed in pixels at the most low levelgetArray(int order) Provide the Array of a dedicated orderReturn the coordinate system (HEALPix convention: G-galactic, C-Equatorial, E-Ecliptic)doubleReturn the fraction of the sky covered by the Moc [0..1]intgetDescendantOrder(int order, long npix) return the order of the first descendant, otherwise -1intDeprecated.see getMaxLimitOrder()intDeprecated.see getMocOrder()intProvide the greatest order really used by the MOC WARNING: use getMocOrder() to know the MOC resolutionlonggetMem()Return approximatively the memory used for this moc (in bytes)longgetMem(int order) Provide the memory used for a dedicated orderintProvide the minimal limit order supported by the Moc (by default 0)intProvide the MOC order.long[]getPixLevel(int order) Provide a copy of the pixel list at the specified order (in longs)getProperty(String key) Provide MOC property value.intgetSize()Provide the number of Healpix pixels (for all MOC orders)intgetSize(int order) Provide the number of Healpix pixels for a dedicated orderstatic intgetType(int order) Provide the integer type for a given orderlongReturn the number of low level pixels of the Mocstatic longhpix2uniq(int order, long npix) Code a couple (order,npix) into a unique long integerintersection(HealpixMoc moc) booleanisAllSky()Return true if the MOC covers the whole skybooleanisAscendant(int order, long npix) True is the MOC pixel is an ascendantbooleanisDescendant(int order, long npix) True if the MOC pixel is a descendantbooleanisEmpty()Return true if the MOC is emptybooleanisIn(int order, long npix) True if the MOC pixel is present at this orderbooleanisIncluding(HealpixMoc moc) Fast test for checking if the parameter MOC is totally inside the current MOC objectbooleanisIntersecting(int order, long npix) Fast test for checking if the cell is intersecting the current MOC objectbooleanisIntersecting(HealpixMoc moc) Fast test for checking if the parameter MOC is intersecting the current MOC objectbooleanisInTree(int order, long npix) Deprecated.see isIntersecting(...)booleanisInTree(HealpixMoc moc) Deprecated.see isIntersecting(...)booleanisSorted()Return true if all Moc level is sortediterator()Provide an Iterator on the MOC pixel List.static final longlog2(long nside) Provide an Iterator on the low level pixel list covering all the MOC area.static final longpow2(long order) queryCell(int order, long npix) queryDisc(HealpixImpl healpix, double alpha, double delta, double radius) Provide Moc pixels totally or partially inside a circlevoidread(InputStream in) Read HEALPix MOC from a stream Support all MOC syntax: FITS standard or any other old syntax (JSON or ASCII)voidread(InputStream in, int mode) Deprecated.see read(InputStream)voidRead HEALPix MOC from a file.voidDeprecated.see read(String)voidreadASCII(InputStream in) Deprecated.see read(InputStream)voidreadFits(InputStream in) Deprecated.see read(InputStream)voidreadJSON(InputStream in) Deprecated.see read(InputStream)voidsetCheckConsistencyFlag(boolean flag) Set the check consistency flag.voidsetCoordSys(String coordSys) Deprecated.Standard MOC must be equatorialprotected voidsetCurrentOrder(int order) voidsetLimitOrder(int limitOrder) Deprecated.see setMaxLimitOrder()voidsetMaxLimitOrder(int limitOrder) Deprecated.see setMocOrder(int)voidsetMinLimitOrder(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.voidsetMocOrder(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.voidsetMocOrder(String mocOrder) Set the MOC order.voidsetPixLevel(int order, int[] val) Set the pixel list at the specified order (6invalid input: '<'=orderinvalid input: '<'=13 ) (Dedicated for fast initialisation)voidsetPixLevel(int order, long[] val) Set the pixel list at the specified order (order>13 ) (Dedicated for fast initialisation)voidsetPixLevel(int order, short[] val) Set the pixel list at the specified order (orderinvalid input: '<'6) (Dedicated for fast initialisation)voidsetProperty(String key, String value) MOC propertie settervoidsort()Sort each level of the Mocsubtraction(HealpixMoc moc) todebug()voidvoidtoString()voidtrim()Remove all the unused space (allocation reservation)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)voidwrite(OutputStream out, int mode) Deprecated.voidWrite HEALPix MOC to a filevoidDeprecated.voidwriteASCII(OutputStream out) Deprecated.see write(OutputStream)voidwriteFits(OutputStream out) Write HEALPix MOC to an output stream in FITS encoded formatvoidwriteFITS(OutputStream out) deprecatedvoidwriteJSON(OutputStream out) Write HEALPix MOC to an output stream IN JSON encoded formatMethods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
VERSION
Healpix MOC API version number- See Also:
-
FITS
public static final int FITSFITS encoding format (IVOA REC 1.0 compliante)- See Also:
-
JSON
public static final int JSONJSON encoding format (IVOA REC 1.0 suggestion)- See Also:
-
ASCII
public static final int ASCIIASCII encoding format (IVOA REC 1.0 suggestion)- See Also:
-
JSON0
public static final int JSON0JSON obsoleted encoding format (only reading supported for compatibility)- See Also:
-
MAXORDER
public static final int MAXORDERMaximal 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 rangeSetOperations on MOCs
-
-
Constructor Details
-
HealpixMoc
public HealpixMoc()HEALPix Multi Order Coverage Map (MOC) creation -
HealpixMoc
Moc Creation with a specified max limitOrder (by default 29)- Throws:
Exception
-
HealpixMoc
Moc Creation with a specified min and max limitOrder (by default 0..29)- Throws:
Exception
-
HealpixMoc
Deprecated.Standard MOC must be equatorialMoc Creation with a specified min and max limitOrder (by default 0..29)- Throws:
Exception
-
HealpixMoc
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
HEALPix Multi Order Coverage Map (MOC) creation and initialisation via a stream- Parameters:
in- input stream- Throws:
Exception
-
HealpixMoc
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 streammode- 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
Deep copy -
setMinLimitOrder
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
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
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
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
Deprecated.see setMaxLimitOrder()- Throws:
Exception
-
getCoordSys
Return the coordinate system (HEALPix convention: G-galactic, C-Equatorial, E-Ecliptic) -
setCoordSys
Deprecated.Standard MOC must be equatorialSpecify 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
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
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
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
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
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 insertionnpixs- list of npix to be inserted- Throws:
Exception
-
add
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 insertionnpixs- list of npix to be inserted- Throws:
Exception
-
add
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
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
Add a MOC pixel Recursive addition : since with have the 3 brothers, we remove them and add recursively their father- Parameters:
order- HEALPix ordernpix- 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
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 ordernpix- 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
Deprecated.see isIntersecting(...)Fast test for checking if the parameter MOC is intersecting the current MOC object -
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 ]- 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
MOC propertie setter- Parameters:
key- => MOCORDER, COORDSYS, MOCTOOL, MOCTYPE, MOCID, DATE, ORIGIN, EXTNAMEvalue-- Throws:
Exception
-
getProperty
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
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 -
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
-
toString
-
toRangeSet
public void toRangeSet() -
toHealpixMoc
- 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
Fast test for checking if the parameter MOC is intersecting the current MOC object- Returns:
- true if the intersection is not null
-
isIncluding
Fast test for checking if the parameter MOC is totally inside the current MOC object- Returns:
- true if MOC is totally inside
-
union
- Throws:
Exception
-
intersection
- Throws:
Exception
-
subtraction
- Throws:
Exception
-
complement
- Throws:
Exception
-
difference
- 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
Equality test -
contains
Check if the spherical coord is inside the MOC. The coordinate system must be compatible with the MOC coordinate system.- Parameters:
alpha- in degreesdelta- 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
- Throws:
Exception
-
setPixLevel
Set the pixel list at the specified order (order>13 ) (Dedicated for fast initialisation)- Throws:
Exception
-
setPixLevel
Set the pixel list at the specified order (6invalid input: '<'=orderinvalid input: '<'=13 ) (Dedicated for fast initialisation)- Throws:
Exception
-
setPixLevel
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
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
Deprecated.see read(String)Read HEALPix MOC from a file.- Parameters:
filename- file namemode- ASCII, JSON, FITS encoded format- Throws:
Exception
-
read
Read HEALPix MOC from a stream Support all MOC syntax: FITS standard or any other old syntax (JSON or ASCII)- Throws:
Exception
-
read
Deprecated.see read(InputStream)Read HEALPix MOC from a stream.- Parameters:
in- input streammode- ASCII, JSON, FITS encoded format- Throws:
Exception
-
readASCII
Deprecated.see read(InputStream)- Throws:
Exception
-
readJSON
Deprecated.see read(InputStream)- Throws:
Exception
-
readFits
Deprecated.see read(InputStream)Read HEALPix MOC from an Binary FITS stream- Throws:
Exception
-
write
Write HEALPix MOC to a file- Parameters:
filename- name of file- Throws:
Exception
-
write
Deprecated.Write HEALPix MOC to a file- Parameters:
filename- name of filemode- encoded format (JSON or FITS)- Throws:
Exception
-
write
Deprecated.Write HEALPix MOC to an output stream- Parameters:
out- output streammode- encoded format (JSON or FITS)- Throws:
Exception
-
writeASCII
Deprecated.see write(OutputStream)Write HEALPix MOC to an output stream IN JSON encoded format- Parameters:
out- output stream- Throws:
Exception
-
writeJSON
Write HEALPix MOC to an output stream IN JSON encoded format- Parameters:
out- output stream- Throws:
Exception
-
writeFits
Write HEALPix MOC to an output stream in FITS encoded format- Parameters:
out- output stream- Throws:
Exception
-
writeFITS
deprecated- Throws:
Exception
-
addHpix
- Throws:
Exception
-
hpix2uniq
public static long hpix2uniq(int order, long npix) Code a couple (order,npix) into a unique long integer- Parameters:
order- HEALPix ordernpix- 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 orderinghpix- 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
- Specified by:
compareToin interfaceComparable
-