Last change
on this file since 20029 was 17962, checked in by dneise, 10 years ago |
these modifications I found in the Mars.svn.2014.05.26 folder of Simona and added them to this branch without further thinking about them.
|
File size:
1.1 KB
|
Line | |
---|
1 | void contemp(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 temp;
|
---|
10 | file.SetPtrAddress("Time", &time);
|
---|
11 | file.SetPtrAddress("T", &temp);
|
---|
12 |
|
---|
13 | UInt_t offset = file.GetUInt("MJDREF");
|
---|
14 | if (beg < 30000)
|
---|
15 | beg+=offset;
|
---|
16 | if (end < 30000)
|
---|
17 | end+=offset;
|
---|
18 |
|
---|
19 | double avg = 0;
|
---|
20 | double avgrms = 0;
|
---|
21 | double rms = 0;
|
---|
22 | int cnt = 0;
|
---|
23 |
|
---|
24 | double last = -1;
|
---|
25 | double lastr = -1;
|
---|
26 | double diff = -1;
|
---|
27 |
|
---|
28 | while (file.GetNextRow())
|
---|
29 | {
|
---|
30 | time += offset;
|
---|
31 |
|
---|
32 | if (time>end)
|
---|
33 | break;
|
---|
34 |
|
---|
35 | if (time<beg)
|
---|
36 | {
|
---|
37 | last = temp;
|
---|
38 | diff = beg-time;
|
---|
39 | continue;
|
---|
40 | }
|
---|
41 |
|
---|
42 | avg += temp;
|
---|
43 | rms += temp*temp;
|
---|
44 | cnt ++;
|
---|
45 | }
|
---|
46 |
|
---|
47 | if (cnt==0)
|
---|
48 | {
|
---|
49 | if (diff<5./24/3600)
|
---|
50 | return;
|
---|
51 |
|
---|
52 | cout << "result " << last << " 0 " << endl;
|
---|
53 | return;
|
---|
54 | }
|
---|
55 |
|
---|
56 | avg /= cnt;
|
---|
57 | rms /= cnt;
|
---|
58 |
|
---|
59 | rms = rms>avg*avg ? 0 : sqrt(rms-avg*avg);
|
---|
60 |
|
---|
61 | cout << "result " << avg << " " << rms << endl;
|
---|
62 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.