X-shooter Pipeline Reference Manual 3.8.15
xsh_data_rec.h
Go to the documentation of this file.
1/* *
2 * This file is part of the ESO X-shooter Pipeline *
3 * Copyright (C) 2006 European Southern Observatory *
4 * *
5 * This library 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, 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA *
18 * */
19
20/*
21 * $Author: amodigli $
22 * $Date: 2010-12-28 08:50:13 $
23 * $Revision: 1.22 $
24 */
25#ifndef XSH_DATA_REC_H
26#define XSH_DATA_REC_H
27
28#include <cpl.h>
29#include <xsh_data_instrument.h>
30#include <xsh_data_pre.h>
32#include <xsh_parameters.h>
33
34#define XSH_REC_TABLE_NB_UVB_ORDERS 11
35#define XSH_REC_TABLE_NB_VIS_ORDERS 14
36#define XSH_REC_TABLE_NB_NIR_ORDERS 16
37
38/* Column Names */
39#define XSH_REC_TABLE_COLNAME_ORDER "ORDER"
40#define XSH_REC_TABLE_COLNAME_NLAMBDA "NLAMBDA"
41#define XSH_REC_TABLE_COLNAME_NSLIT "NSLIT"
42/*
43 The 2 following columns are "array" columns
44 The depth (and dimension) is respectively nlambda, nslit.
45*/
46#define XSH_REC_TABLE_COLNAME_LAMBDA "LAMBDA"
47#define XSH_REC_TABLE_COLNAME_SLIT "SLIT"
48/*
49 The 3 following columns are "array" columns
50 The depth is nlambda*nslit, the dimensions are nlambda and nslit.
51*/
52#define XSH_REC_TABLE_COLNAME_FLUX1 "FLUX1"
53#define XSH_REC_TABLE_COLNAME_FLUX2 "FLUX2"
54#define XSH_REC_TABLE_COLNAME_FLUX3 "FLUX3"
55#define XSH_REC_TABLE_COLNAME_ERRS1 "ERRS1"
56#define XSH_REC_TABLE_COLNAME_ERRS2 "ERRS2"
57#define XSH_REC_TABLE_COLNAME_ERRS3 "ERRS3"
58#define XSH_REC_TABLE_COLNAME_QUAL1 "QUAL1"
59#define XSH_REC_TABLE_COLNAME_QUAL2 "QUAL2"
60#define XSH_REC_TABLE_COLNAME_QUAL3 "QUAL3"
61
62typedef struct{
63 int order ;
65 int nslit ;
66 float * slit ;
67 double * lambda ;
68 float * data1 ;
69 float * data2 ;
70 float * data3 ;
71 float * errs1 ;
72 /* FOR IFU mode */
73 float * errs2 ;
74 float * errs3 ;
75 int * qual1 ;
76 int * qual2 ;
77 int * qual3 ;
78} xsh_rec ;
79
80typedef struct{
81 int size;
82 double slit_min;
83 double slit_max;
84 int nslit;
85 //int max_nlambda ;
86 //int max_nslit ;
89 cpl_propertylist * header;
91
92/* Create / Loading */
93
95
97
98xsh_rec_list * xsh_rec_list_load( cpl_frame *frame, xsh_instrument *instr);
99xsh_rec_list * xsh_rec_list_load_eso( cpl_frame *frame, xsh_instrument *instr);
101/* Save */
102
103cpl_frame* xsh_rec_list_save( xsh_rec_list * list, const char* filename,
104 const char* tag,int is_temp);
105
106cpl_frame* xsh_rec_list_save_table(xsh_rec_list* list, const char* filename,
107 const char* tag, int is_temp );
108
109cpl_frame* xsh_rec_list_save2(xsh_rec_list* list, const char* filename,
110 const char* tag);
111cpl_frame*
112xsh_rec_list1D_save_as_tab(xsh_rec_list* list,const char* filename, const char* tag);
113/* Free */
114
115void xsh_rec_list_free( xsh_rec_list ** list);
116
119cpl_frame * xsh_rec_list_frame_invert( cpl_frame * rec_frame,
120 const char * tag,
122
123void xsh_rec_list_dump( xsh_rec_list * list, const char * fname) ;
124
125void xsh_rec_list_set_data_size( xsh_rec_list * list, int idx, int ordnum,
126 int nlambda, int ns);
127
129 xsh_rectify_param *rec_par,
130 const char* pro_catg);
131
132/* GET */
133
134cpl_propertylist * xsh_rec_list_get_header( xsh_rec_list * list);
135
136float* xsh_rec_list_get_slit( xsh_rec_list * list, int idx);
137
138double* xsh_rec_list_get_lambda( xsh_rec_list * list, int idx);
139
140float* xsh_rec_list_get_data1( xsh_rec_list * list, int idx);
141
142float * xsh_rec_list_get_errs1( xsh_rec_list * list, int idx);
143
144int * xsh_rec_list_get_qual1( xsh_rec_list * list, int idx);
145
146int xsh_rec_list_get_order( xsh_rec_list * list, int idx);
147
148int xsh_rec_list_get_nslit( xsh_rec_list * list, int idx);
149
150int xsh_rec_list_get_nlambda( xsh_rec_list * list, int idx);
151
152void xsh_rec_get_nod_kw( cpl_frame * rec_frame, double * throw,
153 double * jitter, double * reloffset,
154 double * cumoffset ) ;
155
158
161
162
163cpl_error_code xsh_rec_list_set_slit_min( xsh_rec_list* list,const double val);
164cpl_error_code xsh_rec_list_set_slit_max( xsh_rec_list* list,const double val);
165void xsh_compute_slit_index( float slit_min, float slit_step,
166 xsh_rec_list **from, int *slit_index_tab, int size);
167
168void
170 int *slit_index, int nb_frames, int no,
171 int method, const int decode_bp);
172cpl_error_code
174 double* smin, double* smax);
175
176#endif /* XSH_REC_H */
static xsh_instrument * instrument
static float slit_step
void xsh_rec_list_add(xsh_rec_list *dest, xsh_rec_list **from, int *slit_index, int nb_frames, int no, int method, const int decode_bp)
void xsh_compute_slit_index(float slit_min, float slit_step, xsh_rec_list **from, int *slit_index_tab, int size)
int xsh_rec_list_get_nslit(xsh_rec_list *list, int idx)
Definition: xsh_data_rec.c:827
double * xsh_rec_list_get_lambda(xsh_rec_list *list, int idx)
cpl_error_code xsh_rec_list_set_slit_max(xsh_rec_list *list, const double val)
xsh_rec_list * xsh_rec_list_load(cpl_frame *frame, xsh_instrument *instr)
load an rec list from a frame
Definition: xsh_data_rec.c:289
float * xsh_rec_list_get_data1(xsh_rec_list *list, int idx)
cpl_frame * xsh_rec_list_save(xsh_rec_list *list, const char *filename, const char *tag, int is_temp)
Save a rec list in a frame.
cpl_frame * xsh_rec_list_save2(xsh_rec_list *list, const char *filename, const char *tag)
save an rec list to a frame
cpl_error_code xsh_rec_get_nod_extract_slit_min_max(xsh_rec_list *rlist, const double slit_step, double *smin, double *smax)
xsh_rec_list * xsh_rec_list_create_with_size(int size, xsh_instrument *instr)
Create an empty order list.
Definition: xsh_data_rec.c:147
float * xsh_rec_list_get_errs1(xsh_rec_list *list, int idx)
cpl_propertylist * xsh_rec_list_get_header(xsh_rec_list *list)
get header of the table
Definition: xsh_data_rec.c:809
void xsh_rec_list_update_header(xsh_rec_list *list, xsh_pre *pre, xsh_rectify_param *rec_par, const char *pro_catg)
Update header of rectified list writing mandatory KW.
int xsh_rec_list_get_order(xsh_rec_list *list, int idx)
Definition: xsh_data_rec.c:846
double xsh_rec_list_get_slit_max(xsh_rec_list *list)
Definition: xsh_data_rec.c:923
xsh_rec_list * xsh_rec_list_load_eso(cpl_frame *frame, xsh_instrument *instr)
Definition: xsh_data_rec.c:407
void xsh_rec_list_set_data_size(xsh_rec_list *list, int idx, int ordnum, int nlambda, int ns)
Allocate memory for the order idx of the rectify list.
Definition: xsh_data_rec.c:191
void xsh_rec_list_dump(xsh_rec_list *list, const char *fname)
Definition: xsh_data_rec.c:62
double xsh_rec_list_get_lambda_max(xsh_rec_list *list)
Definition: xsh_data_rec.c:957
cpl_frame * xsh_rec_list1D_save_as_tab(xsh_rec_list *list, const char *filename, const char *tag)
save an rec list to a frame
xsh_rec_list * xsh_rec_list_load_eso_1d(cpl_frame *frame, xsh_instrument *instr)
Definition: xsh_data_rec.c:563
int * xsh_rec_list_get_qual1(xsh_rec_list *list, int idx)
xsh_rec_list * xsh_rec_list_duplicate(xsh_rec_list *old, xsh_instrument *instrument)
Definition: xsh_data_rec.c:226
double xsh_rec_list_get_lambda_min(xsh_rec_list *list)
Definition: xsh_data_rec.c:935
float * xsh_rec_list_get_slit(xsh_rec_list *list, int idx)
Definition: xsh_data_rec.c:884
int xsh_rec_list_get_nlambda(xsh_rec_list *list, int idx)
Definition: xsh_data_rec.c:865
cpl_frame * xsh_rec_list_frame_invert(cpl_frame *rec_frame, const char *tag, xsh_instrument *instrument)
Invert the rectified flux images of the input frame into a new frame.
Definition: xsh_data_rec.c:713
void xsh_rec_list_free(xsh_rec_list **list)
free memory associated to a rec_list
Definition: xsh_data_rec.c:760
xsh_rec_list * xsh_rec_list_create(xsh_instrument *instr)
Create an empty order list.
Definition: xsh_data_rec.c:100
double xsh_rec_list_get_slit_min(xsh_rec_list *list)
Definition: xsh_data_rec.c:903
void xsh_rec_get_nod_kw(cpl_frame *rec_frame, double *throw, double *jitter, double *reloffset, double *cumoffset)
cpl_frame * xsh_rec_list_save_table(xsh_rec_list *list, const char *filename, const char *tag, int is_temp)
Save a rec list in a frame.
cpl_error_code xsh_rec_list_set_slit_min(xsh_rec_list *list, const double val)
Definition: xsh_data_rec.c:987
int size
double slit_max
Definition: xsh_data_rec.h:83
xsh_instrument * instrument
Definition: xsh_data_rec.h:88
cpl_propertylist * header
Definition: xsh_data_rec.h:89
double slit_min
Definition: xsh_data_rec.h:82
xsh_rec * list
Definition: xsh_data_rec.h:87
float * errs1
Definition: xsh_data_rec.h:71
float * slit
Definition: xsh_data_rec.h:66
float * data2
Definition: xsh_data_rec.h:69
float * errs2
Definition: xsh_data_rec.h:73
float * data3
Definition: xsh_data_rec.h:70
int nslit
Definition: xsh_data_rec.h:65
float * errs3
Definition: xsh_data_rec.h:74
float * data1
Definition: xsh_data_rec.h:68
int * qual1
Definition: xsh_data_rec.h:75
int * qual2
Definition: xsh_data_rec.h:76
int * qual3
Definition: xsh_data_rec.h:77
int order
Definition: xsh_data_rec.h:63
int nlambda
Definition: xsh_data_rec.h:64
double * lambda
Definition: xsh_data_rec.h:67
const char * method
Definition: xsh_detmon_lg.c:78