Skip to content

cds-astro/cds.moc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

README
------
Authors: Pierre Fernique [Centre de Donnees astronomiques de Strasbourg]
Licence: GPL3

1) What is a MOC => http://ivoa.net/documents/MOC/
2) Where is the "main" classes of this lib 
      space MOC      => cds.moc.SMoc
      time MOC       => cds.moc.TMoc
      space-time MOC => cds.moc.STMoc
3) Can I use HealpixMoc as I did before
   Yes you can, but this class is now a wrapper to SMoc. Have a look on the source code of this
   class for helping you to move to SMoc (really easy) 
4) How to use MOC => cds.moc.Example.java
5) How to check that my MOC is valid: http://alasky.u-strasbg.fr/MocServer/lint
6) Examples: 

a) Create and save a space MOC:

   // Assuming that you have a Collection/array of longs
   // which represent the Healpix (NESTED) cell numbers of your spatial region
   // at a dedicated HEALPix order
   // You want to create the MOC a save it in a file.
   SMoc moc = new SMoc( order );
   moc.bufferOn();          // Buffering is not required, required a little more space, but faster
   for( long hpix : array ) moc.add( order, hpix);
   moc.bufferOff();         // Stop buffering
   moc.write( filename );

b) Load and compare space MOCs:

   // You want to load a MOC from a file and compute the intersection with
   // a spatial region that you provide as a MOC (written in ASCII format)
   SMoc myMoc, interMoc;
   SMoc moc = new SMoc();
   moc.read( filename );
   myMoc = new SMoc("3/1 2 3 4/17-19");
   interMoc = moc.intersection( myMoc );
   
c) Generate a space MOC from a Collection of sky coordinates

   // You want to generate the MOC covering a set of sky positions.
   // The MOC is generated at a dedicated resolution "mocOrder=13"
   // Note: angRes = Math.sqrt( 4*Math.PI/(12*Healpix.pow2(order) * 
   //                                         Healpix.pow2(order) ) )

   SMoc moc = new SMoc(13);
   Healpix hpx = new Healpix();
   for( int i=0; i<100000; i++ ) {
      double lon = Math.random()*360;
      double lat = Math.random()*180 -90;
      moc.add( hpx, lon, lat);
   }
   
d) Create and save a STMOC from a Collection of sky coordinates and dates

   STMoc moc = new STMoc(31,13);   // time order 31 => 17mn,  space order 13 => 25.77"
   Healpix hpx = new Healpix();
   for( int i=0; i<100000; i++ ) {
      double lon = Math.random()*360;
      double lat = Math.random()*180 -90;
      double jdmin = Math.random()*10000. + 2400000.5
      double jdmax = jdmin + Math.random()*10.;
      moc.add( hpx, lon, lat, jdmin, jdmax);
   }   
   
   
7) May I use my own HEALPix lib ?
   Yes, just provide an alternative of cds.moc.Healpix.java class for implementing
   cds.moc.HealpixImpl.java interface

Releases

No releases published

Packages

No packages published

Languages