MOONS Pipeline Reference Manual 0.13.1
moo_fibres_table.h
1/*
2 * This file is part of the MOONS Pipeline
3 * Copyright (C) 2002-2016 European Southern Observatory
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20#ifndef MOO_FIBRES_TABLE_H
21#define MOO_FIBRES_TABLE_H
22
23/*-----------------------------------------------------------------------------
24 Includes
25 -----------------------------------------------------------------------------*/
26
27#include <cpl.h>
28#include <hdrl.h>
29#include <moo_detector.h>
30/*-----------------------------------------------------------------------------
31 Types
32 -----------------------------------------------------------------------------*/
33typedef struct
34{
35 cpl_table *table;
36} moo_fibres_table;
37
38#define MOO_FIBRES_TABLE_EXTNAME "FIBRE_TABLE"
39#define MOO_FIBRES_TABLE_INDEX "INDEX"
40#define MOO_FIBRES_TABLE_INDEXEXT "INDEXEXT"
41#define MOO_FIBRES_TABLE_INDEXRBN "INDEXRBN"
42
43#define MOO_FIBRES_TABLE_FIBRE "FIBRE"
44#define MOO_FIBRES_TABLE_PAIREDFIBRE "PAIREDINDEX"
45#define MOO_FIBRES_TABLE_HEALTH "HEALTH"
46#define MOO_FIBRES_TABLE_HEALTH_BROKEN 0
47#define MOO_FIBRES_TABLE_HEALTH_GOOD 1
48#define MOO_FIBRES_TABLE_HEALTH_NEWLY_BROKEN 2
49#define MOO_FIBRES_TABLE_SPECTRO "SPECTRO"
50#define MOO_FIBRES_TABLE_SLITLET "SLITLET"
51#define MOO_FIBRES_TABLE_TARGNAME "TARGNAME"
52#define MOO_FIBRES_TABLE_TARGALPHA "TARGALPHA"
53#define MOO_FIBRES_TABLE_TARGDELTA "TARGDELTA"
54#define MOO_FIBRES_TABLE_TYPE "TYPE"
55
56
57/*
58 SCIENCE -> T
59 SKY -> S
60 SKY_CONTAM -> C
61 BLANK -> V
62 CHECK_OBJECT -> Q
63 FLUX,STD -> P
64 TELL,STD -> K
65*/
66#define MOO_FIBRES_TABLE_TYPE_CHECKOBJ "Q"
67#define MOO_FIBRES_TABLE_TYPE_SCIENCE "T"
68#define MOO_FIBRES_TABLE_TYPE_SKY "S"
69#define MOO_FIBRES_TABLE_TYPE_BLANK "V"
70#define MOO_FIBRES_TABLE_TYPE_SKYCONTAM "C"
71#define MOO_FIBRES_TABLE_TYPE_STD_FLUX "P"
72#define MOO_FIBRES_TABLE_TYPE_STD_TELL "K"
73
74#define MOO_FIBRES_TABLE_SPECTRO_1 1
75#define MOO_FIBRES_TABLE_SPECTRO_2 2
76
77#define MOO_FIBRES_TABLE_TYPE_NOD "TYPE_NOD"
78#define MOO_FIBRES_TABLE_TRANS_RI "TRANS_RI"
79#define MOO_FIBRES_TABLE_TRANS_YJ "TRANS_YJ"
80#define MOO_FIBRES_TABLE_TRANS_H "TRANS_H"
81
82#define MOO_FIBRES_TABLE_GOODPTSFRAC_RI "GOODPTSFRAC_RI"
83#define MOO_FIBRES_TABLE_GOODPTSFRAC_YJ "GOODPTSFRAC_YJ"
84#define MOO_FIBRES_TABLE_GOODPTSFRAC_H "GOODPTSFRAC_H"
85
86#define MOO_FIBRES_TABLE_MEDSNR_RI_EXT "MEDIAN_SNR_RI_EXT"
87#define MOO_FIBRES_TABLE_MEDSNR_YJ_EXT "MEDIAN_SNR_YJ_EXT"
88#define MOO_FIBRES_TABLE_MEDSNR_H_EXT "MEDIAN_SNR_H_EXT"
89
90#define MOO_FIBRES_TABLE_DERSNR_RI_EXT "DERSNR_RI_EXT"
91#define MOO_FIBRES_TABLE_DERSNR_YJ_EXT "DERSNR_YJ_EXT"
92#define MOO_FIBRES_TABLE_DERSNR_H_EXT "DERSNR_H_EXT"
93
94#define MOO_FIBRES_TABLE_MEDSNR_RI_RBN "MEDIAN_SNR_RI_RBN"
95#define MOO_FIBRES_TABLE_MEDSNR_YJ_RBN "MEDIAN_SNR_YJ_RBN"
96#define MOO_FIBRES_TABLE_MEDSNR_H_RBN "MEDIAN_SNR_H_RBN"
97
98#define MOO_FIBRES_TABLE_DETECTLINE_RI "DETECTLINE_RI"
99#define MOO_FIBRES_TABLE_DETECTLINE_YJ "DETECTLINE_YJ"
100#define MOO_FIBRES_TABLE_DETECTLINE_H "DETECTLINE_H"
101
102#define MOO_FIBRES_TABLE_FAILEDFIT_RI "FAILEDFIT_RI"
103#define MOO_FIBRES_TABLE_FAILEDFIT_YJ "FAILEDFIT_YJ"
104#define MOO_FIBRES_TABLE_FAILEDFIT_H "FAILEDFIT_H"
105
106#define MOO_FIBRES_TABLE_FITLINE_RI "FITLINE_RI"
107#define MOO_FIBRES_TABLE_FITLINE_YJ "FITLINE_YJ"
108#define MOO_FIBRES_TABLE_FITLINE_H "FITLINE_H"
109
110#define MOO_FIBRES_TABLE_MATCHLINE_RI "MATCHLINE_RI"
111#define MOO_FIBRES_TABLE_MATCHLINE_YJ "MATCHLINE_YJ"
112#define MOO_FIBRES_TABLE_MATCHLINE_H "MATCHLINE_H"
113
114#define MOO_FIBRES_TABLE_MODELLINE_RI "MODELLINE_RI"
115#define MOO_FIBRES_TABLE_MODELLINE_YJ "MODELLINE_YJ"
116#define MOO_FIBRES_TABLE_MODELLINE_H "MODELLINE_H"
117
118#define MOO_FIBRES_TABLE_REJECTLINE_RI "REJECTLINE_RI"
119#define MOO_FIBRES_TABLE_REJECTLINE_YJ "REJECTLINE_YJ"
120#define MOO_FIBRES_TABLE_REJECTLINE_H "REJECTLINE_H"
121
122#define MOO_FIBRES_TABLE_XDIFF_MEDIAN_RI "XDIFF_MEDIAN_RI"
123#define MOO_FIBRES_TABLE_XDIFF_MEDIAN_YJ "XDIFF_MEDIAN_YJ"
124#define MOO_FIBRES_TABLE_XDIFF_MEDIAN_H "XDIFF_MEDIAN_H"
125
126#define MOO_FIBRES_TABLE_MONOTONOUS_RI "MONOTONOUS_RI"
127#define MOO_FIBRES_TABLE_MONOTONOUS_YJ "MONOTONOUS_YJ"
128#define MOO_FIBRES_TABLE_MONOTONOUS_H "MONOTONOUS_H"
129
130#define MOO_FIBRES_TABLE_MAG "MAG"
131
132
133/*-----------------------------------------------------------------------------
134 Functions prototypes
135 -----------------------------------------------------------------------------*/
136cpl_array *moo_fibres_table_get_spectro_index(cpl_table *table, int num);
137cpl_array *moo_fibres_table_get_spectro_indexext(cpl_table *table, int num);
138cpl_table *moo_fibres_table_get_spectro_table(cpl_table *table, int num);
139int moo_fibres_table_get_spectro_nrow(cpl_table *table, int num);
140
141cpl_error_code moo_fibres_table_add_locguess_cols(cpl_table *table);
142cpl_error_code moo_fibres_table_add_extract_cols(cpl_table *table);
143cpl_error_code moo_fibres_table_erase_extract_cols(cpl_table *table);
144cpl_error_code moo_fibres_table_add_f2f_cols(cpl_table *table);
145cpl_error_code moo_fibres_table_add_wavecal_cols(cpl_table *table,
146 cpl_table *guess,
147 const char *model);
148cpl_error_code moo_fibres_table_add_rebin_cols(cpl_table *table);
149cpl_error_code moo_fibres_table_add_wavecalguess_cols(cpl_table *table);
150cpl_error_code moo_fibres_table_add_nod_cols(cpl_table *table);
151
152float *
154
155cpl_error_code moo_fibres_table_set_detectline(cpl_table *table,
157 cpl_size row,
158 int value);
159cpl_error_code moo_fibres_table_set_failedfit(cpl_table *table,
161 cpl_size row,
162 int value);
163cpl_error_code moo_fibres_table_set_fitline(cpl_table *table,
165 cpl_size row,
166 int value);
167cpl_error_code moo_fibres_table_set_matchline(cpl_table *table,
169 cpl_size row,
170 int value);
171cpl_error_code moo_fibres_table_set_modelline(cpl_table *table,
173 cpl_size row,
174 int value);
175cpl_error_code moo_fibres_table_set_rejectline(cpl_table *table,
177 cpl_size row,
178 int value);
179cpl_error_code moo_fibres_table_set_xdiff(cpl_table *table,
181 cpl_size row,
182 double value);
183
184int moo_fibres_table_get_matchline(cpl_table *table,
186 cpl_size row);
187
188int moo_fibres_table_get_rejectline(cpl_table *table,
190 cpl_size row);
191double moo_fibres_table_get_xdiff(cpl_table *table,
193 cpl_size row);
194int moo_fibres_table_filter_health(cpl_table *table);
195
196cpl_error_code moo_fibres_table_rbn_to_ext(cpl_table *table,
197 int rbnindex,
198 int *extindex,
199 int *num);
200
201cpl_table *moo_fibre_table_load(cpl_frame *frame);
202int moo_fibres_table_get_spectro(int num);
203const char *moo_fibres_table_get_std_name(cpl_table *table);
204cpl_error_code moo_fibres_table_by_index(cpl_table *table);
205cpl_error_code moo_fibres_table_by_indexrbn(cpl_table *table);
206#endif
enum _moo_detector_type_ moo_detector_type
The type code type.
Definition: moo_detector.h:64
int moo_fibres_table_filter_health(cpl_table *table)
Filter bad health data in fibre table.
cpl_error_code moo_fibres_table_add_wavecalguess_cols(cpl_table *table)
add wavecal additional columns
cpl_table * moo_fibre_table_load(cpl_frame *frame)
Load a fibre table from a file.
cpl_error_code moo_fibres_table_by_index(cpl_table *table)
Order fibres table by INDEX (ASC)
cpl_error_code moo_fibres_table_add_wavecal_cols(cpl_table *table, cpl_table *guess, const char *model)
add wavecal additional columns
cpl_error_code moo_fibres_table_set_matchline(cpl_table *table, moo_detector_type type, cpl_size row, int value)
set the number of match lines for the given detector type
int moo_fibres_table_get_spectro_nrow(cpl_table *table, int num)
get the number of rows of a spectro in the fibre table
cpl_error_code moo_fibres_table_set_failedfit(cpl_table *table, moo_detector_type type, cpl_size row, int value)
set the number od failedfit lines for the given detector type
float * moo_fibres_table_get_median_snr(cpl_table *table, moo_detector_type type)
get the data of median_snr for the given detector type
cpl_array * moo_fibres_table_get_spectro_indexext(cpl_table *table, int num)
get the index of a spectro in the fibre table sort by spetcro,indexext
cpl_error_code moo_fibres_table_set_fitline(cpl_table *table, moo_detector_type type, cpl_size row, int value)
set the number of fit lines for the given detector type
cpl_error_code moo_fibres_table_set_modelline(cpl_table *table, moo_detector_type type, cpl_size row, int value)
set the number of model lines for the given detector type
cpl_table * moo_fibres_table_get_spectro_table(cpl_table *table, int num)
get the selection of a spectro in the fibre table
int moo_fibres_table_get_matchline(cpl_table *table, moo_detector_type type, cpl_size row)
Get the number of matched lines for the given detector type.
int moo_fibres_table_get_rejectline(cpl_table *table, moo_detector_type type, cpl_size row)
Get the number of rejected lines for the given detector type.
double moo_fibres_table_get_xdiff(cpl_table *table, moo_detector_type type, cpl_size row)
Get xdiff for the given detector type.
cpl_error_code moo_fibres_table_set_xdiff(cpl_table *table, moo_detector_type type, cpl_size row, double value)
set the xdiff for the given fibre and detector type
cpl_error_code moo_fibres_table_add_extract_cols(cpl_table *table)
add extract additional columns
const char * moo_fibres_table_get_std_name(cpl_table *table)
get the object name of the STD type in the fibre table
cpl_error_code moo_fibres_table_set_detectline(cpl_table *table, moo_detector_type type, cpl_size row, int value)
set the number od detectline for the given detector type
cpl_error_code moo_fibres_table_add_f2f_cols(cpl_table *table)
add f2f additional columns
cpl_array * moo_fibres_table_get_spectro_index(cpl_table *table, int num)
get the index of a spectro in the fibre table sort by index on the slit
cpl_error_code moo_fibres_table_by_indexrbn(cpl_table *table)
Order fibres table by INDEXRBN (ASC)
cpl_error_code moo_fibres_table_add_nod_cols(cpl_table *table)
add nod additional columns
cpl_error_code moo_fibres_table_rbn_to_ext(cpl_table *table, int rbnindex, int *extindex, int *num)
get from indexrbn the corresponding indexext and num
cpl_error_code moo_fibres_table_add_locguess_cols(cpl_table *table)
add localise guess additional columns
cpl_error_code moo_fibres_table_add_rebin_cols(cpl_table *table)
add rebin additional columns
cpl_error_code moo_fibres_table_set_rejectline(cpl_table *table, moo_detector_type type, cpl_size row, int value)
set the number of rejected lines for the given detector type
cpl_error_code moo_fibres_table_erase_extract_cols(cpl_table *table)
erase extract additional columns