-
Notifications
You must be signed in to change notification settings - Fork 0
/
Recipes_IFU_LM.tex
669 lines (599 loc) · 38.1 KB
/
Recipes_IFU_LM.tex
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
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
%% 06_5-Recipes_IFU.tex
%% Created: Fri Aug 25 13:14:02 2017 by Koehler@I-Mac
%%
%% subsection for IFU recipes
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\clearpage
\subsection{LM integral-field spectroscopy (IFU) recipes}
\label{ssec:IFU_recipes}
% Moved to https://github.com/AstarVienna/METIS_DRLD/issues/100
% \TODO{This section is identical to the PDR document~\cite{DRLS}. We
% will consider rearranging the recipes to be in line with the imaging
% pipelines. This would entail handling basic reduction and background
% subtraction for both science and standard exposures in common
% recipes (\CODE{metis_ifu_basic}, \CODE{metis_ifu_background}), then
% having a recipe to analyse the standard observations
% (\CODE{metis_ifu_photstd}). The science exposures are then fully
% calibrated (\CODE{metis_ifu_calibrate}). A full set of exposures would
% then be assembled and restored with a fully sampled PSF in a
% post-processing recipe (\CODE{metis_ifu_combine}).}
%------------------------------------------------------------------------------------------------------------------
\subsubsection{\REC*{metis_ifu_wavecal}: IFU wavelength calibration}
\label{sssec:ifu_wavecal}
\label{rec:metis_ifu_wavecal}
This recipe processes daytime wavelength calibration images to derive
the pixel-to-wavelength relation for the LM integral-field
spectrograph.
The calibration template will use the lasers in the warm calibration
unit to finely sample the desired wavelength range.
The \ac{WCU} has three lasers \cite{METIS-calibration_plan}:
(1) a fixed laser at \SI{3.39}{\micro\metre},
(2) the \ac{QCL}, a laser tuneable from at least \SI{4.68}{\micro\metre} to \SI{4.78}{\micro\metre}), and
(3) a fixed laser at \SI{5.26}{\micro\metre}.
The tuneable laser can be tuned so quickly during a long exposure with the
long-slit spectrograph or the LMS such that a single exposure with multiple
lines is created.
The image will consist of lines for each wavelength and slice.
The solution will have to provide for each detector pixel
$(x,y)$ the slice number $i$, the spatial position $\xi$ along the
slice and the wavelength in the dispersion correction. As the slices
and wavelength lines may be tilted with respect to the detector
columns and rows, a combined solution is required
\begin{align}
\label{eq:wavelength_solution}
\xi &= f_{i}(x, y) \\
\lambda &= g_{i}(x, y)
\end{align}
The functions $f_{i}$ and $g_{i}$ are expected to be
sufficiently accurately described by low-order polynomials.
In principle we know this relation from our optical models, but we expect small
deviations ($\lesssim$ 1 px) because e.g.\ the main dispersion grating mechanism
in the \ac{LMS} did not come back to exactly to the nominal position.
We expect the offset from the optical model to be well represented either by a
simple linear function or a low-order polynomial.
The exact shape of the wavelength-to-pixel relation will be determined during
\ac{AIT}.
The wavelength range of the LM band is only partially covered by the lasers.
The model will therefore be calibrated only on the part of the range covered by
the lasers and subsequently extrapolated to the whole image.
This calibrated optical model is then used by the other recipes as a first
guess for the wavelength solution.
%, even though it was directly verified only in a subset of the settings.
The boundaries of the slice image on the detector are obtained by
measuring the left and right edges of the wavelength lines.
The slice number is then obtained by counting the
slices according to the optical design of the spectrograph.
The wavelength of each line is known from the settings of the \ac{QCL}, the $x$
coordinate is obtained by
%linear interpolation along the line (or perhaps
using the distortion table from \REC{metis_ifu_distortion}.
%if necessary).
The recipe produces a multi-extension FITS file with an image
extension mapping wavelength across each detector in the array.
A table extension holds the polynomial coefficients.
\begin{recipedef}
Name: & \REC{metis_ifu_wavecal} \\
Purpose: & Determine pixel-to-wavelength transformation. \\
Requirements: & \REQ{METIS-6074}, \REQ{METIS-10300} \\
Type: & Calibration \\
Templates: & \TPL{METIS_ifu_cal_InternalWave} \\
Input data: & \RAW{IFU_WAVE_RAW} \\
& \EXTCALIB{BADPIX_MAP_IFU} (optional) \\
& \EXTCALIB{PERSISTENCE_MAP} \\
& \STATCALIB{LINEARITY_IFU} \\
& \STATCALIB{GAIN_MAP_IFU} \\
& \STATCALIB{MASTER_DARK_IFU} \\
& \PROD{IFU_DISTORTION_TABLE} \\
Matched Keywords: & \FITS{DET.DIT}\\
& \FITS{DET.NDIT}\\
& \FITS{DRS.IFU}\\
Parameters: & None \\
Algorithm: & Measure line locations (left and right edges, centroid by Gaussian fit).\\
& Compute deviation from optical models. \\
& Compute wavelength solution $\xi(x, y, i)$, $\lambda(x, y, i)$. \\
& Compute wavelength map. \\
Output data: & \PROD{IFU_WAVECAL} \\
Expected accuracies: & 1/5th of a pixel after post-processing (cf.~\cite{METIS-calibration_plan}, \REQ{METIS-6074}) \\
QC1 parameters: & \QC{QC IFU WAVECAL RMS} \\
& \QC{QC IFU WAVECAL NLINES} \\
& \QC{QC IFU WAVECAL PEAK CNTS} \\
& \QC{QC IFU WAVECAL LINE WIDTH} \\
\end{recipedef}
\begin{figure}[hb]
\centering
\def \globalscale {0.700000}
\fontsize{10}{12}\selectfont
\input{tikz/metis_ifu_wavecal}
\caption[Recipe: \REC*{metis_ifu_wavecal}]{\REC*{metis_ifu_wavecal} --
daytime wavelength calibration for the IFU.}
\label{fig:metis_ifu_wavecal}
\end{figure}
%------------------------------------------------------------------------------------------------------------------
\clearpage
\subsubsection{\REC*{metis_ifu_rsrf}: IFU relative spectral response function}
\label{sssec:ifu_rsrf}
\label{rec:metis_ifu_rsrf}
This recipe creates a spectroscopic master flat and determines the
relative spectral response function (RSRF) for the four HAWAII2RG
detectors of the LM spectrograph. The input data are obtained by
illuminating the field of view with the black-body calibration lamp at
two different temperatures. The RSRF is then determined by dividing
the image by the known lamp continuum shape for the respective
temperature. We refer to the two-dimensional image obtained by this
division as \PROD{MASTER_FLAT_IFU} and the one-dimensional reponse
function obtained by averaging along the spatial direction of the
\PROD{RSRF_IFU}. The bad pixel mask can be updated by identifying pixels
that deviate strongly from their neighbours.
\begin{recipedef}
Name: & \REC{metis_ifu_rsrf} \\
Purpose: & Create relative spectral response function for the IFU detector. \\
Requirements: & \REQ{METIS-6131}, \REQ{METIS-6698} \\
Type: & Calibration \\
Templates: & \TPL{METIS_ifu_cal_rsrf} \\
Input data: & \RAW{IFU_RSRF_RAW} (Raw flats taken with black-body calibration lamp.) \\
& \EXTCALIB{BADPIX_MAP_IFU} (optional) \\
& \EXTCALIB{PERSISTENCE_MAP} \\
& \STATCALIB{MASTER_DARK_IFU} \\
& \STATCALIB{LINEARITY_IFU} \\
& \STATCALIB{GAIN_MAP_IFU} \\
& \PROD{IFU_DISTORTION_TABLE} \\
& \PROD{IFU_WAVECAL}: image with wavelength at each pixel. \\
Matched Keywords: & \FITS{DET.DIT}\\
& \FITS{DET.NDIT}\\
& \FITS{DRS.IFU}\\
Parameters: & None \\
Algorithm: & Create continuum image by mapping Planck spectrum at $T_{\mathrm{lamp}}$ to
wavelength image. \\
& Divide exposures by continuum image. \\
& Average exposures to yield master flat (2D RSRF). \\
& Average in spatial direction to obtain relative response function \\
Output data: & \PROD{MASTER_FLAT_IFU} \\
& \PROD{RSRF_IFU} \\
& \EXTCALIB{BADPIX_MAP_IFU} \\
Expected accuracies: & 3\% (\REQ{METIS-6698}) \\
QC1 parameters: & \QC{QC IFU RSRF NBADPIX} \\
% & (more TBD) \\
\end{recipedef}
\begin{figure}[hb]
\centering
\def \globalscale {0.700000}
\fontsize{10}{12}\selectfont
\input{tikz/metis_ifu_rsrf}
\caption[Recipe: \REC*{metis_ifu_rsrf}]{\REC*{metis_ifu_rsrf} --
creation of IFU relative spectral response function.}
\label{fig:metis_ifu_rsrf}
\end{figure}
%------------------------------------------------------------------------------------------------------------------
%\clearpage
%\subsubsection{\REC*{metis_ifu_std_processold}: IFU flux standard reduction}
%\label{sssec:ifu_std_processold}
%\label{rec:metis_ifu_std_processold}
%
%This recipe reduces and analyses a series of IFU observations of a
%spectroscopic flux standard star. The comparison of the measured
%detector counts (ADU) with the tabulated spectrum of the star gives
%the wavelength-dependent conversion from ADU to physical units
%(photons per second per centimetre square per micron per arcsec square).
%
%The wavelength calibration is taken from the daylight calibration. It
%may be refined by measuring telluric emission and/or absorption lines
%(by fitting with \lstinline{molecfit}).
%
%\begin{recipedef}
% Name: & \REC{metis_ifu_std_process} \\
% Purpose: & Determine conversion between detector counts and physical source flux. \\
% Requirements: & \REQ{METIS-6131} \\
% Type: & Calibration \\
% Templates: & \TPL{METIS_ifu_cal_standard} \\
% Input data: & \RAW{IFU_STD_RAW} (Raw spectra of flux standard star) \\
% & \PROD{MASTER_DARK_IFU} \\
% & \PROD{RSRF_IFU} (2D relative spectral response function) \\
% & \EXTCALIB{BADPIX_MAP_IFU} \\
% & \PROD{IFU_WAVECAL} \\
% & \PROD{IFU_DISTORTION_TABLE} \\
% Parameters: & None \\
% Algorithm: & Subtract dark, divide by master flat \\
% & Estimate stray light and subtract \\
% & Estimate background and subtract \\
% & Rectify spectra and assemble cube \\
% & Extract 1D spectrum of star \\
% & Compute and apply telluric correction \\
% & Compute conversion to physical units as function of wavelength. \\
% Output data: & \PROD{IFU_STD_REDUCED_CUBE} \\
% & \PROD{IFU_STD_BACKGROUND_CUBE} \\
% & \PROD{IFU_STD_REDUCED_1D} \\
% & \PROD{IFU_STD_TELLURIC_1D} \\
% & \PROD{FLUXCAL_TAB} \\
% Expected accuracies: & $<5$\% absolute flux calibration \\
% QC1 parameters: & \QC{QC IFU STD STRAYLIGHT MEAN} \\
%\end{recipedef}
%
%\begin{figure}[hb]
% \centering
% \def \globalscale {0.700000}
% \fontsize{10}{12}\selectfont
% \input{tikz/metis_ifu_std_process}
% \caption[Recipe: \REC*{metis_ifu_std_process}]{%
% \REC{metis_ifu_std_process} -- reduction of IFU flux standard
% frames and flux calibration (not all data products are shown).}
% \label{fig:metis_ifu_std_processHBOLD}
%\end{figure}
\clearpage
\subsubsection{\REC*{metis_ifu_reduce}: IFU basic data reduction}
\label{sssec:ifu_sci_process}
\label{rec:metis_ifu_sci_process}
\label{sssec:ifu_reduce}
\label{rec:metis_ifu_reduce}
This recipe performs basic reduction of raw science exposures or IFU
observations of a spectroscopic flux standard star, applying
dark and RSRF correction on each exposure individually, but no flux calibration
(i.e.~conversion of pixel values to physical units).
The
recipe will be able to process data from either the nominal or the
extended wavelength mode. For the nominal mode, all slices belong to
the same echelle order. For the extended mode, slices belonging to the
same echelle order are grouped and processing is iterated over the
echelle orders.
% from https://polarion.astron.nl/polarion/#/project/METIS/workitem?id=METIS-9141
For the LM band detectors in the IFU, the pixels on the edges of the detectors will be masked with the following widths~\cite{matisse_minutes} (\REQ{METIS-9141}) (Fig.~\ref{fig:ifu_detector_masking}):
\begin{itemize}
\item 64 columns on each ``outside'' of the 2x2 detector array in the dispersion direction
\item 0 columns on each ``inside'' of the 2x2 detector array in the dispersion direction
\item 32 rows at the top and bottom of each of the 4 detectors.
\end{itemize}
Note: We define rows and columns in the H2RG detector as follow:
\begin{itemize}
\item A row is readout by 32 outputs
\item A column is readout by 1 output
\end{itemize}
\begin{figure}[hb]
\centering
\includegraphics[width=0.7\textwidth]{LMS_detector_masking}
\caption[The IFU masking scheme]{%
The IFU masking scheme. Masked regions are in light blue.}
\label{fig:ifu_detector_masking}
\end{figure}
The level of stray light is estimated in the dark areas between the
spectra and subtracted from the entire frame. The distribution of
stray light across the field can only be characterised once the
instrument is built. It is to be hoped that subtraction of a constant
or a low-level 2D polynomial fit will be sufficient.
The sky and thermal background, as well as residual straylight, is
estimated from blank sky observations if these are available in the
sequence of input frames or by combining (dithered) science
frames. The initial wavelength solution is taken from the daylight
calibration. It may be checked and corrected by measuring atmospheric
lines if a sufficient number is available in the limited wavelength
range.
The recipe produces the following (intermediate) data products:
\begin{itemize}\item Reduced 2D detector images. These are accompanied by additional
information describing the geometry of the slice layout, target
position and wavelength calibration to the extent that the exposure can be
combined with other exposures into a single rectified spectral cube.
This information can be stored in the FITS header or a table
extension.
\item A rectified spectral cube for each exposure with a linear
wavelength grid, constructed by resampling each spectral slice onto
a spatial-wavelength grid common to all slices. The spatial pixels
are rectangular with along-slit pixel scale given by the detector
pixel scale and the across-slit pixel scale given by the slice
width.
\item A spectral cube obtained by combining all exposures taken within
a template. This step involves the image reconstruction discussed in
Section~\ref{ssec:image_reconstruction}.
% TODO: Decide on the below.
% Whether this step is included
% in the present recipe \REC{metis_ifu_sci_process} or is postponed to
% the more general recipe \REC{metis_ifu_sci_postprocess} is TBD. It
% may be formally required to do the image reconstruction here if
% templates are set up to obtain a fixed set of spatially dithered and
% rotated exposures aimed at reconstructing a fully sampled PSF in
% both spatial dimensions.
\end{itemize}
For the nominal mode, each output is a single-extension FITS file
corresponding to one echelle order. For the extended mode, each of the
echelle orders results in an extension in a multi-extension FITS
file.
% HB 20230902: We should not create a separate recipe, but maybe it is
% necessary to also implement a quick-and-dirty version of some
% algorithms, configurable via a parameter.
%The recipe as described here is run in the science pipelines. For the
%observatory pipeline, a variant of the recipe may be implemented with
%reduced functionality and output.
The LM-band images that are taken in parallel with the IFU exposures are
processed with \REC{metis_lm_img_basic_reduce}.
\begin{recipedef}
Name: & \REC{metis_ifu_reduce} \\
Purpose: & Reduction of individual science exposures or standard star observations. \\
Requirements: & \REQ{METIS-6131}, \REQ{METIS-6309} \\
Type: & Science \\
Templates: & \TPL{METIS_ifu_obs_FixedSkyOffset} \\
& \TPL{METIS_ifu_obs_GenericOffset} \\
& \TPL{METIS_ifu_ext_obs_FixedSkyOffset} \\
& \TPL{METIS_ifu_ext_obs_GenericOffset} \\
% TODO: Decide what to do about app
% & \TPL{METIS_ifu_app_obs_GenericOffset} \\
& \TPL{METIS_ifu_vc_obs_FixedSkyOffset} \\
% & \TPL{METIS_ifu_ext_app_obs_GenericOffset} \\
& \TPL{METIS_ifu_ext_vc_obs_FixedSkyOffset} \\
% HB 20230626: Not sure the *_obs_Stare templates should go here, but seems the most logical place.
& \TPL{METIS_ifu_app_obs_Stare} \\
& \TPL{METIS_ifu_ext_app_obs_Stare} \\
& \TPL{METIS_ifu_cal_psf} \\
& \TPL{METIS_ifu_cal_standard} \\
Input data: & \RAW{IFU_SCI_RAW} or \RAW{IFU_STD_RAW} \\
& \RAW{IFU_SKY_RAW} (Blank sky images, if available.) \\
& \EXTCALIB{BADPIX_MAP_IFU} (optional) \\
& \STATCALIB{LINEARITY_IFU} \\
& \STATCALIB{GAIN_MAP_IFU} \\
& \EXTCALIB{PERSISTENCE_MAP} \\
& \STATCALIB{MASTER_DARK_IFU} \\
& \PROD{RSRF_IFU} (2D relative spectral response function) \\
& \PROD{IFU_WAVECAL} \\
% TODO: I believe this should not be just FLUXCAL_TAB as it is not a table but an image
% & \PROD{FLUXCAL_TAB} (Flux calibration table) \\
& \PROD{IFU_DISTORTION_TABLE} \\
% & \STATCALIB{LSF_KERNEL} (Line spread kernel to be used with \CODE{molecfit}) \\
Matched Keywords: & \FITS{DET.DIT}\\
& \FITS{DET.NDIT}\\
& \FITS{DRS.IFU}\\
Parameters: & telluric correction (yes/no) \\
% & more TBD \\
Algorithm: & Subtract dark, divide by master flat \\
& Analyse and optionally remove masked regions and correct crosstalk and ghosts \\
& Estimate stray light and subtract \\
& Estimate background from dithered science exposures or blank-sky exposures and subtract. \\
& Rectify spectra and assemble cube \\
& Extract 1D object spectrum \\
Output data: & \PROD{IFU_SCI_REDUCED} or \PROD{IFU_STD_REDUCED} (2D, per exposure) \\
% & \PROD{IFU_SCI_REDUCED_TAC} (2D, per exposure) \\
& \PROD{IFU_SCI_BACKGROUND} or \PROD{IFU_STD_BACKGROUND} (2D, per exposure) \\
& \PROD{IFU_SCI_REDUCED_CUBE} or \PROD{IFU_STD_REDUCED_CUBE} (3D, per exposure, only for science) \\
% & \PROD{IFU_SCI_REDUCED_CUBE_TAC} (3D, per exposure) \\
& \PROD{IFU_SCI_COMBINED} or \PROD{IFU_STD_COMBINED} (3D) \\
% & \PROD{IFU_SCI_COMBINED_TAC} (3D) \\
% & \PROD{IFU_SCI_OBJECT_1D} or \PROD{IFU_STD_OBJECT_1D} (1D) \\
% & \PROD{IFU_SCI_TELLURIC_1D} \\
Expected accuracies: & for wavelength: 1/5th of a pixel after post-processing\\
& (cf.~\cite{METIS-calibration_plan}, \REQ{METIS-6074} \\
& for flux: 10\% over an atmospheric band \\
QC1 parameters: & \QC{QC IFU REDUCE NBADPIX} \\
& \QC{QC IFU REDUCE MEANBKG} \\
& \QC{QC IFU REDUCE MEANSTRY} \\
\end{recipedef}
\newgeometry{bottom=0.1cm, right=0.1cm, left=0.1cm, top=0.1cm}
\begin{figure}[hb]
\centering
\def \globalscale {0.700000}
\fontsize{10}{12}\selectfont
\input{tikz/metis_ifu_reduce}
\caption[Recipe: \REC*{metis_ifu_reduce}]{%
\REC{metis_ifu_reduce} -- reduction of IFU science frames.}
\label{fig:metis_ifu_reduce}
\end{figure}
\restoregeometry
\clearpage
\subsubsection{\REC*{metis_ifu_telluric}: IFU telluric absorption correction}
\label{sssec:ifu_telluric}
\label{rec:metis_ifu_telluric}
This recipe derives calibration products from either a reduced science
observation, or a reduced standard star observation.
For standard star observations the recipe derives the flux calibration and the
telluric absorption correction.
For science observations, the recipe only derives the telluric absorption
correction.
The preferred approach to correct for the telluric absorption is to derive the
correction directly from the science data.
However, deriving the telluric absorption correction from the standard star
is more conventional, and will be used if the telluric absorption cannot be
determined from the science data.
The resolution of the \ac{IFU} is higher than the \ac{LSS}, so it might be less
relevant to use the standard star for the telluric correction.
A telluric correction is determined by this recipe by automatically
extracting a 1D spectrum from ``object'' pixels identified by a
thresholding algorithm. \lstinline{molecfit} is applied to this
spectrum and the correction is mapped back to the reduced 2D images or
3D cubes using the wavelength images.
In an interactive environment the telluric correction may be improved by asking
the user to define an extraction aperture adapted to the target
structure.
% TODO: Allow metis_ifu_calibrate to do this?
%The spectrum is extracted from a combined cube
%(\PROD{IFU_SCI_COMBINED}) but may be applied to other products of
%\REC{metis_ifu_reduce}.
The actual calibration through the application of these corrections is done in \REC{metis_ifu_calibrate}.
The workflow orchestration rules will prefer the telluric correction from the
science data if both are available and of sufficient quality.
% TODO: create rules that take the quality of the correction into account
\begin{recipedef}
Name: & \REC{metis_ifu_telluric} \\
Purpose: & Derive telluric absorption correction and optionally flux calibration \\
Requirements: & \REQ{METIS-6091} \\
Type: & Calibration / post processing \\
Templates: & --- \\
Input data: & \PROD{IFU_SCI_COMBINED} or \PROD{IFU_STD_COMBINED} -- reduced combined IFU cube \\
& \EXTCALIB{FLUXSTD_CATALOG} (photometric standard catalogue) \\
& \STATCALIB{LSF_KERNEL} -- Line spread kernel to be used with \CODE{molecfit} \\
& \EXTCALIB{ATM_PROFILE} -- Atmospheric input profile to be used with \CODE{molecfit} \\
Matched Keywords: & \FITS{DET.DIT}\\
& \FITS{DET.NDIT}\\
& \FITS{DRS.IFU}\\
Parameters: & extraction aperture parameters \\
& \CODE{molecfit} parameters \\
& atmospheric profile incl.\ radiometer data \\
& line spread kernel \\
Algorithm: & Extract 1D spectrum of science object or standard star. \\
& Compute telluric correction. \\
& Compute conversion to physical units as function of wavelength. \\
Output data: & \PROD{IFU_TELLURIC} \\
& \PROD{FLUXCAL_TAB} (for standard stars) \\
& \PROD{IFU_SCI_REDUCED_1D} or \PROD{IFU_STD_REDUCED_1D} (1D) \\
Expected accuracies: & 2\%~\cite{METIS_calerrbudget} \\
QC1 parameters: & \QC{QC IFU TELLURIC CHI2} \\
& \QC{QC IFU TELLURIC NPTHRESH} \\
& \QC{QC IFU TELLURIC CONV} \\
\end{recipedef}
\begin{figure}[hb]
\centering
\def \globalscale {0.700000}
\fontsize{10}{12}\selectfont
\input{tikz/metis_ifu_telluric}
\caption[Recipe: \REC*{metis_ifu_telluric}]{\REC*{metis_ifu_telluric}
-- telluric correction of reduced IFU science cubes.}
\label{fig:metis_ifu_telluric}
\end{figure}
%------------------------------------------------------------------------------------------------------------------
\clearpage
\subsubsection{\REC*{metis_ifu_calibrate}: calibrate IFU science data}\label{rec:metis_ifu_calibrate}
\label{sssec:ifu_calibrate}
This recipe applies the calibrations from \REC{metis_ifu_telluric} to an
\ac{IFU} science observation.
In particular, the recipe will apply a telluric absorption correction and it
will perform flux calibration (that is, conversion of pixel values to physical
units).
The telluric correction could be derived through different means, e.g.~from
the science data itself or from a standard star.
The workflow orchestration system will perform the selection of the best
calibration data to use; this recipe simply performs the calibration.
\begin{recipedef}
Name: & \REC{metis_ifu_calibrate} \\
Purpose: & Calibrate IFU science data. \\
Requirements: & \REQ{METIS-6091} \\
Type: & Calibration / post processing \\
Templates: & --- \\
Input data: & \PROD{IFU_SCI_REDUCED} -- reduced IFU cube \\
& \PROD{FLUXCAL_TAB} \\
& \STATCALIB{IFU_TELLURIC} \\
Matched Keywords: & \FITS{DRS.IFU}\\
Algorithm: & Correct for telluric absorption. \\
& Apply flux calibration. \\
Output data: & \PROD{IFU_SCI_CUBE_CALIBRATED} \\
Expected accuracies: & $<5$\% absolute flux calibration \\
& $<30$\% absolute line flux accuracy \\
& $<5$\% absolute flux calibration \\
& (cf.~\cite{METIS-calibration_plan}, R-MET-107, R-MET-82) \\
QC1 parameters: & \QC{QC IFU CALIB MAXFLUX} \\
& \QC{QC IFU CALIB MINFLUX} \\
\end{recipedef}
\begin{figure}[hb]
\centering
\def \globalscale {0.700000}
\fontsize{10}{12}\selectfont
\input{tikz/metis_ifu_calibrate}
\caption[Recipe: \REC*{metis_ifu_calibrate}]{\REC*{metis_ifu_calibrate}
-- calibration of reduced IFU science cubes.}
\label{fig:metis_ifu_calibrate}
\end{figure}
%------------------------------------------------------------------------------------------------------------------
\clearpage
\subsubsection{\REC*{metis_ifu_postprocess}: IFU science postprocessing}
\label{sssec:ifu_sci_postprocess}\label{sssec:ifu_postprocess}
\label{rec:metis_ifu_postprocess}
This recipe combines a number of reduced IFU exposures covering a
different spatial and wavelength ranges into a single data cube. The
positions and orientations of the exposures may differ as follows (cf.~\cite{METIS-operational_concept}): %\TODO{Reference to operational concept}
\begin{description}
\item[Spatial dithering:] The target is placed at different positions
along and across the slice. Along-slice dithering aids in background
subtraction, across-slice dithering is necessary image
reconstruction given that the slice width undersamples the PSF\@.
\item[Field rotation:] The field is rotated by 90 degrees between
exposures. The cube of a single exposure has different pixel scales
along and across the slice. The goal of combining exposures at
different rotation angles is to reconstruct images on a square grid
with pixel scale given by the detector scale (8.2\,mas). The exact
procedure remains to be investigated; one of the major challenges is
to find the exact centre of rotation
(Sect.~8.9 of~\cite{DRLS}).
\item[Spectral dithering:] Sequences of exposures are taken at various
echelle angles in order to cover an increased contiguous wavelength
range. In the extended mode, such a sequence may cover the
wavelength gaps between echelle order coverage.
\end{description}
In order to allow co-addition of data from separate OBs, possibly taken
months apart, the wavelengths will be corrected to the heliocentric
reference system before co-addition.
The recipe is only used in the science-grade pipelines, not at the
observatory.
\begin{recipedef}
Name: & \REC{metis_ifu_postprocess} \\
Purpose: & Coaddition and mosaicing of reduced science cubes. \\
Requirements: & \REQ{METIS-6131} \\
Type: & Science \\
Templates: & None \\
Input data: & \PROD{IFU_SCI_CUBE_CALIBRATED} \\
Matched Keywords: & \FITS{DRS.IFU}\\
% or \PROD{IFU_SCI_REDUCED_TAC}
Parameters: & None \\
Algorithm: & Call \DRL{metis_ifu_grid_output} to find the output grid encompassing all input cubes \\
& Call \DRL{metis_ifu_resampling} to resample input cubes to output grid \\
& Call \DRL{metis_ifu_coadd} to stack the images \\
Output data: & \PROD{IFU_SCI_COADD} \\
% & \PROD{IFU_SCI_COADD_ERROR} \\
QC1 parameters: & \QC{QC IFU POSTPROC GRIDRNG} \\
& \QC{QC IFU POSTPROC MEDMEAN} \\
& \QC{QC IFU POSTPROC MEDRMS} \\
& \QC{QC IFU POSTPROC MEDMED} \\
& \QC{QC IFU POSTPROC DELTAC} \\
\end{recipedef}
\begin{figure}[hb]
\centering
\def \globalscale {0.700000}
\fontsize{10}{12}\selectfont
\input{tikz/metis_ifu_postprocess}
\caption[Recipe: \REC*{metis_ifu_postprocess}]{%
\REC{metis_ifu_postprocess} -- post-processing (coaddition) of
reduced IFU science frames.}
\label{fig:metis_ifu_sci_postprocess}
\end{figure}
%------------------------------------------------------------------------------------------------------------------
\clearpage
\subsubsection{\REC*{metis_ifu_distortion}: IFU distortion calibration}
\label{sssec:ifu_distortion}
\label{rec:metis_ifu_distortion}
Calibration of the geometric distortion of the IFU is done by
observing a pin hole mask located in a focal plane within the
instrument. The distortion is described in terms of a polynomial model
whose coefficients can be used to map positions in in the detector
array to sky positions. Measurement of the FWHM of the spots gives an
indication of the variation of spectral resolution across the field of view.
\begin{recipedef}
Name: & \REC{metis_ifu_distortion} \\
Purpose: & Determine geometric distortion coefficients for the IFU. \\
Requirements: & \REQ{METIS-6087}, \REQ{METIS-6073} \\
Type: & Calibration \\
Templates: & \TPL{METIS_ifu_cal_distortion} \\
Input data: & \RAW{IFU_DISTORTION_RAW} (Images of multi-pinhole mask.) \\
& \EXTCALIB{BADPIX_MAP_IFU} (optional) \\
& \EXTCALIB{PERSISTENCE_MAP} \\
& \STATCALIB{LINEARITY_IFU} \\
& \STATCALIB{GAIN_MAP_IFU} \\
& \STATCALIB{MASTER_DARK_IFU} \\
& \EXTCALIB{PINHOLE_TABLE} \\
% & \STATCALIB{GAIN_MAP_IFU}\\
Matched Keywords: & \FITS{DRS.IFU}\\
Parameters: & None \\
Algorithm: & Calculate table mapping pixel position to position on sky. \\
Output data: & \PROD{IFU_DISTORTION_TABLE} \\
& \PROD{IFU_DIST_REDUCED} \\
Expected accuracies: & 1/10th of a pixel after post-processing\\
& (cf.~\cite{METIS-calibration_plan}, R-MET-106, \REQ{METIS-167}, \REQ{METIS-1371})\\
QC1 parameters: & \QC{QC IFU DISTORT RMS}: RMS deviation between measured position and model \\
& \QC{QC IFU DISTORT FWHM}: Measured FWHM of spots \\
& \QC{QC IFU DISTORT NSPOTS}: Number of identified spots \\
\end{recipedef}
\begin{figure}[hb]
\centering
\def \globalscale {0.700000}
\fontsize{10}{12}\selectfont
\input{tikz/metis_ifu_distortion}
\caption[Recipe: \REC*{metis_ifu_distortion}]{%
\REC{metis_ifu_distortion} -- IFU distortion calibration}
\label{fig:metis_ifu_distortion}
\end{figure}
\clearpage
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Local Variables:
%%% TeX-master: "METIS_DRLD"
%%% End: