X-shooter Pipeline Reference Manual 3.8.15
xsh_data_order.h
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:15:28 $
23 * $Revision: 1.38 $
24 * $Name: not supported by cvs2svn $
25 */
26#ifndef XSH_DATA_ORDER_H
27#define XSH_DATA_ORDER_H
28
29#include <cpl.h>
30#include <xsh_data_instrument.h>
31
32#define XSH_ORDER_TABLE_COLNAME_ORDER "ORDER"
33#define XSH_ORDER_TABLE_COLNAME_ABSORDER "ABSORDER"
34#define XSH_ORDER_TABLE_COLNAME_CENTER "CENCOEF"
35#define XSH_ORDER_TABLE_COLNAME_EDGUP "EDGUPCOEF"
36#define XSH_ORDER_TABLE_COLNAME_EDGLO "EDGLOCOEF"
37#define XSH_ORDER_TABLE_COLNAME_SLICUP "SLICUPCOEF"
38#define XSH_ORDER_TABLE_COLNAME_SLICLO "SLICLOCOEF"
39#define XSH_ORDER_TABLE_DEGY "DEGY"
40#define XSH_ORDER_TABLE_COLNAME_STARTY "STARTY"
41#define XSH_ORDER_TABLE_COLNAME_ENDY "ENDY"
42
43#define XSH_ORDER_TABLE_COLNAME_CENTERX "CENTER_X"
44#define XSH_ORDER_TABLE_COLNAME_CENTERY "CENTER_Y"
45#define XSH_ORDER_TABLE_COLNAME_EDGUPX "EDG_UP_X"
46#define XSH_ORDER_TABLE_COLNAME_EDGUPY "EDG_UP_Y"
47#define XSH_ORDER_TABLE_COLNAME_EDGLOX "EDG_LO_X"
48#define XSH_ORDER_TABLE_COLNAME_EDGLOY "EDG_LO_Y"
49#define XSH_ORDER_TABLE_COLNAME_SLICLOX "SLIC_LO_X"
50#define XSH_ORDER_TABLE_COLNAME_SLICLOY "SLIC_LO_Y"
51#define XSH_ORDER_TABLE_COLNAME_SLICUPX "SLIC_UP_X"
52#define XSH_ORDER_TABLE_COLNAME_SLICUPY "SLIC_UP_Y"
53
54
55
56typedef struct{
57 /* relative index of order */
58 int order;
59 /* absolute index of order */
61 /* polynomial fitting the center points of the order */
62 cpl_polynomial *cenpoly;
63 /* polynomial fitting the upper edge of the order */
64 cpl_polynomial *edguppoly;
65 /* polynomial fitting the lower edge of the order */
66 cpl_polynomial *edglopoly;
67 /* polynomial fitting the blaze fonction */
68 cpl_polynomial *blazepoly;
69 /* For IFU */
70 cpl_polynomial *sliclopoly;
71 cpl_polynomial *slicuppoly;
72 /* Polynomial degree (same for the 3 polynomes) */
74 /* first pixel in Y in the order flux */
75 int starty;
76 /* last pixel in Y in the order flux */
77 int endy;
78 /*
79 float edgupcoefsig0;
80 float edgupcoefsig1;
81 float edgupcoefsig2;
82 float edglocoefsig0;
83 float edglocoefsig1;
84 float edglocoefsig2;
85 */
87
88
89typedef struct{
90 int size;
91 int bin_x;
92 int bin_y;
97 cpl_propertylist* header;
99
100
101typedef struct {
102 double residmin ;
103 double residmax ;
104 double residavg ;
105 double residrms ;
106
107
110 int npred ;
111
114 int ndet ;
115
119
122xsh_order_list* xsh_order_list_load(cpl_frame* frame, xsh_instrument* instr);
123cpl_propertylist* xsh_order_list_get_header(xsh_order_list* list);
129 double absorder);
132 xsh_order_list* listb);
133
134cpl_frame*
137 const char* filename,
138 const char* tag,const int ny);
139void xsh_order_list_set_bin_x( xsh_order_list* list, int bin);
140void xsh_order_list_set_bin_y( xsh_order_list* list, int bin);
141double xsh_order_list_eval( xsh_order_list* list, cpl_polynomial *poly,
142 double y);
143int xsh_order_list_eval_int( xsh_order_list* list, cpl_polynomial *poly,
144 double y);
145
146void xsh_order_list_dump( xsh_order_list* list, const char * fname ) ;
147void xsh_order_list_fit(xsh_order_list *list, int size, double* vorderdata,
148 double* posx, double* posy, int deg_poly);
149int xsh_order_list_get_order( xsh_order_list * list, int absorder ) ;
150void xsh_order_list_verify( xsh_order_list * list, int ny ) ;
151void xsh_order_list_apply_shift( xsh_order_list *list, double xshift, double yshift);
152
153void xsh_order_split_qth_d2( cpl_frame* order_tab_frame,
154 cpl_frame* spectrum_format_frame, cpl_frame** qth_order_tab_frame,
155 cpl_frame** d2_order_tab_frame, xsh_instrument* instr);
156
157#endif /* XSH_ORDER_H */
static int starty
static int endy
static xsh_instrument * instrument
xsh_order_list * xsh_order_list_create(xsh_instrument *instr)
create an empty order list
void xsh_order_split_qth_d2(cpl_frame *order_tab_frame, cpl_frame *spectrum_format_frame, cpl_frame **qth_order_tab_frame, cpl_frame **d2_order_tab_frame, xsh_instrument *instr)
void xsh_order_list_set_bin_y(xsh_order_list *list, int bin)
Set the bin of image in y.
int xsh_order_list_get_index_by_absorder(xsh_order_list *list, double absorder)
void xsh_order_list_apply_shift(xsh_order_list *list, double xshift, double yshift)
Shift a order list.
cpl_frame * xsh_order_list_save(xsh_order_list *list, xsh_instrument *instrument, const char *filename, const char *tag, const int ny)
Save an order list to a frame.
void xsh_order_list_set_bin_x(xsh_order_list *list, int bin)
Set the bin of image in x.
int xsh_order_list_eval_int(xsh_order_list *list, cpl_polynomial *poly, double y)
Evaluate an order list poly but return the central pixel position rounding the polynomial.
xsh_order_list * xsh_order_list_load(cpl_frame *frame, xsh_instrument *instr)
load an order list from a frame
xsh_order_list * xsh_order_list_merge(xsh_order_list *lista, xsh_order_list *listb)
cpl_propertylist * xsh_order_list_get_header(xsh_order_list *list)
get header of the table
int xsh_order_list_get_starty(xsh_order_list *list, int i)
get position on Y axis of first pixel detected on order
void xsh_order_list_dump(xsh_order_list *list, const char *fname)
void xsh_order_list_fit(xsh_order_list *list, int size, double *vorderdata, double *posx, double *posy, int deg_poly)
fit the polynomial solution of given points
int xsh_order_list_get_endy(xsh_order_list *list, int i)
get position on Y axis of last pixel detected on order
int xsh_order_list_get_order(xsh_order_list *list, int absorder)
xsh_order_list * xsh_order_list_new(int size)
Create a new order list from size (no check)
void xsh_order_list_free(xsh_order_list **list)
free memory associated to an order_list
void xsh_order_list_verify(xsh_order_list *list, int ny)
double xsh_order_list_eval(xsh_order_list *list, cpl_polynomial *poly, double y)
Evaluate an order list poly.
int size
int * y
xsh_instrument * instrument
cpl_propertylist * header
xsh_order * list
cpl_polynomial * edguppoly
cpl_polynomial * blazepoly
cpl_polynomial * edglopoly
cpl_polynomial * slicuppoly
cpl_polynomial * sliclopoly
cpl_polynomial * cenpoly
void xsh_order_list_set_starty(xsh_order_list *list, int i, int starty)
void xsh_order_list_set_endy(xsh_order_list *list, int i, int endy)
int ny