Logo coherent WaveBurst  
Library Reference Guide
Logo
TestEulerCharacteristic.C
Go to the documentation of this file.
1 //
2 // Test Euler characteristic
3 // Author : Gabriele Vedovato
4 
5 {
6  #define COORDINATES "cWB"
7  #define PROJECTION ""
8 
9  // create healpix skymap order=3
10  skymap sm(int(3));
11 
13 
14  // patch with 9 pixels
15  sm.set(30,10);
16  // get the pixel numbers of the SW, W, NW, N, NE, E, SE and S neighbor pixel=30
17  index = sm.neighbors(30);
18  for(int i=0;i<index.size();i++) sm.set(index[i],20+5*(i%4));
19 
20  // patch with 1 pixel
21  sm.set(80,10);
22 
23  // patch with hole
24  // get the pixel numbers of the SW, W, NW, N, NE, E, SE and S neighbor pixel=200
25  index = sm.neighbors(200);
26  for(int i=0;i<index.size();i++) sm.set(index[i],20+5*(i%4));
27 
28  // get number of rings
29  int nrings = sm.getRings();
30 
31  // get start ring pixel ring=nrings/2
32  int startpix = sm.getStartRingPixel(nrings/2);
33  // get number of pixels in the ring=nrings/2
34  int npixels = sm.getRingPixels(nrings/2);
35  // fill npixels/2 in the ring=nrings/2
36  for(int i=0;i<npixels/2;i++) sm.set(startpix+i,20);
37  // fill npixels2/2 in the ring=nrings/2+1
38  int startpix2 = sm.getStartRingPixel(nrings/2+1);
39  int npixels2 = sm.getRingPixels(nrings/2+1);
40  for(int i=0;i<npixels2/2;i++) sm.set(startpix2+i,30);
41 
42  int EC = sm.getEulerCharacteristic(0.5);
43 
44  cout << "Euler characteristic : " << EC << endl;
45 
46  // draw skymap
47  gskymap* gSM = new gskymap(sm);
49  gSM->Draw();
50 
51  // dump skymap to fits
52  // used aladin to display fits
53  // -> aladin euler_characteristic.fits
54  gSM->Dump2fits("euler_characteristic.fits");
55 
56 }
gskymap * gSM
void Draw(int dpaletteId=1, Option_t *option="colfz")
Definition: gskymap.cc:460
i drho i
virtual size_t size() const
Definition: wavearray.hh:145
Definition: skymap.hh:63
#define PROJECTION
#define COORDINATES
wavearray< int > index
void set(size_t i, double a)
param: sky index param: value to set
Definition: skymap.hh:122
void SetOptions(TString projection="hammer", TString coordinate="Geographic", double resolution=1, bool goff=false)
Definition: gskymap.cc:84