/home/amodigli/releases/xsh/1.2.10/pso/xsh.26608/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>

Go to the source code of this file.

Data Structures

struct  HIGH_ABS_REGION

Defines

#define INTERPOL_WSTEP_NM   2

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, XSH_ARM the_arm)
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_correct_flux_for_badpix (int npix_in_interval, double *flux_spectrum, int *qual_spectrum, int if0, int if1, double exptime, int i, double **flux_added, int *npixels, int *nbad)
static xsh_star_flux_listxsh_response_calculate (xsh_star_flux_list *star_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_spectrum *spectrum, cpl_table *atmos_ext_tab, HIGH_ABS_REGION *phigh, double airmass, double exptime, double gain, xsh_instrument *instrument)
static HIGH_ABS_REGIONxsh_fill_high_abs_regions (xsh_instrument *instrument, cpl_frame *high_abs_frame)
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)

Variables

HIGH_ABS_REGION NirHighAbsRegions []
HIGH_ABS_REGION VisHighAbsRegions []

Define Documentation

#define INTERPOL_WSTEP_NM   2

Definition at line 116 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_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
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 809 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 119 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 133 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

< 1d spectrum

< 1d spectrum

Definition at line 945 of file xsh_compute_response.c.

References check, check_msg, do_compute(), INTERPOL_WSTEP_NM, STAR_MATCH_DEPSILON, 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_parse_catalog_std_stars(), xsh_pfits_get_cdelt1(), xsh_pfits_get_crval1(), xsh_pfits_get_gain(), xsh_pfits_get_naxis1(), xsh_spectrum_free(), xsh_spectrum_interpolate_linear(), 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(), 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

< 1d spectrum

< 1d spectrum

Definition at line 1124 of file xsh_compute_response.c.

References check, check_msg, do_compute(), INTERPOL_WSTEP_NM, STAR_MATCH_DEPSILON, 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_parse_catalog_std_stars(), 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(), xsh_respon_slit_stare(), and xsh_util_compute_response().

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

Definition at line 410 of file xsh_compute_response.c.

References QFLAG_GOOD_PIXEL, and XSH_ASSURE_NOT_NULL_MSG.

Referenced by xsh_response_calculate().

static HIGH_ABS_REGION* xsh_fill_high_abs_regions ( xsh_instrument instrument,
cpl_frame *  high_abs_frame 
) [static]
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 173 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_CALLOC, xsh_data_interpolate(), and xsh_instrument_get_arm().

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,
XSH_ARM  the_arm 
) [static]

Interpolate high absorbtion regions

Parameters:
[in] star_list Table of ref star flux
[out] resp_list Table of response values
[in] the_arm interpolated atmospheric extinction K
Returns:
cpl error code

Definition at line 240 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_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 357 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().


Variable Documentation

Initial value:
 {
  {1060.0, 1232.9}, 
  {1247.4, 1500.0}, 
  {1549.0, 1588.5}, 
  {1595.0, 1625.0}, 
  {1630.0, 1983.5}, 
  {1984.2, 1988.1}, 
  {1988.9, 1991.1}, 
  {1991.7, 2138.0}, 
  {2145.0, 2191.0}, 
  {2218.0, 2271.0}, 
  {2351.0, 2431.0}, 
  {0., 0.} 
}

Definition at line 85 of file xsh_compute_response.c.

Initial value:
 {
  {585.0, 604.0}, 
  {684.5, 746.0}, 
  {755.5, 775.5}, 
  {783.7, 856.0}, 
  {887.5, 993.4}, 
  {0., 0.}
}

Definition at line 107 of file xsh_compute_response.c.


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