|
CR2RE Pipeline Reference Manual 1.6.7
|
Functions | |
| cr2res_nodding_pos * | cr2res_nodding_read_positions (const cpl_frameset *in) |
| Get the nodding positions from a frame set. | |
| char | cr2res_nodding_position_char (cr2res_nodding_pos pos) |
| Get the nodding position character for display. | |
| int | cr2res_combine_nodding_split_frames (const cpl_frameset *in, const cr2res_nodding_pos *positions, cpl_frameset **pos_a, cpl_frameset **pos_b) |
| Split A/B positions in 2 framesets. | |
| int | cr2res_combine_nodding_split (const hdrl_imagelist *in, const cr2res_nodding_pos *positions, hdrl_imagelist **pos_a, hdrl_imagelist **pos_b) |
| Split A/B positions in 2 image lists. | |
| double | cr2res_mjd_obs_now (void) |
| Get the current MJD-OBS. | |
| int | cr2res_order_idx_to_real (int order_idx, int order_zp) |
| Convert the order_idx into order_real. | |
| int | cr2res_order_real_to_idx (int order_real, int order_zp) |
| Convert the order_real into order_idx. | |
| double | cr2res_ra_hms2deg (int hh, int mm, double ss) |
| Convert the RA from hh mm ss to degrees. | |
| double | cr2res_dec_hms2deg (int dd, int mm, double ss) |
| Convert the DEC from dd mm ss to degrees. | |
| int | cr2res_format_setting (char *setting_id) |
| Format the setting. | |
| int | cr2res_is_short_wavelength (const char *setting_id) |
| Identify Short Wavelength. | |
| int | cr2res_format_setting2 (char *setting_id) |
| Format the setting. | |
| double | cr2res_vector_get_mad (cpl_vector *invec, double *mad) |
| Get MAD from a vector. | |
| int * | cr2res_vector_get_int (const cpl_vector *ycen) |
| double * | cr2res_vector_get_rest (const cpl_vector *ycen) |
| cpl_table * | cr2res_combine_extracted (const cpl_table *extracta, const cpl_table *extractb) |
| Combine two extracted spectra by resampling one to the other's WL. | |
| cpl_polynomial * | cr2res_fit_interorder (cpl_image *img, cpl_table *trace_wave, cpl_size order_x, cpl_size order_y) |
| Fit a 2D Polynomial to the interorder regions. | |
| int | cr2res_slit_pos (const cpl_table *trace_wave, cpl_polynomial ***coef_slit, cpl_polynomial ***coef_wave, int *size) |
| Create the polynomials needed to calculate the slit pos and wavelength at any point x, y within an order. | |
| int | cr2res_slit_pos_image (const cpl_table *trace_wave, cpl_image **slitpos, cpl_image **wavelength) |
| get a image of the slitposition (and wavelength) along the slit | |
| cpl_image * | cr2res_image_cut_rectify (const cpl_image *img_in, const cpl_vector *ycen, int height) |
| Cut a bent order into a rectangle, shifting columns. | |
| int | cr2res_image_insert_rect (const cpl_image *rect_in, const cpl_vector *ycen, cpl_image *img_out) |
| Re-insert a rectangular cut-out of an order into the full frame. | |
| cpl_vector * | cr2res_polynomial_eval_vector (const cpl_polynomial *poly, const cpl_vector *vec) |
| Evaluate a polynomial on a vector. | |
| cpl_vector * | cr2res_threshold_spec (const cpl_vector *invector, int smooth, double thresh) |
| Find the regions with over-average values in a vector. | |
| char * | cr2res_get_base_name (const char *filename) |
| Find out the base name of a file (i.e. without prefix path) | |
| char * | cr2res_get_root_name (const char *filename) |
| Find out the root part of a basename (name without extension). | |
| cpl_frameset * | cr2res_extract_frameset (const cpl_frameset *in, const char *tag) |
| Extract the frames with the given tag from a frameset. | |
| cpl_frameset * | cr2res_extract_frameset_several_tags (const cpl_frameset *in, const char **tags, int ntags) |
| Extract the frames whose tag is within a list from a frameset. | |
| char * | cr2res_decker_print_position (cr2res_decker dpos) |
| Get the decker position string for display. | |
| cpl_polynomial * | cr2res_convert_array_to_poly (const cpl_array *arr) |
| Convert an array to polynomial. | |
| cpl_array * | cr2res_convert_poly_to_array (const cpl_polynomial *poly, int size) |
| Convert a polynomial to array. | |
| cpl_error_code | cr2res_detector_shotnoise_model (const cpl_image *ima_data, const double gain, const double ron, cpl_image **ima_errs) |
| compute photon count error in [ADU] | |
| int | cr2res_plot_wavecal_result (const cpl_bivector *extracted_spec, const cpl_bivector *catalog, const char *title, double wmin, double wmax) |
| Plot the spectrum with the catalog. | |
| cpl_image * | cr2res_util_optimal_filter_2d (const cpl_image *img, const cpl_image *weight, double lam_x, double lam_y) |
| Apply the optimal filter in the 2D case. | |
| cpl_polynomial * | cr2res_polyfit_2d_loc (const cpl_vector *x, const cpl_vector *y, const cpl_vector *z, const cpl_matrix *degree) |
| Perform a 2D polynomial fit f(x, y) = z. | |
| double | cr2res_util_blaze_stat (const cpl_table *blaze, int *ngood, double *blaze_tot) |
| Computes the average of the blaze. | |
| double | cr2res_utils_get_center_mjd (const cpl_frameset *frameset) |
| Calculate the middle of the exposures in the frameset. | |
| const char * | cr2res_get_license (void) |
| Get the pipeline copyright and license. | |
| cpl_table * cr2res_combine_extracted | ( | const cpl_table * | extracta, |
| const cpl_table * | extractb | ||
| ) |
Combine two extracted spectra by resampling one to the other's WL.
| extracta | A position extracted spectrum |
| extractb | B position extracted spectrum |
Definition at line 278 of file cr2res_utils.c.
References cr2res_dfs_SPEC_colname_parse(), cr2res_dfs_SPEC_ERR_colname(), cr2res_dfs_WAVELENGTH_colname(), hdrl_parameter_delete(), hdrl_spectrum1D_add_spectrum(), hdrl_spectrum1D_convert_from_table(), hdrl_spectrum1D_delete(), hdrl_spectrum1D_get_flux_value(), hdrl_spectrum1D_get_size(), hdrl_spectrum1D_get_wavelength(), hdrl_spectrum1D_get_wavelength_value(), hdrl_spectrum1D_resample(), and hdrl_spectrum1D_resample_interpolate_parameter_create().
| int cr2res_combine_nodding_split | ( | const hdrl_imagelist * | in, |
| const cr2res_nodding_pos * | positions, | ||
| hdrl_imagelist ** | pos_a, | ||
| hdrl_imagelist ** | pos_b | ||
| ) |
Split A/B positions in 2 image lists.
| in | Input image list |
| positions | nodding positions |
| pos_a | [out] A position images |
| pos_b | [out] B position images |
Definition at line 153 of file cr2res_nodding.c.
References hdrl_image_duplicate(), hdrl_imagelist_get(), hdrl_imagelist_get_size(), hdrl_imagelist_new(), and hdrl_imagelist_set().
| int cr2res_combine_nodding_split_frames | ( | const cpl_frameset * | in, |
| const cr2res_nodding_pos * | positions, | ||
| cpl_frameset ** | pos_a, | ||
| cpl_frameset ** | pos_b | ||
| ) |
Split A/B positions in 2 framesets.
| in | Input frameset |
| positions | nodding positions |
| pos_a | [out] A position frames |
| pos_b | [out] B position frames |
Definition at line 100 of file cr2res_nodding.c.
| cpl_polynomial * cr2res_convert_array_to_poly | ( | const cpl_array * | arr | ) |
Convert an array to polynomial.
| arr | An array |
Definition at line 1305 of file cr2res_utils.c.
Referenced by cr2res_extract2d_trace(), cr2res_fit_interorder(), cr2res_get_trace_wave_poly(), cr2res_slit_curv_gen_map(), cr2res_slit_pos(), cr2res_trace_gen_image(), cr2res_trace_get_trace_ypos(), cr2res_trace_new_slit_fraction(), and cr2res_wave_gen_wave_map().
| cpl_array * cr2res_convert_poly_to_array | ( | const cpl_polynomial * | poly, |
| int | size | ||
| ) |
Convert a polynomial to array.
| poly | A polynomial |
| size | The requested array size |
Definition at line 1339 of file cr2res_utils.c.
Referenced by cr2res_trace_new_slit_fraction(), and cr2res_wave_apply().
| double cr2res_dec_hms2deg | ( | int | dd, |
| int | mm, | ||
| double | ss | ||
| ) |
Convert the DEC from dd mm ss to degrees.
| dd | degrees |
| mm | minutes |
| ss | seconds |
60 arc-minutes is one degree and 60 arc-seconds is one arc-minute.
Definition at line 139 of file cr2res_utils.c.
Referenced by cr2res_ra_hms2deg().
| char * cr2res_decker_print_position | ( | cr2res_decker | dpos | ) |
Get the decker position string for display.
| dpos | The decker position |
Definition at line 1276 of file cr2res_utils.c.
| cpl_error_code cr2res_detector_shotnoise_model | ( | const cpl_image * | ima_data, |
| const double | gain, | ||
| const double | ron, | ||
| cpl_image ** | ima_errs | ||
| ) |
compute photon count error in [ADU]
| ima_data | in [ADU] |
| gain | detector's gain in [e- / ADU] |
| ron | detector's read out noise in [ADU] |
| ima_errs | output error image in [ADU] |

If an image value is negative the associated error is set to RON
Definition at line 1426 of file cr2res_utils.c.
| cpl_frameset * cr2res_extract_frameset | ( | const cpl_frameset * | in, |
| const char * | tag | ||
| ) |
Extract the frames with the given tag from a frameset.
| in | A non-empty frameset |
| tag | The tag of the requested frames |
The returned frameset must be de allocated with cpl_frameset_delete()
Definition at line 1179 of file cr2res_utils.c.
| cpl_frameset * cr2res_extract_frameset_several_tags | ( | const cpl_frameset * | in, |
| const char ** | tags, | ||
| int | ntags | ||
| ) |
Extract the frames whose tag is within a list from a frameset.
| in | A non-empty frameset |
| tags | The list of allowed tags of the requested frames |
| ntags | The number of tags |
The returned frameset must be de allocated with cpl_frameset_delete()
Definition at line 1224 of file cr2res_utils.c.
Referenced by cr2res_io_find_BPM_all(), cr2res_io_find_EXTRACT_1D_all(), cr2res_io_find_SLIT_MODEL(), and cr2res_io_find_TRACE_WAVE_all().
| cpl_polynomial * cr2res_fit_interorder | ( | cpl_image * | img, |
| cpl_table * | trace_wave, | ||
| cpl_size | order_x, | ||
| cpl_size | order_y | ||
| ) |
Fit a 2D Polynomial to the interorder regions.
| img | Image, Image with the noise and traces to fit (e.g. a observation) |
| trace_wave | Trace Wave Table |
| order_x | maximum order of the polynomial in x direction |
| order_y | maximum order of the polynomial in y direction |
Definition at line 461 of file cr2res_utils.c.
References cr2res_convert_array_to_poly(), and cr2res_trace_get_order_idx_values().
| int cr2res_format_setting | ( | char * | setting_id | ) |
Format the setting.
| Setting |
Definition at line 152 of file cr2res_utils.c.
Referenced by cr2res_io_find_SLIT_MODEL().
| int cr2res_format_setting2 | ( | char * | setting_id | ) |
Format the setting.
| Setting |
Definition at line 190 of file cr2res_utils.c.
| char * cr2res_get_base_name | ( | const char * | filename | ) |
Find out the base name of a file (i.e. without prefix path)
| filename | Full path name to scan. |
Definition at line 1112 of file cr2res_utils.c.
| const char * cr2res_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 2362 of file cr2res_utils.c.
| char * cr2res_get_root_name | ( | const char * | filename | ) |
Find out the root part of a basename (name without extension).
| filename | File name to scan. |
Definition at line 1128 of file cr2res_utils.c.
| cpl_image * cr2res_image_cut_rectify | ( | const cpl_image * | img_in, |
| const cpl_vector * | ycen, | ||
| int | height | ||
| ) |
Cut a bent order into a rectangle, shifting columns.
| img_in | |
| ycen | |
| height |
Definition at line 907 of file cr2res_utils.c.
References cr2res_vector_get_int().
Referenced by cr2res_extract_median(), cr2res_extract_slitdec_curved(), cr2res_extract_sum_tilt(), cr2res_extract_sum_vert(), and cr2res_slit_curv_compute_order_trace().
| int cr2res_image_insert_rect | ( | const cpl_image * | rect_in, |
| const cpl_vector * | ycen, | ||
| cpl_image * | img_out | ||
| ) |
Re-insert a rectangular cut-out of an order into the full frame.
| rect_in | |
| ycen |
Definition at line 984 of file cr2res_utils.c.
References cr2res_vector_get_int().
Referenced by cr2res_extract_slitdec_curved().
| int cr2res_is_short_wavelength | ( | const char * | setting_id | ) |
Identify Short Wavelength.
| Setting |
Definition at line 171 of file cr2res_utils.c.
| double cr2res_mjd_obs_now | ( | void | ) |
Get the current MJD-OBS.
Definition at line 58 of file cr2res_utils.c.
Referenced by cr2res_io_save_EMISSION_LINES(), and cr2res_io_save_PHOTO_FLUX().
| char cr2res_nodding_position_char | ( | cr2res_nodding_pos | pos | ) |
Get the nodding position character for display.
| pos | the nodding position |
Definition at line 83 of file cr2res_nodding.c.
| cr2res_nodding_pos * cr2res_nodding_read_positions | ( | const cpl_frameset * | in | ) |
Get the nodding positions from a frame set.
| set | Input frame set |
Definition at line 50 of file cr2res_nodding.c.
References cr2res_pfits_get_nodding_pos().
| int cr2res_order_idx_to_real | ( | int | order_idx, |
| int | order_zp | ||
| ) |
Convert the order_idx into order_real.
| order_idx | Order index |
| order_zp | Order Zero Point |
Definition at line 89 of file cr2res_utils.c.
Referenced by cr2res_trace_filter().
| int cr2res_order_real_to_idx | ( | int | order_real, |
| int | order_zp | ||
| ) |
Convert the order_real into order_idx.
| order_real | Order Real |
| order_zp | Order Zero Point |
Definition at line 102 of file cr2res_utils.c.
Referenced by cr2res_wave_apply().
| int cr2res_plot_wavecal_result | ( | const cpl_bivector * | extracted_spec, |
| const cpl_bivector * | catalog, | ||
| const char * | title, | ||
| double | wmin, | ||
| double | wmax | ||
| ) |
Plot the spectrum with the catalog.
| extracted_spec | The extracted spectrum |
| catalog | The lines catalog |
| title | The title for the plot |
| wmin | Min Wavelength to display or -1 |
| wmax | Max Wavelength to display or -1 |
Definition at line 1458 of file cr2res_utils.c.
Referenced by cr2res_wave_1d().
| cpl_polynomial * cr2res_polyfit_2d_loc | ( | const cpl_vector * | x, |
| const cpl_vector * | y, | ||
| const cpl_vector * | z, | ||
| const cpl_matrix * | degree | ||
| ) |
Perform a 2D polynomial fit f(x, y) = z.
| x | coordinates |
| y | coordinates |
| z | values to fit |
| degrees | to fit with shape (ndegrees, 2) with one entry per xy combination, x degrees in the 1st column, and y degrees in the 2nd, Note that you need to include 0, 0 as well for the constant offset |
Perform a 2D polynomial fit, where the fit degrees are explicitly specified.
Definition at line 2063 of file cr2res_utils.c.
| cpl_vector * cr2res_polynomial_eval_vector | ( | const cpl_polynomial * | poly, |
| const cpl_vector * | vec | ||
| ) |
Evaluate a polynomial on a vector.
| poly | |
| vec |
Definition at line 1059 of file cr2res_utils.c.
Referenced by cr2res_extract2d_trace(), and cr2res_wave_etalon().
| double cr2res_ra_hms2deg | ( | int | hh, |
| int | mm, | ||
| double | ss | ||
| ) |
Convert the RA from hh mm ss to degrees.
| hh | hours |
| mm | minutes |
| ss | seconds |
An arc-hour is 15 degrees, 60 arc-minutes is one arc-hour and 60 arc-seconds is one arc-minute.
Definition at line 121 of file cr2res_utils.c.
References cr2res_dec_hms2deg().
| int cr2res_slit_pos | ( | const cpl_table * | trace_wave, |
| cpl_polynomial *** | coef_slit, | ||
| cpl_polynomial *** | coef_wave, | ||
| int * | size | ||
| ) |
Create the polynomials needed to calculate the slit pos and wavelength at any point x, y within an order.
| trace_wave | input trace wave table with wavelength polynomials for all orders |
| coef_slit | [out] slit pos polynomials as a function of the wavelength and the pixel row y |
| coef_wave | [out] wavelength polynomials as a function of the pixel position x, y |
| size | [out] the number of orders (polynomials) in coef_slit and coef_wave |
Definition at line 627 of file cr2res_utils.c.
References cr2res_convert_array_to_poly(), cr2res_get_trace_numbers(), cr2res_get_trace_table_index(), cr2res_get_trace_wave_poly(), and cr2res_trace_get_order_idx_values().
Referenced by cr2res_slit_pos_image().
| int cr2res_slit_pos_image | ( | const cpl_table * | trace_wave, |
| cpl_image ** | slitpos, | ||
| cpl_image ** | wavelength | ||
| ) |
get a image of the slitposition (and wavelength) along the slit
| tw_decker_1 | tracewave table for traces with decker 1 |
| tw_decker_2 | tracewave_table for traces with decker 2 |
| slitpos | output image of slit positions |
| wavelength | output image of wavelength |
Uses the polynomials from cr2res_slit_pos to calculate the slit position and wavelength of each pixel
Definition at line 841 of file cr2res_utils.c.
References cr2res_slit_pos().
Referenced by cr2res_extract2d_traces().
| cpl_vector * cr2res_threshold_spec | ( | const cpl_vector * | invector, |
| int | smooth, | ||
| double | thresh | ||
| ) |
Find the regions with over-average values in a vector.
| invector | The vector to be analyzed |
| smooth | The size of the boxcar smoothing kernel |
Definition at line 1089 of file cr2res_utils.c.
| double cr2res_util_blaze_stat | ( | const cpl_table * | blaze, |
| int * | ngood, | ||
| double * | blaze_tot | ||
| ) |
Computes the average of the blaze.
| blaze | The extracted spectrum from the flat ie blaze |
Definition at line 2223 of file cr2res_utils.c.
References cr2res_dfs_SPEC_colname_parse().
| cpl_image * cr2res_util_optimal_filter_2d | ( | const cpl_image * | img, |
| const cpl_image * | weight, | ||
| double | lam_x, | ||
| double | lam_y | ||
| ) |
Apply the optimal filter in the 2D case.
| img | Input image to filter |
| weight | Weights for each point, should be between 0 and 1 |
| lam_x | Regularization factor in x direction |
| lam_y | Regularization factor in y direction |
The optimal filter applies a restriction on the 1st derivatives in the x and y directions.
Definition at line 1848 of file cr2res_utils.c.
| double cr2res_utils_get_center_mjd | ( | const cpl_frameset * | frameset | ) |
Calculate the middle of the exposures in the frameset.
| frameset | - the input frames |
The calculation is a weighted arithmetic mean of the midpoints in mjd, weighted by the exposure times.
Definition at line 2289 of file cr2res_utils.c.
| int * cr2res_vector_get_int | ( | const cpl_vector * | ycen | ) |
| <br> |
Definition at line 230 of file cr2res_utils.c.
Referenced by cr2res_extract_median(), cr2res_extract_sum_tilt(), cr2res_extract_sum_vert(), cr2res_image_cut_rectify(), and cr2res_image_insert_rect().
| double cr2res_vector_get_mad | ( | cpl_vector * | invec, |
| double * | mad | ||
| ) |
Get MAD from a vector.
| invec | input vector |
| mad* | median absolute deviation (output) |
Wrap a vector into an image because the cpl does not have this for vectors
Definition at line 212 of file cr2res_utils.c.
Referenced by cr2res_calib_subtract_interorder_column().
| double * cr2res_vector_get_rest | ( | const cpl_vector * | ycen | ) |
| ycen |
Definition at line 253 of file cr2res_utils.c.
Referenced by cr2res_extract_slitdec_curved().