X-shooter Pipeline Reference Manual 3.8.15
Data Structures | Macros | Typedefs | Functions
xsh_model_kernel.h File Reference
#include <math.h>
#include <string.h>
#include <cpl.h>
#include <xsh_data_instrument.h>
#include <xsh_data_order.h>

Go to the source code of this file.

Data Structures

struct  ann_all_par
 
struct  coord
 
struct  xs_3
 

Macros

#define NIR_FIX   36
 

Typedefs

typedef double DOUBLE
 
typedef DOUBLE vec[4]
 
typedef DOUBLE cvec[4]
 
typedef DOUBLE mat[4][4]
 
typedef int detloc[3]
 
typedef int XY[3]
 
typedef struct xs_3 xsh_xs_3
 

Functions

int xsh_3_readfile (double *abest, double *amin, double *amax, int *aname, const char *, struct xs_3 *, ann_all_par *)
 
void xsh_3_init (struct xs_3 *)
 Pre-compute a number of non-wavelength dependent secondary parameters required by the model.
 
void xsh_ref_ind_read_old (const char *ref_ind_file, DOUBLE **ref_ind, DOUBLE temper)
 Load the refractive index array for a given arm and temperature. This old routine is only retained to allow easy testing of new refractive index data.
 
void xsh_ref_ind_read (int arm, DOUBLE **ref_ind, DOUBLE temper)
 Load the refractive index coeffs for a given arm and temperature.
 
void xsh_3_eval (DOUBLE lambda, int morder, DOUBLE **ref_ind, struct xs_3 *p_xs_3)
 Compute the physical x,y position at the detector array for a given wavelength, order and parameter configuration.
 
void xsh_3_eval_check (DOUBLE lambda, int morder, DOUBLE **ref_ind, struct xs_3 *p_xs_3)
 
void xsh_3_detpix (struct xs_3 *p_xs_3)
 Takes the physical x,y position at the detector array and converts this to a pixel position.
 
void xsh_3_detpix_check (struct xs_3 *p_xs_3)
 
DOUBLExsh_alloc1Darray (int asize)
 allocates memory for an array of doubles
 
int * xsh_alloc1Darray_INT (int asize)
 allocates memory for an array of integers
 
double ** xsh_alloc2Darray (int asize, int bsize)
 allocates memory for a 2D array of doubles
 
double *** xsh_alloc3Darray2 (int asize, int bsize, int csize)
 allocate 3D array
 
double *** xsh_alloc3Darray (int asize, int bsize, int csize)
 allocate 3D array
 
int ** xsh_alloc2Darray_i (int asize, int bsize)
 allocates memory for a 2D array of integers
 
float ** xsh_alloc2Darray_f (int asize, int bsize)
 allocates memory for a 2D array of floats
 
int xsh_free2Darray (double **ccdtemp, int asize)
 free memory for a 2D array of doubles
 
int xsh_free3Darray (double ***ccdtemp, int asize, int bsize)
 free 3D array
 
int xsh_free2Darray_i (int **ccdtemp, int asize)
 free memory for a 2D array of integers
 
int xsh_free2Darray_f (float **ccdtemp, int asize)
 free memory for a 2D array of floats
 
double * xsh_copy2D_to_1D (double **ccdtemp, int asize, int bsize)
 copy 2D to 1D array
 
double ** xsh_copy1D_to_2D (double *oneDccdtemp, int asize, int bsize)
 copy 1D to 2D array
 
void xsh_addvectors (vec, vec)
 add 2 vectors a+=b
 
void xsh_addvectors3D (vec, vec)
 add 2 vectors a+=b
 
void xsh_subtractvectors (vec, vec)
 subtract 2 vectors a-=b
 
DOUBLE xsh_scalarproduct (vec, vec)
 implements scalar product
 
void xsh_multiply (vec a, DOUBLE k)
 applies scalar product to vector
 
void xsh_multiplythreematrix (mat A, mat B, mat C, mat D)
 multiply three matrixes A=B*C*D
 
void xsh_showvector (vec a)
 show vector content
 
void xsh_normz (vec a)
 normalize vector
 
void xsh_normall (vec a)
 normalize vector
 
void xsh_showmatrix (mat A)
 Show matrix.
 
void xsh_initializematrix (mat A)
 initialize matrix A
 
void xsh_multiplymatrix (mat A, mat B, mat C)
 multiply three matrixes A=B*C
 
void xsh_matrixforvector (vec a, mat B, vec c)
 Realize a*B*c.
 
void xsh_transpose (mat A, mat B)
 matrix transposal
 
void xsh_rotationmatrix (mat A, const char axis, const DOUBLE angle)
 matrix rotation
 
void xsh_rotin (mat A, const DOUBLE x_angle, const DOUBLE y_angle, const DOUBLE z_angle)
 matrix rotation
 
void xsh_refract (vec, DOUBLE, vec)
 Calculate the new vector after a given incident vector passes a boundary between two materials.
 
void xsh_model_get_xy (xsh_xs_3 *p_xs_3, xsh_instrument *instr, double lambda_nm, int morder, double slit, double *x, double *y)
 Compute the detector location (floating point pixels) of a given wavelength/entrance slit position.
 
cpl_vector ** xsh_model_locus (struct xs_3 *p_xs_3, xsh_instrument *instr, double ent_slit_pos)
 Compute the locus of the spectrum.
 
cpl_frame * xsh_model_spectralformat_create (struct xs_3 *p_xs_3, const char *tab_filename)
 creates the model spectral format table
 
cpl_table * xsh_model_THE (struct xs_3 *p_xs_3, const char *line_list, xsh_instrument *instr, int num_ph, double sep_ph)
 
cpl_frame * xsh_model_THE_create (struct xs_3 *p_xs_3, xsh_instrument *instr, const char *line_list, int num_ph, double sep_ph, const char *THE_filename)
 Compute the THE table (centroid for each feature in lamp spectrum)
 
cpl_frame * xsh_model_pipe_anneal (cpl_frame *cfg_frame, cpl_frame *resid_frame, int maxit, double ann_fac, int scenario, int rec_id)
 Run the annealing (optimisation) algoritm to improve the fit of the model parameter set to a given wavecal exposure.
 
double xsh_model_sellmeier_ext (int arm, double temper, double lam_sqr)
 Get the refractive index for a given temperature and wavelength from the (hard coded) extended Sellmeier co-efficients for infrasil (NIR) and Silica (UVB)
 
double xsh_model_ref_ind_air (double temper, double lam_sqr)
 Return the refractive index of air at a given wavelength and temperature.
 
void xsh_model_binxy (struct xs_3 *p_xs_3, int bin_X, int bin_Y)
 corrects model for detector's binning
 
cpl_vector * xsh_model_refining_detect (const cpl_vector *in, int fwhm, double sigma, int display)
 Detect the brightest features in a spectrum.
 
int xsh_model_first_anneal (cpl_parameterlist *parlist, cpl_frameset *frameset)
 Interpret the command line options and execute the data processing.
 
int xsh_model_first_anneal_save (const cpl_table *, xsh_instrument *, cpl_parameterlist *, cpl_frameset *)
 Save the product of the recipe.
 
int xsh_model_map_ifu (double xifu, double yifu, xsh_xs_3 *p_xs_3)
 Map the IFU position to spectrograph slit position using transformation provided by Ana for IFU2.
 
int xsh_model_offset (DOUBLE disp_pix_shift, DOUBLE slit_pix_shift, struct xs_3 *p_xs_3)
 convert a pixel shift measured on the detector to a shift in detector centroid
 
void xsh_order_edge_list_fit (xsh_order_list *list, int size, double *order, double *posx, double *posy, int deg_poly, int edge)
 Fit edge of an order.
 
cpl_frame * xsh_model_order_edges_tab_create (xsh_xs_3 *p_xs_3, const char *tab_filename)
 Create an order edges table using the phys mod.
 
cpl_error_code xsh_model_maps_create (xsh_xs_3 *p_xs_3, xsh_instrument *instr, const char *wtag, const char *stag, cpl_frame **wmap_frame, cpl_frame **smap_frame, const int save_tmp)
 Compute the wavelength and slit maps.
 

Macro Definition Documentation

◆ NIR_FIX

#define NIR_FIX   36

Definition at line 51 of file xsh_model_kernel.h.

Typedef Documentation

◆ cvec

typedef DOUBLE cvec[4]

Definition at line 61 of file xsh_model_kernel.h.

◆ detloc

typedef int detloc[3]

Definition at line 64 of file xsh_model_kernel.h.

◆ DOUBLE

typedef double DOUBLE

Definition at line 57 of file xsh_model_kernel.h.

◆ mat

typedef DOUBLE mat[4][4]

Definition at line 62 of file xsh_model_kernel.h.

◆ vec

typedef DOUBLE vec[4]

Definition at line 60 of file xsh_model_kernel.h.

◆ xsh_xs_3

typedef struct xs_3 xsh_xs_3

Definition at line 136 of file xsh_model_kernel.h.

◆ XY

typedef int XY[3]

Definition at line 65 of file xsh_model_kernel.h.

Function Documentation

◆ xsh_3_detpix_check()

void xsh_3_detpix_check ( struct xs_3 p_xs_3)

◆ xsh_3_eval_check()

void xsh_3_eval_check ( DOUBLE  lambda,
int  morder,
DOUBLE **  ref_ind,
struct xs_3 p_xs_3 
)

◆ xsh_3_readfile()

int xsh_3_readfile ( double *  abest,
double *  amin,
double *  amax,
int *  aname,
const char *  ,
struct xs_3 ,
ann_all_par  
)

◆ xsh_model_THE()

cpl_table * xsh_model_THE ( struct xs_3 p_xs_3,
const char *  line_list,
xsh_instrument instr,
int  num_ph,
double  sep_ph 
)