X-shooter Pipeline Reference Manual 3.8.15
test-spectrum_stat.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-12-02 14:13:14 $
23 * $Revision: 1.3 $
24 * $Name: not supported by cvs2svn $
25 */
26#ifdef HAVE_CONFIG_H
27# include <config.h>
28#endif
29
30/*--------------------------------------------------------------------------*/
36/*--------------------------------------------------------------------------*/
39/*---------------------------------------------------------------------------
40 Includes
41 ---------------------------------------------------------------------------*/
42#include <xsh_utils.h>
43#include <xsh_error.h>
44#include <xsh_msg.h>
45#include <tests.h>
46#include <cpl.h>
47#include <math.h>
48#include <time.h>
49#include <sys/time.h>
50/*---------------------------------------------------------------------------
51 Defines
52 ---------------------------------------------------------------------------*/
53#define MODULE_ID "CPL_IMAGE_FIT_GAUSSIAN"
54
55/*--------------------------------------------------------------------------*/
61/*--------------------------------------------------------------------------*/
62int main( int argc, char** argv)
63{
64 int ret = 0;
65
67 cpl_msg_set_level( CPL_MSG_DEBUG);
69
70 char name1[256];
71 cpl_table* tab1=NULL;
72
73 double mean=0;
74 double rms=0;
75 double median=0;
76 double min=0;
77 double max=0;
78 int i=0;
79
80 xsh_msg("argc=%d",argc);
81 if((size_t)argc != 2){
82 xsh_msg_warning("Provide one inputs: spectra tables");
83 return 0;
84 } else {
85 sprintf(name1,argv[1]);
86 }
87
88 tab1=cpl_table_load(name1, 1, 1);
89
90 mean=cpl_table_get_column_mean(tab1,"counts_bkg");
91 median=cpl_table_get_column_median(tab1,"counts_bkg");
92 min=cpl_table_get_column_min(tab1,"counts_bkg");
93 max=cpl_table_get_column_max(tab1,"counts_bkg");
94 rms=cpl_table_get_column_stdev(tab1,"counts_bkg");
95
96 xsh_msg_warning("Spectrum %s mean: %g median: %g min: %g max: %g rms: %g",
97 name1,mean,median,min,max,rms);
98 cpl_table_delete(tab1);
99
100 cleanup:
101 if (cpl_error_get_code() != CPL_ERROR_NONE) {
102 xsh_error_dump(CPL_MSG_ERROR);
103 ret = 1;
104 }
105 return ret;
106}
107
int main()
Unit test of xsh_bspline_interpol.
#define xsh_error_dump(level)
Definition: xsh_error.h:92
#define xsh_msg_warning(...)
Print an warning message.
Definition: xsh_msg.h:88
#define xsh_msg(...)
Print a message on info level.
Definition: xsh_msg.h:121
#define MODULE_ID
int xsh_debug_level_set(int level)
set debug level
Definition: xsh_utils.c:3125
#define TESTS_INIT(DRL_ID)
Definition: tests.h:105
#define max(a, b)
@ XSH_DEBUG_LEVEL_MEDIUM
Definition: xsh_utils.h:138