/*---------------------------------------------------------------------------- File name : distortion.h Author : Y. Jung Created on : Feb 2001 Description : ISAAC distortion utilities ---------------------------------------------------------------------------*/ /* $Id: distortion.h,v 1.4 2001/11/15 15:53:47 yjung Exp $ $Author: yjung $ $Date: 2001/11/15 15:53:47 $ $Revision: 1.4 $ */ #ifndef _IS_UTILS_DISTORTION_H_ #define _IS_UTILS_DISTORTION_H_ /*---------------------------------------------------------------------------- Function ANSI C code ---------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/ /** @brief Determine the distortion, correct, and wl calibrate @param in image object @param inimage_name input image name @param listnames input files names @param nb_coeffs number of polynomial coefficients @param rejected_ends number of pix. to reject on image borders @param rej_left nb of pix to rej. on the left (lines id.) @param rej_right on the right ... @param line_table catalog @param auto_dark_subtraction flag to get rid of dark @param file_name output file name @param mode 's' or 'l' for SW or LW mode @param out_corrected flag to output corrected frames @param arcs_fwhm array with arcs pos and fwhm @return 3 columns with the 2d poly and the last column with the 1D polynomial describing the dispersion */ /*--------------------------------------------------------------------------*/ double ** compute_arc_reduction( image_t * in, char * inimage_name, framelist * listnames, int * nb_coeffs, int rejected_ends, int rej_left, int rej_right, char * line_table, int auto_dark_subtraction, char * file_name, char mode, int out_corrected, double3 ** arcs_fwhm) ; /*-------------------------------------------------------------------------*/ /** @brief Write the out tfits file @param outname outfile name @param nb_coeffs nb of coeffs @param out_table result of engine @param inimage_name one input image name @param mode 'l' or 's' for LW or SW mode @param lnames input files list @param lines_type used lines type ("argon", "xenon", argon+xenon") @param arcs_fwhm array with arcs positions and fwhm @return error code: 0 ok, -1 in error case */ /*--------------------------------------------------------------------------*/ int arc_write_outfile( char * outname, int nb_coeffs, double ** out_table, char * inimage_name, char mode, framelist * lnames, char * lines_type, double3 * arcs_fwhm) ; /*-------------------------------------------------------------------------*/ /** @name isaac_compute_distortion @memo computes the distortion @param in input image @param xmin @param ymin The region of interest @param xmax @param ymax @param auto_dark_sub Flag to automatically subtract the dark @param arcs array with arcs positions @return a 2-D polynomial of size 6 double @doc This function is Isaac specific. It attempts to detect a dark ramp and subtract it if found. See compute_distortion for a generic version. */ /*--------------------------------------------------------------------------*/ poly2d * isaac_compute_distortion( image_t * in, int xmin, int ymin, int xmax, int ymax, int auto_dark_sub, int * nb_arcs, double ** arcs) ; /*-------------------------------------------------------------------------*/ /** @name isaac_distortion_estim_corr @memo Estimate and correct the distortion for a batch of frames @param inputs Input images to correct @param nb_inputs nb of input images @param estimation_frame Frame used for slit curv estimation @param arc_flag Flag to use the arc file @param arc_name Arc table that gives the slit curve distortion @param startrace_flag Flag to use the startrace file @param startrace_name Startrace table that gives the sttr distortion @param xmin @param ymin Region used for disto. estimation @param xmax (C coord std : 0 -> 1023) @param ymax @param dark_auto_sub Flag to automat. remove the dark ramp @param status_slit_curv slit curv. status. MODIFIED @param status_startrace startrace status. MODIFIED @return corrected images or NULL if unsuccessfull correction */ /*--------------------------------------------------------------------------*/ image_t ** isaac_distortion_estim_corr( image_t ** inputs, int nb_inputs, char * estimation_frame, int arc_flag, char * arc_name, int startrace_flag, char * startrace_name, int xmin, int ymin, int xmax, int ymax, int dark_auto_sub, int * status_slit_curv, int * status_startrace) ; /*-------------------------------------------------------------------------*/ /** @name isaac_detect_dark_ramp @memo detects a dark ramp in an image @param in input image @param slope slope @return a flag signalling whether the ramp has been detected or not @doc If the the ramp in the input image is found either the dark image should be subtracted or (if no dark is available) level_dark() may be used. By convention lo has lower y values than hi. */ /*--------------------------------------------------------------------------*/ int isaac_detect_dark_ramp( image_t *in, double *slope) ; /*-------------------------------------------------------------------------*/ /** @name level_dark @memo subtracts a first order model of the dark current @param slope slope @param in Non dark subtracted image with two ramps in Y direction centered on exactly in->ly/2 @return 0 if OK -1 if not. The ramp subtracted image is written on disk */ /*--------------------------------------------------------------------------*/ int isaac_level_dark( double slope, image_t *in) ; #endif