public class HealpixMoc extends Object implements Iterable<MocCell>, Cloneable, Comparable
Modifier and Type | Field and 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 String |
VERSION
Healpix MOC API version number
|
Constructor and Description |
---|
HealpixMoc()
HEALPix Multi Order Coverage Map (MOC) creation
|
HealpixMoc(InputStream in)
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
|
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(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
|
Modifier and Type | Method and Description |
---|---|
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.
|
void |
add(int order,
Collection<Long> a)
Add a collection of npix, all of them at the same order.
|
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.
|
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(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(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
|
Object |
clone()
Deep copy
|
int |
compareTo(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(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(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
|
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)
|
String |
getProperty(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(HealpixMoc moc)
Fast test for checking if the parameter MOC is intersecting
the current MOC object
|
boolean |
isIntersecting(int order,
long npix)
Fast test for checking if the cell is intersecting
the current MOC object
|
boolean |
isInTree(HealpixMoc moc)
Deprecated.
see isIntersecting(...)
|
boolean |
isInTree(int order,
long npix)
Deprecated.
see isIntersecting(...)
|
boolean |
isSorted()
Return true if all Moc level is sorted
|
Iterator<MocCell> |
iterator()
Provide an Iterator on the MOC pixel List.
|
static long |
log2(long nside) |
Iterator<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(InputStream in)
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 |
readASCII(InputStream in)
Deprecated.
see read(InputStream)
|
void |
readFits(InputStream in)
Deprecated.
see read(InputStream)
|
void |
readJSON(InputStream in)
Deprecated.
see read(InputStream)
|
void |
setCheckConsistencyFlag(boolean flag)
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 (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(String key,
String value)
MOC propertie setter
|
void |
sort()
Sort each level of the Moc
|
HealpixMoc |
subtraction(HealpixMoc moc) |
String |
todebug() |
void |
toHealpixMoc() |
void |
toRangeSet() |
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(OutputStream out,
int mode)
Deprecated.
|
void |
write(String filename)
Write HEALPix MOC to a file
|
void |
write(String filename,
int mode)
Deprecated.
|
void |
writeASCII(OutputStream out)
Deprecated.
see write(OutputStream)
|
void |
writeFits(OutputStream out)
Write HEALPix MOC to an output stream in FITS encoded format
|
void |
writeFITS(OutputStream out)
deprecated
|
void |
writeJSON(OutputStream out)
Write HEALPix MOC to an output stream IN JSON encoded format
|
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
public static final String VERSION
public static final int FITS
public static final int JSON
public static final int ASCII
public static final int JSON0
public static final int MAXORDER
public static final int SHORT
public static final int INT
public static final int LONG
public healpix.essentials.RangeSet rangeSet
public HealpixMoc()
public HealpixMoc(int maxLimitOrder) throws Exception
Exception
public HealpixMoc(int minLimitOrder, int maxLimitOrder) throws Exception
Exception
public HealpixMoc(String coordSys, int minLimitOrder, int maxLimitOrder) throws Exception
Exception
public HealpixMoc(String s) throws Exception
s
- list of MOC pixelsException
public HealpixMoc(InputStream in) throws Exception
in
- input streamException
public HealpixMoc(InputStream in, int mode) throws Exception
in
- input streammode
- ASCII - ASCII encoded format, JSON encoded format, FITS - Fits encoded formatException
public static int getType(int order)
public void clear()
public void setMinLimitOrder(int limitOrder) throws Exception
Exception
public void setMocOrder(int order) throws Exception
Exception
public void setMaxLimitOrder(int limitOrder) throws Exception
Exception
public int getMinLimitOrder()
public int getMaxLimitOrder()
public int getMocOrder()
public void setMocOrder(String mocOrder) throws Exception
mocOrder
- MOC order (best cells order)Exception
public int getLimitOrder()
public void setLimitOrder(int limitOrder) throws Exception
Exception
public String getCoordSys()
public void setCoordSys(String coordSys)
protected void setCurrentOrder(int order)
public int getSize()
public long getMem()
public long getMem(int order)
public int getSize(int order)
public Array getArray(int order)
public double getAngularRes()
public int getMaxOrder()
public void setCheckConsistencyFlag(boolean flag) throws Exception
flag
- Exception
public int getDescendantOrder(int order, long npix)
public void add(String s) throws Exception
Exception
setCheckUnicity(..)
public void add(HealpixMoc moc) throws Exception
moc
- The Moc to be addedException
public void add(int order, long[] npixs) throws Exception
order
- order of insertionnpixs
- list of npix to be insertedException
public void add(int order, Collection<Long> a) throws Exception
order
- order of insertionnpixs
- list of npix to be insertedException
public boolean add(MocCell cell) throws Exception
cell
- Moc cellException
public boolean add(HealpixImpl healpix, double alpha, double delta) throws Exception
alpha,
- delta positionException
public boolean add(int order, long npix) throws Exception
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 doneException
public void delete(String s)
public boolean delete(int order, long npix)
order
- HEALPix ordernpix
- Healpix numberpublic boolean deleteDescendant(int order, long npix)
order
- npix
- public void sort()
public boolean isSorted()
public boolean isInTree(int order, long npix)
public boolean isInTree(HealpixMoc moc)
public void checkAndFix() throws Exception
Exception
public boolean isAscendant(int order, long npix)
public boolean isDescendant(int order, long npix)
public boolean isIn(int order, long npix)
public void setProperty(String key, String value) throws Exception
key
- => MOCORDER, COORDSYS, MOCTOOL, MOCTYPE, MOCID, DATE, ORIGIN, EXTNAMEvalue
- Exception
public String getProperty(String key)
key
- public double getCoverage()
public long getUsedArea()
public long getArea()
public Iterator<MocCell> iterator()
public Iterator<Long> pixelIterator()
public void trim()
public String todebug()
public void toRangeSet()
public boolean isIntersecting(int order, long npix)
public boolean isIntersecting(HealpixMoc moc)
public boolean isIncluding(HealpixMoc moc)
public HealpixMoc union(HealpixMoc moc) throws Exception
Exception
public HealpixMoc intersection(HealpixMoc moc) throws Exception
Exception
public HealpixMoc subtraction(HealpixMoc moc) throws Exception
Exception
public HealpixMoc complement() throws Exception
Exception
public HealpixMoc difference(HealpixMoc moc) throws Exception
Exception
public boolean isAllSky()
public boolean isEmpty()
public boolean contains(HealpixImpl healpix, double alpha, double delta) throws Exception
alpha
- in degreesdelta
- in degreesException
public HealpixMoc queryDisc(HealpixImpl healpix, double alpha, double delta, double radius) throws Exception
alpha
- circle center (in degrees)delta
- circle center (in degrees)radius
- circle radius (in degrees)Exception
public HealpixMoc queryCell(int order, long npix) throws Exception
Exception
public void setPixLevel(int order, long[] val) throws Exception
Exception
public void setPixLevel(int order, int[] val) throws Exception
Exception
public void setPixLevel(int order, short[] val) throws Exception
Exception
public long[] getPixLevel(int order)
public void read(String filename) throws Exception
filename
- file nameException
public void read(String filename, int mode) throws Exception
filename
- file namemode
- ASCII, JSON, FITS encoded formatException
public void read(InputStream in) throws Exception
Exception
public void read(InputStream in, int mode) throws Exception
in
- input streammode
- ASCII, JSON, FITS encoded formatException
public void readASCII(InputStream in) throws Exception
Exception
public void readJSON(InputStream in) throws Exception
Exception
public void readFits(InputStream in) throws Exception
Exception
public void write(String filename) throws Exception
filename
- name of fileException
public void write(String filename, int mode) throws Exception
filename
- name of filemode
- encoded format (JSON or FITS)Exception
public void write(OutputStream out, int mode) throws Exception
out
- output streammode
- encoded format (JSON or FITS)Exception
public void writeASCII(OutputStream out) throws Exception
out
- output streamException
public void writeJSON(OutputStream out) throws Exception
out
- output streamException
public void writeFits(OutputStream out) throws Exception
out
- output streamException
public void writeFITS(OutputStream out) throws Exception
Exception
public static long hpix2uniq(int order, long npix)
order
- HEALPix ordernpix
- HEALPix numberpublic static long[] uniq2hpix(long uniq)
uniq
- Uniq long orderingpublic static long[] uniq2hpix(long uniq, long[] hpix)
uniq
- Uniq long orderinghpix
- null for reallocating target couplepublic static final long pow2(long order)
public static final long log2(long nside)
public int compareTo(Object o)
compareTo
in interface Comparable