#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_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 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) |
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 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().
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.
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 |
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.
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 |
< 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.
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 |
< 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
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 |
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
[in] | star_list | Table of ref star flux |
[out] | resp_list | Table of response values |
[in] | HIGH_ABS_REGION | pointer to hight abs regions |
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] |
Definition at line 383 of file xsh_compute_response.c.
References binx, biny, check, FILTER_MEDIAN_HSIZE, find_lambda_idx_limit(), xsh_star_flux_list::flux, xsh_spectrum::flux_header, xsh_star_flux_list::lambda, xsh_star_flux_list::size, xsh_add_temporary_file(), XSH_ARM_NIR, XSH_CALLOC, xsh_debug_level_get(), XSH_DEBUG_LEVEL_LOW, xsh_flux_integrate_and_corr_for_badpix(), XSH_FREE, xsh_free_frame(), xsh_free_table(), xsh_msg_dbg_low, xsh_msg_dbg_medium, xsh_pfits_get_binx(), xsh_pfits_get_biny(), xsh_response_crea_ascii(), xsh_spectrum_get_flux(), xsh_spectrum_get_lambda_max(), xsh_spectrum_get_lambda_min(), xsh_spectrum_get_lambda_step(), xsh_spectrum_get_qual(), xsh_spectrum_get_size(), xsh_star_flux_list_create(), xsh_star_flux_list_filter_median(), and xsh_star_flux_list_save().
Referenced by do_compute().
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.
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 |
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 | |||
) |
Definition at line 891 of file xsh_compute_response.c.
References check, xsh_star_flux_list::flux, xsh_free_propertylist(), and xsh_free_table().
Referenced by xsh_compute_response().