MUSE Pipeline Reference Manual  2.1.1
muse_flux.h
1 /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:set sw=2 sts=2 et cin: */
3 /*
4  * This file is part of the MUSE Instrument Pipeline
5  * Copyright (C) 2005-2017 European Southern Observatory
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  */
21 
22 #ifndef MUSE_FLUX_H
23 #define MUSE_FLUX_H
24 
25 /*----------------------------------------------------------------------------*
26  * Includes *
27  *----------------------------------------------------------------------------*/
28 #include <cpl.h>
29 
30 #include "muse_image.h"
31 #include "muse_pixtable.h"
32 #include "muse_resampling.h"
33 #include "muse_table.h"
34 
35 /*----------------------------------------------------------------------------*
36  * Defines *
37  *----------------------------------------------------------------------------*/
38 /* flux scaling units expressed according to the FITS Standard v3.0, §4.3 */
39 static const char kMuseFluxUnitString[] = "10**(-20)*erg/s/cm**2/Angstrom";
40 static const char kMuseFluxStatString[] = "(10**(-20)*erg/s/cm**2/Angstrom)**2";
41 static const double kMuseFluxUnitFactor = 1e20;
42 static const double kMuseFluxStatFactor = 1e40;
43 
44 /* FITS headers for storing detected sources found *
45  * by the standard star flux integration routines */
46 #define MUSE_HDR_FLUX_NOBJ "ESO DRS MUSE FLUX NOBJ"
47 #define MUSE_HDR_FLUX_NOBJ_C "Number of objects detected in standard star cube"
48 #define MUSE_HDR_FLUX_OBJn_X "ESO DRS MUSE FLUX OBJ%d X"
49 #define MUSE_HDR_FLUX_OBJn_X_C "[pix] Object x position in cube"
50 #define MUSE_HDR_FLUX_OBJn_Y "ESO DRS MUSE FLUX OBJ%d Y"
51 #define MUSE_HDR_FLUX_OBJn_Y_C "[pix] Object y position in cube"
52 #define MUSE_HDR_FLUX_OBJn_RA "ESO DRS MUSE FLUX OBJ%d RA"
53 #define MUSE_HDR_FLUX_OBJn_RA_C "[deg] Approximate RA coordinate of object"
54 #define MUSE_HDR_FLUX_OBJn_DEC "ESO DRS MUSE FLUX OBJ%d DEC"
55 #define MUSE_HDR_FLUX_OBJn_DEC_C "[deg] Approximate DEC coordinate of object"
56 #define MUSE_HDR_FLUX_OBJn_FLUX "ESO DRS MUSE FLUX OBJ%d INTFLUX"
57 #define MUSE_HDR_FLUX_OBJn_FLUX_C "[10**(-20)*erg/s/cm**2] Total flux integrated for this object"
58 #define MUSE_HDR_FLUX_NSEL "ESO DRS MUSE FLUX NSEL"
59 #define MUSE_HDR_FLUX_NSEL_C "Object (%s) selected as standard star"
60 
61 /* FITS header to mark flat-field spectrum corrected products */
62 #define MUSE_HDR_FLUX_FFCORR "ESO DRS MUSE FLUX FFCORR" /* bool */
63 #define MUSE_HDR_FLUX_FFCORR_C "Data was flat-field spectrum corrected"
64 
65 /*----------------------------------------------------------------------------*
66  * Data structures *
67  *----------------------------------------------------------------------------*/
69 
73 /*----------------------------------------------------------------------------*/
77 /*----------------------------------------------------------------------------*/
78 typedef struct {
85  cpl_table *reference;
88  cpl_table *sensitivity;
94  cpl_table *tellbands;
96  double raref;
98  double decref;
100 
101 /*----------------------------------------------------------------------------*/
110 /*----------------------------------------------------------------------------*/
111 typedef enum {
118 
119 /*----------------------------------------------------------------------------*/
123 /*----------------------------------------------------------------------------*/
124 typedef enum {
130 
131 /*----------------------------------------------------------------------------*/
135 /*----------------------------------------------------------------------------*/
136 typedef enum {
140 
141 /*----------------------------------------------------------------------------*/
145 /*----------------------------------------------------------------------------*/
146 typedef enum {
152 
155 /*----------------------------------------------------------------------------*
156  * Function prototypes *
157  *----------------------------------------------------------------------------*/
160 
161 cpl_error_code muse_flux_reference_table_check(cpl_table *);
162 double muse_flux_response_interpolate(const cpl_table *, double, double *, muse_flux_interpolation_type);
165 cpl_error_code muse_flux_response_compute(muse_flux_object *, muse_flux_selection_type, double, const cpl_table *, const cpl_table *, const cpl_table *);
168 cpl_error_code muse_flux_compute_qc(muse_flux_object *);
169 cpl_error_code muse_flux_compute_qc_zp(muse_flux_object *, const muse_table *, const char *);
170 
171 cpl_error_code muse_flux_calibrate(muse_pixtable *, const muse_table *, const cpl_table *, const muse_table *);
172 
173 #endif /* MUSE_FLUX_H */
Structure definition of a MUSE datacube.
Definition: muse_datacube.h:48
cpl_error_code muse_flux_compute_qc(muse_flux_object *)
Compute QC parameters, related to on-sky throughput.
Definition: muse_flux.c:2858
muse_image * intimage
Definition: muse_flux.h:83
muse_flux_smooth_type
Type of response curve smoothing to use.
Definition: muse_flux.h:146
muse_flux_profile_type
Type of optimal profile to use.
Definition: muse_flux.h:124
cpl_error_code muse_flux_reference_table_check(cpl_table *)
Check and/or adapt the standard flux reference table format.
Definition: muse_flux.c:170
cpl_table * reference
Definition: muse_flux.h:85
const muse_cpltable_def muse_response_tellbands_def[]
Table definition for a telluric bands table.
Definition: muse_flux.c:1486
cpl_table * sensitivity
Definition: muse_flux.h:88
Structure definition of MUSE three extension FITS file.
Definition: muse_image.h:40
cpl_error_code muse_flux_calibrate(muse_pixtable *, const muse_table *, const cpl_table *, const muse_table *)
Convert the input pixel table from counts to fluxes.
Definition: muse_flux.c:3083
muse_flux_object * muse_flux_object_new(void)
Allocate memory for a new muse_flux_object object.
Definition: muse_flux.c:68
muse_table * telluric
Definition: muse_flux.h:92
cpl_error_code muse_flux_get_telluric_table(muse_flux_object *)
Get the table of the telluric correction.
Definition: muse_flux.c:2752
cpl_error_code muse_flux_compute_qc_zp(muse_flux_object *, const muse_table *, const char *)
Compute QC zeropoint for given filter.
Definition: muse_flux.c:2972
double muse_flux_response_interpolate(const cpl_table *, double, double *, muse_flux_interpolation_type)
Compute linearly interpolated response of some kind at given wavelength.
Definition: muse_flux.c:338
Structure definition of MUSE pixel table.
Flux object to store data needed while computing the flux calibration.
Definition: muse_flux.h:78
cpl_error_code muse_flux_response_compute(muse_flux_object *, muse_flux_selection_type, double, const cpl_table *, const cpl_table *, const cpl_table *)
Compare measured flux distribution over wavelength with calibrated stellar fluxes and derive instrume...
Definition: muse_flux.c:2070
muse_table * response
Definition: muse_flux.h:90
muse_datacube * cube
Definition: muse_flux.h:80
muse_flux_interpolation_type
Type of table interpolation to use.
Definition: muse_flux.h:111
Structure to store a table together with a property list.
Definition: muse_table.h:43
cpl_error_code muse_flux_get_response_table(muse_flux_object *, muse_flux_smooth_type)
Get the table of the standard star response function.
Definition: muse_flux.c:2644
cpl_table * tellbands
Definition: muse_flux.h:94
muse_image * muse_flux_integrate_cube(muse_datacube *, cpl_apertures *, muse_flux_profile_type)
Integrate the flux of the standard star(s) given a datacube.
Definition: muse_flux.c:1009
cpl_error_code muse_flux_integrate_std(muse_pixtable *, muse_flux_profile_type, muse_flux_object *)
Reconstruct a cube, detect the standard star, and integrate its flux.
Definition: muse_flux.c:1362
Definition of a cpl table structure.
muse_flux_selection_type
Type of star selection to use.
Definition: muse_flux.h:136
void muse_flux_object_delete(muse_flux_object *aFluxObj)
Deallocate memory associated to a muse_flux_object.
Definition: muse_flux.c:89