/home/amodigli/releases/xsh/1.2.10/pso/xsh.26608/xshp/xsh/xsh_opt_extract.c File Reference

#include <math.h>
#include <xsh_drl.h>
#include <xsh_badpixelmap.h>
#include <xsh_data_rec.h>
#include <xsh_data_pre.h>
#include <xsh_utils_wrappers.h>
#include <xsh_data_order.h>
#include <xsh_data_wavesol.h>
#include <xsh_data_spectralformat.h>
#include <xsh_data_localization.h>
#include <xsh_dfs.h>
#include <xsh_pfits.h>
#include <xsh_error.h>
#include <xsh_msg.h>
#include <xsh_fit.h>
#include <xsh_model_io.h>
#include <xsh_model_kernel.h>
#include <xsh_rectify.h>
#include <cpl.h>
#include <gsl/gsl_sf_erf.h>

Go to the source code of this file.

Defines

#define SLIT_USEFUL_WINDOW_FACTOR   0.80
#define FIT_FWHM_LIMIT   30
#define OPT_EXTRACT_SLIT_SIZE   80
#define MSE_LIMIT   1
#define FLUX_MODE   0
#define WAVEMAP_MODE   1
#define REGDEBUG_PIXELSIZE   0
#define REGDEBUG_INTEGRATE   0

Functions

static void xsh_image_gaussian_fit_y (cpl_image *img, int chunk_size, int deg_poly, int oversample, cpl_polynomial **center, cpl_polynomial **height, cpl_polynomial **width, cpl_polynomial **offset)
 Do a gaussian fit of Y columns by chunk and fit the position by polynomials in X.
static cpl_image * xsh_image_create_gaussian_image (cpl_image *src, cpl_polynomial *centerp, cpl_polynomial *heightp, cpl_polynomial *widthp, cpl_polynomial *offsetp)
static cpl_image * xsh_image_create_model_image (cpl_image *src_img, double *x_data, double *y_data)
static cpl_vector * xsh_vector_interpolate_linear (cpl_vector *ref_pos, cpl_vector *ref_values, cpl_vector *err_values, cpl_vector *qual_values, cpl_vector *new_pos, cpl_vector **spectrum_err, cpl_vector **spectrum_qual)
 Interpolate values following given positions.
static cpl_vector * xsh_vector_integrate (int oversample, int absorder, cpl_vector *ref_pos, double step, cpl_vector *ref_values, cpl_vector *err_values, cpl_vector *qual_values, cpl_vector *new_pos, cpl_vector **spectrum_err, cpl_vector **spectrum_qual)
 Interpolate values following given positions.
static void xsh_interpolate_spectrum (int oversample, int absorder, double lambda_step, cpl_vector *init_pos, cpl_vector *std_flux, cpl_vector *std_err, cpl_vector *std_qual, cpl_vector *opt_flux, cpl_vector *opt_err, cpl_vector *opt_qual, cpl_vector **res_pos, cpl_vector **res_std_flux, cpl_vector **res_std_err, cpl_vector **res_std_qual, cpl_vector **res_opt_flux, cpl_vector **res_opt_err, cpl_vector **res_opt_qual)
static cpl_image * xsh_optextract_produce_model (cpl_image *s2Dby1D_img, int method, int chunk_ovsamp_size, int deg_poly, int oversample, double *extract_x_data, double *extract_y_data, int abs_order)
static void xsh_object_localize (cpl_frame *slitmap_frame, cpl_frame *loc_frame, int box_hsize, int nlambdas, int ny_extract, double *extract_x_data, double *extract_y_data, xsh_instrument *instr, int *ymin, int *ymax)
static int xsh_interpolate_linear (float *fluxtab, float *errtab, int *qualtab, int nx, int ny, float pos_x, float pos_y, double *flux, double *err, int *qual, int mode)
static void xsh_wavemap_lambda_range (cpl_frame *wavemap_frame, cpl_frame *slitmap_frame, int starty, int endy, int oversample, xsh_order_list *order_list, int iorder, double *xtab, double *ytab, int order, xsh_spectralformat_list *spectralformat, double *lambdastab, double *slitstab, int *sizetab, xsh_instrument *instr)
 Give the value of lambda and x central position for a given y.
static void xsh_vector_divide_poly (cpl_vector *vector, double oversample, cpl_polynomial *poly, int shift, xsh_instrument *instr)
 Divide vector values by a polynomial.
static cpl_image * create_blaze (cpl_frame *masterflat_frame, xsh_order_list *order_list, xsh_instrument *instrument)
 Normalize a master flat frame order by order.
static cpl_vector * xsh_image_extract_standard (cpl_image *img, cpl_image *err_img, cpl_image *qual_img, cpl_vector **err_v, cpl_vector **qual_v)
 Do a standard extraction on image.
static cpl_image * xsh_image_divide_1D (cpl_image *image, cpl_image *err_img, cpl_vector *s1D, cpl_vector *err_s1D, cpl_image **err_2dby1D_img, int abs_order)
 Divide an image by a 1D spectrum (same scale).
static cpl_image * xsh_image_mult_1D (cpl_image *image, cpl_vector *s1D)
 Divide an image by a 1D spectrum (same scale).
static cpl_vector * xsh_image_extract_optimal (cpl_image *img, cpl_image *errs_img, cpl_image *qual_img, xsh_opt_extract_param *opt_par, cpl_image *model_img, cpl_image **corr_img, cpl_vector **err_v)
 Do an optimal extraction on image.
void xsh_opt_extract (cpl_frame *sci_frame, cpl_frame *orderlist_frame, cpl_frame *wavesol_frame, cpl_frame *model_frame, cpl_frame *wavemap_frame, cpl_frame *slitmap_frame, cpl_frame *loc_frame, cpl_frame *spectralformat_frame, cpl_frame *masterflat_frame, xsh_instrument *instrument, xsh_opt_extract_param *opt_extract_par, const char *rec_prefix, cpl_frame **orderext1d_frame, cpl_frame **orderoxt1d_frame)
 Create a SPECTRUM 1D from a Science frame.
void xsh_opt_extract_orders (cpl_frame *sci_frame, cpl_frame *orderlist_frame, cpl_frame *wavesol_frame, cpl_frame *model_frame, cpl_frame *wavemap_frame, cpl_frame *slitmap_frame, cpl_frame *loc_frame, cpl_frame *spectralformat_frame, cpl_frame *masterflat_frame, xsh_instrument *instrument, xsh_opt_extract_param *opt_extract_par, int min_index, int max_index, const char *rec_prefix, cpl_frame **orderext1d_frame, cpl_frame **orderoxt1d_frame)
 Create a SPECTRUM 1D from a Science frame.

Generated on 9 Mar 2011 for X-shooter Pipeline Reference Manual by  doxygen 1.6.1