X-shooter Pipeline Reference Manual 3.8.15
xsh_data_check.c
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: 2011-01-10 09:01:58 $
23 * $Revision: 1.3 $
24 */
25
26#ifdef HAVE_CONFIG_H
27#include <config.h>
28#endif
29
30/*---------------------------------------------------------------------------*/
35/*---------------------------------------------------------------------------*/
36
40/*-----------------------------------------------------------------------------
41 Includes
42 ----------------------------------------------------------------------------*/
43#include <math.h>
45#include <xsh_data_order.h>
46#include <xsh_data_wavesol.h>
47#include <xsh_model_io.h>
48#include <xsh_utils.h>
49#include <xsh_error.h>
50#include <xsh_msg.h>
51#include <xsh_pfits.h>
52#include <cpl.h>
53#include <xsh_utils_table.h>
54#include <xsh_drl.h>
55
56/*----------------------------------------------------------------------------
57 Function implementation
58 ----------------------------------------------------------------------------*/
59
60/*****************************************************************************/
75/*****************************************************************************/
76void
77xsh_data_check_spectralformat( cpl_frame *spectralformat_frame,
78 cpl_frame *orderlist_frame, cpl_frame *wavesol_frame,
79 cpl_frame *model_config_frame, xsh_instrument* instr)
80{
81 xsh_spectralformat_list *spectralformat = NULL;
82 xsh_order_list *orderlist = NULL;
83 xsh_wavesol *wavesol = NULL;
84 xsh_xs_3 model;
85
86 XSH_ASSURE_NOT_NULL( spectralformat_frame);
87 XSH_ASSURE_NOT_NULL( orderlist_frame);
88 XSH_ASSURE_NOT_NULL( instr);
89
90 check( spectralformat = xsh_spectralformat_list_load( spectralformat_frame,
91 instr));
92 check( orderlist = xsh_order_list_load( orderlist_frame, instr));
93
94 if ( model_config_frame != NULL) {
95 check( xsh_model_config_load_best( model_config_frame, &model));
96 }
97 if ( wavesol_frame != NULL) {
98 check( wavesol = xsh_wavesol_load( wavesol_frame, instr));
99 }
100
101 check( xsh_spectralformat_check_wlimit( spectralformat, orderlist,
102 wavesol, &model, instr));
103
104 cleanup:
105 xsh_spectralformat_list_free( &spectralformat);
106 xsh_order_list_free( &orderlist);
107 xsh_wavesol_free( &wavesol);
108 return;
109}
110/*****************************************************************************/
void xsh_data_check_spectralformat(cpl_frame *spectralformat_frame, cpl_frame *orderlist_frame, cpl_frame *wavesol_frame, cpl_frame *model_config_frame, xsh_instrument *instr)
Check the borders of wavelength foreach orders in spectral format.
xsh_order_list * xsh_order_list_load(cpl_frame *frame, xsh_instrument *instr)
load an order list from a frame
void xsh_order_list_free(xsh_order_list **list)
free memory associated to an order_list
void xsh_spectralformat_check_wlimit(xsh_spectralformat_list *spectralformat, xsh_order_list *orderlist, xsh_wavesol *wavesol, xsh_xs_3 *model, xsh_instrument *instr)
xsh_spectralformat_list * xsh_spectralformat_list_load(cpl_frame *frame, xsh_instrument *instr)
Load a spectralformat list from a frame.
void xsh_spectralformat_list_free(xsh_spectralformat_list **list)
Free memory associated to an spactralformat_list.
xsh_wavesol * xsh_wavesol_load(cpl_frame *frame, xsh_instrument *instrument)
load a wavelength solution
void xsh_wavesol_free(xsh_wavesol **w)
free wavelength solution structure
#define check(COMMAND)
Definition: xsh_error.h:71
#define XSH_ASSURE_NOT_NULL(pointer)
Definition: xsh_error.h:99
cpl_error_code xsh_model_config_load_best(cpl_frame *config_frame, xsh_xs_3 *p_xs_3)
Load the config model table and fill the struct.
Definition: xsh_model_io.c:174