MUSE Pipeline Reference Manual  0.18.5
muse_sky.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  *
5  * This file is part of the MUSE Instrument Pipeline
6  * Copyright (C) 2005-2011 European Southern Observatory
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  */
22 
23 #ifndef MUSE_SKY_H
24 #define MUSE_SKY_H
25 
26 /*----------------------------------------------------------------------------*
27  * Includes *
28  *----------------------------------------------------------------------------*/
29 #include <cpl.h>
30 
31 #include "muse_utils.h"
32 #include "muse_cplwrappers.h"
33 #include "muse_pixtable.h"
34 #include "muse_resampling.h"
35 #include "muse_lsf.h"
36 
37 /*----------------------------------------------------------------------------*
38  * Defines *
39  *----------------------------------------------------------------------------*/
40 
42 extern const muse_cpltable_def muse_relativespectrum_def[];
43 extern const muse_cpltable_def muse_extinction_def[];
45 
46 /*----------------------------------------------------------------------------*
47  * Special variable types *
48  *----------------------------------------------------------------------------*/
52 /*----------------------------------------------------------------------------*/
58 /*----------------------------------------------------------------------------*/
59 typedef struct {
63  cpl_table *lines;
65  cpl_table *continuum;
67  muse_lsf_params **lsf; /*<< the LSF parameters */
68 
70 
71 /*----------------------------------------------------------------------------*/
75 /*----------------------------------------------------------------------------*/
76 typedef struct {
77  double fraction;
78  double sampling;
79  double csampling;
81 
82 /*----------------------------------------------------------------------------*/
86 /*----------------------------------------------------------------------------*/
87 typedef struct {
88  cpl_size n_param;
89  cpl_size offset;
90  cpl_size refraction;
91  cpl_size sensitivity;
92  cpl_size slit_width;
93  cpl_size bin_width;
94  cpl_size lsf_width;
95  cpl_size hermit[MAX_HERMIT_ORDER];
97 
100 /*----------------------------------------------------------------------------*
101  * Function prototypes *
102  *----------------------------------------------------------------------------*/
105 cpl_error_code muse_sky_lines_set_range(cpl_table *, double, double);
108 
110 cpl_table *muse_sky_spectrum_from_cube(muse_datacube *, const cpl_mask *);
111 void muse_sky_mark_cosmic(cpl_table *aSpectrum, muse_pixtable *aPixtable);
112 
113 muse_sky_fit_params *muse_sky_fit_params_new(cpl_boolean, cpl_boolean, cpl_size,
114  cpl_size, cpl_size, cpl_size, cpl_size, cpl_size, cpl_size, cpl_size);
115 
117 
118 muse_sky_master *muse_sky_master_fit(const cpl_array *, const cpl_array *,
119  const cpl_array *, const cpl_table *);
120 
122 
123 muse_lsf_params *muse_sky_lsf_params_fit(const cpl_array *,
124  const cpl_array *, const cpl_array *, const cpl_table *, const cpl_array *,
125  const cpl_array *, muse_lsf_params *, int,
126  const muse_sky_fit_params *);
128  muse_lsf_params *);
130  muse_lsf_params **);
131 
132 cpl_error_code muse_sky_subtract_rowbyrow_mask(muse_image *, cpl_table *);
133 cpl_error_code muse_sky_subtract_rowbyrow(muse_image *, cpl_table *, float, unsigned int);
134 
135 cpl_table *muse_sky_lines_create(const cpl_table *, const cpl_table *, double);
136 cpl_error_code muse_sky_lines_apply_strength(cpl_table *, const cpl_array *);
137 
138 cpl_error_code muse_sky_lines_cut(cpl_table *, double);
139 cpl_array *muse_sky_apply_lsf(const cpl_array *, const cpl_table *,
140  const muse_lsf_params *);
141 
142 muse_lsf_params *muse_lsf_params_fit(const cpl_array *,
143  cpl_array *, const cpl_array *, const cpl_table *,
144  muse_lsf_params *, int, const muse_sky_fit_params *);
145 
146 #endif /* MUSE_SKY_H */
Structure definition of a MUSE datacube.
Definition: muse_datacube.h:48
cpl_error_code muse_sky_lines_apply_strength(cpl_table *, const cpl_array *)
Apply the line strengths to the lines.
cpl_table * muse_sky_spectrum_from_cube(muse_datacube *, const cpl_mask *)
Create a spectrum out of a cube by applying a mask.
cpl_table * muse_sky_lines_create(const cpl_table *, const cpl_table *, double)
Create the emission lines from the OH transitions and other lines.
cpl_table * muse_sky_lines_load(muse_processing *)
Load the sky data files.
muse_lsf_params * muse_lsf_params_fit(const cpl_array *, cpl_array *, const cpl_array *, const cpl_table *, muse_lsf_params *, int, const muse_sky_fit_params *)
Fit all entries of one slice.
Definition: muse_lsf_fit.c:131
Structure to hold the MASTER SKY result.
Definition: muse_sky.h:59
cpl_error_code muse_sky_subtract_rowbyrow(muse_image *, cpl_table *, float, unsigned int)
Subtract the sky row-by-row from a CCD-based image.
Structure to define which slice parameters are fit.
Definition: muse_sky.h:87
muse_mask * muse_sky_create_skymask(muse_image *, double)
Select spaxels to be considered as sky.
void muse_sky_fit_params_delete(muse_sky_fit_params *)
Delete the fit parameter structure.
Structure definition of MUSE three extension FITS file.
Definition: muse_image.h:41
void muse_sky_mark_cosmic(cpl_table *aSpectrum, muse_pixtable *aPixtable)
Mark all pixel above a certain limit as COSMIC.
muse_lsf_params * muse_sky_lsf_params_fit(const cpl_array *, const cpl_array *, const cpl_array *, const cpl_table *, const cpl_array *, const cpl_array *, muse_lsf_params *, int, const muse_sky_fit_params *)
Fit all entries of one slice.
cpl_table * muse_sky_continuum_load(muse_processing *)
Load the SKY_CONTINUUM spectrum.
Structure definition of MUSE pixel table.
cpl_table * lines
Table of Atmospheric emission lines and their intensities.
Definition: muse_sky.h:63
Structure to define the major settable sky parameters.
Definition: muse_sky.h:76
const muse_cpltable_def muse_fluxspectrum_def[]
Definition of the flux spectrum table structure.
cpl_error_code muse_sky_lines_set_range(cpl_table *, double, double)
Limit the lines in the table to a wavelength range.
void muse_sky_master_delete(muse_sky_master *)
Delete a MASTER SKY structure.
muse_sky_fit_params * muse_sky_fit_params_new(cpl_boolean, cpl_boolean, cpl_size, cpl_size, cpl_size, cpl_size, cpl_size, cpl_size, cpl_size, cpl_size)
Create a new fit parameter structure.
muse_sky_master * muse_sky_master_fit(const cpl_array *, const cpl_array *, const cpl_array *, const cpl_table *)
Fit all entries of the pixel table to the master sky.
cpl_error_code muse_sky_lines_cut(cpl_table *, double)
Remove all lines below a certain flux limit.
Handling of "mask" files.
Definition: muse_mask.h:43
const muse_cpltable_def muse_pixtable_def[]
MUSE pixel table definition.
muse_sky_master * muse_sky_master_load(muse_processing *)
Load SKY_LINES, SKY_CONTINUUM, and LSF_TABLE into a structure.
cpl_error_code muse_sky_subtract_rowbyrow_mask(muse_image *, cpl_table *)
Prepare an (object) mask for the sky row-by-row fitting.
Definition of a cpl table structure.
cpl_array * muse_sky_apply_lsf(const cpl_array *, const cpl_table *, const muse_lsf_params *)
Apply the LSF parameters to a spectrum.
cpl_table * continuum
Continuum flux table
Definition: muse_sky.h:65
Structure definition of detector (slice) parameters.
Definition: muse_lsf.h:51
cpl_error_code muse_sky_subtract_pixtable(muse_pixtable *a, muse_sky_master *, muse_lsf_params **)
Subtract the sky spectrum from the "data" column of a pixel table.
cpl_error_code muse_sky_subtract_slice(muse_pixtable *, muse_sky_master *, muse_lsf_params *)
Subtract the sky spectrum from the "data" column of a pixel table for one slice.
muse_lsf_params ** lsf
LSF parameter for the resampled spectrum.
Definition: muse_sky.h:67
muse_sky_master * muse_sky_master_new(void)
Create a muse_sky_master structure.