File: phcorrtut.shtml

package info (click to toggle)
munipack 0.6.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 33,104 kB
  • sloc: cpp: 29,677; sh: 4,909; f90: 2,872; makefile: 278; python: 140; xml: 72; awk: 12
file content (298 lines) | stat: -rw-r--r-- 8,629 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- #include virtual="/meta.shtml" -->
<title>Munipack ‒ Photometric Corrections Tutorial</title>
</head>
<body>
<!-- #include virtual="/head.shtml" -->
<section>

<!-- TODO:
    * update commands (synchro with actual dataset)
-->

<h1>Photometric Corrections</h1>

<p class="abstract">
Description for photometric pre-processing of images.
How to create of averaged biases, darks or flat-field frames
and how to apply ones on scientific images.
</p>

<h2>Introduction</h2>

<p>
The preprocessing is image is absolutely
necessary for any correct photometry work. The application
corrects unwanted fluency of devices as zero offset, dark
current or light responsibility.
</p>

<p>
More detailed description of the corrections is included
in pages:
<a href="man_bias.html">Averaged bias frame</a>,
<a href="man_dark.html">Averaged dark frame</a>,
<a href="man_flat.html">Averaged flat-field frame</a> and
<a href="man_phcorr.html">Photometric corrections</a>.
</p>

<p>
As an excellent introduction for preprocessing, the textbook
<a href="http://www.cambridge.org/gb/knowledge/isbn/item2713446/">
To Measure the Sky</a> by F. R. Chromey would be recommended.
</p>

<h2>Sample Data</h2>

<p>
A sample data are available as
<a href="https://integral.physics.muni.cz/ftp/munipack/munipack-data-blazar.tar.gz">munipack-data-blazar.tar.gz</a>.
Use commands
</p>
<pre>
$ cd /tmp/
$ tar zxf munipack-data-blazar.tar.gz
</pre>
<p>
 to unpack it to a desired directory.
We will assume that the sample data are unpacked to <samp>/tmp</samp> directory
as <samp>/tmp/munipack-data-blazar</samp>.
</p>

<p>
The sample dataset includes an observation of this blazar together
with correction frames (flat-fields and dark-frames).
</p>

<div class="table">
<table>
<caption>An overview</caption>
<tr><th>Description</th><th>Filemask</th><th>Exposure</th></tr>
<tr><td>scientific images</td><td style="text-align:right;"><samp>0716_[1-9]R.fits</samp></td><td style="text-align:right;">120 sec</td></tr>
<tr><td>dark-frames of scientific images</td><td style="text-align:right;"><samp>d120_[1-7].fits</samp></td><td style="text-align:right;">120 sec</td></tr>
<tr><td>flat-fields</td><td style="text-align:right;"><samp>f10_[1-9]R.fits</samp></td><td style="text-align:right;">10 sec</td></tr>
<tr><td>dark-frames of flat-fields</td><td style="text-align:right;"><samp>d10_[1-9].fits</samp></td><td style="text-align:right;">10 sec</td></tr>
</table>
</div>

<h2>Working directory</h2>

<p>
As a first important step, we will create a working directory. For example,
create directory <samp>/tmp/munipack-data-blazar</samp> and switch to by the command:
</p>
<pre>
$ mkdir /tmp/work
</pre>
<p>
The name does not matter. It is highly recommended to use
a new empty directory to prevent any lost of data
(especially of original images!).
</p>

<h2>Preparation</h2>
<p>
Some functionality of preprocessing tools requires correct
setting of FITS header keywords. The keywords are preset,
but sometimes local conventions are different. Therefore there
are available some <a href="man_env.html">environment variables</a>
for individual tuning.
</p>

<p>
It is recommended to set the variables by the way in your
bash shell as the initial step (modify by your needs):
</p>
<pre>
$ FITS_KEY_FILTER='FILTER'
$ FITS_KEY_EXPTIME='EXPTIME'
$ FITS_KEY_TEMPERATURE='TEMPERAT'
$ FITS_KEY_DATEOBS='DATE-OBS'
$ MUNIPACK_TEMPERATURE_TOLERANCE=1 # Celsius degree
$ MUNIPACK_EXPTIME_TOLERANCE=1e-6  # seconds
$ export FITS_KEY_FILTER FITS_KEY_EXPTIME FITS_KEY_TEMPERATURE FITS_KEY_DATEOBS
$ export MUNIPACK_TEMPERATURE_TOLERANCE MUNIPACK_EXPTIME_TOLERANCE
</pre>

<p>
To avoid need of repeated typing of the keywords, add these commands
to your ~/.bashrc profile.
</p>


<h2>Average Of Dark Frames</h2>
<p>
To create an average dark frame for scientific exposures, run the command:
</p>
<pre>
$ cd /tmp/work
$ munipack dark -o d120.fits /tmp/munipack-data-blazar/d120_*.fits
$ ls d120.fits
d120.fits
</pre>
<p>
Munipack is invoking the module <samp>dark</samp> intended
to average of images specified as the last argument.
The asterisk matches all images begins with <samp>d120_</samp>
together and ending with the suffix <samp>.fits</samp>.
The processed mean is stored as <samp>d120.fits</samp>.

</p>

<p class="indent">
Averaging uses a robust mean method by default.
It reduces of fluency of cosmic-rays and similar single-frame defects on
final products. On other side, it requires much more computer resources
than simple averaging by the arithmetical mean (switch <samp>-a</samp>)
</p>

<p class="indent">
Note that, this step can be omitted (a single dark frame can
be used only), but one is preferred from a statistical point
of view. The result image is frequently called as master-dark.
</p>

<figure>
<img class="figure" src="d120_1.png" alt="d10_1.png" title="A dark image">
<figcaption>
A randomly selected dark image.
</figcaption>
</figure>

<figure>
<img class="figure" src="d120.png" alt="d120.png" title="Mean of dark-frames">
<figcaption>
Mean of dark-frames (master-dark).
</figcaption>
</figure>


<h2>Average Of Flat-Fields</h2>

<p>
Because flat-fields are light frames similar to scientific frames,
ones needs similar preprocessing. Especially, we must correct
its for dark frames.
</p>

<p>
  So, the first step is preparation of the dark with 10 s of exposure
  times for flats
</p>
<pre>
$ munipack dark -o d10.fits /tmp/munipack-data-blazar/d10_*.fits
</pre>
<p>
The exposure times must be exactly the same for both darks and flats.
</p>

<p>
With this dark we can easy create the averaged flat as:
</p>
<pre>
$ munipack flat -o f_R.fits -dark d10.fits /tmp/munipack-data-blazar/f10_*R.fits
</pre>
<p>
The internally corrected
flat-fields are scaled by its mean intensity and its dispersion to
a unified output level. A robust mean is made on the uniform scaled flats
and an output flat is stored as <samp>f_R.fits</samp>.
</p>

<p class="indent">
The key feature of <samp>flat</samp> is the scaling and a robust mean of single
flats. The procedure is pretty effective for short series of the twilight
sky's exposures when brightness rapidly decrease. Also, a long over-night series
of non-identical fields (like many blazar fields) will produce excellent
results.
</p>

<figure>
<img class="figure" src="f10_1.png" alt="f10_1.png" title="A flat-field image">
<figcaption>
A randomly selected flat-field image.
</figcaption>
</figure>

<figure>
<img class="figure" src="autoflat.png" alt="autoflat.png" title="A scaled robust mean of flats">
<figcaption>
A scaled robust mean of flat-fields (master-flat).
</figcaption>
</figure>


<h2>Dark And Flat-Field Corrections</h2>
<p>
Original scientific images can be corrected for dark-frames by running:
</p>
<pre>
$ munipack phcorr -t . -dark d120.fits /tmp/munipack-data-blazar/0716_*R.fits
</pre>
<p>
<samp>phcorr</samp> action subtracts, the previously created mean-dark
<samp>d120.fits</samp> given as a first non-optional argument,
from every scientific exposures of 0716+71 and newly created images
will be stored in
the current working directory (given by option -t . (tee and dot!)
with image names identical to original ones.
</p>

<figure>
<img class="figure" src="0716_original.png" alt="0716_original.png" title="An original image">
<figcaption>
A randomly selected scientific exposure of blazar 0716+714.
</figcaption>
</figure>

<figure>
<img class="figure" src="0716_dark.png" alt="0716_dark.png" title="An original image with the dark-frame subtracted">
<figcaption>
A randomly selected scientific exposure of blazar 0716+714 with the d120 dark-frame subtracted.
</figcaption>
</figure>

<p>
By analogy of dark correction, scientific images (subtracted for dark)
can be corrected for flats by
</p>
<pre>
$ munipack phcorr -t . -flat f_R.fits /tmp/munipack-data-blazar/0716_*R.fits
</pre>
<p>
We can see that the current directory images are used.
</p>

<figure>
<img class="figure" src="0716_final.png" alt="0716_final.png" title="A fully corrected scientific exposure">
<figcaption>
A randomly selected, fully corrected (dark and flat), image of blazar 0716+714.
</figcaption>
</figure>



<p>
For convenience, both correction can be appplied together
</p>
<pre>
$ munipack phcorr -t . -flat f_R.fits -dark d120.fits /tmp/munipack-data-blazar/0716_*R.fits
</pre>


<h2>See Also</h2>

<p>
Manuals:
<a href="man_bias.html">Bias</a>,
<a href="man_dark.html">Dark</a>,
<a href="man_flat.html">Flat-field</a>,
<a href="man_phcorr.html">Photometric corrections</a>.
</p>

</section>
<!-- #include virtual="/foot.shtml" -->
</body>
</html>