X-shooter Pipeline Reference Manual 3.8.15
test-xsh_format.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: 2012-01-16 21:21:52 $
23 * $Revision: 1.5 $
24 */
25
26#ifdef HAVE_CONFIG_H
27# include <config.h>
28#endif
29
30/*-------------------------------------------------------------------------*/
35/*-------------------------------------------------------------------------*/
38/*--------------------------------------------------------------------------
39 Includes
40 --------------------------------------------------------------------------*/
41
42#include <tests.h>
43#include <xsh_data_pre.h>
44#include <xsh_error.h>
45#include <xsh_msg.h>
46#include <xsh_data_instrument.h>
47#include <xsh_data_rec.h>
49#include <xsh_drl.h>
50#include <xsh_pfits.h>
51#include <xsh_data_pre_3d.h>
52#include <xsh_badpixelmap.h>
53
54#include <cpl.h>
55#include <math.h>
56
57#include <getopt.h>
58
59/*--------------------------------------------------------------------------
60 Defines
61 --------------------------------------------------------------------------*/
62
63#define MODULE_ID "XSH_FORMAT"
64
65enum {
68};
69/*
70static struct option long_options[] = {
71 {"oversample", required_argument, 0, OVERSAMPLE_OPT},
72 {"box-hsize", required_argument, 0, BOX_HSIZE_OPT},
73 {"chunk-size", required_argument, 0, CHUNK_SIZE_OPT},
74 {"lambda-step", required_argument, 0, LAMBDA_STEP_OPT},
75 {"kappa", required_argument, 0, KAPPA_OPT},
76 {"method", required_argument, 0, METHOD_OPT},
77 {"order-min", required_argument, 0, MIN_ORDER_OPT},
78 {"order-max", required_argument, 0, MAX_ORDER_OPT},
79 {"help", 0, 0, HELP_OPT},
80 {0, 0, 0, 0}
81};
82*/
83static void Help( void )
84{
85 puts( "Unitary test of a cube build");
86 puts( "Usage: test_format [options] <input_files>");
87
88 puts( "Options" ) ;
89 puts( "\nInput Files" ) ;
90 puts( "The input files argument MUST be in this order:" ) ;
91 puts( " 1. ORDER2D_DOWN, ORDER2D_CEN, ORDER2D_UP" ) ;
92 TEST_END();
93}
94
95/*--------------------------------------------------------------------------
96 Implementation
97 --------------------------------------------------------------------------*/
98
106int main( int argc, char **argv)
107{
108 int ret;
109 /* Declarations */
111 const char *sof_name = NULL;
112 cpl_frameset *set = NULL;
113 cpl_frame *cube = NULL;
114
115 /* Initialize libraries */
117 cpl_msg_set_level( CPL_MSG_DEBUG);
119
120 /* Analyse parameters */
121 if (argc >= 2 ) {
122 sof_name = argv[1];
123 }
124 else{
125 Help();
126 exit(0);
127 }
128
129 /* Create frameset from sof */
130 check( set = sof_to_frameset( sof_name));
132
133 check( cube = xsh_format( set, "CUBE.fits", instrument,"test"));
134
135 /* USE load function */
136
137 cleanup:
138 if (cpl_error_get_code() != CPL_ERROR_NONE) {
139 xsh_error_dump(CPL_MSG_ERROR);
140 ret = 1;
141 }
142 xsh_free_frameset( &set);
144 xsh_free_frame( &cube);
145
146 TEST_END();
147 return ret;
148}
149
int main()
Unit test of xsh_bspline_interpol.
static void Help(void)
#define MODULE_ID
@ METHOD_OPT
@ HELP_OPT
@ BOX_HSIZE_OPT
@ OVERSAMPLE_OPT
@ MAX_ORDER_OPT
@ LAMBDA_STEP_OPT
@ KAPPA_OPT
@ CHUNK_SIZE_OPT
@ MIN_ORDER_OPT
static xsh_instrument * instrument
cpl_frameset * sof_to_frameset(const char *sof_name)
Definition: tests.c:576
#define check(COMMAND)
Definition: xsh_error.h:71
#define xsh_error_dump(level)
Definition: xsh_error.h:92
cpl_frame * xsh_format(cpl_frameset *rect_frame_set, const char *result_name, xsh_instrument *instrument, const char *rec_prefix)
Definition: xsh_format.c:152
void xsh_instrument_free(xsh_instrument **instrument)
free an instrument structure
void xsh_free_frame(cpl_frame **f)
Deallocate a frame and set the pointer to NULL.
Definition: xsh_utils.c:2269
void xsh_free_frameset(cpl_frameset **f)
Deallocate a frame set and set the pointer to NULL.
Definition: xsh_utils.c:2254
int xsh_debug_level_set(int level)
set debug level
Definition: xsh_utils.c:3125
#define TEST_END()
Definition: tests.h:111
#define TESTS_INIT(DRL_ID)
Definition: tests.h:105
xsh_instrument * xsh_dfs_set_groups(cpl_frameset *set)
Set the group as RAW or CALIB in a frameset and return the instrument detected.
Definition: xsh_dfs.c:1046
@ XSH_DEBUG_LEVEL_MEDIUM
Definition: xsh_utils.h:138