X-shooter Pipeline Reference Manual 3.8.15
xsh_data_instrument.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: 2013-07-12 14:54:48 $
23 * $Revision: 1.38 $
24 * $Name: not supported by cvs2svn $
25 */
26#ifndef XSH_DATA_INSTRUMENT_H
27#define XSH_DATA_INSTRUMENT_H
28
29/*---------------------------------------------------------------------------
30 Includes
31 ----------------------------------------------------------------------------*/
32#include <cpl.h>
33
34/*---------------------------------------------------------------------------
35 Typedefs
36 ---------------------------------------------------------------------------*/
37/*
38#define XSH_RAW_NAXIS2_UVB 3000
39#define XSH_RAW_NAXIS2_VIS 4000
40#define XSH_RAW_NAXIS2_NIR 2048
41*/
42#define XSH_ORDERS_NIR 16
43#define XSH_ORDER_MIN_NIR 11
44#define XSH_ORDER_MAX_NIR 26
45
46#define XSH_ORDERS_UVB 12
47#define XSH_ORDERS_UVB_QTH 8
48#define XSH_ORDERS_UVB_D2 4
49
50#define XSH_ORDER_MIN_UVB 13
51#define XSH_ORDER_MAX_UVB 24
52#define XSH_ORDER_MIN_UVB_D2 21
53#define XSH_ORDER_MAX_UVB_D2 XSH_ORDER_MAX_UVB
54#define XSH_ORDER_MIN_UVB_QTH XSH_ORDER_MIN_UVB
55#define XSH_ORDER_MAX_UVB_QTH XSH_ORDER_MIN_UVB_D2 -1
56
57#define XSH_ORDERS_VIS 15
58#define XSH_ORDER_MIN_VIS 16
59#define XSH_ORDER_MAX_VIS 30
60
61#define XSH_ORDERS_UNDEFINED 0
62
63#define XSH_NB_PINHOLE 9
64
65/* Arc seconds per pixel */
66#define XSH_ARCSEC_NIR 0.2
67#define XSH_ARCSEC_UVB 0.14
68#define XSH_ARCSEC_VIS 0.135
69
70/* Slit dimension in SLIT mode (unit=arcsecond)*/
71#if 0
72#define MIN_SLIT -5.5
73#define MAX_SLIT 5.5
74#else
75#define MIN_SLIT -5.3
76#define MAX_SLIT 5.7
77#endif
78#define LENGTH_SLIT 11.
79#define BASE_MIN_SLIT -5.5
80#define BASE_MAX_SLIT 5.5
81
82/* Slit dimension in IFU mode (unit=arcsecond) */
83#define MIN_SLIT_IFU -6.0
84#define MAX_SLIT_IFU 6.0
85#define LENGTH_SLIT_IFU 12
86#define WIDTH_SLIT_IFU 0.6
87
88#define CHECK_POS_IN_SLIT( pos)\
89 if ( (pos < MIN_SLIT_IFU) || (pos > MAX_SLIT_IFU)){\
90 xsh_error_msg( "Invalid slit position %f : not in [%f,%f]"\
91 ,pos, MIN_SLIT_IFU, MAX_SLIT_IFU);\
92 }
93
94/* Mapping of IFU co-ordinates to entrance slit co-ordinates (mm) */
95#define IFU_SCALE 0.03925
96#define IFU_MAP_LEFT_C0X (-0.6*IFU_SCALE)//-10.10
97#define IFU_MAP_LEFT_C1X -1.0//-58.81
98#define IFU_MAP_LEFT_C2X 0.0//-85.17
99#define IFU_MAP_CEN_C0X 0.0//0.0
100#define IFU_MAP_CEN_C1X 1.0//0.98
101#define IFU_MAP_CEN_C2X 0.0//7.01
102#define IFU_MAP_RIGHT_C0X (0.6*IFU_SCALE)//7.4
103#define IFU_MAP_RIGHT_C1X -1.0//-41.25
104#define IFU_MAP_RIGHT_C2X 0.0//57.55
105
106#define IFU_MAP_LEFT_C0Y (4.0*IFU_SCALE)//2.13
107#define IFU_MAP_LEFT_C1Y -1.0
108#define IFU_MAP_LEFT_C2Y 0.0
109#define IFU_MAP_CEN_C0Y 0.0
110#define IFU_MAP_CEN_C1Y 1.0
111#define IFU_MAP_CEN_C2Y 0.0
112#define IFU_MAP_RIGHT_C0Y (-4.0*IFU_SCALE)//-2.09
113#define IFU_MAP_RIGHT_C1Y -1.0
114#define IFU_MAP_RIGHT_C2Y 0.0
115
116/*IFU slitlet limits in arcsec*/
117#define IFU_LOW -2.0 //=-0.5*(11.4/3)
118#define IFU_HI 2.0 //=+0.5*(11.4/3)
119#define IFU_LEFT_MIN -0.9 //=-1.5*0.6
120#define IFU_LEFT_MAX -0.3 //=-0.5*0.6
121#define IFU_CEN_MIN -0.3 //=-0.5*0.6
122#define IFU_CEN_MAX 0.3 //=+0.5*0.6
123#define IFU_RIGHT_MIN 0.3 //=+0.5*0.6
124#define IFU_RIGHT_MAX 0.9 //=+1.5*0.6
125
126typedef enum {
131
132
133typedef enum {
140
141typedef enum {
148
149typedef struct {
151 int naxis;
154 int nx;
155 int ny;
156 int prscx;
157 int prscy;
158 int ovscx;
159 int ovscy;
160 double pszx;
161 double pszy;
162 double ron;
163 double conad;
164 double pxspace ;
165 int orders ;
169
170typedef struct {
182 int binx;
183 int biny;
185
191 const char* pipeline_id;
192 const char *dictionary;
193 const char * recipe_id ;
195
196
197#define XSH_NAME_LAMP_MODE_ARM( name, id, ext, instr) \
198 XSH_NAME_PREFIX_LAMP_MODE_ARM( name, "", id, ext, instr)
199
200#define XSH_NAME_PREFIX_LAMP_MODE_ARM( name, prefix, id, ext, instr)\
201 XSH_FREE( name);\
202 XSH_ASSURE_NOT_NULL( prefix);\
203 if ( xsh_instrument_get_mode( instr) != XSH_MODE_UNDEFINED){\
204 if (xsh_instrument_get_lamp( instr) != XSH_LAMP_UNDEFINED){\
205 name = xsh_stringcat_any( prefix, id, "_", \
206 xsh_instrument_lamp_tostring( instr)\
207 , "_", xsh_instrument_mode_tostring( instr),"_", \
208 xsh_instrument_arm_tostring( instr), ext, "");\
209 }\
210 else{\
211 name = xsh_stringcat_any( prefix, id, "_",\
212 xsh_instrument_mode_tostring( instr),"_", \
213 xsh_instrument_arm_tostring( instr), ext, "");\
214 }\
215 }\
216 else{\
217 name = xsh_stringcat_any( prefix, id, "_",\
218 xsh_instrument_arm_tostring( instr), ext, "");\
219 }\
220 XSH_ASSURE_NOT_NULL( name)
221/*---------------------------------------------------------------------------
222 Methods
223 ---------------------------------------------------------------------------*/
224
225/* Create / delete */
229/* Set / Get */
231void xsh_instrument_set_decode_bp(xsh_instrument* i,const int decode_bp);
234void xsh_instrument_set_recipe_id(xsh_instrument* i, const char *recipe_id);
235
238 cpl_frame* spectralformat_frame);
239
244
247
248XSH_ARM xsh_arm_get(const char* tag);
249XSH_MODE xsh_mode_get(const char* tag);
250XSH_LAMP xsh_lamp_get(const char* tag);
251
253double xsh_resolution_get( xsh_instrument * instrument, double slit);
254
255/* analyse tags */
256void xsh_instrument_parse_tag(xsh_instrument* inst,const char* tag);
257
258/* ToString */
262
263const char* xsh_mode_tostring(XSH_MODE mode);
264const char* xsh_arm_tostring(XSH_ARM arm);
265const char* xsh_lamp_tostring(XSH_LAMP lamp);
269cpl_error_code
270xsh_instrument_nir_corr_if_JH(cpl_frameset* raws, xsh_instrument* instr);
271int
272xsh_instrument_nir_is_JH(cpl_frame* frm, xsh_instrument* instr);
273
274cpl_error_code
276#endif /* XSH_DATA_INSTRUMENT_H */
static char mode[32]
static xsh_instrument * instrument
int binx
int biny
const char * xsh_instrument_mode_tostring(xsh_instrument *i)
Get the string associated with a mode.
const char * xsh_lamp_tostring(XSH_LAMP lamp)
Get the string associated with a lamp.
cpl_error_code xsh_instrument_nir_corr_if_spectral_format_is_JH(cpl_frameset *calib, xsh_instrument *instr)
cpl_error_code xsh_instrument_nir_corr_if_JH(cpl_frameset *raws, xsh_instrument *instr)
void xsh_instrument_set_mode(xsh_instrument *i, XSH_MODE mode)
Set a mode on instrument structure.
void xsh_instrument_update_from_spectralformat(xsh_instrument *i, cpl_frame *spectralformat_frame)
const char * xsh_instrument_arm_tostring(xsh_instrument *i)
Get the string associated with an arm.
void xsh_instrument_update_lamp(xsh_instrument *i, XSH_LAMP lamp)
void xsh_instrument_set_recipe_id(xsh_instrument *i, const char *recipe_id)
Set the recipe_id into the instrument structure.
double xsh_arcsec_get(xsh_instrument *instrument)
Get the Arc seconds per pixel for this Arm.
XSH_LAMP xsh_instrument_get_lamp(xsh_instrument *i)
Get a lamp on instrument structure.
void xsh_mode_set(xsh_instrument *instrument, XSH_MODE mode)
set the instrument mode as user specifies
int xsh_instrument_get_binx(xsh_instrument *instrument)
void xsh_instrument_set_arm(xsh_instrument *i, XSH_ARM arm)
Set an arm on instrument structure.
XSH_MODE xsh_instrument_get_mode(xsh_instrument *i)
Get a mode on instrument structure.
double xsh_resolution_get(xsh_instrument *instrument, double slit)
Get the resoltion.
const char * xsh_instrument_lamp_tostring(xsh_instrument *i)
Get the string associated with a lamp.
void xsh_instrument_set_biny(xsh_instrument *instrument, const int biny)
int xsh_instrument_nir_is_JH(cpl_frame *frm, xsh_instrument *instr)
const char * xsh_arm_tostring(XSH_ARM arm)
Get the string associated with an arm.
void xsh_instrument_set_binx(xsh_instrument *instrument, const int binx)
XSH_INSTRCONFIG * xsh_instrument_get_config(xsh_instrument *i)
Get the instrument default set of keywords.
xsh_instrument * xsh_instrument_duplicate(xsh_instrument *instrument)
int xsh_instrument_get_biny(xsh_instrument *instrument)
XSH_LAMP xsh_lamp_get(const char *tag)
get the lamp from the frame tag
XSH_ARM xsh_arm_get(const char *tag)
get the arm from the frame tag
XSH_ARM xsh_instrument_get_arm(xsh_instrument *i)
Get an arm on instrument structure.
XSH_MODE xsh_mode_get(const char *tag)
get the mode from the frame tag
void xsh_instrument_set_lamp(xsh_instrument *i, XSH_LAMP lamp)
Set a lamp on instrument structure.
void xsh_instrument_parse_tag(xsh_instrument *inst, const char *tag)
analyse a frame tag to set data in instrument structure
void xsh_instrument_free(xsh_instrument **)
free an instrument structure
xsh_instrument * xsh_instrument_new(void)
create new instrument structure
void xsh_instrument_set_decode_bp(xsh_instrument *i, const int decode_bp)
Set bad pixel code.
const char * xsh_mode_tostring(XSH_MODE mode)
Get the string associated with a mode.
const char * pipeline_id
const char * recipe_id
const char * dictionary
XSH_INSTRCONFIG * config
@ XSH_LAMP_UNDEFINED
@ XSH_LAMP_D2
@ XSH_LAMP_QTH
@ XSH_LAMP_THAR
@ XSH_LAMP_QTH_D2
@ XSH_ARM_AGC
@ XSH_ARM_UNDEFINED
@ XSH_ARM_UVB
@ XSH_ARM_NIR
@ XSH_ARM_VIS
@ XSH_MODE_SLIT
@ XSH_MODE_IFU
@ XSH_MODE_UNDEFINED