#include <math.h>
#include <xsh_data_the_map.h>
#include <xsh_drl.h>
#include <xsh_data_pre.h>
#include <xsh_dfs.h>
#include <xsh_pfits.h>
#include <xsh_error.h>
#include <xsh_msg.h>
#include <xsh_data_instrument.h>
#include <xsh_data_spectralformat.h>
#include <xsh_badpixelmap.h>
#include <xsh_model_io.h>
#include <cpl.h>
#include <xsh_model_ref_ind.h>
#include <xsh_data_resid_tab.h>
#include <xsh_data_arclist.h>
#include <xsh_model_kernel.h>
#include <xsh_model_metric.h>
#include <xsh_model_arm_constants.h>
#include <xsh_utils_wrappers.h>
Go to the source code of this file.
Data Structures | |
struct | CENTER_ORDER |
Defines | |
#define | VERBOSE 0 |
#define | mm2nm 1000000.0 |
#define | mm2um 1000.0 |
#define | XSH_TRACE_MSG(array) |
#define | ERROR 1 |
#define | OK 0 |
#define | ERROR 1 |
#define | OK 0 |
Functions | |
static void | xsh_nullmatrix (mat A) |
static void | xsh_nullvector (vec a) |
static void | xsh_copyvector (vec a, vec b) |
static const char * | xsh_get_tag_opt_mod_cfg (xsh_xs_3 *p_xs_3, int rec_id) |
static cpl_error_code | xsh_model_compute_residuals (xsh_xs_3 *p_xs_3, coord *msp_coord, DOUBLE *p_wlarray, DOUBLE **ref_ind, const int size, const int annealed, cpl_propertylist *resid_header, cpl_frame *resid_frame, cpl_propertylist **result) |
void | xsh_3_init (struct xs_3 *p_xs_3) |
Pre-compute a number of non-wavelength dependent secondary parameters required by the model. | |
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_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_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_T, DOUBLE temper) |
Load the refractive index coeffs for a given arm and temperature. | |
int * | xsh_alloc1Darray_INT (int asize) |
allocates memory for an array of integers | |
DOUBLE * | xsh_alloc1Darray (int asize) |
allocates memory for an array of doubles | |
double ** | xsh_alloc2Darray (int asize, int bsize) |
allocates memory for a 2D array of doubles | |
float ** | xsh_alloc2Darray_f (int asize, int bsize) |
allocates memory for a 2D array of floats | |
int ** | xsh_alloc2Darray_i (int asize, int bsize) |
allocates memory for a 2D array of integers | |
int | xsh_free2Darray (double **ccdtemp, int asize) |
free memory for a 2D array of doubles | |
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 | |
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_free3Darray (double ***ccdtemp, int asize, int bsize) |
free 3D array | |
void | xsh_addvectors (vec a, vec b) |
add 2 vectors a+=b | |
void | xsh_addvectors3D (vec a, vec b) |
add 2 vectors a+=b | |
void | xsh_subtractvectors (vec a, vec b) |
subtract 2 vectors a-=b | |
DOUBLE | xsh_scalarproduct (vec a, vec b) |
implements scalar product | |
void | xsh_multiply (vec a, DOUBLE k) |
applies scalar product to vector | |
void | xsh_showvector (vec a) |
show vector content | |
void | xsh_normz (vec a) |
normalize vector | |
void | xsh_normall (vec a) |
normalize vector | |
void | xsh_multiplymatrix (mat A, mat B, mat C) |
multiply three matrixes A=B*C | |
void | xsh_multiplythreematrix (mat A, mat B, mat C, mat D) |
multiply three matrixes A=B*C*D | |
void | xsh_showmatrix (mat A) |
Show matrix. | |
void | xsh_initializematrix (mat A) |
initialize matrix A | |
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 | |
double | xsh_physmod_grating (vec in, int m, double sg, mat in_rot, mat exit_rot, vec out) |
Calculate the new vector after a given incident vector is reflected in a prism (i.e. exits from the same surface than it entered through). | |
void | xsh_refract (vec b, DOUBLE rind, vec a) |
Calculate the new vector after a given incident vector passes a boundary between two materials. | |
static cpl_error_code | xsh_model_compute_slitmap_kw (const double slit_min, const double slit_max, xsh_xs_3 *p_xs_3, xsh_instrument *instr, cpl_propertylist **plist) |
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) |
Compute the wavelength and slit maps. | |
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. | |
cpl_vector ** | xsh_model_locus (struct xs_3 *p_xs_3, xsh_instrument *instr, double ent_slit_pos) |
Compute the locus of the spectrum. | |
void | xsh_model_get_xy (xsh_xs_3 *p_xs_3, xsh_instrument *instr, double lambda_nm, int morder, double ent_slit_pos, double *x, double *y) |
Compute the detector location (floating point pixels) of a given wavelength/entrance slit position. | |
void | xsh_model_binxy (xsh_xs_3 *p_xs_3, int bin_X, int bin_Y) |
corrects model for detector's binning | |
cpl_frame * | xsh_model_spectralformat_create (xsh_xs_3 *p_xs_3, const char *tab_filename) |
creates the model spectral format table | |
cpl_frame * | xsh_model_THE_create (xsh_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. | |
int | xsh_model_open_param (char *listname, char *findname, int *ref, int setref, double *best, double setbest, double *min, double *max, double gfac, double fac, int counter) |
Open a parameter in the model config structure for annealing and set the limits. | |
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. | |
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 *out_table, xsh_instrument *instr, cpl_parameterlist *parlist, cpl_frameset *set) |
Save the product of the recipe. | |
int | xsh_model_offset (DOUBLE slit_pix_shift, DOUBLE disp_pix_shift, struct xs_3 *p_xs_3) |
convert a pixel shift measured on the detector to a shift in detector centroid | |
static int | comp_center2 (const void *one, const void *two) |
static void | save_centers (CENTER_ORDER *pcent, int fpos, int npos, const char *arm) |
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. | |
static void | fit_order_edge_list (xsh_order_list *list, int npos, CENTER_ORDER *pcent, int degree, int edge) |
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. | |
Variables | |
static const int | vectordim = 4 |
#define mm2nm 1000000.0 |
Definition at line 68 of file xsh_model_kernel.c.
Referenced by xsh_model_get_xy(), xsh_model_locus(), xsh_model_maps_create(), xsh_model_order_edges_tab_create(), and xsh_model_spectralformat_create().
#define mm2um 1000.0 |
Definition at line 69 of file xsh_model_kernel.c.
Referenced by xsh_3_eval().
#define VERBOSE 0 |
Definition at line 67 of file xsh_model_kernel.c.
#define XSH_TRACE_MSG | ( | array | ) |
Definition at line 75 of file xsh_model_kernel.c.
Referenced by xsh_3_eval().
const int vectordim = 4 [static] |
Definition at line 89 of file xsh_model_kernel.c.
Referenced by xsh_addvectors(), xsh_addvectors3D(), xsh_copyvector(), xsh_initializematrix(), xsh_matrixforvector(), xsh_multiply(), xsh_multiplymatrix(), xsh_nullmatrix(), xsh_nullvector(), xsh_scalarproduct(), xsh_showmatrix(), xsh_showvector(), xsh_subtractvectors(), and xsh_transpose().