source: trunk/Mars/fact/processing/dust.C@ 19674

Last change on this file since 19674 was 18525, checked in by Daniela Dorner, 8 years ago
handle cases where time stamp gets stuck during the night
File size: 1.2 KB
Line 
1void dust(const char *fname, double beg=0, double end=100000)
2{
3 fits file(fname);
4
5 //file.PrintColumns();
6 //file.PrintKeys();
7
8 Double_t time;
9 Float_t dust;
10 file.SetPtrAddress("Time", &time);
11 file.SetPtrAddress("Dust", &dust);
12
13 UInt_t offset = file.GetUInt("MJDREF");
14 if (beg < 30000)
15 beg+=offset;
16 if (end < 30000)
17 end+=offset;
18
19 TGraph g;
20 Double_t timeprev;
21 Float_t dustprev;
22 Int_t counter=1;
23 Int_t day=TMath::Nint((beg+end)/2);
24 while (file.GetNextRow())
25 {
26 // handle doubl values
27 if (time==timeprev && dust==dustprev)
28 continue;
29
30 //exclude day
31 if (time+offset<day-0.25)
32 continue;
33 if (time+offset>day+0.35)
34 break;
35
36 //handle values where time gets stuck
37 if (time-timeprev<1/12.*counter)
38 {
39 g.SetPoint(g.GetN(), timeprev+1/12.*counter+offset, dust);
40 counter++;
41 continue;
42 }
43 else
44 {
45 g.SetPoint(g.GetN(), time+offset, dust);
46 counter=1;
47 }
48
49 timeprev=time;
50 dustprev=dust;
51 }
52 cout << "result " << MSpline3(g).Eval((beg+end)/2) << endl;
53}
Note: See TracBrowser for help on using the repository browser.