/*---------------------------------------------------------------------------- File name : utils.h Author : N. Devillard Created on : August 1998 Description : ISAAC various utilities ---------------------------------------------------------------------------*/ /* $Id: utils.h,v 1.3 2001/09/21 09:22:06 yjung Exp $ $Author: yjung $ $Date: 2001/09/21 09:22:06 $ $Revision: 1.3 $ */ #ifndef _ISAAC_UTILS_H_ #define _ISAAC_UTILS_H_ /*---------------------------------------------------------------------------- Includes ---------------------------------------------------------------------------*/ #include "eclipse.h" /*---------------------------------------------------------------------------- Defines ---------------------------------------------------------------------------*/ #define ALGO_NOTREACHED 0 #define ALGO_OK 1 #define ALGO_FAILED -1 #define ALGO_SKIPPED 2 #define AIRMASS_START 0 #define AIRMASS_END 1 /* * ISAAC configuration */ #define ISAAC_LR_DIR 7.0 /* angle in degrees */ #define ISAAC_MR_DIR 31.5 /* angle in degrees */ #define ISAAC_LR_GRATING 40.0 /* grooves/mm */ #define ISAAC_MR_GRATING 210.0 /* grooves/mm */ #define ISAAC_FOCAL_LENGTH_MM 175.0 /* mm */ #define ISAAC_PIXEL_SIZE_S 18.5 /* microns */ #define ISAAC_PIXEL_SIZE_M 27.0 /* microns */ #define ISAAC_BEAM_DIFF 2.72 /* angle in degrees */ #define ISAAC_PUPIL_SIZE_MM 100.0 /* mm */ #define ISAAC_FLGTH_S1 1.75 #define ISAAC_FLGTH_S2 3.25 #define ISAAC_FLGTH_L1 1.56 #define ISAAC_FLGTH_L2 4.77 #define ISAAC_FLGTH_L3 9.88 #define ANGLE_IN_DEFAULT 0.00 #define ANGLE_OUT_DEFAULT 0.00 /* if difference between 2 middle lines above this level attemt even out dark */ #define THR_DARK_DETECT 20.0 /*---------------------------------------------------------------------------- Function ANSI C prototypes ---------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/ /** @name isaac_check_instrument @memo Check that a FITS file or ASCII list is an ISAAC product. @param name Name of the frame or list to check @return 1 if ISAAC product, 0 if not, -1 if error occurred. @doc This function checks that a FITS frame or an ASCII list are indeed ISAAC products (i.e. INSTRUME='ISAAC'). If it is not the case, a warning is produced by this function to signal this, and the function returns 0. If all frames check Ok, the function is silent and returns 1. If an error occurs (non-existing frame or list), an error message is produced and -1 is returned. */ /*--------------------------------------------------------------------------*/ int isaac_check_instrument(char * name); /*-------------------------------------------------------------------------*/ /** @name isaac_ff_dark_badpix_handling @memo apply dark subtraction and ff division, replace bad pixels @param in pointer to allocated cube @param ff_name flat field name @param dark_name dark name @return badpix_name bad pixel name @doc The input cube is always modified, to ensure that the returned value is read/write. */ /*--------------------------------------------------------------------------*/ void isaac_ff_dark_badpix_handling( cube_t ** in, char * ff_name, char * dark_name, char * badpix_name) ; /*-------------------------------------------------------------------------*/ /** @name spectro_jitter_average @memo shift(?) and average images @param cube cubes array @param nbcubes nb of cubes @param offsets_list offsets list @param t_switch array that associates images to cubes @param noffsets nb entries in t_switch and offsets_list @param average_status status flag. MODIFIED. @return averaged images (1 image per input cube) */ /*--------------------------------------------------------------------------*/ image_t ** spectro_jitter_average( cube_t ** cube, int nbcubes, double * offsets_list, int * t_switch, int noffsets, int * average_status) ; /*-------------------------------------------------------------------------*/ /** @name spectro_jitter_extract @memo Specrum detection and extraction for jitter-like recipes @param combined combined image in which the spec is extracted @param spec_width Width of the spectrum @param lo_dist Dist. spec -> lower resid. sky @param hi_dist Dist. spec -> high resid. sky @param lo_width Width of the low residual sky @param hi_width Width of the high residual sky @param apply_filter Flag to apply a median filter before extraction @param sky_frame Frame for sky extraction (not done if NULL provided) @param main_offset_diff Offsets between black and white lines @param nb_offsets Nb of offsets @param status_wavecal_done Flag to specify that the disprel is available @param wavecal Dispersion relation @param nb_coeffs Nb of coeffs of the polynomial disp relation @param spec_position Spectrum position. Found if <0 provided. MODIFIED @param spec_detected Flag. MODIFIED @param spec_extracted Flag. MODIFIED @param status Status of algorithm. MODIFIED @return A double3 array: x=xcoordinate, y=extracted spec, z=sky spec @doc Spectra are supposed to be horizontal */ /*--------------------------------------------------------------------------*/ double3 * spectro_jitter_extract( image_t * combined, int spec_width, int lo_dist, int hi_dist, int lo_width, int hi_width, int apply_filter, char * sky_frame, double * main_offset_diff, int nb_offsets, int status_wavecal_done, double * wavecal, int nb_coeffs, int * spec_position, int * spec_detected, int * spec_extracted, int * status) ; /*-------------------------------------------------------------------------*/ /** @name divide_by_fit @memo Fit the input image and divide it by the fit @param in input image @param order order of the fit @param xsize central X size to be used for the fit @param offset offset @param setting_nb setting id @param pair_nb pair id @param output_poly_image flag to output the polynomial images @return corrected image */ /*--------------------------------------------------------------------------*/ image_t * divide_by_fit( image_t * in, int order, int xsize, int offset, int setting_nb, int pair_nb, int output_poly_image) ; /* * This function only converts an integer into a character string... */ char * algo_stat(int s) ; #endif