File: xsh_data_check.c

package info (click to toggle)
cpl-plugin-xshoo 2.8.4%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 18,168 kB
  • sloc: ansic: 146,236; sh: 11,433; python: 2,342; makefile: 1,024
file content (112 lines) | stat: -rw-r--r-- 4,135 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/*                                                                           *
 *   This file is part of the ESO X-shooter Pipeline                         *
 *   Copyright (C) 2006 European Southern Observatory                        *
 *                                                                           *
 *   This library is free software; you can redistribute it and/or modify    *
 *   it under the terms of the GNU General Public License as published by    *
 *   the Free Software Foundation; either version 2 of the License, or       *
 *   (at your option) any later version.                                     *
 *                                                                           *
 *   This program is distributed in the hope that it will be useful,         *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of          *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           *
 *   GNU General Public License for more details.                            *
 *                                                                           *
 *   You should have received a copy of the GNU General Public License       *
 *   along with this program; if not, write to the Free Software             *
 *   Foundation, 51 Franklin St, Fifth Floor, Boston, MA  02111-1307  USA    *
 *                                                                           */

/*
 * $Author: amodigli $
 * $Date: 2011-01-10 09:01:58 $
 * $Revision: 1.3 $
 */

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

/*---------------------------------------------------------------------------*/
/**
 * @defgroup xsh_data_check Check data format
 * @ingroup data_handling
 */
/*---------------------------------------------------------------------------*/

/**@{*/


/*-----------------------------------------------------------------------------
  Includes
  ----------------------------------------------------------------------------*/
#include <math.h>
#include <xsh_data_spectralformat.h>
#include <xsh_data_order.h>
#include <xsh_data_wavesol.h>
#include <xsh_model_io.h>
#include <xsh_utils.h>
#include <xsh_error.h>
#include <xsh_msg.h>
#include <xsh_pfits.h>
#include <cpl.h>
#include <xsh_utils_table.h>
#include <xsh_drl.h>

/*----------------------------------------------------------------------------
  Function implementation
  ----------------------------------------------------------------------------*/

/*****************************************************************************/
/** 
  @brief
    Check the borders of wavelength foreach orders in spectral format
 @param[in] spectralformat_frame
   The spectral format to check
 @param[in] orderlist_frame
   The order list frame
  @param[in] wavesol_frame
    The wave solution frame
  @param[in] model_config_frame
    The model configuration frame
  @param[in] instr
    The instrument
*/
/*****************************************************************************/
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)
{
  xsh_spectralformat_list *spectralformat = NULL;
  xsh_order_list *orderlist = NULL;
  xsh_wavesol *wavesol = NULL;
  xsh_xs_3 model;  

  XSH_ASSURE_NOT_NULL( spectralformat_frame);
  XSH_ASSURE_NOT_NULL( orderlist_frame);
  XSH_ASSURE_NOT_NULL( instr);

  check( spectralformat = xsh_spectralformat_list_load( spectralformat_frame,
    instr));
  check( orderlist = xsh_order_list_load( orderlist_frame, instr));

  if ( model_config_frame != NULL) {
    check( xsh_model_config_load_best( model_config_frame, &model));
  }
  if ( wavesol_frame != NULL) {
    check( wavesol = xsh_wavesol_load( wavesol_frame, instr));
  }

  check( xsh_spectralformat_check_wlimit( spectralformat, orderlist,
    wavesol, &model, instr));

  cleanup:
    xsh_spectralformat_list_free( &spectralformat);
    xsh_order_list_free( &orderlist);
    xsh_wavesol_free( &wavesol);
    return;
}
/*****************************************************************************/
/**@}*/