/home/amodigli/releases/xsh/1.4.2/xsh.13380/xshp/xsh/xsh_compute_response.c File Reference

#include <xsh_dfs.h>
#include <xsh_error.h>
#include <xsh_msg.h>
#include <cpl.h>
#include <string.h>
#include <time.h>
#include <xsh_utils_table.h>
#include <xsh_data_star_flux.h>
#include <xsh_data_atmos_ext.h>
#include <xsh_data_spectrum.h>
#include <xsh_pfits.h>
#include <xsh_utils.h>
#include <xsh_drl.h>
#include <xsh_utils_efficiency.h>
#include <xsh_efficiency_response.h>

Go to the source code of this file.

Defines

#define INTERPOL_WSTEP_NM   2
#define FILTER_MEDIAN_HSIZE   3

Functions

static int find_lambda_idx (double lambda, double *wave, int from, int to, double step)
static void find_lambda_idx_limit (double min, double max, double *spectrum, int from, int to, double step, int *if0, int *if1)
static cpl_error_code xsh_interpolate_atm_ext (xsh_star_flux_list *star_list, cpl_table *atmos_ext_tab, xsh_instrument *instrument, double **atmos_lambda, double **atmos_K)
static cpl_error_code xsh_interpolate_high_abs_regions (xsh_star_flux_list *star_list, xsh_star_flux_list *resp_list, HIGH_ABS_REGION *phigh)
static cpl_error_code xsh_response_crea_ascii (xsh_star_flux_list *resp_list, xsh_star_flux_list *star_list, double *lambda_spectrum, double *flux_spectrum, double *flux_added)
static cpl_error_code xsh_flux_integrate_and_corr_for_badpix (int npix_in_interval, double *flux_spectrum, int *qual_spectrum, int if0, int if1, int i, double **flux_added, int *npixels, int *nbad)
static xsh_star_flux_listxsh_response_calculate (xsh_star_flux_list *star_list, xsh_star_flux_list **obj_list, xsh_spectrum *spectrum, cpl_table *atmos_ext_tab, XSH_ARM the_arm, double *atmos_K, double airmass, double exptime, double gain)
static xsh_star_flux_listdo_compute (xsh_star_flux_list *star_list, xsh_star_flux_list **obj_list, xsh_spectrum *spectrum, cpl_table *atmos_ext_tab, HIGH_ABS_REGION *phigh, double airmass, double exptime, double gain, xsh_instrument *instrument)
cpl_error_code xsh_response_merge_obj_std_info (cpl_frame *result, xsh_star_flux_list *star_list, xsh_star_flux_list *obj_list)
cpl_frame * xsh_compute_response (cpl_frame *spectrum_frame, cpl_frame *flux_std_star_cat_frame, cpl_frame *atmos_ext_frame, cpl_frame *high_abs_frame, xsh_instrument *instrument, double exptime)
cpl_frame * xsh_compute_response_ord (cpl_frame *spectrum_frame, cpl_frame *flux_std_star_cat_frame, cpl_frame *atmos_ext_frame, cpl_frame *high_abs_win_frame, xsh_instrument *instrument, double exptime)

Define Documentation

#define FILTER_MEDIAN_HSIZE   3

Definition at line 69 of file xsh_compute_response.c.

Referenced by xsh_response_calculate().

#define INTERPOL_WSTEP_NM   2

Definition at line 68 of file xsh_compute_response.c.

Referenced by xsh_compute_response(), and xsh_compute_response_ord().


Function Documentation

static xsh_star_flux_list* do_compute ( xsh_star_flux_list star_list,
xsh_star_flux_list **  obj_list,
xsh_spectrum spectrum,
cpl_table *  atmos_ext_tab,
HIGH_ABS_REGION phigh,
double  airmass,
double  exptime,
double  gain,
xsh_instrument instrument 
) [static]

Integrate the flux on the same sampling that the star_list, taking into account the bad pixels, apply atmos correction, and divide by the star_list table.

Parameters:
star_list Table of ref star flux
star_list Table of obs obj flux
spectrum 1./CPL/DOC/cpl_um_2.0.1.psD merged spectrum of standard star
atmos_ext_table Atmos Extinction table
airmass observed object airmass mean
exptime Exposure time
gain detector's gain
instrument instrument arm and lamp setting
Returns:
The computed response frame (table)

Definition at line 820 of file xsh_compute_response.c.

References check, xsh_star_flux_list::flux, xsh_star_flux_list::lambda, xsh_star_flux_list::size, XSH_ASSURE_NOT_NULL, XSH_FREE, xsh_instrument_get_arm(), xsh_interpolate_atm_ext(), xsh_interpolate_high_abs_regions(), xsh_msg_dbg_low, xsh_msg_dbg_medium, xsh_response_calculate(), xsh_spectrum_get_flux(), xsh_spectrum_get_lambda_max(), xsh_spectrum_get_lambda_min(), xsh_spectrum_get_lambda_step(), and xsh_spectrum_get_qual().

Referenced by xsh_compute_response(), and xsh_compute_response_ord().

static int find_lambda_idx ( double  lambda,
double *  wave,
int  from,
int  to,
double  step 
) [static]

Definition at line 72 of file xsh_compute_response.c.

Referenced by xsh_interpolate_high_abs_regions().

static void find_lambda_idx_limit ( double  min,
double  max,
double *  spectrum,
int  from,
int  to,
double  step,
int *  if0,
int *  if1 
) [static]

Definition at line 86 of file xsh_compute_response.c.

References xsh_msg_dbg_high, and xsh_msg_dbg_low.

Referenced by xsh_response_calculate().

cpl_frame* xsh_compute_response ( cpl_frame *  spectrum_frame,
cpl_frame *  flux_std_star_cat_frame,
cpl_frame *  atmos_ext_frame,
cpl_frame *  high_abs_frame,
xsh_instrument instrument,
double  exptime 
)

Compute the instrument response using the rectified frame and the Standard star flux frame. The input should include also the Master Response Function and the Athmospheric Extinction Curve. Also should be produced the Efficiency frame.

Parameters:
spectrum_frame Rectified frame (1D spectrum)
flux_std_star_cat_frame Standard star flux catalog frame
atmos_ext_frame Atmospheric Extinction Frame
instrument Instrument strcture
exptime Exposure time
Returns:
Frame of the computed response

< computed response frame

< Std star flux

< Std star flux

< 1d spectrum

< 1d spectrum

Definition at line 951 of file xsh_compute_response.c.

References check, check_msg, do_compute(), INTERPOL_WSTEP_NM, STAR_MATCH_DEPSILON, xsh_add_temporary_file(), XSH_ARM_NIR, XSH_ASSURE_NOT_NULL, XSH_ATMOS_EXT, xsh_atmos_ext_list_free(), xsh_atmos_ext_list_load(), xsh_fill_high_abs_regions(), xsh_frame_product(), xsh_frame_sci_get_ra_dec_airmass(), xsh_free_frame(), xsh_free_propertylist(), xsh_free_table(), xsh_instrument_arm_tostring(), xsh_instrument_get_arm(), xsh_instrument_mode_tostring(), xsh_msg, xsh_msg_warning, xsh_parse_catalog_std_stars(), xsh_pfits_get_biny(), xsh_pfits_get_cdelt1(), xsh_pfits_get_crval1(), xsh_pfits_get_gain(), xsh_pfits_get_naxis1(), xsh_response_merge_obj_std_info(), xsh_spectrum_free(), xsh_spectrum_interpolate(), xsh_spectrum_load(), xsh_spectrum_resample(), xsh_spectrum_save(), xsh_star_flux_list_free(), xsh_star_flux_list_load(), and xsh_star_flux_list_save().

Referenced by xsh_respon_slit_nod(), xsh_respon_slit_offset(), xsh_respon_slit_stare(), xsh_util_compute_response(), and xsh_util_integrate().

cpl_frame* xsh_compute_response_ord ( cpl_frame *  spectrum_frame,
cpl_frame *  flux_std_star_cat_frame,
cpl_frame *  atmos_ext_frame,
cpl_frame *  high_abs_win_frame,
xsh_instrument instrument,
double  exptime 
)

Compute the instrument response using the rectified frame and the Standard star flux frame. The input should include also the Master Response Function and the Athmospheric Extinction Curve. Also should be produced the Efficiency frame.

Parameters:
spectrum_frame Rectified frame (1D spectrum)
flux_std_star_cat_frame Standard star flux catalog frame
atmos_ext_frame Atmospheric Extinction Frame
instrument Instrument strcture
exptime Exposure time
Returns:
Frame of the computed response

< computed response frame

< Std star flux

< obj star flux

< 1d spectrum

< 1d spectrum

Definition at line 1136 of file xsh_compute_response.c.

References check, check_msg, do_compute(), INTERPOL_WSTEP_NM, STAR_MATCH_DEPSILON, xsh_add_temporary_file(), XSH_ARM_NIR, XSH_ASSURE_NOT_NULL, xsh_atmos_ext_list_free(), xsh_atmos_ext_list_load(), xsh_fill_high_abs_regions(), xsh_frame_product(), xsh_frame_sci_get_ra_dec_airmass(), xsh_free_frame(), xsh_free_propertylist(), xsh_free_table(), xsh_instrument_arm_tostring(), xsh_instrument_get_arm(), xsh_instrument_mode_tostring(), xsh_msg, xsh_msg_warning, xsh_parse_catalog_std_stars(), xsh_pfits_get_biny(), xsh_pfits_get_cdelt1(), xsh_pfits_get_crval1(), xsh_pfits_get_gain(), xsh_pfits_get_naxis1(), xsh_spectrum_free(), xsh_spectrum_interpolate(), xsh_spectrum_load_order(), xsh_spectrum_save_order(), xsh_star_flux_list_free(), xsh_star_flux_list_load(), and xsh_star_flux_list_save_order().

Referenced by xsh_respon_slit_nod(), xsh_respon_slit_offset(), and xsh_respon_slit_stare().

static cpl_error_code xsh_flux_integrate_and_corr_for_badpix ( int  npix_in_interval,
double *  flux_spectrum,
int *  qual_spectrum,
int  if0,
int  if1,
int  i,
double **  flux_added,
int *  npixels,
int *  nbad 
) [static]

Definition at line 332 of file xsh_compute_response.c.

References QFLAG_GOOD_PIXEL, and XSH_ASSURE_NOT_NULL_MSG.

Referenced by xsh_response_calculate().

static cpl_error_code xsh_interpolate_atm_ext ( xsh_star_flux_list star_list,
cpl_table *  atmos_ext_tab,
xsh_instrument instrument,
double **  atmos_lambda,
double **  atmos_K 
) [static]

Interpolate atms extinction at same sampling step as ref std star

Parameters:
star_list Table of ref star flux
[in] atmos_ext_tab atmospheric extinction table
[in] instrument instrument arm and lamp setting
[out] atmos_lambda interpolated wave array
[out] atmos_K interpolated atmospheric extinction K
Returns:
cpl error code

Definition at line 126 of file xsh_compute_response.c.

References xsh_star_flux_list::lambda, xsh_star_flux_list::size, XSH_ARM_NIR, XSH_ASSURE_NOT_NULL_MSG, XSH_ATMOS_EXT_LIST_COLNAME_K, XSH_ATMOS_EXT_LIST_COLNAME_OLD, XSH_CALLOC, xsh_data_interpolate(), xsh_instrument_get_arm(), and xsh_msg_warning.

Referenced by do_compute().

static cpl_error_code xsh_interpolate_high_abs_regions ( xsh_star_flux_list star_list,
xsh_star_flux_list resp_list,
HIGH_ABS_REGION phigh 
) [static]

Interpolate high absorbtion regions

Parameters:
[in] star_list Table of ref star flux
[out] resp_list Table of response values
[in] HIGH_ABS_REGION pointer to hight abs regions
Returns:
cpl error code

Definition at line 197 of file xsh_compute_response.c.

References find_lambda_idx(), xsh_star_flux_list::flux, xsh_star_flux_list::lambda, HIGH_ABS_REGION::lambda_max, HIGH_ABS_REGION::lambda_min, xsh_star_flux_list::size, XSH_ASSURE_NOT_NULL_MSG, xsh_msg, and xsh_msg_dbg_medium.

Referenced by do_compute().

static xsh_star_flux_list* xsh_response_calculate ( xsh_star_flux_list star_list,
xsh_star_flux_list **  obj_list,
xsh_spectrum spectrum,
cpl_table *  atmos_ext_tab,
XSH_ARM  the_arm,
double *  atmos_K,
double  airmass,
double  exptime,
double  gain 
) [static]
static cpl_error_code xsh_response_crea_ascii ( xsh_star_flux_list resp_list,
xsh_star_flux_list star_list,
double *  lambda_spectrum,
double *  flux_spectrum,
double *  flux_added 
) [static]

Integrate the flux on the same sampling that the star_list, taking into account the bad pixels, apply atmos correction, and divide by the star_list table.

Parameters:
resp_list Table of response values
star_list Table of ref star flux
lambda_spectrum array with lambda values
flux_spectrum array with flux values
flux_added array with integrated flux values
Returns:
cpl error code

Definition at line 280 of file xsh_compute_response.c.

References xsh_star_flux_list::flux, xsh_star_flux_list::lambda, xsh_star_flux_list::size, and XSH_ASSURE_NOT_NULL_MSG.

Referenced by xsh_response_calculate().

cpl_error_code xsh_response_merge_obj_std_info ( cpl_frame *  result,
xsh_star_flux_list star_list,
xsh_star_flux_list obj_list 
)

Generated on 22 Mar 2012 for X-shooter Pipeline Reference Manual by  doxygen 1.6.1