Last change
on this file since 18481 was 15223, checked in by Daniela Dorner, 12 years ago |
added (macro to extract camera temperature from the file FSC_CONTROL_TEMPERATURE)
|
File size:
1.5 KB
|
Line | |
---|
1 | void camtemp(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[31];
|
---|
10 | file.SetPtrAddress("Time", &time);
|
---|
11 | file.SetPtrAddress("T_sens", 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 | double m = 0;
|
---|
36 | double r = 0;
|
---|
37 | int n = 0;
|
---|
38 | for (int i=0; i<31; i++)
|
---|
39 | {
|
---|
40 | if (temp[i]!=0)
|
---|
41 | {
|
---|
42 | m += temp[i];
|
---|
43 | r += temp[i]*temp[i];
|
---|
44 | n++;
|
---|
45 | }
|
---|
46 | }
|
---|
47 | m /= n;
|
---|
48 | r /= n;
|
---|
49 |
|
---|
50 | if (time<beg)
|
---|
51 | {
|
---|
52 | last = m;
|
---|
53 | lastr = sqrt(r-m*m);
|
---|
54 | diff = beg-time;
|
---|
55 | continue;
|
---|
56 | }
|
---|
57 |
|
---|
58 | avgrms += sqrt(r-m*m);
|
---|
59 |
|
---|
60 | avg += m;
|
---|
61 | rms += m*m;
|
---|
62 | cnt ++;
|
---|
63 | }
|
---|
64 |
|
---|
65 | if (cnt==0)
|
---|
66 | {
|
---|
67 | if (diff<5./24/3600)
|
---|
68 | return;
|
---|
69 |
|
---|
70 | cout << "result " << last << " 0 " << lastr << endl;
|
---|
71 | return;
|
---|
72 | }
|
---|
73 |
|
---|
74 | avg /= cnt;
|
---|
75 | rms /= cnt;
|
---|
76 |
|
---|
77 | avgrms /= cnt;
|
---|
78 |
|
---|
79 | rms = sqrt(rms-avg*avg);
|
---|
80 |
|
---|
81 | cout << "result " << avg << " " << rms << " " << avgrms << endl;
|
---|
82 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.