pax_global_header 0000666 0000000 0000000 00000000064 13154006152 0014507 g ustar 00root root 0000000 0000000 52 comment=447a7be073876dba32d1c6be811eebc48255c844
eag-HEALPix-master/ 0000775 0000000 0000000 00000000000 13154006152 0014270 5 ustar 00root root 0000000 0000000 eag-HEALPix-master/.classpath 0000664 0000000 0000000 00000000334 13154006152 0016253 0 ustar 00root root 0000000 0000000
eag-HEALPix-master/.project 0000664 0000000 0000000 00000000562 13154006152 0015742 0 ustar 00root root 0000000 0000000
eag-HEALPIXorg.eclipse.jdt.core.javabuilderorg.eclipse.jdt.core.javanature
eag-HEALPix-master/Licence.txt 0000664 0000000 0000000 00000024527 13154006152 0016405 0 ustar 00root root 0000000 0000000 GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, “this License” refers to version 3 of the GNU Lesser
General Public License, and the “GNU GPL” refers to version 3 of the GNU
General Public License.
The Library refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An Application is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A Combined Work is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the Linked
Version.
The Minimal Corresponding Source for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The Corresponding Application Codefor a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License “or any later version”
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
eag-HEALPix-master/Readme.txt 0000664 0000000 0000000 00000000406 13154006152 0016226 0 ustar 00root root 0000000 0000000
Provides source code of java tools compatible with HEALPIX methods to work
with sky pixelization.
AUTHOR:
Nikolay Kuropatkin kuropat@fnal.gov
Java docs of all included classes are in doc subdirectory
eag-HEALPix-master/doc/ 0000775 0000000 0000000 00000000000 13154006152 0015035 5 ustar 00root root 0000000 0000000 eag-HEALPix-master/doc/PixTools.html 0000664 0000000 0000000 00000011513 13154006152 0017505 0 ustar 00root root 0000000 0000000
PixTools
HEALPix PixTools.java
The package gov.fnal.eag.healpix contains four classes -
PixTools.java , Region.java, service classes BitManipulation.java, and PixInfo.java
These classes in general are translation of the corresponding HEALPix FORTRAN90
programs to Java.
The translation is not straight forward, but included junit tests have
validated the package.
The Package Overview.
The package creates sky pixelization to a specified resolution.
The original FORTRAN version has natural limit imposed by HEALPix to the number of
pixels Npix = 12 x N^2, where N the number of sides is an integer
power of 2 and <= 8192 (Npix ~ 8.0E8)
The presented Java version overcomes this limitation boosting the
resolution to about 0.2 arcsec (Npix ~ 1.3E13) which seems to be sufficient for modern experiments
like SNAP
These tools permit creation of HEALPix maps as well as use
of existing maps. There are tools to translate sky coordinates (Ra, Dec) to
a pixel number, and to generate a list of neighboring pixels within some specified
radius. More complicated queries are also supported.
The new class Region was added to the package. The class permits to define
a rectangular area on the sphere providing standard ra,dec (Right ascension and Declination) limits of the area.
Provided methods permits to pixelize the area with specified size of pixels.
To download the self-installing jar file click here.
To install these jar files and the package documentation use command:
java -jar eag-HEALPix.jar
This will create in the installation directory two jar files (vecmath.jar, PixTools.jar) and the "doc" subdirectory.
Optimization.
Working with highest resolution is time consuming and can be prohibitive.
There is an optimized version of this package giving significant improvement in some cases. This version
was developed by Jan Kotek, and can be found here.
06/14/2005 Nikolay Kuropatkin.
12/19/2007 Nikolay Kuropatkin.
04/11/2008 Nikolay Kuropatkin.
07/09/2008 Nikolay Kuropatkin. Bug fixed in inRing method
02/09/2010 Nikolay Kuropatkin. Bug was found by Jan Kotek in Query-disc with search
radius smaller than the pixel size. Fixed.
11 Jan 2012 Nikolay Kuropatkin. Make the BitManipulation a static class.
11 Jan 2012 modifications were proposed and implemented by Mark Taylor to make the package thread safe.
All methods are thread safe now. This class can be used as a singleton,
the singleton instance being available from the getInstance method.
For compatibility with previous versions however it is possible to
construct new instances using the default constructor.
Unit tests showing various methods of using the class are provided.
28 Jul 2012 Nikolay Kuropatkin. To address some silly test of QuertyDisc method
when two close points over the pole are missing each other in inclusive search the radius modification
for inclusive search was changed.
As the pixel shape is changing toward the pole from almost square to triangular the radius modifier should grow.
In normal case close to equator the modifier is chosen to be half of the angular size of
the pixel. Now the modifier is a function of the z component of unit vector pointing in the center of disc.
The modifier value M=a+abs(z)*a, where a is half pixel size.
In this case no changes in the QueryDisc behavior in the equatorial area is expected,
while in the polar area one can expect increased number of pixels returned in the
inclusive search. The maximum number of additional pixels can be estimated as
2*PI*(radius + M)/(2*a).
eag-HEALPix-master/doc/allclasses-frame.html 0000664 0000000 0000000 00000005340 13154006152 0021143 0 ustar 00root root 0000000 0000000
All Classes (javadoc for PixTools)
contains methods translated from HEALPix Fortran90
with increased map resolution in comparison to original Fortran code.
Author:
N Kuropatkin
Created on Mar 10, 2005
Modified on December 18 2007
Corrected arithmetic and mistyping April 20 2008, Mark Taylor made modifications to make the class thread safe 11-Jan-2012
All methods are thread safe. This class can be used as a singleton,
the singleton instance being available from the getInstance() method.
For compatibility with previous versions however it is possible to
construct new instances using the default constructor.
renders the pixel number pix (NESTED scheme) for a pixel which contains a
point on a sphere at coordinates theta and phi, given map resolution
parameter nside.
renders the pixel number ipix (RING scheme) for a pixel which contains a
point with coordinates theta and phi, given the map resolution parameter
nside.
calculates vector corresponding to angles theta (co-latitude
measured from North pole, in [0,pi] radians) phi (longitude measured
eastward in [0,2pi] radians) North pole is (x,y,z) = (0, 0, 1)
calculate requared nside given pixel size in arcsec
java.util.ArrayList
InRing(long nside,
long iz,
double phi0,
double dphi,
boolean nest)
returns the list of pixels in RING or NEST scheme with latitude in [phi0 -
dpi, phi0 + dphi] on the ring iz in [1, 4*nside -1 ] The pixel id numbers
are in [0, 12*nside^2 - 1] the indexing is in RING, unless nest is set to
1
computes the intersection di of 2 intervals d1 (= [a1,b1])
and d2 (= [a2,b2]) on the periodic domain (=[A,B] where A and B
arbitrary) ni is the resulting number of intervals (0,1, or 2) if a1 b1 then d1 = {x | a1 <=x <= B U A <=x
<=b1}
returns 7 or 8 neighbours of any pixel in the nested scheme The neighbours
are ordered in the following way: First pixel is the one to the south (
the one west of the south direction is taken for pixels that don't have a
southern neighbour).
returns ra, dec in degrees given polar coordinates in radians
java.util.ArrayList
query_disc(long nside,
javax.vecmath.Vector3d vector,
double radius,
int nest,
int inclusive)
generates in the RING or NESTED scheme all pixels that lays within an
angular distance Radius of the center.
java.util.ArrayList
query_polygon(long nside,
java.util.ArrayList vlist,
long nest,
long inclusive)
finds pixels that lay within a CONVEX polygon defined by its vertex on
sphere
java.util.ArrayList
query_strip(long nside,
double theta1,
double theta2,
long nest)
finds pixels having a colatitude (measured from North pole) :
theta1 < colatitude < theta2 with 0 <= theta1 < theta2 <= Pi
if theta2 < theta1
then pixels with 0 <= colatitude < theta2 or theta1 < colatitude < Pi are
returned
java.util.ArrayList
query_triangle(long nside,
javax.vecmath.Vector3d v1,
javax.vecmath.Vector3d v2,
javax.vecmath.Vector3d v3,
long nest,
long inclusive)
generates a list of pixels that lay inside a triangle defined by
the three vertex vectors
calculates the surface of spherical triangle defined by
vertices v1,v2,v3 Algorithm: finds triangle sides and uses l'Huilier
formula to compute "spherical excess" = surface area of triangle on a
sphere of radius one see, eg Bronshtein, Semendyayev Eq 2.86 half
perimeter hp = 0.5*(side1+side2+side3) l'Huilier formula x0 = tan( hp/2.)
x1 = tan((hp - side1)/2.) x2 = tan((hp - side2)/2.) x3 = tan((hp -
side3)/2.)
converts a Vector3d in a tuple of angles tup[0] = theta
co-latitude measured from North pole, in [0,PI] radians, tup[1] = phi
longitude measured eastward, in [0,2PI] radians
renders the pixel number pix (NESTED scheme) for a pixel which contains a
point on a sphere at coordinate vector (x,y,z), given the map resolution
parameter nside.
renders the pixel number ipix (RING scheme) for a pixel which contains a
point on a sphere at coordinate vector (x,y,z), given the map resolution
parameter nside
public java.util.ArrayList query_strip(long nside,
double theta1,
double theta2,
long nest)
throws java.lang.Exception
finds pixels having a colatitude (measured from North pole) :
theta1 < colatitude < theta2 with 0 <= theta1 < theta2 <= Pi
if theta2 < theta1
then pixels with 0 <= colatitude < theta2 or theta1 < colatitude < Pi are
returned
Parameters:
nside - long the map resolution parameter
theta1 - lower edge of the colatitude
theta2 - upper edge of the colatitude
nest - long if = 1 result is in NESTED scheme
Returns:
ArrayList of pixel numbers (long)
Throws:
java.lang.Exception
java.lang.IllegalArgumentException
query_polygon
public java.util.ArrayList query_polygon(long nside,
java.util.ArrayList vlist,
long nest,
long inclusive)
throws java.lang.Exception
finds pixels that lay within a CONVEX polygon defined by its vertex on
sphere
Parameters:
nside - the map resolution
vlist - ArrayList of vectors defining the polygon vertices
nest - if set to 1 use NESTED scheme
inclusive - if set 1 returns all pixels crossed by polygon boundaries
Returns:
ArrayList of pixels
algorithm: the polygon is divided into triangles vertex 0 belongs to all
triangles
Throws:
java.lang.Exception
java.lang.IllegalArgumentException
query_triangle
public java.util.ArrayList query_triangle(long nside,
javax.vecmath.Vector3d v1,
javax.vecmath.Vector3d v2,
javax.vecmath.Vector3d v3,
long nest,
long inclusive)
throws java.lang.Exception
generates a list of pixels that lay inside a triangle defined by
the three vertex vectors
Parameters:
nside - long map resolution parameter
v1 - Vector3d defines one vertex of the triangle
v2 - Vector3d another vertex
v3 - Vector3d yet another one
nest - long 0 (default) RING numbering scheme, if set to 1 the NESTED
scheme will be used.
inclusive - long 0 (default) only pixels whose centers are inside the
triangle will be listed, if set to 1 all pixels overlaping the
triangle will be listed
Returns:
ArrayList with pixel numbers
Throws:
java.lang.Exception
java.lang.IllegalArgumentException
intrs_intrv
public double[] intrs_intrv(double[] d1,
double[] d2)
computes the intersection di of 2 intervals d1 (= [a1,b1])
and d2 (= [a2,b2]) on the periodic domain (=[A,B] where A and B
arbitrary) ni is the resulting number of intervals (0,1, or 2) if a1 b1 then d1 = {x | a1 <=x <= B U A <=x
<=b1}
Parameters:
d1 - double[] first interval
d2 - double[] second interval
Returns:
double[] one or two intervals intersections
getDisc_ring
public java.util.ArrayList getDisc_ring(long nside,
javax.vecmath.Vector3d vector0,
double radius)
an obsolete method. Use query_disc instead.
Parameters:
nside -
vector0 -
radius -
Returns:
- ArrayList of long
query_disc
public java.util.ArrayList query_disc(long nside,
javax.vecmath.Vector3d vector,
double radius,
int nest,
int inclusive)
generates in the RING or NESTED scheme all pixels that lays within an
angular distance Radius of the center.
Parameters:
nside - long map resolution
vector - Vector3d pointing to the disc center
radius - double angular radius of the disc (in RADIAN )
nest - int 0 (default) if output is in RING scheme, if set to 1
output is in NESTED
inclusive - int 0 (default) only pixels whose centers lay in the disc
are listed, if set to 1, all pixels overlapping the disc
are listed. In the inclusive mode the radius is increased by half the pixel size.
In this case most probably all neighbor pixels will be listed even with very small
radius.
In case of exclusive search and very small radius when the disc lays completely
inside a pixel the pixel number is returned using vector2pix method.
public double[] pix2ang_ring(long nside,
long ipix)
renders theta and phi coordinates of the nominal pixel center for the
pixel number ipix (RING scheme) given the map resolution parameter nside
Parameters:
nside - long map resolution
ipix - long pixel number
Returns:
double[] theta,phi
pix2vect_ring
public javax.vecmath.Vector3d pix2vect_ring(long nside,
long ipix)
returns the vector pointing in the center of the pixel ipix. The vector
is calculated by makePix2Vect_ring method
Parameters:
nside - map resolution
ipix - pixel number
Returns:
Vector3d
pix2vertex_ring
public double[][] pix2vertex_ring(long nside,
long ipix)
returns double [][] with coordinates of the pixel corners. The array is
calculated by makePix2Vect_ring method
Parameters:
nside - map resolution
ipix - pixel number
Returns:
double[][] list of vertex coordinates
makePix2Vect_ring
private PixInfo makePix2Vect_ring(long nside,
long ipix)
renders vector (x,y,z) coordinates of the nominal pixel center for pixel
ipix (RING scheme) given the map resolution parameter nside. It also
calculates (x,y,z) positions of the four vertices in order N,W,S,E.
These results are returned in a PixInfo object.
Those can be used using pix2Vect_ring and pix2vert_ring methods
Parameters:
nside - long map resolution
ipix - pixel number
Returns:
result object
ang2pix_ring
public long ang2pix_ring(long nside,
double theta,
double phi)
renders the pixel number ipix (RING scheme) for a pixel which contains a
point with coordinates theta and phi, given the map resolution parameter
nside.
Parameters:
nside - long map resolution parameter
theta - double theta
phi - -
double phi
Returns:
long ipix
vect2pix_ring
public long vect2pix_ring(long nside,
javax.vecmath.Vector3d vector)
renders the pixel number ipix (RING scheme) for a pixel which contains a
point on a sphere at coordinate vector (x,y,z), given the map resolution
parameter nside
Parameters:
nside - long map resolution
vector - Vector3d of the point coordinates
Returns:
long pixel number
Throws:
java.lang.IllegalArgumentException
pix2ang_nest
public double[] pix2ang_nest(long nside,
long ipix)
Renders theta and phi coordinates of the normal pixel center for the
pixel number ipix (NESTED scheme) given the map resolution parameter
nside.
Parameters:
nside - map resolution parameter - long
ipix - long pixel number
Returns:
double[] (theta, phi)
Throws:
java.lang.IllegalArgumentException
pix2vect_nest
public javax.vecmath.Vector3d pix2vect_nest(long nside,
long ipix)
renders vector (x,y,z) coordinates of the nominal pixel center for the
pixel ipix (NESTED scheme ) given the map resolution parameter nside.
Also calculates the (x,y,z) positions of 4 pixel vertices (corners) in
the order N,W,S,E. These can be get using method pix2vertex_nest.
Parameters:
nside - the map resolution
ipix - long pixel number
Returns:
Vector3d
Throws:
java.lang.IllegalArgumentException
pix2vertex_nest
public double[][] pix2vertex_nest(long nside,
long ipix)
renders vector (x,y,z) coordinates of the nominal pixel center for the
pixel ipix (NESTED scheme ) given the map resolution parameter nside.
Also calculates the (x,y,z) positions of 4 pixel vertices (corners) in
the order N,W,S,E.
Parameters:
nside - the map resolution
ipix - long pixel number
Returns:
double[3][4] 4 sets of vector components
Throws:
java.lang.IllegalArgumentException
makePix2Vect_Nest
private PixInfo makePix2Vect_Nest(long nside,
long ipix)
renders vector (x,y,z) coordinates of the nominal pixel center for the
pixel ipix (NESTED scheme ) given the map resolution parameter nside. Tis
can be get using method pix2vect_nest Also calculates the (x,y,z)
positions of 4 pixel vertices (corners) in the order N,W,S,E.
The result can be used using method pix2vertex_nest.
Parameters:
nside - long the map resolution
ipix - long pixel number
Returns:
result
ang2pix_nest
public long ang2pix_nest(long nside,
double theta,
double phi)
renders the pixel number pix (NESTED scheme) for a pixel which contains a
point on a sphere at coordinates theta and phi, given map resolution
parameter nside.
The computation is made to the highest resolution available and then
degraded to required resolution by integer division. It makes sure that
the treatment of round-off will be consistent for every resolution.
Parameters:
nside - the map resolution parameter
theta - double theta coordinate in radians
phi - double phi coordinate in radians
Returns:
pixel number long
Throws:
java.lang.IllegalArgumentException
convert_nest2ring
public java.lang.Object[] convert_nest2ring(long nside,
java.lang.Object[] map)
make the conversion NEST to RING
Parameters:
nside - the map resolution parameter
map - Object[] the map in NESTED scheme
Returns:
- Object[] a map in RING scheme
Throws:
java.lang.IllegalArgumentException
convert_ring2nest
public java.lang.Object[] convert_ring2nest(long nside,
java.lang.Object[] map)
makes the conversion RING to NEST
Parameters:
nside - long resolution
map - map in RING
Returns:
map in NEST
Throws:
java.lang.IllegalArgumentException
convert_inplace_long
public java.lang.Object[] convert_inplace_long(java.lang.String subcall,
java.lang.Object[] map)
converts a 8 byte Object map from RING to NESTED and vice versa in place,
ie without allocation a temporary map (Has no reason for Java). This
method is more general but slower than convert_nest2ring.
This method is a wrapper for functions ring2nest and nest2ring. Their
names are supplied in the subcall argument.
Parameters:
subcall - String name of the method to use.
map - Object[] map
Returns:
resulting Object[] map.
Throws:
java.lang.IllegalArgumentException
neighbours_nest
public java.util.ArrayList neighbours_nest(long nside,
long ipix)
returns 7 or 8 neighbours of any pixel in the nested scheme The neighbours
are ordered in the following way: First pixel is the one to the south (
the one west of the south direction is taken for pixels that don't have a
southern neighbour). From then on the neighbors are ordered in the
clockwise direction.
Parameters:
nside - the map resolution
ipix - long pixel number
Returns:
ArrayList
Throws:
java.lang.IllegalArgumentException
InRing
public java.util.ArrayList InRing(long nside,
long iz,
double phi0,
double dphi,
boolean nest)
returns the list of pixels in RING or NEST scheme with latitude in [phi0 -
dpi, phi0 + dphi] on the ring iz in [1, 4*nside -1 ] The pixel id numbers
are in [0, 12*nside^2 - 1] the indexing is in RING, unless nest is set to
1
Parameters:
nside - long the map resolution
iz - long ring number
phi0 - double
dphi - double
nest - boolean format flag
Returns:
ArrayList of pixels
Throws:
java.lang.IllegalArgumentException - Modified by N. Kuropatkin 07/09/2008 Corrected several bugs and make test of all cases.
next_in_line_nest
public long next_in_line_nest(long nside,
long ipix)
calculates the pixel that lies on the East side (and the same
latitude) as the given NESTED pixel number - ipix
Parameters:
nside - long resolution
ipix - long pixel number
Returns:
long next pixel in line
Throws:
java.lang.IllegalArgumentException
vect2pix_nest
public long vect2pix_nest(long nside,
javax.vecmath.Vector3d vector)
renders the pixel number pix (NESTED scheme) for a pixel which contains a
point on a sphere at coordinate vector (x,y,z), given the map resolution
parameter nside.
The computation is made to the highest resolution available (nside=ns_max)
and then degraded to that requared (by Integer division) this doesn't
cost much, and it makes sure that the treatment of round-off will be
consistent for every resolution
Parameters:
nside - long the map resolution
vector - Vewctor3d the input vector
Returns:
pixel long
Throws:
java.lang.IllegalArgumentException
xy2pix_nest
private long xy2pix_nest(long nside,
long ix,
long iy,
long face_num)
gives the pixel number ipix (NESTED) corresponding to ix, iy and face_num
Parameters:
nside - the map resolution parameter
ix - Integer x coordinate
iy - Integer y coordinate
face_num - long face number
Returns:
long pixel number ipix
Throws:
java.lang.IllegalArgumentException
pix2xy_nest
private long[] pix2xy_nest(long nside,
long ipf)
gives the x,y coordinates in a face from pixel number within the face
(NESTED) schema.
Parameters:
nside - long resolution parameter
ipf - long pixel number
Returns:
ixiy long[] contains x and y coordinates
Throws:
java.lang.IllegalArgumentException
mk_pix2xy
private void mk_pix2xy()
creates an array of pixel numbers pix2x from x and y coordinates in the
face. Suppose NESTED scheme of pixel ordering Bits corresponding to x and
y are interleaved in the pixel number in even and odd bits.
ring2nest
public long ring2nest(long nside,
long ipring)
converts pixel number from ring numbering schema to the nested one
Parameters:
nside - long resolution
ipring - long pixel number in ring schema
Returns:
long pixel number in nest schema
Throws:
java.lang.IllegalArgumentException
nest2ring
public long nest2ring(long nside,
long ipnest)
converts from NESTED to RING pixel numbering
Parameters:
nside - long resolution
ipnest - long NEST pixel number
Returns:
ipring long RING pixel number
Throws:
java.lang.IllegalArgumentException
mk_xy2pix
private static void mk_xy2pix()
fills arrays x2pix and y2pix giving the number of the pixel laying in
(x,y). x and y are in [1,512] the pixel number is in [0, 512**2 -1]
if i-1 = sum_p=0 b_p*2^p then ix = sum+p=0 b_p*4^p iy = 2*ix ix + iy in
[0,512**2 -1]
RingNum
public long RingNum(long nside,
double z)
returns the ring number in {1, 4*nside - 1} calculated from z coordinate
Parameters:
nside - long resolution
z - double z coordinate
Returns:
long ring number
Ang2Vec
public javax.vecmath.Vector3d Ang2Vec(double theta,
double phi)
calculates vector corresponding to angles theta (co-latitude
measured from North pole, in [0,pi] radians) phi (longitude measured
eastward in [0,2pi] radians) North pole is (x,y,z) = (0, 0, 1)
Parameters:
theta - double
phi - double
Returns:
Vector3d
Throws:
java.lang.IllegalArgumentException
Vect2Ang
public double[] Vect2Ang(javax.vecmath.Vector3d v)
converts a Vector3d in a tuple of angles tup[0] = theta
co-latitude measured from North pole, in [0,PI] radians, tup[1] = phi
longitude measured eastward, in [0,2PI] radians
returns nside such that npix = 12*nside^2, nside should be
power of 2 and smaller than ns_max if not return -1
Parameters:
npix - long the number of pixels in the map
Returns:
long nside the map resolution parameter
Nside2Npix
public long Nside2Npix(long nside)
calculates npix such that npix = 12*nside^2 ,nside should be
a power of 2, and smaller than ns_max otherwise return -1
Parameters:
nside - long the map resolution
Returns:
npix long the number of pixels in the map
SurfaceTriangle
public double SurfaceTriangle(javax.vecmath.Vector3d v1,
javax.vecmath.Vector3d v2,
javax.vecmath.Vector3d v3)
throws java.lang.Exception
calculates the surface of spherical triangle defined by
vertices v1,v2,v3 Algorithm: finds triangle sides and uses l'Huilier
formula to compute "spherical excess" = surface area of triangle on a
sphere of radius one see, eg Bronshtein, Semendyayev Eq 2.86 half
perimeter hp = 0.5*(side1+side2+side3) l'Huilier formula x0 = tan( hp/2.)
x1 = tan((hp - side1)/2.) x2 = tan((hp - side2)/2.) x3 = tan((hp -
side3)/2.)
Parameters:
v1 - Vector3d
v2 - Vector3d
v3 - Vector3d vertices of the triangle
Returns:
double the triangle surface
Throws:
java.lang.Exception
AngDist
public double AngDist(javax.vecmath.Vector3d v1,
javax.vecmath.Vector3d v2)
throws java.lang.Exception
calculates angular distance (in radians) between 2 Vectors
v1 and v2 In general dist = acos(v1.v2) except if the vectors are almost
aligned
Parameters:
v1 - Vector3d
v2 - Vector3d
Returns:
double dist
Throws:
java.lang.Exception
VectProd
public java.util.Vector VectProd(java.util.Vector v1,
java.util.Vector v2)
throws java.lang.Exception
calculates a vector production of two vectors.
Parameters:
v1 - Vectror containing 3 elements of Number type
v2 - Vector containing 3 elements of Number type
Returns:
Vector of 3 Objects of Double type
Throws:
java.lang.Exception
dotProduct
public double dotProduct(javax.vecmath.Vector3d v1,
javax.vecmath.Vector3d v2)
throws java.lang.Exception
calculates a dot product (inner product) of two 3D vectors
the result is double
Parameters:
v1 - 3d Vector of Number Objects (Double, long .. )
v2 - 3d Vector
Returns:
double
Throws:
java.lang.Exception
crossProduct
public javax.vecmath.Vector3d crossProduct(javax.vecmath.Vector3d v1,
javax.vecmath.Vector3d v2)
calculate cross product of two vectors
Parameters:
v1 - Vector3d
v2 - Vector3d
Returns:
Vector3d result of the product
PixRes
public double PixRes(long nside)
calculates angular resolution of the pixel map
in arc seconds.
Parameters:
nside -
Returns:
double resolution in arcsec
GetNSide
public long GetNSide(double pixsize)
calculate requared nside given pixel size in arcsec
Parameters:
pixsize - in arcsec
Returns:
long nside parameter
RaDecToPolar
public double[] RaDecToPolar(double[] radec)
returns polar coordinates in radians given ra, dec in degrees
Parameters:
radec - double array containing ra,dec in degrees
Returns:
res double array containing theta and phi in radians
res[0] = theta res[1] = phi
PolarToRaDec
public double[] PolarToRaDec(double[] polar)
returns ra, dec in degrees given polar coordinates in radians
Parameters:
polar - double array polar[0] = phi in radians
polar[1] = theta in radians
Returns:
double array radec radec[0] = ra in degrees
radec[1] = dec in degrees
xyzToPolar
public double[] xyzToPolar(double x,
double y,
double z)
returns polar coordinates of a point on unit sphere given Cartesian coordinates
Parameters:
x - - Cartesian coordinate x of a point on unit sphere
kuropat
The class represents square region on a sphere defined by raMin, raMax
decMin,decMax in degrees. The dec varies from Pi/2 to -Pi/2.
The ra varies from 0. inclusive to 2Pi exclusive. Negative value of ra
will be corrected by adding 2Pi
The package contains conversion of basic utilities used for pixel
manipulation
in the HEALPix
from FORTRAN90 to Java. The package consists of one class PixTools
and supporting methods and the vecmath.jar library.
The package permits to create HEALPix maps, query existing maps
providing a list of neighboring pixels selected by various requarements.
All methods of the class are thread safe. This class can be used as a singleton,
the singleton instance being available from the #getInstance method.
For compatibility with previous versions however it is possible to
construct new instances using the default constructor.
eag-HEALPix-master/doc/gov/fnal/eag/healpix/package.html 0000664 0000000 0000000 00000002246 13154006152 0023223 0 ustar 00root root 0000000 0000000
No title
EAG HEALPix
The package contains conversion of basic utilities used for pixel
manipulation
in the HEALPix
from FORTRAN90 to Java. The package consists of one class PixTools
and supporting methods and the vecmath.jar library.
The package permits to create HEALPix maps, query existing maps
providing a list of neighboring pixels selected by various requarements.
All methods of the class are thread safe. This class can be used as a singleton,
the singleton instance being available from the {@link #getInstance} method.
For compatibility with previous versions however it is possible to
construct new instances using the default constructor.
Haversine formula for spherical trigonometry.
This does not have the numerical instabilities of the cosine formula
at small angles.
This implementation derives from Bob Chamberlain's contribution
to the comp.infosystems.gis FAQ; he cites
R.W.Sinnott, "Virtues of the Haversine", Sky and Telescope vol.68,
no.2, 1984, p159.
Parameters:
ra1 - right ascension of point 1 in radians
dec1 - declination of point 1 in radians
ra2 - right ascension of point 2 in radians
dec2 - declination of point 2 in radians
Returns:
angular separation of point 1 and point 2 in radians
See Also:
main
public static void main(java.lang.String[] args)
throws java.lang.Exception
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
Overview
The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.
Package
Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:
Interfaces (italic)
Classes
Enums
Exceptions
Errors
Annotation Types
Class/Interface
Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:
Class inheritance diagram
Direct Subclasses
All Known Subinterfaces
All Known Implementing Classes
Class/interface declaration
Class/interface description
Nested Class Summary
Field Summary
Constructor Summary
Method Summary
Field Detail
Constructor Detail
Method Detail
Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.
Annotation Type
Each annotation type has its own separate page with the following sections:
Annotation Type declaration
Annotation Type description
Required Element Summary
Optional Element Summary
Element Detail
Enum
Each enum has its own separate page with the following sections:
Enum declaration
Enum description
Enum Constant Summary
Enum Constant Detail
Use
Each documented package, class and interface has its own Use page. This page describes what packages, classes, methods, constructors and fields use any part of the given class or package. Given a class or interface A, its Use page includes subclasses of A, fields declared as A, methods that return A, and methods and constructors with parameters of type A. You can access this page by first going to the package, class or interface, then clicking on the "Use" link in the navigation bar.
Tree (Class Hierarchy)
There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.
When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
Deprecated API
The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.
Index
The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.
Prev/Next
These links take you to the next or previous class, interface, package, or related page.
Frames/No Frames
These links show and hide the HTML frames. All pages are available with or without frames.
All Classes
The All Classes link shows all classes and interfaces except non-static nested types.
Serialized Form
Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.
renders the pixel number pix (NESTED scheme) for a pixel which contains a
point on a sphere at coordinates theta and phi, given map resolution
parameter nside.
renders the pixel number ipix (RING scheme) for a pixel which contains a
point with coordinates theta and phi, given the map resolution parameter
nside.
calculates vector corresponding to angles theta (co-latitude
measured from North pole, in [0,pi] radians) phi (longitude measured
eastward in [0,2pi] radians) North pole is (x,y,z) = (0, 0, 1)
returns the list of pixels in RING or NEST scheme with latitude in [phi0 -
dpi, phi0 + dphi] on the ring iz in [1, 4*nside -1 ] The pixel id numbers
are in [0, 12*nside^2 - 1] the indexing is in RING, unless nest is set to
1
computes the intersection di of 2 intervals d1 (= [a1,b1])
and d2 (= [a2,b2]) on the periodic domain (=[A,B] where A and B
arbitrary) ni is the resulting number of intervals (0,1, or 2) if a1 b1 then d1 = {x | a1 <=x <= B U A <=x
<=b1}
returns 7 or 8 neighbours of any pixel in the nested scheme The neighbours
are ordered in the following way: First pixel is the one to the south (
the one west of the south direction is taken for pixels that don't have a
southern neighbour).
finds pixels having a colatitude (measured from North pole) :
theta1 < colatitude < theta2 with 0 <= theta1 < theta2 <= Pi
if theta2 < theta1
then pixels with 0 <= colatitude < theta2 or theta1 < colatitude < Pi are
returned
calculates the surface of spherical triangle defined by
vertices v1,v2,v3 Algorithm: finds triangle sides and uses l'Huilier
formula to compute "spherical excess" = surface area of triangle on a
sphere of radius one see, eg Bronshtein, Semendyayev Eq 2.86 half
perimeter hp = 0.5*(side1+side2+side3) l'Huilier formula x0 = tan( hp/2.)
x1 = tan((hp - side1)/2.) x2 = tan((hp - side2)/2.) x3 = tan((hp -
side3)/2.)
converts a Vector3d in a tuple of angles tup[0] = theta
co-latitude measured from North pole, in [0,PI] radians, tup[1] = phi
longitude measured eastward, in [0,2PI] radians
renders the pixel number pix (NESTED scheme) for a pixel which contains a
point on a sphere at coordinate vector (x,y,z), given the map resolution
parameter nside.
renders the pixel number ipix (RING scheme) for a pixel which contains a
point on a sphere at coordinate vector (x,y,z), given the map resolution
parameter nside