|
CR2RE Pipeline Reference Manual 1.6.10
|
Functions | |
| cpl_table * | cr2res_trace (cpl_image *ima, int smooth_x, int smooth_y, double threshold, int opening, int degree, int min_cluster) |
| Main function for running all parts of the trace algorithm. | |
| cpl_mask * | cr2res_trace_clean (cpl_mask *mask, int opening, int min_cluster) |
| Clean small blobs. | |
| cpl_image * | cr2res_trace_gen_image (cpl_table *trace, int nx, int ny) |
| Make an image out of the trace solution. | |
| int * | cr2res_trace_get_order_idx_values (const cpl_table *trace, int *nb_order_idx_values) |
| Count and return the different order_idx values from a TW table. | |
| cpl_size | cr2res_get_nb_traces (const cpl_table *trace_wave, int order_idx) |
| Get the number of traces for a specified order_idx. | |
| int * | cr2res_get_trace_numbers (const cpl_table *trace_wave, int order_idx, int *nb_traces) |
| Get the trace numbers for a specified order_idx. | |
| cpl_table * | cr2res_trace_merge (const cpl_table *trace_wave1, const cpl_table *trace_wave2) |
| Merge 2 trace_wave tables. | |
| cpl_size | cr2res_get_trace_table_index (const cpl_table *trace_wave, int order_idx, int trace_nb) |
| Get the index in a TRACE_WAVE table. | |
| cpl_polynomial * | cr2res_get_trace_wave_poly (const cpl_table *trace_wave, const char *poly_column, int order_idx, int trace_nb) |
| Get a polynomial from a TRACE_WAVE table. | |
| cpl_vector * | cr2res_trace_get_wl (const cpl_table *trace_wave, int order_idx, int trace_nb, int size) |
| Get the Wavelength vector from a TRACE_WAVE table. | |
| cpl_vector * | cr2res_trace_get_ycen (const cpl_table *trace, int order_idx, int trace_nb, int size) |
| Retrieves the middle (All) polynomial from trace table and evaluates. | |
| int | cr2res_trace_get_height (const cpl_table *trace, cpl_size order_idx, cpl_size trace_nb) |
| Computes the average height (pix) of an order, from trace polys. | |
| cpl_vector * | cr2res_trace_compute_middle (cpl_polynomial *trace1, cpl_polynomial *trace2, int vector_size) |
| Computes the positions between 2 trace polynomials. | |
| int | cr2res_trace_compute_height (cpl_polynomial *trace1, cpl_polynomial *trace2, int vector_size) |
| Computes extraction height between 2 trace polynomials. | |
| double | cr2res_trace_get_trace_ypos (const cpl_table *traces, int idx) |
| Compute the y position of the trace. | |
| int | cr2res_trace_add_extra_columns (cpl_table *traces, const char *infile, int det_nr) |
| Add extra columns to the plain trace table. | |
| cpl_table * | cr2res_trace_new_slit_fraction (const cpl_table *traces, const cpl_array *new_slit_fraction) |
| Recompute the traces at a newly specified slit fraction. | |
| cr2res_decker | cr2res_trace_slit_fraction_info (const cpl_array *slit_frac, int *up_or_down) |
| Get a standard slit fraction information. | |
| cpl_array * | cr2res_trace_slit_fraction_create (cr2res_decker decker_position, int up_or_down) |
| Get a standard slit fraction. | |
| cpl_table * | cr2res_trace_split (cpl_table *trace_wave, int order_idx, int nb_subtraces) |
| Splits full slit traces into several sub traces. | |
| cpl_table * | cr2res_trace_filter (const cpl_table *tw, const char *setting, int zp_order) |
| Only keep the predefined orders of the setting. | |
| cpl_size cr2res_get_nb_traces | ( | const cpl_table * | trace_wave, |
| int | order_idx | ||
| ) |
Get the number of traces for a specified order_idx.
| tab | A TRACE_WAVE table |
| order_idx | the order_idx |
Definition at line 486 of file cr2res_trace.c.
Referenced by cr2res_get_trace_numbers().
| int * cr2res_get_trace_numbers | ( | const cpl_table * | trace_wave, |
| int | order_idx, | ||
| int * | nb_traces | ||
| ) |
Get the trace numbers for a specified order_idx.
| tab | A TRACE_WAVE table |
| order_idx | the order_idx |
| nb_traces | [out] number of traces |
Definition at line 517 of file cr2res_trace.c.
References cr2res_get_nb_traces().
Referenced by cr2res_qc_flat_trace_center_y(), cr2res_slit_pos(), cr2res_trace_new_slit_fraction(), and cr2res_trace_split().
| cpl_size cr2res_get_trace_table_index | ( | const cpl_table * | trace_wave, |
| int | order_idx, | ||
| int | trace_nb | ||
| ) |
Get the index in a TRACE_WAVE table.
| tab | A TRACE_WAVE table |
| order_idx | the order_idx |
| trace_nb | the trace number |
Definition at line 652 of file cr2res_trace.c.
Referenced by cr2res_extract2d_trace(), cr2res_get_trace_wave_poly(), cr2res_slit_pos(), cr2res_trace_new_slit_fraction(), cr2res_trace_split(), and cr2res_wave_apply().
| cpl_polynomial * cr2res_get_trace_wave_poly | ( | const cpl_table * | trace_wave, |
| const char * | poly_column, | ||
| int | order_idx, | ||
| int | trace_nb | ||
| ) |
Get a polynomial from a TRACE_WAVE table.
| tab | A TRACE_WAVE table |
| poly_column | CR2RES_COL_WAVELENGTH, CR2RES_COL_UPPER, |
| order_idx | the order_idx |
| trace_nb | the trace number |
Definition at line 685 of file cr2res_trace.c.
References cr2res_convert_array_to_poly(), and cr2res_get_trace_table_index().
Referenced by cr2res_extract_slitdec_curved(), cr2res_extract_sum_tilt(), cr2res_pol_get_beam_trace(), cr2res_slit_pos(), cr2res_trace_get_height(), cr2res_trace_get_wl(), cr2res_trace_get_ycen(), and cr2res_wave_apply().
| cpl_table * cr2res_trace | ( | cpl_image * | ima, |
| int | smooth_x, | ||
| int | smooth_y, | ||
| double | threshold, | ||
| int | opening, | ||
| int | degree, | ||
| int | min_cluster | ||
| ) |
Main function for running all parts of the trace algorithm.
| ima | input image |
| smooth_x | Low pass filter kernel size in x |
| smooth_y | Low pass filter kernel size in y |
| threshold | The threshold used for detection |
| opening | Used for cleaning the mask |
| degree | Fitted polynomial degree |
| min_cluster | A trace must be bigger - discarded otherwise |
A detection is applied to create a mask. This one is labelised. The function converts the label image in the proper cluster table in trace to call the traces fitting function. The cluster table contains the label image information in the form of a table. One column per pixel. The columns are xs (pixel x position), ys (pixel y position) and cluster (label number). The returned table contains 1 line per trace. Each line has 3 polynomials (All, Upper and Lower). For example with degree 1 : All| Upper| Lower| 24.3593, 0.0161583| 34.6822, 0.0164165| 14.0261, 0.0159084| 225.479, 0.0167469| 236.604, 0.0168986| 214.342, 0.0166058| 436.94, 0.0173438| 448.436, 0.017493| 425.423, 0.017203|
Definition at line 163 of file cr2res_trace.c.
References cr2res_trace_clean().
| int cr2res_trace_add_extra_columns | ( | cpl_table * | traces, |
| const char * | infile, | ||
| int | det_nr | ||
| ) |
Add extra columns to the plain trace table.
| traces | The plain traces table |
| infile | File used for WL infos and Decker position |
| det_nr | Detector |
infile is the input file from which we use the header to get the Wavelength and the Decker position.
The added columns are: CR2RES_COL_ORDER CR2RES_COL_TRACENB CR2RES_COL_WAVELENGTH CR2RES_COL_WAVELENGTH_ERROR CR2RES_COL_SLIT_CURV_A CR2RES_COL_SLIT_CURV_B CR2RES_COL_SLIT_CURV_C CR2RES_COL_SLIT_FRACTION The values are set as defaults The resulting table is a proper TRACE_WAVE table
Definition at line 972 of file cr2res_trace.c.
References cr2res_io_get_ext_idx(), cr2res_pfits_get_decker_position(), cr2res_pfits_get_order_idx(), cr2res_trace_get_order_idx_values(), cr2res_trace_get_trace_ypos(), and cr2res_wave_get_estimate().
| cpl_mask * cr2res_trace_clean | ( | cpl_mask * | mask, |
| int | opening, | ||
| int | min_cluster | ||
| ) |
Clean small blobs.
| mask | input mask with small blobs |
| opening | Flag to apply opening filtering to the traces |
| min_cluster | Remove all clusters smaller than this |
Definition at line 292 of file cr2res_trace.c.
Referenced by cr2res_trace().
| int cr2res_trace_compute_height | ( | cpl_polynomial * | trace1, |
| cpl_polynomial * | trace2, | ||
| int | vector_size | ||
| ) |
Computes extraction height between 2 trace polynomials.
| trace1 | First trace |
| trace2 | Second trace |
| vector_size | detector x size |
The returned int is the rounded-up mean difference between the two input polynomials, evaluated on a vector from 1 to vector_size.
Definition at line 886 of file cr2res_trace.c.
Referenced by cr2res_trace_get_height().
| cpl_vector * cr2res_trace_compute_middle | ( | cpl_polynomial * | trace1, |
| cpl_polynomial * | trace2, | ||
| int | vector_size | ||
| ) |
Computes the positions between 2 trace polynomials.
| poly1 | First trace |
| poly2 | Second trace |
| size | Output vector size |
Definition at line 851 of file cr2res_trace.c.
| cpl_table * cr2res_trace_filter | ( | const cpl_table * | tw, |
| const char * | setting, | ||
| int | zp_order | ||
| ) |
Only keep the predefined orders of the setting.
| tw | trace wave table |
| setting | The setting ID |
| zp_order | The order ZP |
Definition at line 1965 of file cr2res_trace.c.
References cr2res_order_idx_to_real().
| cpl_image * cr2res_trace_gen_image | ( | cpl_table * | trace, |
| int | nx, | ||
| int | ny | ||
| ) |
Make an image out of the trace solution.
| trace | The trace table |
| nx | X size of the produced image |
| ny | Y size of the produced image |
Definition at line 362 of file cr2res_trace.c.
References cr2res_convert_array_to_poly().
Referenced by cr2res_qc_overexposed().
| int cr2res_trace_get_height | ( | const cpl_table * | trace, |
| cpl_size | order_idx, | ||
| cpl_size | trace_nb | ||
| ) |
Computes the average height (pix) of an order, from trace polys.
| trace | TRACE table |
| order_idx | the order_idx |
| trace_nb | the trace number |
Definition at line 805 of file cr2res_trace.c.
References cr2res_get_trace_wave_poly(), and cr2res_trace_compute_height().
Referenced by cr2res_extract_median(), cr2res_extract_slitdec_curved(), cr2res_extract_sum_tilt(), and cr2res_extract_sum_vert().
| int * cr2res_trace_get_order_idx_values | ( | const cpl_table * | trace, |
| int * | nb_order_idx_values | ||
| ) |
Count and return the different order_idx values from a TW table.
| trace | TW table |
| nb_order_idx_values | [output] number of different order_idx values |
The int array will need to be freed by the caller. Its size is nb_orders. It contains the list of different order_idx values found in the TW table.
Definition at line 431 of file cr2res_trace.c.
Referenced by cr2res_fit_interorder(), cr2res_qc_der_snr(), cr2res_qc_flat_order_positions(), cr2res_qc_flat_trace_center_y(), cr2res_qc_snr(), cr2res_slit_pos(), cr2res_trace_add_extra_columns(), cr2res_trace_merge(), cr2res_trace_new_slit_fraction(), and cr2res_trace_split().
| double cr2res_trace_get_trace_ypos | ( | const cpl_table * | traces, |
| int | idx | ||
| ) |
Compute the y position of the trace.
| traces | The traces table |
| idx | The index of the trace row |
Definition at line 923 of file cr2res_trace.c.
References cr2res_convert_array_to_poly().
Referenced by cr2res_qc_flat_order_positions(), and cr2res_trace_add_extra_columns().
| cpl_vector * cr2res_trace_get_wl | ( | const cpl_table * | trace_wave, |
| int | order_idx, | ||
| int | trace_nb, | ||
| int | size | ||
| ) |
Get the Wavelength vector from a TRACE_WAVE table.
| trace_wave | A TRACE_WAVE table |
| order_idx | the order_idx |
| trace_nb | the trace number |
| size | Output vector size |
Definition at line 730 of file cr2res_trace.c.
References cr2res_get_trace_wave_poly().
Referenced by cr2res_extract_EXTRACT1D_create(), cr2res_qc_wave_central(), and cr2res_qc_wave_disp().
| cpl_vector * cr2res_trace_get_ycen | ( | const cpl_table * | trace, |
| int | order_idx, | ||
| int | trace_nb, | ||
| int | size | ||
| ) |
Retrieves the middle (All) polynomial from trace table and evaluates.
| trace | TRACE table |
| order_idx | the order_idx |
| trace_nb | the trace number |
| size | Output vector size |
Definition at line 769 of file cr2res_trace.c.
References cr2res_get_trace_wave_poly().
Referenced by cr2res_extract_median(), cr2res_extract_slitdec_curved(), cr2res_extract_sum_tilt(), cr2res_extract_sum_vert(), cr2res_qc_flat_trace_center_y(), and cr2res_slit_curv_compute_order_trace().
| cpl_table * cr2res_trace_merge | ( | const cpl_table * | trace_wave1, |
| const cpl_table * | trace_wave2 | ||
| ) |
Merge 2 trace_wave tables.
| trace_wave1 | Table to merge |
| trace_wave2 | Table to merge |
Definition at line 592 of file cr2res_trace.c.
References cr2res_trace_get_order_idx_values().
| cpl_table * cr2res_trace_new_slit_fraction | ( | const cpl_table * | traces, |
| const cpl_array * | new_slit_fraction | ||
| ) |
Recompute the traces at a newly specified slit fraction.
| traces | The input traces |
| new_slit_fraction | The newly wished slit fraction |
For each order in the input tracewave, the function will produce a new row in the output trace table corresponding to the passed slit fraction, based on all available traces (rows).
Definition at line 1152 of file cr2res_trace.c.
References cr2res_convert_array_to_poly(), cr2res_convert_poly_to_array(), cr2res_dfs_check_traces_table(), cr2res_get_trace_numbers(), cr2res_get_trace_table_index(), and cr2res_trace_get_order_idx_values().
Referenced by cr2res_pol_get_beam_trace().
| cpl_array * cr2res_trace_slit_fraction_create | ( | cr2res_decker | decker_position, |
| int | up_or_down | ||
| ) |
Get a standard slit fraction.
| decker_position | CR2RES_DECKER_NONE, _1_3 or _2_4 |
| up_or_down | 0 (if CR2RES_DECKER_NONE), 1 for up, 2 for down |
Definition at line 1760 of file cr2res_trace.c.
| cr2res_decker cr2res_trace_slit_fraction_info | ( | const cpl_array * | slit_frac, |
| int * | up_or_down | ||
| ) |
Get a standard slit fraction information.
| slit_frac | Slit Fraction array |
| up_or_down | [out] 0 (if CR2RES_DECKER_NONE), 1 for up, 2 for down |
Definition at line 1710 of file cr2res_trace.c.
Referenced by cr2res_qc_flat_order_positions().
| cpl_table * cr2res_trace_split | ( | cpl_table * | trace_wave, |
| int | order_idx, | ||
| int | nb_subtraces | ||
| ) |
Splits full slit traces into several sub traces.
| trace_wave | trace wave table |
| order_idx | order to split (-100 for all) |
| nb_subtraces | number of subtraces to create |
All input traces that have a full slit_fraction are split.
The returned trace wave table only contains the newly created traces.
Sub traces are created by evenly splitting the existing trace, so that no subtraces overlap.
Definition at line 1834 of file cr2res_trace.c.
References cr2res_get_trace_numbers(), cr2res_get_trace_table_index(), cr2res_trace_get_order_idx_values(), and fraction().