wiki:InstallingHealpixForMars

Version 10 (modified by tbretz, 5 years ago) ( diff )

--

The HealPix concept (and the original libraries) are described at https://healpix.jpl.nasa.gov/index.shtml.

A HealPix implementation for ROOT is available at https://github.com/akira-okumura/RootHealPix. You can compile that into your Mars libarary.

After checking out Mars from the repository (see InstallingMars), simple extract the attached zip-file into your Mars source directory or get RootHealPix from git:

[0] cd Mars
[1] git clone https://github.com/akira-okumura/RootHealPix.git

If RootHealPix is located in your Mars source directory, cmake should find it automatically and compile the healpix classes into the Mars library, otherwise call cmake with the corresponding path:

[2] cmake -DHEALPIX_PREFIX=<path-to-RootHealPix>

To test the installation, start root in your Mars build directory and try something like:

THealPixD hp("name", "", 2); 
for (int i=0; i<10000; i++) 
   hp.Fill(gRandom->Uniform()*90, gRandom->Uniform()*180); 
hp.Draw("COLZ");

The following example onreading and writing is adapted from RootHealPix/tutorials/ReadAndWrite.C.

{{{!#Spoiler {{{!#c++ void ReadAndWrite() {

THealPixD hpd1("hpd1", "data1", 5); THealPixD hpd2("hpd2", "data2", 4); hpd1.SetUnit("MeV"); Set the unit of entries hpd2.SetUnit("GeV"); hpd1.SetDegree(); change the unit of Fill(theta, phi) hpd2.SetDegree();

for(Int_t i = 0; i<1800; i++) {

for(Int_t j = 0; j<3600; j++) {

hpd1.Fill(i/10., j/10., 1); hpd2.Fill(i/10., j/10., 5);

}

}

std::vector<THealPix*> vec; vec.push_back(&hpd1); vec.push_back(&hpd2);

THealUtil::SaveToFits("!test.fits", vec); hpd1/2 are saved in one file

Read only "data2" from FITS file THealPixD* hpd = THealPixD::ReadFits("test.fits", "data2");

std::cout << "Order: " << hpd->GetOrder() << std::endl; std::cout << "Nside: " << hpd->GetNside() << std::endl; std::cout << "Npix : " << hpd->GetNpix() << std::endl; std::cout << "Unit : " << hpd->GetUnit() << std::endl; std::cout << "Title: " << hpd->GetTitle() << std::endl;

} }}} }}}

The documentation is not very complete, but you can find it here: https://www.fact-project.org/RootHealPix/.

The available Draw/Paint options are described at https://www.fact-project.org/RootHealPix/THealPainter.html#THealPainter:Paint

The example above should produce something like this: .

Attachments (2)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.