Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages

extract/incl/extract.h

Go to the documentation of this file.
00001 /* === Doxygen File Comment ======================================== */
00015 /* ================================================================= */
00016 
00017 #ifndef _EXTRACT_H
00018 #define _EXTRACT_H
00019 
00020 /* ===== Global variables ============================== */
00021 
00022 /* ===== Misc. settings ============================== */
00023 
00024 /* find_mpup: nllsqfit_distMLA */
00025 
00026 #define FMP_XC            1027.
00027 #define FMP_YC            1770.      
00028 #define FMP_LENSSNORM     1.e2
00029 #define FMP_ANGLENORM     6.e-2
00030 #define FMP_POSITNORM     1.e3
00031 #define FMP_ALPHANORM     1.e-8      
00032 
00033 /* find_mpup: nllsqfit_globalPSF */
00034 
00035 #define FMP_IPSFNORM      1.e2       // 20 up to v 1.17, 1e4 up to 1.24
00036 #define FMP_XPSFNORM      0.5        
00037 
00038 /* find_mpup: nllsqfit_localPSF */
00039 
00040 #define FMP_IPUPNORM      60.
00041 #define FMP_XPUPNORM      0.3
00042 #define FMP_SPUPNORM      0.1        
00043 
00044 /* find_max */
00045 
00047 #define FMX_TOOFAR        2.
00048 
00050 /* From Sauron, it's better to have a `big' number: at worst, you skip
00051    the very end of the spectra. Having too small a number (eg 1), the
00052    fit will not converge */
00053 #define FMX_SIGMA_CLIP    5.
00054 
00055 /* create_mask */
00056 
00058 #define MASK_NPARAM       16
00059 
00060 /* ===== Function prototyping ============================== */
00061 
00062 /* File least_sq.c */
00063 
00064 void nllsqfit_noderiv();
00065 
00066 /* File io.c */
00067 
00068 int get_lenses_col(E3D_file *frame, char *lab_col, void *zlens, int *il);
00069 double RD_frame_interp(IMAGE2D *frame, double x,double y);
00070 
00071 /* File filter.c */
00072 
00073 void spatial_filter(int nrow, float X[], float Y[], float Z[], float rad,
00074                     char method, int minNnb, int Nnb[]);
00075 
00076 /* File dump.c */
00077 
00078 int dump_dbgArray(void *array, int type, int npts, char *dbgname, 
00079                   SPECTRUM *refspec);
00080 int dump_spec_mem(SPECTRUM *spectrum, char *name, char *ident, char *unit, 
00081                   int fclass);
00082 void put_tiger_arrays(TIGERfile *frame, int no_lens, 
00083                       void *signal, void *noise, int data_type, 
00084                       int npix, double start);
00085 int dump_2Darray(void **array, int data_type, int npix[], char *name);
00086 
00087 /* File nllsqfit_fn.c */
00088 
00089 long nllsqfit_lorentz(long *mode, long *npts, long *npar, long *ldfj, 
00090                       double par[], double f[], double fjac[], 
00091                       long *nstate, long *iuser, double x_n_sig[]);
00092 long nllsqfit_gaussian(long *mode, long *npts, long *npar, long *ldfj, 
00093                        double par[], double f[], double fjac[], 
00094                        long *nstate, long *iuser, double x_n_sig[]);
00095 long nllsqfit_NNgaussian(long *mode, long *npts, long *npar, long *ldfj, 
00096                          double par[], double f[], double fjac[], 
00097                          long *nstate, long *iuser, double x_n_sig[]);
00098 long nllsqfit_quad(long *mode, long *npts, long *npar, long *ldfj, 
00099                    double par[], double f[], double fjac[], 
00100                    long *nstate, long *iuser, double x_n_sig[]);
00101 
00102 /* File proc_mpup.c */
00103 
00104 int discard_null_mpups(int npup, int **ilist, int **jlist, float **value,
00105                        int ppup[]);
00106 int detect_mpups(IMAGE2D mpup, double threshold, 
00107                  int *ppup[], double *fpup[], float *xpup[], float *ypup[]);
00108 int study_triangulation(IMAGE2D mpup, float xpup[], float ypup[], int npup,
00109                         int iadj[], int iend[], double xtri[], double ytri[], 
00110                         double stri[], double ltri[], double atri[]);
00111 void mpup_orders(double fpup[], int opup[], int npup, 
00112                  double f[3], double df[3]);
00113 void rotate_coord(float x[],float y[],int n,
00114                   float x0,float y0,float angle, float xr[],float yr[]);
00115 int select_mpup_dist(float x0, float y0, float maxdist, 
00116                      int npup, float xpup[], float ypup[], int opup[],
00117                      int icen[]);
00118 int select_mpup_sharpest_smooth(float maxdist,
00119                                 int npup,float xpup[],float ypup[], 
00120                                 int opup[], float spup[], int icen[]);
00121 
00122 /* File fit_mpup.c */
00123 
00124 double gaussian_mpup(double arr[], int n, double x, double step, 
00125                      double par[], double dpar[], double fit[]);
00126 long nllsqfit_distMLA(long *mode, long *npts, long *npar, long *ldfj, 
00127                       double *par, double f[], double fjac[], long *nstate, 
00128                       long *iuser, double user[]);
00129 void model_distMLA(int npup, double dpar[], int npar, 
00130                    float xd[],float yd[],float rd[]);
00131 
00132 double set_geoPSF(float scale);
00133 double geoPSF(double x);
00134 long nllsqfit_globalPSF(long *mode, long *npts, long *npar, long *ldfj, 
00135                         double *par, double fvec[], double fjac[], 
00136                         long *nstate, long *iuser, double x_n_sig[]);
00137 double globalPSF(double x, double psfpar[]);
00138 double deconv_globalPSF(int ngpsf, double psfpar[], double decfac);
00139 double set_corePSF(double psfpar[]);
00140 long nllsqfit_localPSFn(long *mode, long *npts, long *npar, long *ldfj, 
00141                         double *par, double fvec[], double fjac[], 
00142                         long *nstate, long *iuser, double x_n_sig[]);
00143 double final_mpup(double xarr[], int npts, double start, double step, 
00144                   double xloc[], double dxloc[], double xfit[]);
00145 
00146 /* File proc_max.c */
00147 
00148 int search_extrema(double line[], int npts, 
00149                    int imin[], double fmin[], int imax[], double fmax[], 
00150                    int *nlmin);
00151 int search_pack(double line[], int *curpeak, int imax[], int nmax, 
00152                 double threshold, int *packpb, int *packpe);
00153 int locate_peak(max_lines line, double x);
00154 int find_nearest_peak(Maxima_Set *maxset, int iline, float x);
00155 int find_nearest_max(Maxima_Set *maxset, float x,float y, 
00156                      int *iline,int *ipeak);
00157 int open_max(char *maxname, Maxima_Set *maxset);
00158 int pup_get_maxdata(Maxima_Set *maxset, float xpup, float ypup, float lbdapup, 
00159                     SnifsOptics *optics, float pixsize, double lstep,
00160                     double *lbda[], double *dx[], double *sigma[]);
00161 
00162 /* File fit_max.c */
00163 
00164 long nllsqfit_maxpack(long *mode, long *npts, long *npar, long *ldfj, 
00165                       double par[],double fvec[],double fjac[],long *nstate, 
00166                       long *iuser, double x_n_sig[]);
00167 double fit_maxpack(double xarr[], double sarr[], int npts, int npeak, 
00168                    double packpar[], double dpackpar[], double xfit[]);
00169 
00170 /* File proc_config.c */
00171 
00172 float read_lbdaref(void *anyfile);
00173 Channel read_channel(void *anyfile);
00174 int read_focus(void *anyfile);
00175 int read_default_snifs_config(const Channel channel, SnifsConfig *config);
00176 void optics2dval(const SnifsOptics *Optics,double *dval);
00177 void dval2optics(const double *dval,SnifsOptics *Optics);
00178 int write_snifs_config_to_mask(TABLE *mask, SnifsConfig *config);
00179 int read_snifs_config_from_mask(TABLE *mask, SnifsConfig *config);
00180 void print_snifs_optics(const SnifsOptics *Optics);
00181 void print_snifs_telescope(const Telescope *UHT);
00182 void print_snifs_detector(const SnifsDetector *CCD);
00183 void print_snifs_config(const SnifsConfig *config);
00184 
00185 /* File proc_psf.c */
00186 
00187 int read_PSFgeo_param(void *anyfile, double *geo_param[]);
00188 int read_PSFglobal_param(void *anyfile, double *psf_param[]);
00189 int read_PSFlocal_ng(void *anyfile);
00190 int read_corePSF(void *anyfile, CorePSF *psf);
00191 void free_corePSF(CorePSF *psf);
00192 double xdisp_profile(CorePSF *psf, SpectrumCCD *spectrum, float x);
00193 
00194 /* File optics_signature.c */
00195 
00196 double blaze_function(const Grism *grism, int order, double lambda);
00197 double lateral_color_ampl(const CameraCollimator *element, double lambda) ;
00198 double collimator_forward(const CameraCollimator *collimator, double gamma,
00199                           double lambda, double r);
00200 double camera_forward(const CameraCollimator *camera, 
00201                       double lambda, double tantheta);
00202 double invert_camcoll(double y, double e, double b);
00203 void rotation_2D(double *x, double *y, double theta) ;
00204 void refraction(double *x, double *y, double *z, double n1, double n2) ;
00205 void grating_forward(double *x, double *y, double *z, 
00206                      double lambda, double n, double g_per_mm, int order) ;
00207 void grating_backward(double *x, double *y, double *z, 
00208                       double lambda, double n, double g_per_mm, int order) ;
00209 double sellmeier_index(double lambda, const double sellcoeffs[]);
00210 void grism_forward(const Grism *grism, double lambda, 
00211                    double *x, double *y, double *z, int order);
00212 void grism_backward(const Grism *grism, double lambda, 
00213                    double *x, double *y, double *z, int order);
00214 void snifs_optics_forward(const SnifsOptics *optics, 
00215                           double xmla,double ymla, double *xccd,double *yccd, 
00216                           double lambda, int order);
00217 void snifs_optics_backward(const SnifsOptics *optics, 
00218                            double xccd,double yccd, double *xmla,double *ymla, 
00219                            double lambda, int order);
00220 void snifs_optics_test_forward(const SnifsOptics *optics,double xmla,double ymla, 
00221                                double *xccd,double *yccd, 
00222                                double lambda, int order);
00223 void snifs_optics_CCD2MLA(const SnifsOptics *optics, 
00224                           double xccd,double yccd, double *xmla,double *ymla, 
00225                           double pixsize,double lbdaref);
00226 void snifs_optics_MLA2CCD(const SnifsOptics *optics, 
00227                           double xmla,double ymla, double *xccd,double *yccd, 
00228                           double pixsize,double lbda, int order);
00229 
00230 /* File proc_plot.c */
00231 
00232 void plot_set_limits(const float x[],const float y[], int n, PlotLimits *limits);
00233 void plot_increase_limits(PlotLimits *limits);
00234 int inside_plot_limits(float x,float y, PlotLimits limits);
00235 int plot_compticks(int nticks,float min,float max,float *first,float *step);
00236 void plot_set_device(char *devname);
00237 void plot_start(Plot *plot, float scale);
00238 void plot_axes(const Plot *plot, char *xlabel,char *ylabel);
00239 void plot_title(char *title);
00240 void plot_set_bkgnd(IMAGE2D *bkgndima, Plot *plot, float mincut,float maxcut,
00241                     int *nx,int *ny, float ***zmat);
00242 void plot_max(const Maxima_Set *maxset, const Plot *plot, const double shift[]);
00243 void plot_lens(const SnifsOptics *optics, int nopup,float xppup,float yppup, 
00244                int nlbda,const float lbda[], int order,
00245                const Plot *plot, float lbdaref,float pixsize, 
00246                int dxnc, double dxcoeff[], const double shift[],
00247                double *xmla,double *ymla);
00248 void plot_lens_tab(const SnifsOptics *optics, float xppup,float yppup, 
00249                    int nlbda,const float lbda[], int order,
00250                    TABLE *table, const int colid[], int row,
00251                    float lbdaref,float pixsize, 
00252                    int dxnc, double dxcoeff[], const double shift[],
00253                    double *xmla,double *ymla);
00254 void plot_array_err(const PlotSymbol *symbol, float x[], float y[], int n,
00255                     float dx[], float dy[]);
00256 void plot_initialize(Plot *plot, const char *devname, 
00257                      const PlotLimits *limits, const PlotSymbol *symbol, 
00258                      float mincut, float maxcut);
00259 
00260 /* File proc_mask.c */
00261 
00262 void norm_mask_param(Channel channel, double par[MASK_NPARAM]);
00263 void unnorm_mask_param(Channel channel, double par[MASK_NPARAM]);
00264 void set_mask_param_limits(double par[MASK_NPARAM], 
00265                            double parlb[MASK_NPARAM], double parub[MASK_NPARAM]);
00266 void optics2mask_param(SnifsOptics *optics, double par[MASK_NPARAM]);
00267 void mask_param2optics(double par[MASK_NPARAM], SnifsOptics *optics);
00268 void print_mask_param(double par[MASK_NPARAM]);
00269 void print_mask_param_in(double par[MASK_NPARAM], 
00270                          double parlb[MASK_NPARAM], double parub[MASK_NPARAM]);
00271 void print_mask_param_out(double par[MASK_NPARAM], double epar[MASK_NPARAM]);
00272 int open_mask(char *maskname, TABLE *mask, char *mode);
00273 int read_local_model(TABLE *mask, int flag, double ***coeff);
00274 int has_local_model(int nc, double coeff[]);
00275 int read_mask_arc(TABLE *mask, char *maskname, char *refname);
00276 
00277 /* File proc_spectra.c */
00278 
00279 int read_spectra_refcoord(TABLE *mask, SpectrumCCD spectra[]);
00280 int read_spectra_chromatic_model(TABLE *mask, int flag, SpectrumCCD spectra[]);
00281 
00282 /* File proc_misc.c */
00283 
00284 int open_image(IMAGE2D *frame, char *name, char *mode, int class, char *type);
00285 int open_image_ext(IMAGE2D *signal, IMAGE2D *variance, 
00286                    char *name, char *mode, int class, char *type);
00287 float read_mean_RoN(void *anyfile, Channel channel);
00288 float read_jdate(void *anyfile);
00289 float check_jdate(char *arcname, float cal_jdate, 
00290                   char *objname, float obj_jdate);
00291 void read_ima_axes(IMAGE2D *inframe, char xlab[], char ylab[]);
00292 
00293 /* File proc_corr.c */
00294 
00295 int extract_arc(const IMAGE2D *frame, int npix, double **tab);
00296 void negate_2D(double **I, int nx, int ny);
00297 void complex_product_2D(double **AR, double **AI, 
00298                         double **BR, double **BI,
00299                         int nx, int ny, double **CR, double **CI);
00300 int FFT2D_real(double **in, int nx, int ny, double **outR, double **outI);
00301 int iFFT2D_real(double **inR, double **inI, int nx, int ny, double **outR);
00302 int correlation2D(double **A, double **B, int nx, int ny, double **X);
00303 long nllsqfit_2Dgauss(long *mode,long *npts,long *npar,long *ldfj,double *par,
00304                       double *f, double *fjac, long *nstate, long *iuser,
00305                       double *user);
00306 int Fit_Xpeak(double **ref_tab, double **cur_tab, int nx, int ny, 
00307               int winx, int winy, double par[6], double epar[6]);
00308 
00309 /* File proc_extract.c */
00310 
00311 int good_neighbor(float *ylo, float *yup, int *neighbors, float y);
00312 int good_neighbor_spectrum(SpectrumCCD spectra[], int neighbors[], float y);
00313 void interpolate_y2lbda(int n, double y[], double signal[], double variance[],
00314                         int yofl_deg, float yofl_coeffs[],
00315                         SPECTRUM *spectrum, SPECTRUM *noise);
00316 
00317 /* File proc_shift.c */
00318 
00319 void comp_mean_disp(double parpeak[6], double eparpeak[6], 
00320                     double *msig, double *emsig);
00321 void print_parpeak(double parpeak[6], double eparpeak[6]);
00322 int comp_calibration_offsets(char *refName, 
00323                              char *arcName, float *arcAirmass, float *arcJDate,
00324                              char *arc2Name,float *arc2Airmass,float *arc2JDate,
00325                              float offset[2]);
00326 int comp_specres(char *arcName, float *specres);
00327 
00328 #endif /* _EXTRACT_H */
00329 

Generated on Wed Oct 26 23:59:39 2005 for Snifs by doxygen 1.3.5