Data Structures | ||||
struct | FRAME_DATE_IDX | |||
Defines | ||||
#define | CPL_TYPE float | |||
#define | CPL_TYPE_T CPL_TYPE_FLOAT | |||
#define | CPL_IMAGE_GET_DATA cpl_image_get_data_float | |||
#define | CPL_IMAGE_GET_DATA_CONST cpl_image_get_data_float_const | |||
#define | CPL_IMAGE_GET_MEDIAN cpl_tools_get_median_float | |||
#define | XSH_DOUBLE_SWAP(a, b) { register double t=(a);(a)=(b);(b)=t; } | |||
#define | XSH_FLOAT_SWAP(a, b) { register float t=(a);(a)=(b);(b)=t; } | |||
#define | XSH_INT_SWAP(a, b) { register int t=(a);(a)=(b);(b)=t; } | |||
#define | XSH_PIX_STACK_SIZE 50 | |||
Functions | ||||
cpl_image * | xsh_imagelist_collapse_sigclip_iter_create (const cpl_imagelist *imlist, double sigma_low, double sigma_upp, const int niter) | |||
Average with sigma-clipping rejection an imagelist to a single image. | ||||
static double | xsh_hms2deg (const double hms) | |||
Convert a double from hours minute seconds to deg:. | ||||
static double | xsh_sess2deg (const double sess) | |||
Convert a double from ssessagesimal to deg: 203049.197= 20:30:49.197 = 20.5136658333. | ||||
cpl_error_code | xsh_check_input_is_unbinned (cpl_frame *in) | |||
Check if an input frame is not binned. | ||||
int | xsh_fileutils_copy (const char *srcpath, const char *dstpath) | |||
int | xsh_fileutils_move (const char *srcpath, const char *dstpath) | |||
char * | xsh_set_recipe_file_prefix (cpl_frameset *raw, const char *recipe) | |||
Set recipe frames prefix. | ||||
cpl_error_code | xsh_set_cd_matrix (cpl_propertylist *plist) | |||
Set CD matrix. | ||||
cpl_error_code | xsh_set_cd_matrix1d (cpl_propertylist *plist) | |||
Set CD matrix. | ||||
cpl_error_code | xsh_set_cd_matrix2d (cpl_propertylist *plist) | |||
Set CD matrix. | ||||
cpl_error_code | xsh_set_cd_matrix3d (cpl_propertylist *plist) | |||
Set CD matrix. | ||||
cpl_parameterlist * | xsh_parameterlist_duplicate (const cpl_parameterlist *pin) | |||
Extract frames with given tag from frameset. | ||||
static void | xsh_property_dump (cpl_property *property) | |||
Dump property. | ||||
cpl_frame * | xsh_frameset_average (cpl_frameset *set, const char *tag) | |||
Dump propertylist. | ||||
cpl_frame * | xsh_frameset_add (cpl_frameset *set, xsh_instrument *instr) | |||
coadd frames in a frameset | ||||
void | xsh_plist_dump (cpl_propertylist *plist) | |||
Dump propertylist. | ||||
cpl_error_code | xsh_frameset_dump (cpl_frameset *set) | |||
Dump frameset. | ||||
cpl_error_code | xsh_frameset_dump_nod_info (cpl_frameset *set) | |||
Dump frameset nod info. | ||||
void | xsh_init (void) | |||
Reset library state. | ||||
char * | xsh_get_basename (const char *filename) | |||
Return base filename. | ||||
const char * | xsh_get_license (void) | |||
Get the pipeline copyright and license. | ||||
cpl_error_code | xsh_begin (cpl_frameset *frames, const cpl_parameterlist *parameters, xsh_instrument **instrument, cpl_frameset **raws, cpl_frameset **calib, const char *tag_list[], int tag_list_size, const char *recipe_id, unsigned int binary_version, const char *short_descr) | |||
Recipe initialization. | ||||
void | xsh_add_temporary_file (const char *name) | |||
Add temporary file to temprary files list. | ||||
void | xsh_free_temporary_files (void) | |||
Free temprary files list. | ||||
void | xsh_add_product_file (const char *name) | |||
Add temporary file to temprary files list. | ||||
void | xsh_free_product_files (void) | |||
Free temprary files list. | ||||
cpl_error_code | xsh_end (const char *recipe_id, cpl_frameset *frames, cpl_parameterlist *parameters) | |||
Recipe termination. | ||||
cpl_error_code | xsh_get_property_value (const cpl_propertylist *plist, const char *keyword, cpl_type keywordtype, void *result) | |||
Read a property value from a property list. | ||||
char * | xsh_stringdup (const char *s) | |||
String duplication. | ||||
char * | xsh_sdate_utc (time_t *now) | |||
char * | xsh_stringcat (const char *s1, const char *s2) | |||
String concatenation. | ||||
char * | xsh_stringcat_3 (const char *s1, const char *s2, const char *s3) | |||
String concatenation. | ||||
char * | xsh_stringcat_4 (const char *s1, const char *s2, const char *s3, const char *s4) | |||
String concatenation. | ||||
char * | xsh_stringcat_5 (const char *s1, const char *s2, const char *s3, const char *s4, const char *s5) | |||
String concatenation. | ||||
char * | xsh_stringcat_6 (const char *s1, const char *s2, const char *s3, const char *s4, const char *s5, const char *s6) | |||
String concatenation. | ||||
char * | xsh_stringcat_any (const char *s,...) | |||
Concatenate an arbitrary number of strings. | ||||
int * | xsh_sort (void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *)) | |||
Sort an array and give is index table. | ||||
void | xsh_reindex (double *data, int *idx, int size) | |||
TO BE DESCRIBED. | ||||
void | xsh_reindex_float (float *data, int *idx, int size) | |||
TO BE DESCRIBED. | ||||
void | xsh_reindex_int (int *data, int *idx, int size) | |||
TO BE DESCRIBED. | ||||
void | xsh_free (const void *mem) | |||
Deallocate memory. | ||||
void | xsh_free_image (cpl_image **i) | |||
Deallocate an image and set the pointer to NULL. | ||||
void | xsh_free_table (cpl_table **t) | |||
Deallocate a table and set the pointer to NULL. | ||||
void | xsh_free_mask (cpl_mask **m) | |||
Deallocate an image mask and set the pointer to NULL. | ||||
void | xsh_free_imagelist (cpl_imagelist **i) | |||
Deallocate an image list and set the pointer to NULL. | ||||
void | xsh_free_propertylist (cpl_propertylist **p) | |||
Deallocate a property list and set the pointer to NULL. | ||||
void | xsh_free_polynomial (cpl_polynomial **p) | |||
Deallocate a polynomial and set the pointer to NULL. | ||||
void | xsh_free_matrix (cpl_matrix **m) | |||
Deallocate a matrix and set the pointer to NULL. | ||||
void | xsh_free_parameterlist (cpl_parameterlist **p) | |||
Deallocate a parameter list and set the pointer to NULL. | ||||
void | xsh_free_parameter (cpl_parameter **p) | |||
Deallocate a parameter and set the pointer to NULL. | ||||
void | xsh_free_frameset (cpl_frameset **f) | |||
Deallocate a frame set and set the pointer to NULL. | ||||
void | xsh_free_frame (cpl_frame **f) | |||
Deallocate a frame and set the pointer to NULL. | ||||
void | xsh_free_vector (cpl_vector **v) | |||
Deallocate a vector and set the pointer to NULL. | ||||
void | xsh_free_array (cpl_array **m) | |||
Deallocate an array and set the pointer to NULL. | ||||
void | xsh_free_stats (cpl_stats **s) | |||
Deallocate a stats object and set the pointer to NULL. | ||||
void | xsh_unwrap_image (cpl_image **i) | |||
Unwrap an image and set the pointer to NULL. | ||||
void | xsh_unwrap_vector (cpl_vector **v) | |||
Unwrap a vector and set the pointer to NULL. | ||||
void | xsh_unwrap_bivector_vectors (cpl_bivector **b) | |||
Unwrap a bi-vector and set the pointer to NULL. | ||||
void | xsh_show_time (const char *comment) | |||
show time | ||||
void | xsh_tools_get_statistics (double *tab, int size, double *median, double *mean, double *stdev) | |||
Compute median, stdev and mean for the tab. | ||||
cpl_error_code | xsh_tools_sort_double (double *pix_arr, int n) | |||
Sort a double array. | ||||
cpl_error_code | xsh_tools_sort_float (float *pix_arr, int n) | |||
Sort a float array. | ||||
cpl_error_code | xsh_tools_sort_int (int *pix_arr, int n) | |||
Sort an integer array. | ||||
double | xsh_tools_get_median_double (double *array, int size) | |||
Calculates the median value of an array of double. | ||||
int | xsh_tools_running_median_1d_get_max (double *tab, int size, int wsize) | |||
get max of a list of doubles after running median | ||||
void | xsh_tools_min_max (int size, double *tab, double *min, double *max) | |||
computes min & max in ab array | ||||
cpl_vector * | xsh_tools_tchebitchev_poly_eval (int n, double X) | |||
Compute tchebitchev Tn(X) first coefficient for tchebitchev polynomial. | ||||
void | xsh_tools_tchebitchev_transform_tab (int size, double *pos, double min, double max, double *tcheb_pos) | |||
computes Tchebitchev transformation | ||||
double | xsh_tools_tchebitchev_transform (double pos, double min, double max) | |||
computes Tchebitchev transformation | ||||
double | xsh_tools_tchebitchev_reverse_transform (double pos, double min, double max) | |||
computes reverse Tchebitchev transformation | ||||
void | xsh_image_fit_spline (cpl_image *img, xsh_grid *grid) | |||
perform spline fit | ||||
void | xsh_vector_fit_gaussian (cpl_vector *x, cpl_vector *y, XSH_GAUSSIAN_FIT *result) | |||
set debug level | ||||
int | xsh_debug_level_set (int level) | |||
set debug level | ||||
int | xsh_debug_level_get (void) | |||
get debug level | ||||
const char * | xsh_debug_level_tostring (void) | |||
set debug level | ||||
int | xsh_time_stamp_set (int ts) | |||
set timestamp | ||||
int | xsh_time_stamp_get (void) | |||
get timestamp | ||||
void | xsh_mem_dump (const char *prompt) | |||
double | convert_bin_to_data (double bin_data, int binning) | |||
double | convert_data_to_bin (double data, int binning) | |||
static double | date_to_double (const char *the_date) | |||
static int | compare_frame_date (const void *one, const void *two) | |||
cpl_frameset * | xsh_order_frameset_by_date (cpl_frameset *frameset) | |||
Order frameset by date. | ||||
polynomial * | xsh_polynomial_regression_2d (cpl_table *t, const char *X1, const char *X2, const char *Y, const char *sigmaY, int degree1, int degree2, const char *polynomial_fit, const char *residual_square, const char *variance_fit, double *mse, double *red_chisq, polynomial **variance, double kappa, double min_reject) | |||
Fit a 2d polynomial to three table columns. | ||||
int | xsh_select_table_rows (cpl_table *t, const char *column, cpl_table_select_operator operator, double value) | |||
Select table rows. | ||||
int | xsh_erase_table_rows (cpl_table *t, const char *column, cpl_table_select_operator operator, double value) | |||
Erase table rows. | ||||
cpl_frame * | xsh_frame_inv (cpl_frame *in, const char *filename, xsh_instrument *instr) | |||
Inverse the flux of a PRE frame. | ||||
cpl_frame * | xsh_frame_abs (cpl_frame *in, xsh_instrument *instr, cpl_frame **sign) | |||
Computes absolute value of a frame. | ||||
void | xsh_frame_image_save (cpl_frame *frm, const char *name_o) | |||
save an image frame | ||||
void | xsh_frame_table_save (cpl_frame *frame, const char *name_o) | |||
Save a table frame. | ||||
cpl_frame * | xsh_frame_mult (cpl_frame *in, xsh_instrument *instr, cpl_frame *sign) | |||
Computes product of two input frames. | ||||
cpl_error_code | xsh_monitor_flux (cpl_frame *frm_ima, const cpl_frame *frm_tab, xsh_instrument *instrument) | |||
Monitor Flux level along the orders traces given by an input table. | ||||
cpl_error_code | xsh_update_pheader_in_image_multi (cpl_frame *frame, const cpl_propertylist *pheader) | |||
Update FITS header. | ||||
double | xsh_vector_get_err_median (cpl_vector *vect) | |||
Computes median error on a data set. | ||||
double | xsh_vector_get_err_mean (cpl_vector *vect) | |||
Computes mean error on a data set. | ||||
long | xsh_round_double (double x) | |||
Computes round(x). | ||||
int | xsh_min_int (int x, int y) | |||
Minimum of two numbers. | ||||
int | xsh_max_int (int x, int y) | |||
Maximum of two numbers. | ||||
double | xsh_min_double (double x, double y) | |||
Minimum of two numbers. | ||||
double | xsh_max_double (double x, double y) | |||
Maximum of two numbers. | ||||
double | xsh_pow_int (double x, int y) | |||
Computes x^y. | ||||
const char * | xsh_string_tolower (char *s) | |||
Convert all uppercase characters in a string into lowercase characters. | ||||
const char * | xsh_string_toupper (char *s) | |||
Convert all lowercase characters in a string into uppercase characters. | ||||
double | xsh_spline_hermite (double xp, const double *x, const double *y, int n, int *istart) | |||
Spline interpolation based on Hermite polynomials. | ||||
double | xsh_spline_hermite_table (double xp, const cpl_table *t, const char *column_x, const char *column_y, int *istart) | |||
Spline interpolation based on Hermite polynomials. | ||||
cpl_error_code | xsh_get_table_value (const cpl_table *table, const char *colname, cpl_type coltype, int i, void *result) | |||
Read a table value from a fits table. | ||||
cpl_error_code | xsh_sort_table_1 (cpl_table *t, const char *column, cpl_boolean reverse) | |||
Sort a table by one column. | ||||
cpl_error_code | xsh_sort_table_2 (cpl_table *t, const char *column1, const char *column2, cpl_boolean reverse1, cpl_boolean reverse2) | |||
Sort a table by two columns. | ||||
double | xsh_data_interpolate (double wav, int nrow, double *pw, double *pe) | |||
Interpolate data points. | ||||
double | xsh_table_interpolate (cpl_table *tbl, double wav, const char *colx, const char *coly) | |||
Interpolate table columns. | ||||
static cpl_error_code | xsh_table_monitor_flux_qc (cpl_table *table, const double ws, const double we, const char *prefix, const int index, cpl_propertylist **header) | |||
Computes statistics on spectrum for QC. | ||||
static cpl_propertylist * | xsh_frame_table_monitor_flux_qc_ext (cpl_table *table, const char *colw, const char *colf, const char *prefix, xsh_instrument *instrument) | |||
Computes statistics on spectrum for QC. | ||||
cpl_error_code | xsh_frame_table_monitor_flux_qc (cpl_frame *frm, const char *colw, const char *colf, const char *prefix, xsh_instrument *instrument) | |||
Computes statistics on spectrum for QC. | ||||
Variables | ||||
static char ** | TempFiles = NULL | |||
static int | NbTemp = 0 | |||
static char ** | ProdFiles = NULL | |||
static int | NbProducts = 0 | |||
int | FRAME_DATE_IDX::frame_idx | |||
cpl_frame * | FRAME_DATE_IDX::frame | |||
const char * | FRAME_DATE_IDX::frame_name | |||
xsh_image_to_vector() | ||||
converts a fits image to a spectral vector
| ||||
cpl_vector * | xsh_image_to_vector (cpl_image *spectrum) | |||
cpl_image * | xsh_vector_to_image (const cpl_vector *vector, cpl_type type) | |||
Convert a vector to a 1d image. | ||||
cpl_frame * | xsh_util_multiply_by_response (cpl_frame *merged_sci, cpl_frame *response, const char *tag_o) | |||
Multiply input frame by response frame. | ||||
cpl_frame * | xsh_util_multiply_by_response_ord (cpl_frame *extracted_sci, cpl_frame *response, const char *tag_o) | |||
Multiply input frame by response frame. | ||||
static cpl_error_code | xsh_util_get_infsup (double *piw, double w, int i_start, int i_end, int *i_inf, int *i_sup) | |||
static double | xsh_spectrum_integrate (double *pif, double *piw, int i1_inf, int i1_sup, int i2_inf, int i2_sup, double wave, double wstep) | |||
cpl_frame * | xsh_spectrum_resample (cpl_frame *frame_inp, const double wstep, const double wmin, const double wmax, xsh_instrument *instr) | |||
resample a spectrum | ||||
cpl_frame * | xsh_util_frameset_collapse_mean (cpl_frameset *set, xsh_instrument *instrument) | |||
Compute mean frame from a list of (IMAGE) framesets. | ||||
cpl_error_code | xsh_normalize_spectrum_image_slice (const char *name_s, const char *tag_o, const int ext, const int binx, const double gain, const double exptime, const double airmass, const cpl_table *tbl_atm_ext) | |||
Normalize spectrum slice. | ||||
cpl_frame * | xsh_normalize_spectrum (const cpl_frame *obj_frame, const cpl_frame *atm_ext_frame, cpl_boolean correct_binning, xsh_instrument *instrument, const char *tag_o) | |||
Normalize a spectrum. | ||||
cpl_frame * | xsh_normalize_spectrum_ord (const cpl_frame *obj_frame, const cpl_frame *atm_ext_frame, cpl_boolean correct_binning, xsh_instrument *instrument, const char *tag_o) | |||
Normalize a spectrum. | ||||
cpl_image * | xsh_normalize_spectrum_image (const cpl_image *spectrum, const cpl_image *spectrum_error, const cpl_propertylist *spectrum_header, const int binx, const double gain, const double exptime, const double airmass, const int n_traces, const cpl_table *atm_extinction, cpl_image **scaled_error) | |||
Normalize a spectrum. | ||||
static double | xsh_iterpol_linear (double *data_x, double *data_y, int ndata, double x, int *i_inf, int *i_sup) | |||
cpl_frame * | xsh_spectrum_interpolate_linear (cpl_frame *table_frame, const double wstep, const double wmin, const double wmax) | |||
spectra interpolation | ||||
cpl_frame * | xsh_spectrum_interpolate (cpl_frame *table_frame, const double wstep, const double wmin, const double wmax) | |||
spectra interpolation | ||||
void | xsh_array_clip_mean (cpl_array *array, double kappa, int niter, double frac_min, double *mean, double *stdev) | |||
mean clip of an array | ||||
void | xsh_array_clip_median (cpl_array *array, double kappa, int niter, double frac_min, double *median, double *stdev) | |||
median clip of an array | ||||
void | xsh_array_clip_poly1d (cpl_vector *pos_vect, cpl_vector *val_vect, double kappa, int niter, double frac_min, int deg, cpl_polynomial **polyp, double *chisq, int **flagsp) | |||
clip outliers from a 1D poly fit |
This module is for the stuff that don't fit anywhere else. It should be kept as small as possible.
#define CPL_IMAGE_GET_DATA cpl_image_get_data_float |
Definition at line 95 of file xsh_utils.c.
Referenced by xsh_imagelist_collapse_sigclip_iter_create().
#define CPL_IMAGE_GET_DATA_CONST cpl_image_get_data_float_const |
Definition at line 96 of file xsh_utils.c.
Referenced by xsh_imagelist_collapse_sigclip_iter_create().
#define CPL_IMAGE_GET_MEDIAN cpl_tools_get_median_float |
Definition at line 97 of file xsh_utils.c.
#define CPL_TYPE float |
Definition at line 93 of file xsh_utils.c.
#define CPL_TYPE_T CPL_TYPE_FLOAT |
Definition at line 94 of file xsh_utils.c.
Referenced by xsh_imagelist_collapse_sigclip_iter_create().
#define XSH_DOUBLE_SWAP | ( | a, | |||
b | ) | { register double t=(a);(a)=(b);(b)=t; } |
Definition at line 2266 of file xsh_utils.c.
Referenced by xsh_tools_sort_double().
#define XSH_FLOAT_SWAP | ( | a, | |||
b | ) | { register float t=(a);(a)=(b);(b)=t; } |
Definition at line 2267 of file xsh_utils.c.
Referenced by xsh_tools_sort_float().
#define XSH_INT_SWAP | ( | a, | |||
b | ) | { register int t=(a);(a)=(b);(b)=t; } |
Definition at line 2268 of file xsh_utils.c.
Referenced by xsh_tools_sort_int().
#define XSH_PIX_STACK_SIZE 50 |
Definition at line 2270 of file xsh_utils.c.
Referenced by xsh_tools_sort_double(), xsh_tools_sort_float(), and xsh_tools_sort_int().
static int compare_frame_date | ( | const void * | one, | |
const void * | two | |||
) | [static] |
Definition at line 3147 of file xsh_utils.c.
References first, and FRAME_DATE_IDX::frame_date.
Referenced by xsh_order_frameset_by_date().
double convert_bin_to_data | ( | double | bin_data, | |
int | binning | |||
) |
Definition at line 3091 of file xsh_utils.c.
Referenced by xsh_dispersol_list_eval(), and xsh_order_list_eval().
double convert_data_to_bin | ( | double | data, | |
int | binning | |||
) |
Definition at line 3109 of file xsh_utils.c.
Referenced by fill_rectified(), xsh_order_list_eval(), xsh_order_list_get_endy(), xsh_order_list_get_starty(), xsh_wavesol_eval_polx(), and xsh_wavesol_eval_poly().
static double date_to_double | ( | const char * | the_date | ) | [static] |
Definition at line 3118 of file xsh_utils.c.
References mm, and XSH_ASSURE_NOT_NULL.
Referenced by xsh_order_frameset_by_date().
void xsh_add_product_file | ( | const char * | name | ) |
Add temporary file to temprary files list.
[in] | name | The name of the file |
Definition at line 1359 of file xsh_utils.c.
References NbProducts, and ProdFiles.
Referenced by xsh_add_product(), xsh_add_product_bpmap(), xsh_add_product_image(), xsh_add_product_imagelist(), xsh_add_product_pre(), xsh_add_product_pre_3d(), xsh_add_product_spectrum(), xsh_add_product_table(), and xsh_add_product_table_multi().
void xsh_add_temporary_file | ( | const char * | name | ) |
Add temporary file to temprary files list.
[in] | name | The name of the file |
Definition at line 1320 of file xsh_utils.c.
References NbTemp, and TempFiles.
Referenced by xsh_arclist_save(), xsh_compute_linearity(), xsh_compute_noise_map(), xsh_create_order_table(), xsh_create_poly_wavemap(), xsh_detect_arclines(), xsh_detect_continuum(), xsh_detect_order_edge(), xsh_follow_arclines(), xsh_image_get_hot_cold_pixs(), xsh_linear(), xsh_linetilt_list_save(), xsh_mdark(), xsh_pre_3d_save(), xsh_pre_frame_subtract(), xsh_pre_save(), xsh_rec_list_save(), xsh_rec_list_save_table(), xsh_resid_order_save(), xsh_resid_tab_save(), xsh_shift_tab_save(), xsh_star_flux_list_save(), and xsh_star_flux_list_save_order().
void xsh_array_clip_mean | ( | cpl_array * | array, | |
double | kappa, | |||
int | niter, | |||
double | frac_min, | |||
double * | mean, | |||
double * | stdev | |||
) |
mean clip of an array
array | array of values to be clipped | |
kappa | kappa value of kappa sigma clip | |
niter | number of iterations | |
frac_min | minimum accepable fraction of good pixels | |
[out] | mean | mean of values after clipping |
[out] | stdev | sigma of values after clipping |
Definition at line 6177 of file xsh_utils.c.
References check, sigma, XSH_ASSURE_NOT_NULL, XSH_CALLOC, XSH_FREE, xsh_msg, and xsh_msg_dbg_medium.
void xsh_array_clip_median | ( | cpl_array * | array, | |
double | kappa, | |||
int | niter, | |||
double | frac_min, | |||
double * | median, | |||
double * | stdev | |||
) |
median clip of an array
array | array of values to be clipped | |
kappa | kappa value of kappa sigma clip | |
niter | number of iterations | |
frac_min | minimum accepable fraction of good pixels | |
[out] | median | median of values after clipping |
[out] | stdev | sigma of values after clipping |
Definition at line 6259 of file xsh_utils.c.
References check, sigma, XSH_ASSURE_NOT_NULL, XSH_CALLOC, XSH_FREE, and xsh_msg.
Referenced by compute_specres().
void xsh_array_clip_poly1d | ( | cpl_vector * | pos_vect, | |
cpl_vector * | val_vect, | |||
double | kappa, | |||
int | niter, | |||
double | frac_min, | |||
int | deg, | |||
cpl_polynomial ** | polyp, | |||
double * | chisq, | |||
int ** | flagsp | |||
) |
clip outliers from a 1D poly fit
pos_vect | vector with positions | |
val_vect | vector with values | |
kappa | kappa value of kappa sigma clip | |
niter | number of iterations | |
frac_min | minimum accepable fraction of good pixels | |
deg | degree of polynomial | |
polyp | polynomial | |
chisq | chi square | |
flagsp | flag parameter |
Definition at line 6340 of file xsh_utils.c.
References check, sigma, XSH_ASSURE_NOT_NULL, XSH_CALLOC, XSH_FREE, xsh_free_polynomial(), xsh_msg, xsh_msg_dbg_medium, xsh_polynomial_fit_1d_create(), and xsh_unwrap_vector().
Referenced by find_tilt().
cpl_error_code xsh_begin | ( | cpl_frameset * | frames, | |
const cpl_parameterlist * | parameters, | |||
xsh_instrument ** | instrument, | |||
cpl_frameset ** | raws, | |||
cpl_frameset ** | calib, | |||
const char * | tag_list[], | |||
int | tag_list_size, | |||
const char * | recipe_id, | |||
unsigned int | binary_version, | |||
const char * | short_descr | |||
) |
Recipe initialization.
frames | The input frame set | |
parameters | The input parameter list | |
instrument | Pointer to the instrument structure pointer | |
raws | Pointer to RAW Frameset | |
calib | Pointer to CALIB Frameset | |
tag_list | List of valid tags for the recipe | |
tag_list_size | size of List of valid tags for the recipe | |
recipe_id | Name of the recipe, e.g. xsh_mbias | |
binary_version | Recipe version (possibly different from pipeline version) | |
short_descr | A short description of what the recipe does |
This function should be called at the beginning of every recipe. It takes care of the mandatory tasks that are common for all recipes before the beginning of the data reduction.
xsh_dfs_set_groups()
), andSee also xsh_end()
.
Definition at line 1157 of file xsh_utils.c.
References assure, check, MAXIMUM, XSH_ASSURE_NOT_NULL, xsh_debug_level_tostring(), xsh_dfs_files_dont_exist(), xsh_dfs_filter(), xsh_dfs_set_groups(), xsh_dfs_split_in_group(), xsh_instrument_set_recipe_id(), xsh_msg, XSH_NEW_FRAMESET, xsh_parameters_debug_level_get(), xsh_parameters_get_temporary(), xsh_parameters_time_stamp_get(), xsh_print_cpl_frameset(), and xsh_stringcat_4().
Referenced by xsh_2dmap(), xsh_cfg_recover_driver(), xsh_flexcomp(), xsh_geom_ifu(), xsh_linear(), xsh_lingain(), xsh_mbias(), xsh_mdark(), xsh_mflat(), xsh_orderpos(), xsh_predict(), xsh_respon_slit_nod(), xsh_respon_slit_offset(), xsh_respon_slit_stare(), xsh_scired_ifu_offset(), xsh_scired_ifu_stare(), xsh_scired_slit_nod(), xsh_scired_slit_offset(), xsh_scired_slit_stare(), xsh_util_afc(), xsh_util_apply_response(), xsh_util_bpmap_coadd(), xsh_util_bpmap_nl_raw2pre(), xsh_util_compute_response(), xsh_util_crh_single(), xsh_util_efficiency1d(), xsh_util_efficiency2d(), xsh_util_guess_xy(), xsh_util_ifu_build_cube(), xsh_util_ima_arith(), xsh_util_integrate(), xsh_util_physmod(), and xsh_wavecal().
cpl_error_code xsh_check_input_is_unbinned | ( | cpl_frame * | in | ) |
Check if an input frame is not binned.
in | input frame |
Definition at line 312 of file xsh_utils.c.
References binx, biny, xsh_free_propertylist(), xsh_msg_error, xsh_pfits_get_binx(), and xsh_pfits_get_biny().
Referenced by xsh_2dmap(), xsh_orderpos(), and xsh_predict().
double xsh_data_interpolate | ( | double | wav, | |
int | nrow, | |||
double * | pw, | |||
double * | pe | |||
) |
Interpolate data points.
wav | value at which is desired an interpolated value | |
nrow | number of data points | |
pw | pointer to wave array | |
pe | pointer to efficiency array |
Definition at line 195 of file xsh_utils_table.c.
References y.
Referenced by xsh_interpolate_atm_ext(), and xsh_table_interpolate().
int xsh_debug_level_get | ( | void | ) |
get debug level
Definition at line 3005 of file xsh_utils.c.
References XshDebugLevel.
Referenced by create_resid_tab(), detect_centroid(), fit_spline(), flag_noisy_pixels(), xsh_create_dispersol_physmod(), xsh_create_order_table(), xsh_create_poly_wavemap(), xsh_detect_arclines(), xsh_detect_continuum(), xsh_detect_order_edge(), xsh_fit_gaussian(), xsh_image_extract_optimal(), xsh_localize_obj_auto(), xsh_opt_extract_orders(), xsh_optextract_produce_model(), xsh_order_frameset_by_date(), xsh_order_table_from_fmtchk(), xsh_remove_cosmics(), xsh_remove_crh_single(), xsh_response_calculate(), xsh_vector_integrate(), xsh_wavelist_subtract_sky(), xsh_wavemap_list_build_sky(), and xsh_wavemap_list_new().
int xsh_debug_level_set | ( | int | level | ) |
set debug level
level | error level |
Definition at line 2988 of file xsh_utils.c.
References XshDebugLevel.
Referenced by HandleOptions(), main(), xsh_model_reduce(), and xsh_parameters_debug_level_get().
const char* xsh_debug_level_tostring | ( | void | ) |
set debug level
Definition at line 3018 of file xsh_utils.c.
References XSH_DEBUG_LEVEL_HIGH, XSH_DEBUG_LEVEL_LOW, XSH_DEBUG_LEVEL_MEDIUM, XSH_DEBUG_LEVEL_NONE, and XshDebugLevel.
Referenced by xsh_begin().
cpl_error_code xsh_end | ( | const char * | recipe_id, | |
cpl_frameset * | frames, | |||
cpl_parameterlist * | parameters | |||
) |
Recipe termination.
recipe_id | Name of calling recipe | |
frames | The output frame set | |
parameters | The input parameter list |
This function is called at the end of every recipe. The output frame set is printed, and the number of warnings produced by the recipe is summarized.
See also xsh_begin()
.
Definition at line 1406 of file xsh_utils.c.
References NbTemp, TempFiles, xsh_free_product_files(), xsh_free_temporary_files(), xsh_msg, xsh_msg_get_warnings(), xsh_msg_warning, xsh_parameters_get_temporary(), and xsh_print_cpl_frame().
Referenced by xsh_2dmap(), xsh_cfg_recover_last_step(), xsh_flexcomp(), xsh_geom_ifu(), xsh_linear(), xsh_mbias(), xsh_mdark(), xsh_mflat(), xsh_orderpos(), xsh_predict(), xsh_respon_slit_nod(), xsh_respon_slit_offset(), xsh_respon_slit_stare(), xsh_scired_ifu_offset(), xsh_scired_ifu_stare(), xsh_scired_slit_nod(), xsh_scired_slit_offset(), xsh_scired_slit_stare(), xsh_util_ifu_build_cube(), and xsh_wavecal().
int xsh_erase_table_rows | ( | cpl_table * | t, | |
const char * | column, | |||
cpl_table_select_operator | operator, | |||
double | value | |||
) |
Erase table rows.
t | Table | |
column | Column name | |
operator | Logical operator | |
value | Value used for comparison |
A table row is erased if and only if the value in column is in the relation operator to the specified value. The specified column must have type CPL_TYPE_DOUBLE or CPL_TYPE_INT. If integer, the integer nearest to value is used for the comparison.
The table selection flags are reset.
Also see cpl_table_and_selected_<type>()
.
Definition at line 3765 of file xsh_utils.c.
References assure, check_msg, and xsh_select_table_rows().
Referenced by xsh_polynomial_regression_2d().
int xsh_fileutils_copy | ( | const char * | srcpath, | |
const char * | dstpath | |||
) |
Definition at line 366 of file xsh_utils.c.
References DEV_BLOCKSIZE.
Referenced by xsh_fileutils_move().
int xsh_fileutils_move | ( | const char * | srcpath, | |
const char * | dstpath | |||
) |
Definition at line 471 of file xsh_utils.c.
References xsh_fileutils_copy().
Referenced by xsh_add_product_table_multi().
cpl_frame* xsh_frame_abs | ( | cpl_frame * | in, | |
xsh_instrument * | instr, | |||
cpl_frame ** | sign | |||
) |
Computes absolute value of a frame.
in | input frame | |
instr | instrument setting | |
sign | input frame |
Definition at line 3827 of file xsh_utils.c.
References check, XSH_ASSURE_NOT_NULL, xsh_free_frame(), xsh_free_image(), xsh_pre_abs(), xsh_pre_free(), xsh_pre_load(), and xsh_pre_save().
Referenced by xsh_abs_remove_crh_single().
void xsh_frame_image_save | ( | cpl_frame * | frm, | |
const char * | name_o | |||
) |
save an image frame
frm | frame | |
name_o | output filename |
Definition at line 3872 of file xsh_utils.c.
References xsh_free_image().
cpl_frame* xsh_frame_inv | ( | cpl_frame * | in, | |
const char * | filename, | |||
xsh_instrument * | instr | |||
) |
Inverse the flux of a PRE frame.
in | The pre frame to inverse | |
filename | filename | |
instr | instrument setting |
Definition at line 3794 of file xsh_utils.c.
References check, XSH_ASSURE_NOT_NULL, xsh_free_frame(), xsh_pre_free(), xsh_pre_load(), xsh_pre_multiply_scalar(), and xsh_pre_save().
cpl_frame* xsh_frame_mult | ( | cpl_frame * | in, | |
xsh_instrument * | instr, | |||
cpl_frame * | sign | |||
) |
Computes product of two input frames.
in | input frame | |
instr | instrument structure | |
sign | input frame |
Definition at line 3938 of file xsh_utils.c.
References check, XSH_ASSURE_NOT_NULL, xsh_free_frame(), xsh_free_image(), xsh_pre_free(), xsh_pre_load(), xsh_pre_multiply_image(), and xsh_pre_save().
Referenced by xsh_abs_remove_crh_single().
cpl_error_code xsh_frame_table_monitor_flux_qc | ( | cpl_frame * | frm, | |
const char * | colw, | |||
const char * | colf, | |||
const char * | prefix, | |||
xsh_instrument * | instrument | |||
) |
Computes statistics on spectrum for QC.
[in] | frm | spectrum frame |
[in] | colw | wavelength column name |
[in] | colf | flux column name |
[in] | prefix | prefix of QC parameter |
[in] | instrument | instrument arm setting |
Definition at line 400 of file xsh_utils_table.c.
References check, XSH_ASSURE_NOT_NULL_MSG, xsh_frame_table_monitor_flux_qc_ext(), xsh_free_propertylist(), and xsh_free_table().
Referenced by xsh_respon_slit_nod(), xsh_respon_slit_offset(), xsh_respon_slit_stare(), xsh_util_compute_response(), and xsh_util_efficiency1d().
static cpl_propertylist* xsh_frame_table_monitor_flux_qc_ext | ( | cpl_table * | table, | |
const char * | colw, | |||
const char * | colf, | |||
const char * | prefix, | |||
xsh_instrument * | instrument | |||
) | [static] |
Computes statistics on spectrum for QC.
[in] | table | input table describing spectrum |
[in] | colw | wavelength column name |
[in] | colf | flux column name |
[in] | prefix | prefix of QC parameter |
[in] | instrument | instrument arm setting |
Definition at line 343 of file xsh_utils_table.c.
References check, XSH_ARM_NIR, XSH_ARM_UVB, XSH_ARM_VIS, XSH_ASSURE_NOT_NULL_MSG, xsh_instrument_get_arm(), and xsh_table_monitor_flux_qc().
Referenced by xsh_frame_table_monitor_flux_qc().
void xsh_frame_table_save | ( | cpl_frame * | frame, | |
const char * | name_o | |||
) |
Save a table frame.
frame | input table frame | |
name_o | file name |
Definition at line 3894 of file xsh_utils.c.
References check, xsh_free_propertylist(), and xsh_free_table().
cpl_frame* xsh_frameset_add | ( | cpl_frameset * | set, | |
xsh_instrument * | instr | |||
) |
coadd frames in a frameset
set | input frameset | |
instr | instrument arm setting |
Definition at line 835 of file xsh_utils.c.
References check, xsh_pre::nx, nx, xsh_pre::ny, ny, QFLAG_GOOD_PIXEL, XSH_ASSURE_NOT_NULL, XSH_CALLOC, XSH_FREE, xsh_free_frame(), XSH_GOOD_PIXEL_LEVEL, xsh_pre_duplicate(), xsh_pre_free(), xsh_pre_get_data(), xsh_pre_get_errs(), xsh_pre_get_qual(), xsh_pre_load(), and xsh_pre_save().
cpl_frame* xsh_frameset_average | ( | cpl_frameset * | set, | |
const char * | tag | |||
) |
Dump propertylist.
set | the input frameset | |
tag | the output frame tag |
Definition at line 789 of file xsh_utils.c.
References check, size, xsh_frame_product(), xsh_free_image(), xsh_free_imagelist(), and xsh_free_propertylist().
cpl_error_code xsh_frameset_dump | ( | cpl_frameset * | set | ) |
Dump frameset.
set | the input frameset |
Definition at line 967 of file xsh_utils.c.
cpl_error_code xsh_frameset_dump_nod_info | ( | cpl_frameset * | set | ) |
Dump frameset nod info.
set | the input frameset |
Definition at line 1001 of file xsh_utils.c.
References n, xsh_free_propertylist(), xsh_msg, xsh_msg_warning, XSH_NOD_CUMULATIVE_OFFSETY, XSH_NOD_JITTER_BOX, XSH_NOD_THROW, xsh_pfits_get_cumoffsety(), xsh_pfits_get_nod_jitterwidth(), and xsh_pfits_get_nodthrow().
Referenced by xsh_respon_slit_nod(), and xsh_scired_slit_nod().
void xsh_free | ( | const void * | mem | ) |
Deallocate memory.
mem | to deallocate |
Definition at line 1981 of file xsh_utils.c.
Referenced by xsh_polynomial_delete_const(), and xsh_util_bpmap_nl_raw2pre().
void xsh_free_array | ( | cpl_array ** | m | ) |
Deallocate an array and set the pointer to NULL.
m | Array to deallocate |
Definition at line 2178 of file xsh_utils.c.
Referenced by compute_specres(), xsh_cfg_recover_pattern_match(), xsh_image_mflat_detect_blemishes(), xsh_image_mflat_detect_hotcold(), xsh_rec_list_save(), xsh_rec_list_save2(), and xsh_rec_list_save_table().
void xsh_free_frame | ( | cpl_frame ** | f | ) |
Deallocate a frame and set the pointer to NULL.
f | Frame to deallocate |
Definition at line 2148 of file xsh_utils.c.
Referenced by analyse_localization(), calculate_qc_parameters(), create_resid_tab(), create_zero_rectify(), main(), save_pre_frame(), shift_with_kw(), xsh_2dmap(), xsh_abs_remove_crh_single(), xsh_add_product_pre(), xsh_add_product_pre_3d(), xsh_add_product_spectrum(), xsh_afcthetab_create(), xsh_build_ifu_cube(), xsh_cfg_recover_last_step(), xsh_cfg_recover_measure_line_xy(), xsh_check_load_master_bpmap(), xsh_combine_nod(), xsh_compute_response(), xsh_compute_response_ord(), xsh_compute_slice_dist(), xsh_create_master_bias2(), xsh_create_master_bpmap(), xsh_create_master_dark(), xsh_dfs_split_nir(), xsh_dfs_split_offset(), xsh_dfs_split_qth_d2(), xsh_dispersol_list_to_slitmap(), xsh_dispersol_list_to_wavemap(), xsh_divide_flat(), xsh_flexcomp(), xsh_flexcor(), xsh_flux_calibrate(), xsh_frame_abs(), xsh_frame_inv(), xsh_frame_mult(), xsh_frame_product(), xsh_frameset_add(), xsh_gain(), xsh_geom_ifu(), xsh_linear(), xsh_lingain(), xsh_localize_obj(), xsh_mbias(), xsh_mdark(), xsh_mflat(), xsh_mflat_recipe_main(), xsh_model_first_anneal_save(), xsh_model_pipe_anneal(), xsh_model_reduce(), xsh_model_spectralformat_create(), xsh_model_THE_create(), xsh_monitor_spectrum1D_flux(), xsh_multiply_flat(), xsh_nod_rectify_and_shift_with_key(), xsh_opt_extract_orders(), xsh_orderpos(), xsh_phys_spectrum_save(), xsh_pre_3d_save(), xsh_pre_save(), xsh_pre_save_product(), xsh_predict(), xsh_preframe_extract(), xsh_prepare(), xsh_rectify_and_shift(), xsh_remove_cosmics(), xsh_resid_order_save(), xsh_resid_tab_save(), xsh_respon_slit_nod(), xsh_respon_slit_offset(), xsh_respon_slit_stare(), xsh_response_calculate(), xsh_scired_ifu_offset(), xsh_scired_ifu_stare(), xsh_scired_slit_nod(), xsh_scired_slit_nod_accurate(), xsh_scired_slit_nod_fast(), xsh_scired_slit_offset(), xsh_scired_slit_stare(), xsh_scired_util_spectra_flux_calibrate(), xsh_shift(), xsh_shift_tab_save(), xsh_slit_stare_correct_crh_and_sky(), xsh_spectrum1D_save(), xsh_spectrum_save(), xsh_spectrum_save_order(), xsh_subtract_background(), xsh_subtract_bias(), xsh_subtract_dark(), xsh_subtract_nir_on_off(), xsh_subtract_sky_single(), xsh_util_afc(), xsh_util_apply_response(), xsh_util_compute_response(), xsh_util_crh_single(), xsh_util_efficiency1d(), xsh_util_ifu_build_cube(), xsh_util_integrate(), xsh_util_model_SPF_create(), xsh_wavecal(), and xsh_wavemap_list_save_poly().
void xsh_free_frameset | ( | cpl_frameset ** | f | ) |
Deallocate a frame set and set the pointer to NULL.
f | Frame set to deallocate |
Definition at line 2133 of file xsh_utils.c.
Referenced by main(), sof_to_frameset(), xsh_2dmap(), xsh_cfg_recover_driver(), xsh_cfg_recover_last_step(), xsh_dfs_split_nir(), xsh_dfs_split_qth_d2(), xsh_ensure_raws_input_offset_recipe_is_proper(), xsh_extract_nod_pairs(), xsh_extract_obj_and_sky_pairs(), xsh_flexcomp(), xsh_follow_arclines_ifu(), xsh_gain(), xsh_geom_ifu(), xsh_ifu_wavetab_create(), xsh_linear(), xsh_lingain(), xsh_lingain_pre_format(), xsh_localize_obj_ifu(), xsh_mbias(), xsh_mdark(), xsh_merge_ord_ifu(), xsh_mflat(), xsh_mflat_recipe_main(), xsh_model_first_anneal_save(), xsh_nod_group_by_reloff(), xsh_nod_prepare_set(), xsh_order_frameset_by_date(), xsh_orderpos(), xsh_predict(), xsh_respon_slit_nod(), xsh_respon_slit_offset(), xsh_respon_slit_stare(), xsh_scired_ifu_offset(), xsh_scired_ifu_stare(), xsh_scired_slit_nod(), xsh_scired_slit_nod_accurate(), xsh_scired_slit_offset(), xsh_scired_slit_stare(), xsh_subtract_nir_on_off(), xsh_subtract_on_off(), xsh_subtract_sky_nod(), xsh_subtract_sky_offset(), xsh_util_afc(), xsh_util_apply_response(), xsh_util_bpmap_coadd(), xsh_util_bpmap_nl_raw2pre(), xsh_util_compute_response(), xsh_util_efficiency1d(), xsh_util_efficiency2d(), xsh_util_guess_xy(), xsh_util_ifu_build_cube(), xsh_util_ima_arith(), xsh_util_ima_shift(), xsh_util_integrate(), xsh_util_physmod(), and xsh_wavecal().
void xsh_free_image | ( | cpl_image ** | i | ) |
Deallocate an image and set the pointer to NULL.
i | Image to deallocate |
Definition at line 1995 of file xsh_utils.c.
Referenced by compute_specres(), create_blaze(), create_frame(), createFakeFrames(), get_masterbias_qc_structure_col_region(), get_masterbias_qc_structure_row_region(), main(), make_data_cube(), set_masterbias_qc_uves_structure_region(), set_masterdark_qc(), xsh_add_product(), xsh_add_product_bpmap(), xsh_add_product_image(), xsh_add_sky_model(), xsh_badpixelmap_coadd(), xsh_build_ifu_cube(), xsh_cfg_recover_linear_ext(), xsh_cfg_recover_measure_line_xy(), xsh_cfg_recover_measure_line_xy_fit(), xsh_check_load_master_bpmap(), xsh_compute_flat_edges(), xsh_compute_fpn_mbias(), xsh_compute_linearity(), xsh_compute_noise_map(), xsh_compute_ron(), xsh_create_dispersol_physmod(), xsh_dispersol_list_to_slitmap(), xsh_dispersol_list_to_wavemap(), xsh_efficiency_compute(), xsh_fixed_pattern_noise(), xsh_fixed_pattern_noise_bias(), xsh_flat_merge_qth_d2(), xsh_frame_abs(), xsh_frame_force_pro_catg(), xsh_frame_image_ext_qc_trace_window(), xsh_frame_image_qc_trace_window(), xsh_frame_image_save(), xsh_frame_mult(), xsh_frameset_average(), xsh_frameset_average_pre(), xsh_gain(), xsh_gfit_tests(), xsh_ifu_trace_object_calibrate(), xsh_image_clean_badpixel(), xsh_image_compute_geom_corr(), xsh_image_create_gaussian_image(), xsh_image_create_model_image(), xsh_image_divide_1D(), xsh_image_flag_bptype_with_crox(), xsh_image_get_hot_cold_pixs(), xsh_image_get_stdev_clean(), xsh_image_get_stdev_robust(), xsh_image_mflat_detect_blemishes(), xsh_image_mflat_detect_hotcold(), xsh_image_mult_1D(), xsh_image_smooth_fft(), xsh_image_smooth_mean_y(), xsh_linear(), xsh_lingain(), xsh_mbias(), xsh_mdark(), xsh_mflat_normalize(), xsh_model_maps_create(), xsh_monitor_flux(), xsh_normalize_spectrum_image(), xsh_normalize_spectrum_image_slice(), xsh_object_localize(), xsh_opt_extract_orders(), xsh_optextract_produce_model(), xsh_pre_create(), xsh_pre_extract(), xsh_pre_free(), xsh_pre_multiply_image(), xsh_preoverscan_corr(), xsh_rec_list_load_eso(), xsh_rec_list_save2(), xsh_remove_cosmics(), xsh_remove_crh_single(), xsh_spectrum1D_free(), xsh_spectrum_free(), xsh_subtract_background(), xsh_subtract_sky_single(), xsh_test_create_frame(), xsh_update_pheader_in_image_multi(), xsh_util_afc(), xsh_util_bpmap_coadd(), xsh_util_efficiency(), xsh_util_efficiency2d(), xsh_util_frameset_collapse_mean(), xsh_util_ifu_build_cube(), xsh_util_ima_arith(), xsh_util_ima_getextno(), xsh_util_ima_oversample(), xsh_util_ima_rebin(), xsh_util_ima_shift(), xsh_util_ima_subsample(), xsh_util_multiply_by_response(), xsh_util_multiply_by_response_ord(), xsh_vector_to_image(), xsh_wavemap_lambda_range(), xsh_wavemap_list_save(), xsh_wavemap_list_save2(), and xsh_wavemap_qc().
void xsh_free_imagelist | ( | cpl_imagelist ** | i | ) |
Deallocate an image list and set the pointer to NULL.
i | Image list to deallocate |
Definition at line 2043 of file xsh_utils.c.
Referenced by xsh_add_product(), xsh_add_product_imagelist(), xsh_build_ifu_cube(), xsh_compute_linearity(), xsh_create_master_bias2(), xsh_cube_qc_trace_window(), xsh_frame_force_pro_catg(), xsh_frameset_average(), xsh_frameset_average_pre(), xsh_gain(), xsh_linear(), xsh_mbias(), xsh_mdark(), xsh_remove_cosmics(), and xsh_util_ifu_build_cube().
void xsh_free_mask | ( | cpl_mask ** | m | ) |
Deallocate an image mask and set the pointer to NULL.
m | Mask to deallocate |
Definition at line 2028 of file xsh_utils.c.
Referenced by reject_lo_hi(), xsh_create_master_bias2(), xsh_image_get_hot_cold_pixs(), xsh_image_get_stdev_clean(), xsh_image_get_stdev_robust(), xsh_mdark(), and xsh_remove_cosmics().
void xsh_free_matrix | ( | cpl_matrix ** | m | ) |
Deallocate a matrix and set the pointer to NULL.
m | Matrix to deallocate |
Definition at line 2088 of file xsh_utils.c.
Referenced by xsh_cfg_recover_pattern_match(), xsh_image_mflat_detect_blemishes(), xsh_image_mflat_detect_hotcold(), xsh_model_maps_create(), xsh_polynomial_fit_1d(), xsh_polynomial_fit_2d(), and xsh_remove_crh_single().
void xsh_free_parameter | ( | cpl_parameter ** | p | ) |
Deallocate a parameter and set the pointer to NULL.
p | Parameter to deallocate |
Definition at line 2118 of file xsh_utils.c.
void xsh_free_parameterlist | ( | cpl_parameterlist ** | p | ) |
Deallocate a parameter list and set the pointer to NULL.
p | Parameter list to deallocate |
Definition at line 2103 of file xsh_utils.c.
Referenced by destroy(), main(), xsh_2dmap_destroy(), xsh_cfg_recover_destroy(), xsh_cfg_recover_exec(), xsh_flexcomp_destroy(), xsh_geom_ifu_destroy(), xsh_lingain_destroy(), xsh_mbias_destroy(), xsh_mdark(), xsh_mdark_destroy(), xsh_mflat_destroy(), xsh_orderpos_destroy(), xsh_predict_destroy(), xsh_respon_slit_nod_destroy(), xsh_respon_slit_offset_destroy(), xsh_respon_slit_stare_destroy(), xsh_scired_ifu_offset_destroy(), xsh_scired_ifu_stare_destroy(), xsh_scired_slit_nod_destroy(), xsh_scired_slit_offset_destroy(), xsh_scired_slit_stare_destroy(), xsh_util_ifu_build_cube_destroy(), and xsh_wavecal_destroy().
void xsh_free_polynomial | ( | cpl_polynomial ** | p | ) |
Deallocate a polynomial and set the pointer to NULL.
p | Polynomial to deallocate |
Definition at line 2073 of file xsh_utils.c.
Referenced by create_blaze(), fill_rectified(), find_tilt(), main(), xsh_array_clip_poly1d(), xsh_compute_flat_edges(), xsh_detect_continuum(), xsh_detect_order_edge(), xsh_dispersol_list_free(), xsh_image_create_model_image(), xsh_image_gaussian_fit_y(), xsh_localization_free(), xsh_localize_obj_auto(), xsh_model_maps_create(), xsh_optextract_produce_model(), xsh_order_list_free(), xsh_polynomial_add_2d(), xsh_polynomial_collapse(), xsh_polynomial_convert_from_table(), xsh_polynomial_fit_1d(), xsh_polynomial_fit_2d(), xsh_polynomial_new_zero(), xsh_vector_integrate(), xsh_wavemap_list_free(), and xsh_wavesol_free().
void xsh_free_product_files | ( | void | ) |
Free temprary files list.
Definition at line 1378 of file xsh_utils.c.
References NbProducts, and ProdFiles.
Referenced by xsh_end().
void xsh_free_propertylist | ( | cpl_propertylist ** | p | ) |
Deallocate a property list and set the pointer to NULL.
p | Property list to deallocate |
Definition at line 2058 of file xsh_utils.c.
Referenced by create_frame(), createFakeFrames(), main(), save_pre_frame(), shift_with_kw(), verify_order_table(), xsh_abs_remove_crh_single(), xsh_add_product(), xsh_add_product_bpmap(), xsh_add_product_image(), xsh_add_product_imagelist(), xsh_add_product_pre(), xsh_add_product_table(), xsh_add_product_table_multi(), xsh_arclist_free(), xsh_badpixelmap_coadd(), xsh_build_ifu_cube(), xsh_cfg_recover_gen_xyg_frame(), xsh_cfg_recover_measure_tab_xy_peaks(), xsh_check_input_is_unbinned(), xsh_check_load_master_bpmap(), xsh_compute_flat_edges(), xsh_compute_linearity(), xsh_compute_noise_map(), xsh_compute_response(), xsh_compute_response_ord(), xsh_compute_ron(), xsh_cube_qc_trace_window(), xsh_detect_arclines(), xsh_detect_continuum(), xsh_detect_order_edge(), xsh_dispersol_list_free(), xsh_dispersol_list_to_slitmap(), xsh_dispersol_list_to_wavemap(), xsh_efficiency_compute(), xsh_ensure_raws_number_is_even(), xsh_extract_nod_pairs(), xsh_extract_obj_and_sky_pairs(), xsh_extract_with_tag(), xsh_flexcor(), xsh_frame_check_is_right_afcatt(), xsh_frame_check_model_cfg_is_afc_corrected(), xsh_frame_check_model_cfg_is_proper_for_sci(), xsh_frame_force_pro_catg(), xsh_frame_has_same_nod_pos(), xsh_frame_image_ext_qc_trace_window(), xsh_frame_image_qc_trace_window(), xsh_frame_sci_get_gain_airmass_exptime_naxis1_biny(), xsh_frame_sci_get_ra_dec_airmass(), xsh_frame_table_monitor_flux_qc(), xsh_frame_table_save(), xsh_frameset_average(), xsh_frameset_average_pre(), xsh_frameset_drl_frames(), xsh_frameset_dump_nod_info(), xsh_frameset_ext_image_frames(), xsh_frameset_ext_table_frames(), xsh_frameset_extract_offsety_matches(), xsh_frameset_extract_offsety_mismatches(), xsh_gain(), xsh_get_binning(), xsh_get_exptimes(), xsh_get_offsets(), xsh_get_slit_edges(), xsh_ifu_trace_object_calibrate(), xsh_image_clean_badpixel(), xsh_image_get_hot_cold_pixs(), xsh_image_mflat_detect_blemishes(), xsh_image_mflat_detect_hotcold(), xsh_linear_group_by_exptime(), xsh_linetilt_list_free(), xsh_lingain(), xsh_localization_free(), xsh_localization_load(), xsh_mbias(), xsh_mdark(), xsh_merge_ord_slitlet(), xsh_merge_ord_with_tag(), xsh_mflat(), xsh_model_first_anneal_save(), xsh_model_maps_create(), xsh_model_order_edges_tab_create(), xsh_model_pipe_anneal(), xsh_model_spectralformat_create(), xsh_model_temperature_update_frame(), xsh_model_temperature_update_structure(), xsh_model_THE_create(), xsh_monitor_flux(), xsh_nod_group_by_reloff(), xsh_normalize_spectrum(), xsh_normalize_spectrum_image_slice(), xsh_normalize_spectrum_ord(), xsh_order_frameset_by_date(), xsh_order_list_free(), xsh_order_list_load(), xsh_order_split_qth_d2(), xsh_params_bin_scale(), xsh_pre_3d_free(), xsh_pre_create(), xsh_pre_free(), xsh_preoverscan_corr(), xsh_rec_get_nod_kw(), xsh_rec_list_free(), xsh_rec_list_load(), xsh_rec_list_load_eso(), xsh_rec_list_save2(), xsh_rectify_and_shift(), xsh_resid_order_free(), xsh_resid_tab_free(), xsh_respon_slit_nod(), xsh_scired_slit_stare(), xsh_set_recipe_file_prefix(), xsh_shift_tab_free(), xsh_slice_offset_free(), xsh_slice_offset_load(), xsh_slit_stare_get_calibs(), xsh_sort_table_1(), xsh_sort_table_2(), xsh_spectralformat_list_free(), xsh_spectralformat_list_load(), xsh_spectrum1D_free(), xsh_spectrum_free(), xsh_spectrum_interpolate(), xsh_spectrum_interpolate_linear(), xsh_spectrum_resample(), xsh_star_flux_list_free(), xsh_subtract_background(), xsh_test_create_bias_image(), xsh_test_create_frame(), xsh_the_map_free(), xsh_the_map_load(), xsh_update_pheader_in_image_multi(), xsh_util_afc(), xsh_util_bpmap_coadd(), xsh_util_compute_response(), xsh_util_efficiency(), xsh_util_efficiency2d(), xsh_util_ifu_build_cube(), xsh_util_ima_arith(), xsh_util_ima_getextno(), xsh_util_ima_oversample(), xsh_util_ima_rebin(), xsh_util_ima_shift(), xsh_util_ima_subsample(), xsh_util_integrate(), xsh_util_multiply_by_response(), xsh_util_multiply_by_response_ord(), xsh_util_physmod_model_THE_create(), xsh_utils_efficiency(), xsh_wavemap_list_free(), xsh_wavemap_list_save(), xsh_wavemap_list_save2(), xsh_wavemap_qc(), xsh_wavesol_free(), and xsh_wavetab_qc().
void xsh_free_stats | ( | cpl_stats ** | s | ) |
Deallocate a stats object and set the pointer to NULL.
s | Stats object to deallocate |
Definition at line 2193 of file xsh_utils.c.
Referenced by xsh_pre_dump().
void xsh_free_table | ( | cpl_table ** | t | ) |
Deallocate a table and set the pointer to NULL.
t | table to deallocate |
Definition at line 2012 of file xsh_utils.c.
Referenced by fit_spline(), xsh_add_product(), xsh_add_product_table_multi(), xsh_background_poly(), xsh_build_ifu_cube(), xsh_cfg_recover_extend_xy_pos_frm(), xsh_cfg_recover_gen_xyg_frame(), xsh_cfg_recover_guess_tab_corr_by_ordpos(), xsh_cfg_recover_guess_tab_corr_by_user(), xsh_cfg_recover_last_step(), xsh_cfg_recover_linear_ext(), xsh_cfg_recover_measure_line_xy(), xsh_cfg_recover_measure_line_xy_fit(), xsh_cfg_recover_measure_tab_xy_peaks(), xsh_cfg_recover_pattern_match(), xsh_cfg_recover_prepare_pm_set(), xsh_cfg_recover_remove_blends(), xsh_cfg_recover_select_peaks(), xsh_compute_flat_edges(), xsh_compute_response(), xsh_compute_response_ord(), xsh_create_order_table(), xsh_cube_qc_trace_window(), xsh_detect_arclines(), xsh_detect_order_edge(), xsh_dispersol_list_load(), xsh_dispersol_list_save(), xsh_efficiency_compute(), xsh_fill_high_abs_regions(), xsh_flexcor(), xsh_frame_force_pro_catg(), xsh_frame_image_ext_qc_trace_window(), xsh_frame_image_qc_trace_window(), xsh_frame_table_monitor_flux_qc(), xsh_frame_table_save(), xsh_gain(), xsh_get_noffsets(), xsh_ifu_wavetab_create(), xsh_localize_obj_auto(), xsh_mdark(), xsh_mflat(), xsh_model_compute_residuals(), xsh_model_first_anneal(), xsh_model_maps_create(), xsh_model_pipe_anneal(), xsh_model_readfits(), xsh_model_spectralformat_create(), xsh_model_temperature_update_frame(), xsh_model_THE_create(), xsh_monitor_flux(), xsh_normalize_spectrum(), xsh_normalize_spectrum_ord(), xsh_order_list_save(), xsh_order_split_qth_d2(), xsh_pre_median_mean_stdev_window(), xsh_spectrum_interpolate(), xsh_spectrum_interpolate_linear(), xsh_spectrum_resample(), xsh_subtract_background(), xsh_table_monitor_flux_qc(), xsh_util_afc(), xsh_util_compute_qc_residuals(), xsh_util_efficiency(), xsh_util_efficiency2d(), xsh_util_ifu_build_cube(), xsh_util_multiply_by_response(), xsh_util_multiply_by_response_ord(), xsh_util_physmod_model_THE_create(), xsh_utils_efficiency(), xsh_utils_efficiency_internal(), xsh_verify_2dmap_poly_input(), xsh_wavemap_qc(), and xsh_wavetab_qc().
void xsh_free_temporary_files | ( | void | ) |
Free temprary files list.
Definition at line 1339 of file xsh_utils.c.
References NbTemp, and TempFiles.
Referenced by xsh_end().
void xsh_free_vector | ( | cpl_vector ** | v | ) |
Deallocate a vector and set the pointer to NULL.
v | Vector to deallocate |
Definition at line 2163 of file xsh_utils.c.
Referenced by clean_arclist_data(), compute_specres(), data_wavesol_fit_with_sigma(), detect_centroid(), fill_rectified(), find_tilt(), lambda_fit(), main(), test_tech_eval_perf(), theo_tab_model(), xsh_afcthetab_create(), xsh_build_ifu_cube(), xsh_cfg_recover_measure_line_xy(), xsh_cfg_recover_measure_tab_xy_peaks(), xsh_detect_continuum(), xsh_dispersol_list_to_slitmap(), xsh_dispersol_list_to_wavemap(), xsh_efficiency_compute(), xsh_fit_gaussian(), xsh_flexcor(), xsh_get_offsets(), xsh_image_extract_optimal(), xsh_image_extract_standard(), xsh_image_fit_gaussian_max_pos_x_window(), xsh_image_fit_gaussian_max_pos_y_window(), xsh_image_gaussian_fit_y(), xsh_interpolate_spectrum(), xsh_localize_obj_auto(), xsh_model_maps_create(), xsh_normalize_spectrum_image_slice(), xsh_opt_extract_orders(), xsh_phys_spectrum_save(), xsh_polynomial_fit_1d(), xsh_pre_median_mean_stdev(), xsh_pre_median_mean_stdev_window(), xsh_remove_crh_single(), xsh_spectralformat_list_get_orders(), xsh_spectrum_load(), xsh_spectrum_load_order(), xsh_spectrum_save(), xsh_spectrum_save_order(), xsh_star_flux_list_filter_median(), xsh_tools_get_statistics(), xsh_tools_tchebitchev_poly_eval(), xsh_util_efficiency(), xsh_util_efficiency2d(), xsh_util_ifu_build_cube(), xsh_util_multiply_by_response(), xsh_util_multiply_by_response_ord(), xsh_vector_integrate(), xsh_vector_interpolate_linear(), xsh_wavemap_list_eval_lambda(), xsh_wavemap_list_new(), xsh_wavesol_eval_polx(), xsh_wavesol_eval_poly(), xsh_wavesol_free(), and xsh_wavetab_qc().
char* xsh_get_basename | ( | const char * | filename | ) |
Return base filename.
filename | input filename |
Definition at line 1088 of file xsh_utils.c.
Referenced by xsh_model_pipe_anneal(), xsh_preoverscan_corr(), xsh_util_ima_oversample(), xsh_util_ima_rebin(), and xsh_util_ima_subsample().
const char* xsh_get_license | ( | void | ) |
Get the pipeline copyright and license.
The function returns a pointer to the statically allocated license string. This string should not be modified using the returned pointer.
Definition at line 1106 of file xsh_utils.c.
Referenced by cpl_plugin_get_info().
cpl_error_code xsh_get_property_value | ( | const cpl_propertylist * | plist, | |
const char * | keyword, | |||
cpl_type | keywordtype, | |||
void * | result | |||
) |
Read a property value from a property list.
plist | Propertylist to read | |
keyword | Name of property to read | |
keywordtype | Type of keyword | |
result | The value read |
This function wraps cpl_propertylist_get_int()
, cpl_propertylist_get_bool()
, cpl_propertylist_get_double()
and cpl_propertylist_get_string()
. It checks existence and type of the requested keyword before reading and describes what went wrong if the property could not be read.
Definition at line 1487 of file xsh_utils.c.
References assure, check_msg, and xsh_tostring_cpl_type().
Referenced by verify_order_table(), xsh_pfits_get_airm_end(), xsh_pfits_get_airm_start(), xsh_pfits_get_arcfile(), xsh_pfits_get_b_dec_cumoffset(), xsh_pfits_get_b_dec_reloffset(), xsh_pfits_get_b_ra_cumoffset(), xsh_pfits_get_b_ra_reloffset(), xsh_pfits_get_bias_down_median(), xsh_pfits_get_bias_down_stdev(), xsh_pfits_get_bias_left_median(), xsh_pfits_get_bias_left_stdev(), xsh_pfits_get_bias_right_median(), xsh_pfits_get_bias_right_stdev(), xsh_pfits_get_bias_up_median(), xsh_pfits_get_bias_up_stdev(), xsh_pfits_get_cd11(), xsh_pfits_get_cd12(), xsh_pfits_get_cd13(), xsh_pfits_get_cd21(), xsh_pfits_get_cd22(), xsh_pfits_get_cd23(), xsh_pfits_get_cd31(), xsh_pfits_get_cd32(), xsh_pfits_get_cd33(), xsh_pfits_get_cdelt1(), xsh_pfits_get_cdelt2(), xsh_pfits_get_cdelt3(), xsh_pfits_get_crpix1(), xsh_pfits_get_crpix2(), xsh_pfits_get_crpix3(), xsh_pfits_get_crval1(), xsh_pfits_get_crval2(), xsh_pfits_get_crval3(), xsh_pfits_get_cumoffsetx(), xsh_pfits_get_cumoffsety(), xsh_pfits_get_date(), xsh_pfits_get_date_obs(), xsh_pfits_get_dec(), xsh_pfits_get_dec_cumoffset(), xsh_pfits_get_dec_reloffset(), xsh_pfits_get_det_gain(), xsh_pfits_get_det_pxspace(), xsh_pfits_get_dit(), xsh_pfits_get_dpr_catg(), xsh_pfits_get_dpr_tech(), xsh_pfits_get_dpr_type(), xsh_pfits_get_exptime(), xsh_pfits_get_extname(), xsh_pfits_get_extract_slit_max(), xsh_pfits_get_extract_slit_min(), xsh_pfits_get_FOCU1ENC(), xsh_pfits_get_lamp_on_off(), xsh_pfits_get_mjdobs(), xsh_pfits_get_nod_cumoffset(), xsh_pfits_get_nod_jitterwidth(), xsh_pfits_get_nod_reloffset(), xsh_pfits_get_nodthrow(), xsh_pfits_get_obs_id(), xsh_pfits_get_obs_targ_name(), xsh_pfits_get_pcatg(), xsh_pfits_get_posang(), xsh_pfits_get_pszx(), xsh_pfits_get_pszy(), xsh_pfits_get_qc_mbiasavg(), xsh_pfits_get_qc_mbiasmed(), xsh_pfits_get_qc_mbiasrms(), xsh_pfits_get_qc_mbiasslope(), xsh_pfits_get_qc_ncrh(), xsh_pfits_get_qc_nhpix(), xsh_pfits_get_qc_ron(), xsh_pfits_get_qc_structx(), xsh_pfits_get_qc_structy(), xsh_pfits_get_ra(), xsh_pfits_get_ra_cumoffset(), xsh_pfits_get_ra_reloffset(), xsh_pfits_get_raw1catg(), xsh_pfits_get_raw1name(), xsh_pfits_get_rectify_bin_lambda(), xsh_pfits_get_rectify_bin_space(), xsh_pfits_get_rectify_lambda_max(), xsh_pfits_get_rectify_lambda_min(), xsh_pfits_get_rectify_space_max(), xsh_pfits_get_rectify_space_min(), xsh_pfits_get_slitmap_median_cen(), xsh_pfits_get_slitmap_median_edglo(), xsh_pfits_get_slitmap_median_edgup(), xsh_pfits_get_slitmap_median_sliclo(), xsh_pfits_get_slitmap_median_slicup(), xsh_pfits_get_tel_targ_alpha(), xsh_pfits_get_tel_targ_delta(), xsh_pfits_get_temp2(), xsh_pfits_get_temp5(), xsh_pfits_get_temp82(), xsh_pfits_get_wavesol_lambda_max(), xsh_pfits_get_wavesol_lambda_min(), xsh_pfits_get_wavesol_order_max(), xsh_pfits_get_wavesol_order_min(), xsh_pfits_get_wavesol_slit_max(), xsh_pfits_get_wavesol_slit_min(), xsh_pfits_get_wavesol_x_max(), xsh_pfits_get_wavesol_x_min(), xsh_pfits_get_wavesol_y_max(), xsh_pfits_get_wavesol_y_min(), xsh_pfits_get_wavesoltype(), and xsh_pfits_get_win1_dit1().
cpl_error_code xsh_get_table_value | ( | const cpl_table * | table, | |
const char * | colname, | |||
cpl_type | coltype, | |||
int | i, | |||
void * | result | |||
) |
Read a table value from a fits table.
table | table to read | |
colname | Name of column to read | |
coltype | Type of column | |
i | row to read | |
result | The value read |
Definition at line 66 of file xsh_utils_table.c.
References assure, check_msg, and XSH_ASSURE_NOT_NULL.
Referenced by xsh_arclist_load(), xsh_atmos_ext_list_load(), xsh_dispersol_list_load(), xsh_localization_load(), xsh_order_list_load(), xsh_order_split_qth_d2(), xsh_rec_list_load(), xsh_resid_order_load(), xsh_resid_tab_load(), xsh_shift_tab_load(), xsh_slice_offset_load(), xsh_spectralformat_list_load(), xsh_star_flux_list_load(), xsh_the_map_load(), and xsh_wavesol_load().
static double xsh_hms2deg | ( | const double | hms | ) | [static] |
Convert a double from hours minute seconds to deg:.
hms | angle in hours minute second units |
Definition at line 248 of file xsh_utils.c.
void xsh_image_fit_spline | ( | cpl_image * | img, | |
xsh_grid * | grid | |||
) |
perform spline fit
img | input image | |
grid | input grid specifying evaluation points |
Definition at line 2843 of file xsh_utils.c.
References check, nx, ny, xsh_grid_point::v, xsh_grid_point::x, XSH_ASSURE_NOT_ILLEGAL, XSH_ASSURE_NOT_NULL, XSH_FREE, xsh_grid_get_index(), xsh_grid_point_get(), XSH_MALLOC, xsh_msg, and xsh_grid_point::y.
Referenced by xsh_subtract_background().
cpl_vector* xsh_image_to_vector | ( | cpl_image * | spectrum | ) |
Definition at line 4546 of file xsh_utils.c.
References XSH_ASSURE_NOT_NULL_MSG, and xsh_msg_error.
Referenced by xsh_normalize_spectrum_image_slice(), xsh_util_multiply_by_response(), and xsh_util_multiply_by_response_ord().
cpl_image* xsh_imagelist_collapse_sigclip_iter_create | ( | const cpl_imagelist * | imlist, | |
double | sigma_low, | |||
double | sigma_upp, | |||
const int | niter | |||
) |
Average with sigma-clipping rejection an imagelist to a single image.
imlist | the input images list | |
sigma_low | the sigma value to clip low signal pixels | |
sigma_upp | the sigma value to clip high signal pixels | |
niter | the number of clipping iterations |
The returned image has to be deallocated with cpl_image_delete().
The bad pixel maps of the input frames are not taken into account, and the one of the created image is empty.
For each pixel position the pixels whose value is higher than mean+sigma_upp*stdev or lower than mean-sigma_low*stdev are discarded for the average computation. If all pixels are discarde, the reslting pixel is 0. Where mean is the average of the pixels at that position, and stdev is the standard deviation of the pixels at that position.
The input image list can be of type CPL_TYPE_INT, CPL_TYPE_FLOAT and CPL_TYPE_DOUBLE.
Possible _cpl_error_code_ set in this function:
Definition at line 130 of file xsh_utils.c.
References check, CPL_IMAGE_GET_DATA, CPL_IMAGE_GET_DATA_CONST, CPL_TYPE, CPL_TYPE_T, n, nx, and ny.
void xsh_init | ( | void | ) |
Reset library state.
This function must be called from the recipe initializer function to make sure that the recipe is re-entrant (i.e. behaves identical on successive invocations)
Successive plugin invocations share their memory, so it is important that all static memory is reset to a well defined state.
Definition at line 1073 of file xsh_utils.c.
References xsh_error_reset, and xsh_msg_init().
Referenced by create(), xsh_2dmap_create(), xsh_cfg_recover_create(), xsh_flexcomp_create(), xsh_geom_ifu_create(), xsh_lingain_create(), xsh_mbias_create(), xsh_mdark_create(), xsh_mflat_create(), xsh_model_anneal_create(), xsh_model_create(), xsh_model_first_anneal_create(), xsh_orderpos_create(), xsh_predict_create(), xsh_respon_slit_nod_create(), xsh_respon_slit_offset_create(), xsh_respon_slit_stare_create(), xsh_scired_ifu_offset_create(), xsh_scired_ifu_stare_create(), xsh_scired_slit_nod_create(), xsh_scired_slit_offset_create(), xsh_scired_slit_stare_create(), xsh_util_afc_create(), xsh_util_apply_response_create(), xsh_util_bpmap_coadd_create(), xsh_util_bpmap_nl_raw2pre_create(), xsh_util_compute_response_create(), xsh_util_crh_single_create(), xsh_util_efficiency1d_create(), xsh_util_efficiency2d_create(), xsh_util_efficiency_create(), xsh_util_guess_xy_create(), xsh_util_ifu_build_cube_create(), xsh_util_ima_arith_create(), xsh_util_ima_getextno_create(), xsh_util_ima_oversample_create(), xsh_util_ima_rebin_create(), xsh_util_ima_shift_create(), xsh_util_ima_subsample_create(), xsh_util_integrate_create(), xsh_util_physmod_create(), xsh_util_ronbias_create(), and xsh_wavecal_create().
static double xsh_iterpol_linear | ( | double * | data_x, | |
double * | data_y, | |||
int | ndata, | |||
double | x, | |||
int * | i_inf, | |||
int * | i_sup | |||
) | [static] |
Definition at line 5952 of file xsh_utils.c.
References y.
Referenced by xsh_spectrum_interpolate_linear().
double xsh_max_double | ( | double | x, | |
double | y | |||
) |
Maximum of two numbers.
x | First number | |
y | Second number |
See also xsh_round_double()
.
Definition at line 4315 of file xsh_utils.c.
Referenced by subtract_background().
int xsh_max_int | ( | int | x, | |
int | y | |||
) |
Maximum of two numbers.
x | First number | |
y | Second number |
See also xsh_round_double()
.
Definition at line 4279 of file xsh_utils.c.
Referenced by xsh_polynomial_add_2d().
void xsh_mem_dump | ( | const char * | prompt | ) |
Debugging utility. A call to this function dumps the memory usage to stderr.
prompt | A string output to stderr before memory dump |
Definition at line 3071 of file xsh_utils.c.
double xsh_min_double | ( | double | x, | |
double | y | |||
) |
Minimum of two numbers.
x | First number | |
y | Second number |
See also xsh_round_double()
.
Definition at line 4298 of file xsh_utils.c.
int xsh_min_int | ( | int | x, | |
int | y | |||
) |
Minimum of two numbers.
x | First number | |
y | Second number |
See also xsh_round_double()
.
Definition at line 4262 of file xsh_utils.c.
cpl_error_code xsh_monitor_flux | ( | cpl_frame * | frm_ima, | |
const cpl_frame * | frm_tab, | |||
xsh_instrument * | instrument | |||
) |
Monitor Flux level along the orders traces given by an input table.
frm_ima | The input frame image whose flux is to be monitored | |
frm_tab | input frame table with order traces | |
instrument | instrument (arm setting) |
Definition at line 3984 of file xsh_utils.c.
References binx, biny, check, XSH_ARM_NIR, xsh_free_image(), xsh_free_propertylist(), xsh_free_table(), xsh_instrument_get_arm(), xsh_pfits_get_binx(), xsh_pfits_get_biny(), XSH_QC_FLUX, XSH_QC_FLUX_MAX_C, XSH_QC_FLUX_MIN_C, and xsh_update_pheader_in_image_multi().
Referenced by xsh_mflat_recipe_main(), and xsh_orderpos().
cpl_frame* xsh_normalize_spectrum | ( | const cpl_frame * | obj_frame, | |
const cpl_frame * | atm_ext_frame, | |||
cpl_boolean | correct_binning, | |||
xsh_instrument * | instrument, | |||
const char * | tag_o | |||
) |
Normalize a spectrum.
obj_frame | The 1d (merged) or 2d (non-merged or 2d extracted+merged) spectrum to be normalized | |
atm_ext_frame | The frame of atmospheric extinction spectrum | |
correct_binning | Flag to divide or not by the x-binning factor | |
instrument | Instrument setting (XSH ARM..) | |
tag_o | pro catg of output frame |
The spectrum is divided by exposure time, gain and (optionally) binning. Also corrected for atmospheric extinction using the provided table of extinction coefficients.
Bad pixels are propagated.xsh_utils.h
Definition at line 5597 of file xsh_utils.c.
References binx, check, exptime, XSH_ARM_NIR, XSH_ASSURE_NOT_NULL_MSG, xsh_frame_product(), xsh_free_propertylist(), xsh_free_table(), xsh_instrument_get_arm(), xsh_msg_dbg_medium, xsh_normalize_spectrum_image_slice(), xsh_pfits_get_airm_mean(), xsh_pfits_get_biny(), xsh_pfits_get_exptime(), and xsh_pfits_get_gain().
Referenced by xsh_scired_util_spectra_flux_calibrate().
cpl_image* xsh_normalize_spectrum_image | ( | const cpl_image * | spectrum, | |
const cpl_image * | spectrum_error, | |||
const cpl_propertylist * | spectrum_header, | |||
const int | binx, | |||
const double | gain, | |||
const double | exptime, | |||
const double | airmass, | |||
const int | n_traces, | |||
const cpl_table * | atm_extinction, | |||
cpl_image ** | scaled_error | |||
) |
Normalize a spectrum.
spectrum | The 1d (merged) or 2d (non-merged or 2d extracted+merged) spectrum to be normalized | |
spectrum_error | Error (1 sigma) of spectrum, or NULL. | |
spectrum_header | Header describing the geometry of the input spectrum | |
binx | x bin | |
gain | detector's gain | |
exptime | observed object's exposure time | |
airmass | observed object's airmass | |
n_traces | Number of spatial bins (1 unless 2d extracted) | |
atm_extinction | The table of extinction coefficients | |
scaled_error | (output) If non-NULL, error of output spectrum |
The spectrum is divided by exposure time, gain and (optionally) binning. Also corrected for atmospheric extinction using the provided table of extinction coefficients.
Bad pixels are propagated.xsh_utils.h
Definition at line 5778 of file xsh_utils.c.
References assure, check_msg, nx, ny, order, x, XSH_ASSURE_NOT_NULL_MSG, xsh_free_image(), xsh_msg_dbg_medium, xsh_pfits_get_cdelt1(), xsh_pfits_get_crval1(), and xsh_spline_hermite_table().
Referenced by xsh_normalize_spectrum_image_slice().
cpl_error_code xsh_normalize_spectrum_image_slice | ( | const char * | name_s, | |
const char * | tag_o, | |||
const int | ext, | |||
const int | binx, | |||
const double | gain, | |||
const double | exptime, | |||
const double | airmass, | |||
const cpl_table * | tbl_atm_ext | |||
) |
Normalize spectrum slice.
name_s | spectrum filename | |
tag_o | output frame pro catg | |
ext | extension value | |
binx | X bin size | |
gain | detector's gain | |
exptime | exposure time | |
airmass | airmass | |
tbl_atm_ext | atmospheric extinction table |
The spectrum is divided by exposure time, gain and (optionally) binning. Also corrected for atmospheric extinction using the provided table of extinction coefficients.
Bad pixels are propagated.xsh_utils.h
Definition at line 5440 of file xsh_utils.c.
References check, xsh_free_image(), xsh_free_propertylist(), xsh_free_vector(), xsh_image_to_vector(), xsh_normalize_spectrum_image(), xsh_pfits_get_naxis(), xsh_pfits_set_pcatg(), XSH_PRE_DATA_BPP, XSH_PRE_DATA_TYPE, XSH_PRE_ERRS_BPP, XSH_PRE_ERRS_TYPE, XSH_PRE_QUAL_BPP, XSH_PRE_QUAL_TYPE, XSH_SPECTRUM_DATA_BPP, XSH_SPECTRUM_ERRS_BPP, and xsh_vector_to_image().
Referenced by xsh_normalize_spectrum(), and xsh_normalize_spectrum_ord().
cpl_frame* xsh_normalize_spectrum_ord | ( | const cpl_frame * | obj_frame, | |
const cpl_frame * | atm_ext_frame, | |||
cpl_boolean | correct_binning, | |||
xsh_instrument * | instrument, | |||
const char * | tag_o | |||
) |
Normalize a spectrum.
obj_frame | The 1d (merged) or 2d (non-merged or 2d extracted+merged) spectrum to be normalized | |
atm_ext_frame | The frame with atmospheric extinction spectrum | |
correct_binning | Flag indicating whether or not to divide by the x-binning factor | |
instrument | instrument arm | |
tag_o | output product tag |
The spectrum is divided by exposure time, gain and (optionally) binning. Also corrected for atmospheric extinction using the provided table of extinction coefficients.
Bad pixels are propagated.xsh_utils.h
Definition at line 5683 of file xsh_utils.c.
References binx, check, exptime, XSH_ARM_NIR, XSH_ASSURE_NOT_NULL_MSG, xsh_frame_product(), xsh_free_propertylist(), xsh_free_table(), xsh_instrument_get_arm(), xsh_msg_dbg_medium, xsh_normalize_spectrum_image_slice(), xsh_pfits_get_airm_mean(), xsh_pfits_get_biny(), xsh_pfits_get_exptime(), and xsh_pfits_get_gain().
Referenced by xsh_flux_calibrate(), and xsh_util_apply_response().
cpl_frameset* xsh_order_frameset_by_date | ( | cpl_frameset * | frameset | ) |
Order frameset by date.
frameset | input frameset |
Definition at line 3169 of file xsh_utils.c.
References check, compare_frame_date(), date_to_double(), FRAME_DATE_IDX::frame, FRAME_DATE_IDX::frame_date, FRAME_DATE_IDX::frame_idx, FRAME_DATE_IDX::frame_name, XSH_ASSURE_NOT_NULL, XSH_CALLOC, xsh_debug_level_get(), XSH_DEBUG_LEVEL_NONE, XSH_FREE, xsh_free_frameset(), xsh_free_propertylist(), xsh_msg, and xsh_pfits_get_date_obs().
Referenced by xsh_respon_slit_nod(), xsh_scired_slit_nod(), and xsh_subtract_sky_offset().
cpl_parameterlist* xsh_parameterlist_duplicate | ( | const cpl_parameterlist * | pin | ) |
Extract frames with given tag from frameset.
pin | input parameterlist |
Definition at line 685 of file xsh_utils.c.
Referenced by xsh_lingain().
void xsh_plist_dump | ( | cpl_propertylist * | plist | ) |
Dump propertylist.
plist | the input propertylist |
Definition at line 939 of file xsh_utils.c.
References xsh_property_dump().
polynomial* xsh_polynomial_regression_2d | ( | cpl_table * | t, | |
const char * | X1, | |||
const char * | X2, | |||
const char * | Y, | |||
const char * | sigmaY, | |||
int | degree1, | |||
int | degree2, | |||
const char * | polynomial_fit, | |||
const char * | residual_square, | |||
const char * | variance_fit, | |||
double * | mse, | |||
double * | red_chisq, | |||
polynomial ** | variance, | |||
double | kappa, | |||
double | min_reject | |||
) |
Fit a 2d polynomial to three table columns.
t | The table | |
X1 | Name of table column containing 1st independent variable | |
X2 | Name of table column containing 2nd independent variable | |
Y | Name of table column containing dependent variable | |
sigmaY | Uncertainty of dependent variable. If NULL, constant uncertainties are assumed. | |
degree1 | Degree of polynomial fit (1st variable) | |
degree2 | Degree of polynomial fit (2nd variable) | |
polynomial_fit | If non-NULL, name of column to add. The fitted value. | |
residual_square | If non-NULL, name of column to add. The squared residual of the fit. | |
variance_fit | If non-NULL, name of column to add. Variance of the fitted value. | |
[out] | mse | Mean squared error of the residuals. May be NULL. |
[out] | red_chisq | Reduced chi square of the fit. May be NULL. |
[out] | variance | Variance of the fit-polynomial (which is in itself a polynomial; see also xsh_polynomial_fit_2d() ). May be NULL. |
kappa | If positive, the value of kappa used in a kappa sigma-clipping. Ignored if negative. | |
min_reject | Minimum number of outliers worth rejecting. Stop iterating (for efficiency) if less than this relative number of outliers (e.g. 0.001) are detected. Negative to disable |
This function fits column Y (must be of type CPL_TYPE_DOUBLE) as function of X1 (CPL_TYPE_DOUBLE or CPL_TYPE_INT) and X2 (CPL_TYPE_DOUBLE or CPL_TYPE_INT). The column sigmaY contains the Y-uncertainties. If NULL, constant uncertainty equal to 1 is assumed.
If non-NULL the columns specified by the parameters polynomial_fit, residual_square and variance_fit are added to the table (containing the fitted value, the squared residual and the variance of the fitted value, for each point).
If non-NULL, the mean_squared_error and red_chisq (reduced chi square) are calculated.
If non-NULL the parameter variance will contain the polynomial that defines the variance of the fit (i.e. as function of x1 and x2 ).
To calculate variances or reduced chi square, the parameter sigmaY must be non-NULL.
If kappa is positive, a kappa-sigma clipping is performed (iteratively, until there are no points with residuals worse than kappa*sigma). The rejected points (rows) are physically removed from the table.
Also see xsh_polynomial_regression_1d()
.
Definition at line 3286 of file xsh_utils.c.
References assure, check_msg, xsh_erase_table_rows(), xsh_msg_debug, xsh_polynomial_delete(), xsh_polynomial_evaluate_2d(), xsh_polynomial_fit_2d(), xsh_tostring_cpl_type(), xsh_unwrap_bivector_vectors(), xsh_unwrap_vector(), and y.
Referenced by xsh_background_poly().
double xsh_pow_int | ( | double | x, | |
int | y | |||
) |
Computes x^y.
x | base | |
y | order |
Definition at line 4329 of file xsh_utils.c.
Referenced by xsh_polynomial_fit_1d(), and xsh_polynomial_fit_2d().
static void xsh_property_dump | ( | cpl_property * | property | ) | [static] |
Dump property.
property | property to be dumped |
Definition at line 711 of file xsh_utils.c.
References size.
Referenced by xsh_plist_dump().
void xsh_reindex | ( | double * | data, | |
int * | idx, | |||
int | size | |||
) |
TO BE DESCRIBED.
data | ||
idx | ||
size |
Definition at line 1887 of file xsh_utils.c.
References XSH_ASSURE_NOT_ILLEGAL, and XSH_ASSURE_NOT_NULL.
Referenced by xsh_create_order_table().
void xsh_reindex_float | ( | float * | data, | |
int * | idx, | |||
int | size | |||
) |
TO BE DESCRIBED.
data | ||
idx | ||
size |
Definition at line 1917 of file xsh_utils.c.
References XSH_ASSURE_NOT_ILLEGAL, and XSH_ASSURE_NOT_NULL.
Referenced by concat_rec().
void xsh_reindex_int | ( | int * | data, | |
int * | idx, | |||
int | size | |||
) |
TO BE DESCRIBED.
data | ||
idx | ||
size |
Definition at line 1949 of file xsh_utils.c.
References XSH_ASSURE_NOT_ILLEGAL, and XSH_ASSURE_NOT_NULL.
Referenced by concat_rec().
long xsh_round_double | ( | double | x | ) |
Computes round(x).
x | input |
Definition at line 4246 of file xsh_utils.c.
Referenced by deg2hms(), detect_centroid(), find_tilt(), get_lambda(), shift_with_kw(), xsh_compute_slit_index(), xsh_follow_arclines(), xsh_localize_obj_auto(), xsh_merge_ord_with_tag(), xsh_rectify_and_shift(), xsh_rectify_orders(), xsh_select_table_rows(), and xsh_vector_integrate().
char* xsh_sdate_utc | ( | time_t * | now | ) |
From the time in seconds, create a string in the format: YYYYMMDD-HHMMSS The date is UTC. The function uses cpl_malloc to allocate memory for the string. The space allocated must be freed with cpl_free
now | Date in Unix/Linux format (seconds since 1970) |
Definition at line 1578 of file xsh_utils.c.
References XSH_CALLOC.
Referenced by xsh_add_product(), xsh_add_product_bpmap(), xsh_add_product_image(), xsh_add_product_imagelist(), xsh_add_product_pre(), xsh_add_product_pre_3d(), xsh_add_product_spectrum(), xsh_add_product_table(), xsh_add_product_table_multi(), and xsh_pre_save_product().
int xsh_select_table_rows | ( | cpl_table * | t, | |
const char * | column, | |||
cpl_table_select_operator | operator, | |||
double | value | |||
) |
Select table rows.
t | Table | |
column | Column name | |
operator | Logical operator | |
value | Value used for comparison |
A row is selected if and only if the value in column is in the relation operator to the specified value. The specified column must have type CPL_TYPE_DOUBLE, CPL_TYPE_FLOAT or CPL_TYPE_INT. If integer, the integer nearest to value is used for the comparison.
Also see cpl_table_and_selected_<type>()
.
Definition at line 3700 of file xsh_utils.c.
References assure, check_msg, passure, xsh_round_double(), and xsh_tostring_cpl_type().
Referenced by xsh_background_poly(), and xsh_erase_table_rows().
static double xsh_sess2deg | ( | const double | sess | ) | [static] |
Convert a double from ssessagesimal to deg: 203049.197= 20:30:49.197 = 20.5136658333.
sess | angle in seesagesimal units (see above) |
Definition at line 281 of file xsh_utils.c.
cpl_error_code xsh_set_cd_matrix | ( | cpl_propertylist * | plist | ) |
Set CD matrix.
plist | input propertylist |
Definition at line 590 of file xsh_utils.c.
References xsh_msg_error, xsh_pfits_get_naxis(), xsh_set_cd_matrix1d(), xsh_set_cd_matrix2d(), and xsh_set_cd_matrix3d().
cpl_error_code xsh_set_cd_matrix1d | ( | cpl_propertylist * | plist | ) |
Set CD matrix.
plist | input propertylist |
Definition at line 615 of file xsh_utils.c.
References xsh_pfits_get_cdelt1(), and xsh_pfits_set_cd1().
Referenced by xsh_set_cd_matrix().
cpl_error_code xsh_set_cd_matrix2d | ( | cpl_propertylist * | plist | ) |
Set CD matrix.
plist | input propertylist |
Definition at line 632 of file xsh_utils.c.
References check, xsh_pfits_get_cdelt1(), xsh_pfits_get_cdelt2(), xsh_pfits_set_cd11(), xsh_pfits_set_cd12(), xsh_pfits_set_cd21(), and xsh_pfits_set_cd22().
Referenced by xsh_set_cd_matrix(), and xsh_spectrum_2D_create().
cpl_error_code xsh_set_cd_matrix3d | ( | cpl_propertylist * | plist | ) |
Set CD matrix.
plist | input propertylist |
Definition at line 658 of file xsh_utils.c.
References check, xsh_pfits_get_cdelt3(), xsh_pfits_set_cd13(), xsh_pfits_set_cd23(), xsh_pfits_set_cd31(), xsh_pfits_set_cd32(), and xsh_pfits_set_cd33().
Referenced by xsh_format(), and xsh_set_cd_matrix().
char* xsh_set_recipe_file_prefix | ( | cpl_frameset * | raw, | |
const char * | recipe | |||
) |
Set recipe frames prefix.
raw | input frameset | |
recipe | input recipe name |
Definition at line 515 of file xsh_utils.c.
References check, xsh_free_propertylist(), xsh_msg_warning, xsh_pfits_get_dpr_catg(), xsh_pfits_get_dpr_tech(), xsh_pfits_get_dpr_type(), and xsh_stringcat_any().
Referenced by xsh_geom_ifu(), xsh_respon_slit_nod(), xsh_respon_slit_offset(), xsh_respon_slit_stare(), xsh_scired_ifu_offset(), xsh_scired_ifu_stare(), xsh_scired_slit_nod(), xsh_scired_slit_offset(), xsh_scired_slit_stare(), and xsh_util_ifu_build_cube().
void xsh_show_time | ( | const char * | comment | ) |
show time
comment | comment to print |
Definition at line 2252 of file xsh_utils.c.
References xsh_msg.
int* xsh_sort | ( | void * | base, | |
size_t | nmemb, | |||
size_t | size, | |||
int(*)(const void *, const void *) | compar | |||
) |
Sort an array and give is index table.
base | ||
nmemb | ||
size | ||
compar |
Definition at line 1845 of file xsh_utils.c.
References xsh_sort_data::data, xsh_sort_data::idx, XSH_ASSURE_NOT_ILLEGAL, XSH_ASSURE_NOT_NULL, XSH_FREE, and XSH_MALLOC.
Referenced by concat_rec(), and xsh_create_order_table().
cpl_error_code xsh_sort_table_1 | ( | cpl_table * | t, | |
const char * | column, | |||
cpl_boolean | reverse | |||
) |
Sort a table by one column.
t | Table | |
column | Column name | |
reverse | Flag indicating if column values are sorted descending (CPL_TRUE) or ascending (CPL_FALSE) |
This is a wrapper of cpl_table_sort()
.
Definition at line 124 of file xsh_utils_table.c.
References assure, check_msg, and xsh_free_propertylist().
Referenced by xsh_cfg_recover_prepare_pm_set(), and xsh_localize_obj_auto().
cpl_error_code xsh_sort_table_2 | ( | cpl_table * | t, | |
const char * | column1, | |||
const char * | column2, | |||
cpl_boolean | reverse1, | |||
cpl_boolean | reverse2 | |||
) |
Sort a table by two columns.
t | Table | |
column1 | 1st column name | |
column2 | 2nd column name | |
reverse1 | Flag indicating if 1st column values are sorted descending (true) or ascending (CPL_FALSE) | |
reverse2 | Flag indicating if 2nd column values are sorted descending (true) or ascending (CPL_TRUE) |
This is a wrapper of cpl_table_sort()
. column1 is the more significant column (i.e. values in column2 are compared, only if the values in column1 are equal).
Definition at line 162 of file xsh_utils_table.c.
References assure, check_msg, and xsh_free_propertylist().
static double xsh_spectrum_integrate | ( | double * | pif, | |
double * | piw, | |||
int | i1_inf, | |||
int | i1_sup, | |||
int | i2_inf, | |||
int | i2_sup, | |||
double | wave, | |||
double | wstep | |||
) | [static] |
Definition at line 5077 of file xsh_utils.c.
Referenced by xsh_spectrum_resample().
cpl_frame* xsh_spectrum_interpolate | ( | cpl_frame * | table_frame, | |
const double | wstep, | |||
const double | wmin, | |||
const double | wmax | |||
) |
spectra interpolation
table_frame | table frame containing the spectrum | |
wstep | wave step | |
wmin | wave min | |
wmax | wave max |
Definition at line 6087 of file xsh_utils.c.
References check, check_msg, XSH_ASSURE_NOT_ILLEGAL_MSG, XSH_ASSURE_NOT_NULL_MSG, xsh_frame_product(), xsh_free_propertylist(), xsh_free_table(), xsh_msg_dbg_medium, xsh_pfits_set_pcatg(), and xsh_spline_hermite_table().
Referenced by xsh_compute_response_ord().
cpl_frame* xsh_spectrum_interpolate_linear | ( | cpl_frame * | table_frame, | |
const double | wstep, | |||
const double | wmin, | |||
const double | wmax | |||
) |
spectra interpolation
table_frame | table frame containing the spectrum | |
wstep | wave step | |
wmin | wave min | |
wmax | wave max |
Definition at line 5995 of file xsh_utils.c.
References check, XSH_ASSURE_NOT_ILLEGAL_MSG, XSH_ASSURE_NOT_NULL_MSG, xsh_frame_product(), xsh_free_propertylist(), xsh_free_table(), xsh_iterpol_linear(), and xsh_pfits_set_pcatg().
Referenced by xsh_compute_response().
cpl_frame* xsh_spectrum_resample | ( | cpl_frame * | frame_inp, | |
const double | wstep, | |||
const double | wmin, | |||
const double | wmax, | |||
xsh_instrument * | instr | |||
) |
resample a spectrum
[in] | frame_inp | input spectrum |
[in] | wstep | output spectrum wavelength step |
[in] | wmin | min wave on the given arm |
[in] | wmax | max wave on the given arm |
[in] | instr | instrument setting |
Definition at line 5131 of file xsh_utils.c.
References check, XSH_ARM_UVB, XSH_ATM_EXT_UVB_WAV_MIN, xsh_frame_product(), xsh_free_propertylist(), xsh_free_table(), xsh_instrument_arm_tostring(), xsh_instrument_get_arm(), xsh_msg, xsh_spectrum_integrate(), and xsh_util_get_infsup().
Referenced by xsh_compute_response().
double xsh_spline_hermite | ( | double | xp, | |
const double * | x, | |||
const double * | y, | |||
int | n, | |||
int * | istart | |||
) |
Spline interpolation based on Hermite polynomials.
xp | x-value to interpolate | |
x | x-values | |
y | y-values | |
n | array length | |
istart | (input/output) initial row (set to 0 to search all row) |
The x column must be sorted (ascending or descending) and all x column values must be different.
Adopted from: Cristian Levin - ESO La Silla, 1-Apr-1991
Definition at line 4443 of file xsh_utils.c.
Referenced by xsh_spline_hermite_table().
double xsh_spline_hermite_table | ( | double | xp, | |
const cpl_table * | t, | |||
const char * | column_x, | |||
const char * | column_y, | |||
int * | istart | |||
) |
Spline interpolation based on Hermite polynomials.
xp | x-value to interpolate | |
t | Table containing the columns to interpolate | |
column_x | Column of x-values | |
column_y | Column of y-values | |
istart | (input/output) initial row (set to 0 to search all row) |
Definition at line 4514 of file xsh_utils.c.
References check_msg, n, x, xsh_spline_hermite(), and y.
Referenced by xsh_normalize_spectrum_image(), xsh_spectrum_interpolate(), xsh_util_multiply_by_response(), and xsh_util_multiply_by_response_ord().
const char* xsh_string_tolower | ( | char * | s | ) |
Convert all uppercase characters in a string into lowercase characters.
s | The string to convert. |
Walks through the given string and turns uppercase characters into lowercase characters using tolower().
Definition at line 4374 of file xsh_utils.c.
const char* xsh_string_toupper | ( | char * | s | ) |
Convert all lowercase characters in a string into uppercase characters.
s | The string to convert. |
Walks through the given string and turns lowercase characters into uppercase characters using toupper().
Definition at line 4408 of file xsh_utils.c.
Referenced by xsh_parameters_subtract_sky_single_get().
char* xsh_stringcat | ( | const char * | s1, | |
const char * | s2 | |||
) |
String concatenation.
s1 | First string | |
s2 | Second string |
cpl_free()
Definition at line 1606 of file xsh_utils.c.
References assure.
char* xsh_stringcat_3 | ( | const char * | s1, | |
const char * | s2, | |||
const char * | s3 | |||
) |
String concatenation.
s1 | First string | |
s2 | Second string | |
s3 | Third string |
cpl_free()
Definition at line 1640 of file xsh_utils.c.
References assure.
Referenced by xsh_find_frame().
char* xsh_stringcat_4 | ( | const char * | s1, | |
const char * | s2, | |||
const char * | s3, | |||
const char * | s4 | |||
) |
String concatenation.
s1 | First string | |
s2 | Second string | |
s3 | Third string | |
s4 | Fourth string |
cpl_free()
Definition at line 1678 of file xsh_utils.c.
References assure.
Referenced by xsh_begin(), and xsh_unique_filename().
char* xsh_stringcat_5 | ( | const char * | s1, | |
const char * | s2, | |||
const char * | s3, | |||
const char * | s4, | |||
const char * | s5 | |||
) |
String concatenation.
s1 | First string | |
s2 | Second string | |
s3 | Third string | |
s4 | Fourth string | |
s5 | Fifth string |
cpl_free()
Definition at line 1718 of file xsh_utils.c.
References assure.
char* xsh_stringcat_6 | ( | const char * | s1, | |
const char * | s2, | |||
const char * | s3, | |||
const char * | s4, | |||
const char * | s5, | |||
const char * | s6 | |||
) |
String concatenation.
s1 | First string | |
s2 | Second string | |
s3 | Third string | |
s4 | Fourth string | |
s5 | Fifth string | |
s6 | Sixth string |
cpl_free()
Definition at line 1762 of file xsh_utils.c.
References assure.
Referenced by xsh_unique_filename().
char* xsh_stringcat_any | ( | const char * | s, | |
... | ||||
) |
Concatenate an arbitrary number of strings.
s | First string | |
... | Other strings (at least 1 more) |
cpl_free()
Definition at line 1804 of file xsh_utils.c.
Referenced by concat_rec(), get_resid_ifu_slitlet_tag(), get_tilt_ifu_slitlet_tag(), get_wave_ifu_slitlet_tag(), irplib_paf_init(), main(), save_centers(), shift_with_localization(), xsh_2dmap(), xsh_add_product(), xsh_add_product_bpmap(), xsh_add_product_image(), xsh_add_product_imagelist(), xsh_add_product_pre(), xsh_add_product_pre_3d(), xsh_add_product_spectrum(), xsh_add_product_table(), xsh_add_product_table_multi(), xsh_cfg_recover_last_step(), xsh_combine_nod(), xsh_extract_with_tag(), xsh_find_calpro_model_config(), xsh_find_calpro_model_meas_coord(), xsh_find_model_config_open(), xsh_find_model_testpar(), xsh_find_model_wavelist(), xsh_find_raw_arc_slit_nir_off(), xsh_find_raw_arc_slit_nir_on(), xsh_find_raw_arc_slit_uvb_vis(), xsh_find_raw_orderdef_nir(), xsh_find_raw_orderdef_nir_off(), xsh_find_raw_orderdef_vis_uvb(), xsh_find_spectral_format(), xsh_linear(), xsh_merge_ord_with_tag(), xsh_model_first_anneal(), xsh_opt_extract_orders(), xsh_parameters_new_string(), xsh_predict(), xsh_remove_crh_single(), xsh_scired_ifu_offset(), xsh_set_recipe_file_prefix(), xsh_shift(), xsh_wavemap_list_save(), and xsh_wavemap_list_save2().
char* xsh_stringdup | ( | const char * | s | ) |
String duplication.
s | String to duplicate |
cpl_free()
Definition at line 1545 of file xsh_utils.c.
References assure.
Referenced by xsh_arclist_load(), and xsh_find_frame().
double xsh_table_interpolate | ( | cpl_table * | tbl, | |
double | wav, | |||
const char * | colx, | |||
const char * | coly | |||
) |
Interpolate table columns.
tbl | Table | |
wav | value at which is desired to get an interpolated value | |
colx | 1st column name | |
coly | 2nd column name |
Definition at line 261 of file xsh_utils_table.c.
References check, xsh_data_interpolate(), and y.
Referenced by xsh_utils_efficiency_internal().
static cpl_error_code xsh_table_monitor_flux_qc | ( | cpl_table * | table, | |
const double | ws, | |||
const double | we, | |||
const char * | prefix, | |||
const int | index, | |||
cpl_propertylist ** | header | |||
) | [static] |
Computes statistics on spectrum for QC.
[in] | table | input table |
[in] | ws | wavelength start value |
[in] | we | wavelength end value |
[in] | prefix | prefix of QC parameter |
[in] | index | index to specify QC parameter name |
[out] | header | header containing computed QC key |
Definition at line 293 of file xsh_utils_table.c.
References check, and xsh_free_table().
Referenced by xsh_frame_table_monitor_flux_qc_ext().
int xsh_time_stamp_get | ( | void | ) |
get timestamp
Definition at line 3059 of file xsh_utils.c.
References XshTimeStamp.
Referenced by xsh_add_product(), xsh_add_product_bpmap(), xsh_add_product_image(), xsh_add_product_imagelist(), xsh_add_product_pre(), xsh_add_product_pre_3d(), xsh_add_product_spectrum(), xsh_add_product_table(), xsh_add_product_table_multi(), and xsh_pre_save_product().
int xsh_time_stamp_set | ( | int | ts | ) |
set timestamp
ts | time stamp index |
Definition at line 3042 of file xsh_utils.c.
References XshTimeStamp.
Referenced by xsh_parameters_time_stamp_get().
double xsh_tools_get_median_double | ( | double * | array, | |
int | size | |||
) |
Calculates the median value of an array of double.
array | The input array | |
size | The size of the array |
The first step is to sort in ascending ordre. Then the median is calculated: if size is an odd number, the median is the value of the size/2+1-th element. If size is an even number, the median is the average of the 2 elements size/2 and size/2+1. The input array is MODIFIED.
Definition at line 2584 of file xsh_utils.c.
References xsh_tools_sort_double().
Referenced by flag_noisy_pixels(), and xsh_tools_running_median_1d_get_max().
void xsh_tools_get_statistics | ( | double * | tab, | |
int | size, | |||
double * | median, | |||
double * | mean, | |||
double * | stdev | |||
) |
Compute median, stdev and mean for the tab.
[in] | tab | the input array |
[in] | size | the size of input array |
[out] | median | the median of array |
[out] | mean | the mean of array |
[out] | stdev | the stdev of array |
Definition at line 2284 of file xsh_utils.c.
References check, XSH_ASSURE_NOT_ILLEGAL, XSH_ASSURE_NOT_NULL, and xsh_free_vector().
void xsh_tools_min_max | ( | int | size, | |
double * | tab, | |||
double * | min, | |||
double * | max | |||
) |
computes min & max in ab array
size | size of array | |
tab | array | |
min | minimum | |
max | maximum |
Definition at line 2662 of file xsh_utils.c.
References XSH_ASSURE_NOT_ILLEGAL, and XSH_ASSURE_NOT_NULL.
Referenced by lambda_fit(), and xsh_wavesol_compute().
int xsh_tools_running_median_1d_get_max | ( | double * | tab, | |
int | size, | |||
int | wsize | |||
) |
get max of a list of doubles after running median
tab | list of values | |
size | number of values | |
wsize | window size for running median |
Definition at line 2611 of file xsh_utils.c.
References XSH_ASSURE_NOT_NULL, XSH_FREE, XSH_MALLOC, and xsh_tools_get_median_double().
Referenced by xsh_fit_gaussian().
cpl_error_code xsh_tools_sort_double | ( | double * | pix_arr, | |
int | n | |||
) |
Sort a double array.
pix_arr | the array to sort | |
n | the array size |
From the cpl_tools_sort_double. Possible _cpl_error_code_ set in this function:
Definition at line 2324 of file xsh_utils.c.
References XSH_DOUBLE_SWAP, and XSH_PIX_STACK_SIZE.
Referenced by xsh_tools_get_median_double().
cpl_error_code xsh_tools_sort_float | ( | float * | pix_arr, | |
int | n | |||
) |
Sort a float array.
pix_arr | the array to sort | |
n | the array size |
From the cpl_tools_sort_double. Possible _cpl_error_code_ set in this function:
Definition at line 2411 of file xsh_utils.c.
References XSH_FLOAT_SWAP, and XSH_PIX_STACK_SIZE.
cpl_error_code xsh_tools_sort_int | ( | int * | pix_arr, | |
int | n | |||
) |
Sort an integer array.
pix_arr | the array to sort | |
n | the array size |
Possible _cpl_error_code_ set in this function:
Definition at line 2496 of file xsh_utils.c.
References XSH_INT_SWAP, and XSH_PIX_STACK_SIZE.
cpl_vector* xsh_tools_tchebitchev_poly_eval | ( | int | n, | |
double | X | |||
) |
Compute tchebitchev Tn(X) first coefficient for tchebitchev polynomial.
n | index of the last term to be computed (0 to n) | |
X | value of X in evaluation of the polynomial |
Definition at line 2699 of file xsh_utils.c.
References check, XSH_ASSURE_NOT_ILLEGAL, and xsh_free_vector().
Referenced by lambda_fit(), test_tech_eval_perf(), xsh_wavemap_list_eval_lambda(), xsh_wavesol_eval_polx(), and xsh_wavesol_eval_poly().
double xsh_tools_tchebitchev_reverse_transform | ( | double | pos, | |
double | min, | |||
double | max | |||
) |
computes reverse Tchebitchev transformation
pos | position | |
min | minimum | |
max | maximum |
Definition at line 2817 of file xsh_utils.c.
References XSH_ASSURE_NOT_ILLEGAL.
Referenced by xsh_wavemap_list_eval_lambda(), xsh_wavesol_eval_polx(), and xsh_wavesol_eval_poly().
double xsh_tools_tchebitchev_transform | ( | double | pos, | |
double | min, | |||
double | max | |||
) |
computes Tchebitchev transformation
pos | position | |
min | minimum | |
max | maximum |
Definition at line 2780 of file xsh_utils.c.
References XSH_ASSURE_NOT_ILLEGAL, and xsh_msg_dbg_medium.
Referenced by xsh_wavemap_list_eval_lambda(), xsh_wavesol_eval_polx(), and xsh_wavesol_eval_poly().
void xsh_tools_tchebitchev_transform_tab | ( | int | size, | |
double * | pos, | |||
double | min, | |||
double | max, | |||
double * | tcheb_pos | |||
) |
computes Tchebitchev transformation
size | saze of array | |
pos | position array | |
min | minimum | |
max | maximum | |
tcheb_pos | transformed position array |
Definition at line 2744 of file xsh_utils.c.
References XSH_ASSURE_NOT_ILLEGAL, and XSH_ASSURE_NOT_NULL.
Referenced by lambda_fit(), xsh_wavesol_compute(), and xsh_wavesol_residual().
void xsh_unwrap_bivector_vectors | ( | cpl_bivector ** | b | ) |
Unwrap a bi-vector and set the pointer to NULL.
b | Bi-vector to deallocate |
Definition at line 2239 of file xsh_utils.c.
Referenced by xsh_polynomial_regression_2d().
void xsh_unwrap_image | ( | cpl_image ** | i | ) |
Unwrap an image and set the pointer to NULL.
i | Image to unwrap |
Definition at line 2209 of file xsh_utils.c.
Referenced by xsh_opt_extract_orders().
void xsh_unwrap_vector | ( | cpl_vector ** | v | ) |
Unwrap a vector and set the pointer to NULL.
v | Vector to unwrap |
Definition at line 2224 of file xsh_utils.c.
Referenced by create_blaze(), find_tilt(), main(), set_qc_parameters(), xsh_array_clip_poly1d(), xsh_bpmap_collapse_mean(), xsh_bpmap_collapse_median(), xsh_detect_arclines(), xsh_detect_order_edge(), xsh_follow_arclines(), xsh_image_create_model_image(), xsh_image_extract_optimal(), xsh_image_gaussian_fit_y(), xsh_localize_obj_auto(), xsh_opt_extract_orders(), xsh_order_edge_list_fit(), xsh_order_list_fit(), xsh_polynomial_regression_2d(), xsh_pre_data_window_median_flux_pa(), xsh_pre_data_window_sample_flux_pa(), xsh_rec_list_add(), xsh_spectrum_load(), and xsh_spectrum_load_order().
cpl_error_code xsh_update_pheader_in_image_multi | ( | cpl_frame * | frame, | |
const cpl_propertylist * | pheader | |||
) |
Update FITS header.
frame | The frame whose frame need to be updated | |
pheader | The primary header to copy to the frame |
Definition at line 4121 of file xsh_utils.c.
References check, XSH_ASSURE_NOT_NULL, xsh_free_image(), xsh_free_propertylist(), and xsh_msg_dbg_medium.
Referenced by xsh_monitor_flux(), and xsh_wavemap_qc().
cpl_frame* xsh_util_frameset_collapse_mean | ( | cpl_frameset * | set, | |
xsh_instrument * | instrument | |||
) |
Compute mean frame from a list of (IMAGE) framesets.
set | The input frameset | |
instrument | The instrument structure |
Definition at line 5333 of file xsh_utils.c.
References check, xsh_frame_product(), xsh_free_image(), xsh_instrument_arm_tostring(), XSH_PRE_DATA_BPP, XSH_PRE_DATA_TYPE, XSH_PRE_ERRS_BPP, XSH_PRE_ERRS_TYPE, XSH_PRE_QUAL_BPP, and XSH_PRE_QUAL_TYPE.
Referenced by xsh_scired_ifu_offset().
static cpl_error_code xsh_util_get_infsup | ( | double * | piw, | |
double | w, | |||
int | i_start, | |||
int | i_end, | |||
int * | i_inf, | |||
int * | i_sup | |||
) | [static] |
Definition at line 5056 of file xsh_utils.c.
Referenced by xsh_spectrum_resample().
cpl_frame* xsh_util_multiply_by_response | ( | cpl_frame * | merged_sci, | |
cpl_frame * | response, | |||
const char * | tag_o | |||
) |
Multiply input frame by response frame.
merged_sci | The input object frame | |
response | The input response | |
tag_o | The output frame pro catg |
Definition at line 4664 of file xsh_utils.c.
References check, check_msg, lambda_step, XSH_ASSURE_NOT_NULL_MSG, xsh_frame_product(), xsh_free_image(), xsh_free_propertylist(), xsh_free_table(), xsh_free_vector(), xsh_image_to_vector(), xsh_msg, xsh_msg_dbg_medium, xsh_pfits_get_cdelt1(), xsh_pfits_get_crval1(), xsh_pfits_get_naxis(), xsh_pfits_set_pcatg(), XSH_PRE_DATA_BPP, XSH_PRE_DATA_TYPE, XSH_PRE_ERRS_BPP, XSH_PRE_ERRS_TYPE, XSH_PRE_QUAL_BPP, XSH_PRE_QUAL_TYPE, XSH_SPECTRUM_DATA_BPP, XSH_SPECTRUM_ERRS_BPP, xsh_spline_hermite_table(), and xsh_vector_to_image().
Referenced by xsh_scired_util_spectra_flux_calibrate().
cpl_frame* xsh_util_multiply_by_response_ord | ( | cpl_frame * | extracted_sci, | |
cpl_frame * | response, | |||
const char * | tag_o | |||
) |
Multiply input frame by response frame.
extracted_sci | The input object frame | |
response | The input response | |
tag_o | the output frame pro.catg |
Definition at line 4849 of file xsh_utils.c.
References check, check_msg, lambda_step, order, XSH_ASSURE_NOT_NULL_MSG, xsh_frame_product(), xsh_free_image(), xsh_free_propertylist(), xsh_free_table(), xsh_free_vector(), xsh_image_to_vector(), xsh_msg, xsh_msg_dbg_medium, xsh_pfits_get_cdelt1(), xsh_pfits_get_crval1(), xsh_pfits_get_naxis(), xsh_pfits_set_pcatg(), XSH_PRE_DATA_BPP, XSH_PRE_DATA_TYPE, XSH_PRE_ERRS_BPP, XSH_PRE_ERRS_TYPE, XSH_PRE_QUAL_BPP, XSH_PRE_QUAL_TYPE, XSH_SPECTRUM_DATA_BPP, XSH_SPECTRUM_ERRS_BPP, xsh_spline_hermite_table(), and xsh_vector_to_image().
Referenced by xsh_flux_calibrate(), and xsh_util_apply_response().
void xsh_vector_fit_gaussian | ( | cpl_vector * | x, | |
cpl_vector * | y, | |||
XSH_GAUSSIAN_FIT * | result | |||
) |
set debug level
x | vector with independent variable | |
y | vector with dependent variable | |
result | structure containing results (peakpos,sigma,area,offset,mse) |
cpl_vector_fit_gaussian
(assumes no errors on X,Y); Definition at line 2964 of file xsh_utils.c.
References XSH_GAUSSIAN_FIT::area, XSH_GAUSSIAN_FIT::mse, XSH_GAUSSIAN_FIT::offset, XSH_GAUSSIAN_FIT::peakpos, XSH_GAUSSIAN_FIT::sigma, and XSH_ASSURE_NOT_NULL.
Referenced by detect_centroid(), xsh_image_fit_gaussian_max_pos_x_window(), and xsh_image_fit_gaussian_max_pos_y_window().
double xsh_vector_get_err_mean | ( | cpl_vector * | vect | ) |
Computes mean error on a data set.
vect | input data |
Definition at line 4217 of file xsh_utils.c.
References check, and XSH_ASSURE_NOT_NULL.
Referenced by xsh_rec_list_add().
double xsh_vector_get_err_median | ( | cpl_vector * | vect | ) |
Computes median error on a data set.
vect | input data |
Definition at line 4182 of file xsh_utils.c.
References check, M_PI, and XSH_ASSURE_NOT_NULL.
Referenced by xsh_rec_list_add().
cpl_image* xsh_vector_to_image | ( | const cpl_vector * | vector, | |
cpl_type | type | |||
) |
Convert a vector to a 1d image.
vector | to convert | |
type | of image |
Definition at line 4611 of file xsh_utils.c.
References assure, and xsh_free_image().
Referenced by xsh_normalize_spectrum_image_slice(), xsh_util_multiply_by_response(), and xsh_util_multiply_by_response_ord().
cpl_frame* FRAME_DATE_IDX::frame [inherited] |
Definition at line 3142 of file xsh_utils.c.
Referenced by xsh_order_frameset_by_date().
int FRAME_DATE_IDX::frame_idx [inherited] |
Definition at line 3141 of file xsh_utils.c.
Referenced by xsh_order_frameset_by_date().
const char* FRAME_DATE_IDX::frame_name [inherited] |
Definition at line 3143 of file xsh_utils.c.
Referenced by xsh_order_frameset_by_date().
int NbProducts = 0 [static] |
Definition at line 1310 of file xsh_utils.c.
Referenced by xsh_add_product_file(), and xsh_free_product_files().
int NbTemp = 0 [static] |
Definition at line 1308 of file xsh_utils.c.
Referenced by xsh_add_temporary_file(), xsh_end(), and xsh_free_temporary_files().
char** ProdFiles = NULL [static] |
Definition at line 1309 of file xsh_utils.c.
Referenced by xsh_add_product_file(), and xsh_free_product_files().
char** TempFiles = NULL [static] |
Definition at line 1307 of file xsh_utils.c.
Referenced by xsh_add_temporary_file(), xsh_end(), and xsh_free_temporary_files().