X-shooter Pipeline Reference Manual 3.8.15
test-xsh_create_spectralformat.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: 2009-09-27 10:35:23 $
23 * $Revision: 1.2 $
24 */
25
26#ifdef HAVE_CONFIG_H
27# include <config.h>
28#endif
29
30/*-------------------------------------------------------------------------*/
36/*-------------------------------------------------------------------------*/
39/*--------------------------------------------------------------------------
40 Includes
41 --------------------------------------------------------------------------*/
42
43#include <tests.h>
44
45#include <xsh_data_pre.h>
46#include <xsh_error.h>
47#include <xsh_msg.h>
48#include <xsh_data_instrument.h>
49#include <xsh_data_resid_tab.h>
50#include <xsh_model_io.h>
51#include <xsh_model_kernel.h>
52#include <xsh_drl.h>
53#include <xsh_pfits.h>
54
55#include <cpl.h>
56#include <math.h>
57
58#include <getopt.h>
59
60/*--------------------------------------------------------------------------
61 Defines
62 --------------------------------------------------------------------------*/
63
64#define MODULE_ID "XSH_CREATE_SPECTRALFORMAT"
65#define SYNTAX "Create a spectral format file from a model config file\n"\
66 "use : ./the_xsh_create_spectralformat MODEL_CONFIG\n"\
67 "MODEL_CONFIG => the model config frame\n"
68
69
70/*--------------------------------------------------------------------------
71 Implementation
72 --------------------------------------------------------------------------*/
73
81int main( int argc, char **argv)
82{
83 /* Declarations */
84 int ret = 0 ;
86 xsh_xs_3 config;
87 char* model_config_name = NULL;
88 cpl_frame* model_config_frame = NULL;
89 cpl_frame* spec_form_frame = NULL;
90 /* Initialize libraries */
92
93 cpl_msg_set_level(CPL_MSG_DEBUG);
95
96 /* Analyse parameters */
97 if (argc > 1){
98 model_config_name = argv[1];
99 }
100 else{
101 printf(SYNTAX);
102 return 0;
103 }
104
105 /* Create instrument structure and fill */
109
110 /* Create frames */
111 XSH_ASSURE_NOT_NULL( model_config_name);
112 model_config_frame = cpl_frame_new();
113 cpl_frame_set_filename( model_config_frame, model_config_name) ;
114 cpl_frame_set_level( model_config_frame, CPL_FRAME_LEVEL_TEMPORARY);
115 cpl_frame_set_group( model_config_frame, CPL_FRAME_GROUP_RAW ) ;
116 cpl_frame_set_tag( model_config_frame, "MODEL_CONFIG_TAB_VIS");
117 check( xsh_model_config_load_best( model_config_frame, &config));
118 check(spec_form_frame= xsh_model_spectralformat_create( &config,"spectral_format.fits"));
119
120 cleanup:
121 xsh_free_frame(&spec_form_frame);
122 if (cpl_error_get_code() != CPL_ERROR_NONE) {
123 xsh_error_dump(CPL_MSG_ERROR);
124 return 1;
125 }
126 else return ret ;
127}
128
int main()
Unit test of xsh_bspline_interpol.
static xsh_instrument * instrument
#define check(COMMAND)
Definition: xsh_error.h:71
#define xsh_error_dump(level)
Definition: xsh_error.h:92
#define XSH_ASSURE_NOT_NULL(pointer)
Definition: xsh_error.h:99
void xsh_instrument_set_mode(xsh_instrument *i, XSH_MODE mode)
Set a mode on instrument structure.
void xsh_instrument_set_arm(xsh_instrument *i, XSH_ARM arm)
Set an arm on instrument structure.
xsh_instrument * xsh_instrument_new(void)
create new instrument structure
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
cpl_frame * xsh_model_spectralformat_create(xsh_xs_3 *p_xs_3, const char *tab_filename)
creates the model spectral format table
void xsh_free_frame(cpl_frame **f)
Deallocate a frame and set the pointer to NULL.
Definition: xsh_utils.c:2269
int xsh_debug_level_set(int level)
set debug level
Definition: xsh_utils.c:3125
#define TESTS_INIT(DRL_ID)
Definition: tests.h:105
@ XSH_ARM_VIS
@ XSH_MODE_IFU
@ XSH_DEBUG_LEVEL_MEDIUM
Definition: xsh_utils.h:138