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 /* ===== Function prototyping ============================== */
00056 
00057 /* File least_sq.c */
00058 
00059 void nllsqfit_noderiv();
00060 
00061 /* File io.c */
00062 
00063 int get_lenses_col(E3D_file *frame, char *lab_col, void *zlens, int *il);
00064 double RD_frame_interp(IMAGE2D *frame, double x,double y);
00065 
00066 /* File filter.c */
00067 
00068 void spatial_filter(int nrow, float X[], float Y[], float Z[], float rad,
00069                     char method, int minNnb, int Nnb[]);
00070 
00071 /* File stats.c */
00072 
00073 void frame_stats(const IMAGE2D *frame, double *mean, double *sigma, 
00074                  double *median, double *sigmed);
00075 SPECTRUM *array_histo(const double *array, int npts, 
00076                       double min, double max, int nbin);
00077 SPECTRUM *subframe_histo(const IMAGE2D *frame, 
00078                          int imin, int imax, int jmin, int jmax, 
00079                          double min, double max, int nbin);
00080 SPECTRUM *frame_histo(const IMAGE2D *frame, double min, double max, int nbin);
00081 double histo_threshold(const SPECTRUM *histospec, float frac);
00082 float median_f(const float x[], int n);
00083 double mean_sig_f(const float x[], int n, double *mean, double *sigma);
00084 void minmax(const double x[], int n, double *min, double *max, int *imin, int *imax);
00085 void minmax_f(const float x[], int n, float *min, float *max, int *imin, int *imax);
00086 int locate_sorted(const double x[], int n, double x0);
00087 void invert_indexx(const int idx[], int n);
00088 
00089 int Fit_polynom2(float *x, float *y, int npts, int input_degree, int *output_degree,
00090                  float *coef, float *dy, float *chi2);
00091 
00092 /* File dump.c */
00093 
00094 int dump_spec_mem(SPECTRUM *spectrum, char *name, char *ident, char *unit, 
00095                   int fclass);
00096 void put_tiger_arrays(TIGERfile *frame, int no_lens, 
00097                       void *signal, void *noise, int data_type, 
00098                       int npix, double start);
00099 int dump_2Darray(void **array, int data_type, int npix[], char *name);
00100 
00101 /* File nllsqfit_fn.c */
00102 
00103 long nllsqfit_lorentz(long *mode, long *npts, long *npar, long *ldfj, 
00104                       double par[], double f[], double fjac[], 
00105                       long *nstate, long *iuser, double x_n_sig[]);
00106 long nllsqfit_gaussian(long *mode, long *npts, long *npar, long *ldfj, 
00107                        double par[], double f[], double fjac[], 
00108                        long *nstate, long *iuser, double x_n_sig[]);
00109 long nllsqfit_NNgaussian(long *mode, long *npts, long *npar, long *ldfj, 
00110                          double par[], double f[], double fjac[], 
00111                          long *nstate, long *iuser, double x_n_sig[]);
00112 long nllsqfit_quad(long *mode, long *npts, long *npar, long *ldfj, 
00113                    double par[], double f[], double fjac[], 
00114                    long *nstate, long *iuser, double x_n_sig[]);
00115 
00116 /* File proc_mpup.c */
00117 
00118 int discard_null_mpups(int npup, int **ilist, int **jlist, float **value,
00119                        int ppup[]);
00120 int detect_mpups(IMAGE2D mpup, double threshold, 
00121                  int *ppup[], double *fpup[], float *xpup[], float *ypup[]);
00122 int study_triangulation(IMAGE2D mpup, float xpup[], float ypup[], int npup,
00123                         int iadj[], int iend[], double xtri[], double ytri[], 
00124                         double stri[], double ltri[], double atri[]);
00125 void mpup_orders(double fpup[], int opup[], int npup, 
00126                  double f[3], double df[3]);
00127 void rotate_coord(float x[],float y[],int n,
00128                   float x0,float y0,float angle, float xr[],float yr[]);
00129 int select_mpup_dist(float x0, float y0, float maxdist, 
00130                      int npup, float xpup[], float ypup[], int opup[],
00131                      int icen[]);
00132 int select_mpup_sharpest_smooth(float maxdist,
00133                                 int npup,float xpup[],float ypup[], 
00134                                 int opup[], float spup[], int icen[]);
00135 
00136 /* File fit_mpup.c */
00137 
00138 double gaussian_mpup(double arr[], int n, double x, double step, 
00139                      double par[], double dpar[], double fit[]);
00140 long nllsqfit_distMLA(long *mode, long *npts, long *npar, long *ldfj, 
00141                       double *par, double f[], double fjac[], long *nstate, 
00142                       long *iuser, double user[]);
00143 void model_distMLA(int npup, double dpar[], int npar, 
00144                    float xd[],float yd[],float rd[]);
00145 
00146 double set_geoPSF(float scale);
00147 double geoPSF(double x);
00148 long nllsqfit_globalPSF(long *mode, long *npts, long *npar, long *ldfj, 
00149                         double *par, double fvec[], double fjac[], 
00150                         long *nstate, long *iuser, double x_n_sig[]);
00151 double globalPSF(double x, double psfpar[]);
00152 double deconv_globalPSF(int ngpsf, double psfpar[], double decfac);
00153 double set_corePSF(double psfpar[]);
00154 long nllsqfit_localPSFn(long *mode, long *npts, long *npar, long *ldfj, 
00155                         double *par, double fvec[], double fjac[], 
00156                         long *nstate, long *iuser, double x_n_sig[]);
00157 double final_mpup(double xarr[], int npts, double start, double step, 
00158                   double xloc[], double dxloc[], double xfit[]);
00159 
00160 /* File proc_max.c */
00161 
00162 int search_extrema(double line[], int npts, 
00163                    int imin[], double fmin[], int imax[], double fmax[], 
00164                    int *nlmin);
00165 int search_pack(double line[], int *curpeak, int imax[], int nmax, 
00166                 double threshold, int *packpb, int *packpe);
00167 int locate_peak(max_lines line, double x);
00168 int find_nearest_peak(Maxima_Set *maxset, int iline, float x);
00169 int find_nearest_max(Maxima_Set *maxset, float x,float y, 
00170                      int *iline,int *ipeak);
00171 int open_max(char *maxname, Maxima_Set *maxset);
00172 int pup_get_maxdata(Maxima_Set *maxset, float xpup, float ypup, float lbdapup, 
00173                     SnifsOptics *optics, float pixsize, double lstep,
00174                     double *lbda[], double *dx[], double *sigma[]);
00175 
00176 /* File fit_max.c */
00177 
00178 long nllsqfit_maxpack(long *mode, long *npts, long *npar, long *ldfj, 
00179                       double par[],double fvec[],double fjac[],long *nstate, 
00180                       long *iuser, double x_n_sig[]);
00181 double Fit_pack(double xarr[], int npts, int npeak, 
00182                 double packpar[], double dpackpar[], double xfit[]);
00183 
00184 /* File proc_config.c */
00185 
00186 int read_PSFgeo_param(void *anyfile, double *geo_param[]);
00187 int read_PSFglobal_param(void *anyfile, double *psf_param[]);
00188 int read_PSFlocal_ng(void *anyfile);
00189 float read_lbdaref(void *anyfile);
00190 Channel read_channel(void *anyfile);
00191 int read_focus(void *anyfile);
00192 int read_default_snifs_config(const Channel channel, SnifsConfig *config);
00193 void optics2dval(const SnifsOptics *Optics,double *dval);
00194 void dval2optics(const double *dval,SnifsOptics *Optics);
00195 int write_snifs_config_to_mask(TABLE *mask, SnifsConfig *config);
00196 int read_snifs_config_from_mask(TABLE *mask, SnifsConfig *config);
00197 void print_snifs_optics(const SnifsOptics *Optics);
00198 void print_snifs_telescope(const Telescope *UHT);
00199 void print_snifs_detector(const SnifsDetector *CCD);
00200 void print_snifs_config(const SnifsConfig *config);
00201 
00202 /* File optics_signature.c */
00203 
00204 double blaze_function(const Grism *grism, int order, double lambda);
00205 double lateral_color_ampl(const CameraCollimator *element, double lambda) ;
00206 double collimator_forward(const CameraCollimator *collimator, double gamma,
00207                           double lambda, double r);
00208 double camera_forward(const CameraCollimator *camera, 
00209                       double lambda, double tantheta);
00210 double invert_camcoll(double y, double e, double b);
00211 void rotation_2D(double *x, double *y, double theta) ;
00212 void refraction(double *x, double *y, double *z, double n1, double n2) ;
00213 void grating_forward(double *x, double *y, double *z, 
00214                      double lambda, double n, double g_per_mm, int order) ;
00215 void grating_backward(double *x, double *y, double *z, 
00216                       double lambda, double n, double g_per_mm, int order) ;
00217 double sellmeier_index(double lambda, const double sellcoeffs[]);
00218 void grism_forward(const Grism *grism, double lambda, 
00219                    double *x, double *y, double *z, int order);
00220 void grism_backward(const Grism *grism, double lambda, 
00221                    double *x, double *y, double *z, int order);
00222 void snifs_optics_forward(const SnifsOptics *optics, 
00223                           double xmla,double ymla, double *xccd,double *yccd, 
00224                           double lambda, int order);
00225 void snifs_optics_backward(const SnifsOptics *optics, 
00226                            double xccd,double yccd, double *xmla,double *ymla, 
00227                            double lambda, int order);
00228 void snifs_optics_test_forward(const SnifsOptics *optics,double xmla,double ymla, 
00229                                double *xccd,double *yccd, 
00230                                double lambda, int order);
00231 void snifs_optics_CCD2MLA(const SnifsOptics *optics, 
00232                           double xccd,double yccd, double *xmla,double *ymla, 
00233                           double pixsize,double lbdaref);
00234 void snifs_optics_MLA2CCD(const SnifsOptics *optics, 
00235                           double xmla,double ymla, double *xccd,double *yccd, 
00236                           double pixsize,double lbda, int order);
00237 
00238 /* File proc_plot.c */
00239 
00240 void plot_set_limits(const float x[],const float y[], int n, PlotLimits *limits);
00241 void plot_increase_limits(PlotLimits *limits);
00242 int inside_plot_limits(float x,float y, PlotLimits limits);
00243 int plot_compticks(int nticks,float min,float max,float *first,float *step);
00244 void plot_start(Plot *plot, float scale);
00245 void plot_axes(const Plot *plot, char *xlabel,char *ylabel);
00246 void plot_title(char *title);
00247 void plot_set_bkgnd(IMAGE2D *bkgndima, Plot *plot, float mincut,float maxcut,
00248                     int *nx,int *ny, float ***zmat);
00249 void plot_max(const Maxima_Set *maxset, const Plot *plot, const double shift[]);
00250 void plot_lens(const SnifsOptics *optics, int nopup,float xppup,float yppup, 
00251                int nlbda,const float lbda[], int order,
00252                const Plot *plot, float lbdaref,float pixsize, 
00253                int dxnc, double *dxcoeff, const double shift[],
00254                double *xmla,double *ymla);
00255 void plot_lens_tab(const SnifsOptics *optics, float xppup,float yppup, 
00256                    int nlbda,const float lbda[], int order,
00257                    TABLE *table, const int colid[], int row,
00258                    float lbdaref,float pixsize, 
00259                    int dxnc, double *dxcoeff, const double shift[],
00260                    double *xmla,double *ymla);
00261 void plot_array_err(const PlotSymbol *symbol, float x[], float y[], int n,
00262                     float dx[], float dy[]);
00263 void plot_initialize(Plot *plot, int GRAPH, const char *devname, 
00264                      const PlotLimits *limits, const PlotSymbol *symbol, 
00265                      float mincut, float maxcut);
00266 
00267 /* File proc_mask.c */
00268 
00269 void norm_mask_param(Channel channel, double par[16]);
00270 void unnorm_mask_param(Channel channel, double par[16]);
00271 void set_mask_param_limits(double par[16], double parlb[16], double parub[16]);
00272 void optics2mask_param(SnifsOptics *optics, double par[16]);
00273 void mask_param2optics(double par[16], SnifsOptics *optics);
00274 void print_mask_param(double par[16]);
00275 void print_mask_param_in(double par[16], double parlb[16], double parub[16]);
00276 void print_mask_param_out(double par[16], double epar[16]);
00277 int open_mask(char *maskname, TABLE *mask, char *mode);
00278 int read_local_model(TABLE *mask, int flag, double ***coeff);
00279 
00280 /* File proc_misc.c */
00281 
00282 int open_image(IMAGE2D *frame, char *name, char *mode, int class, char *type);
00283 int open_image_ext(IMAGE2D *signal, IMAGE2D *variance, 
00284                    char *name, char *mode, int class, char *type);
00285 float read_mean_RoN(void *anyfile, Channel channel);
00286 float read_airmass(void *anyfile);
00287 float read_juliandate(void *anyfile);
00288 float check_airmass(char *arcname, float cal_airmass, 
00289                     char *objname, float obj_airmass);
00290 float check_jdate(char *arcname, float cal_jdate, 
00291                   char *objname, float obj_jdate);
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 double Mpup_PSF(int no, float x);
00312 int good_neighbor(float *ylo, float *yup, int *neighbors, float y);
00313 
00314 /* File proc_shift.c */
00315 
00316 void comp_mean_disp(double parpeak[6], double eparpeak[6], 
00317                     double *msig, double *emsig);
00318 void print_parpeak(double parpeak[6], double eparpeak[6], 
00319                    double msig, double emsig);
00320 int comp_calibration_offsets(char *refname, float *ref_airmass, 
00321                              char *arcname, float *cal_airmass, float *cal_jdate,
00322                              char *arc2name, float *cal2_airmass, float *cal2_jdate,
00323                              double shift[2]);
00324 
00325 #endif /* _EXTRACT_H */
00326 
00327 /* 
00328 ;;; Local Variables: ***
00329 ;;; eval: (add-to-list 'c-font-lock-extra-types "Channel") ***
00330 ;;; eval: (add-to-list 'c-font-lock-extra-types "CameraCollimator") ***
00331 ;;; eval: (add-to-list 'c-font-lock-extra-types "Grism") ***
00332 ;;; eval: (add-to-list 'c-font-lock-extra-types "SnifsConfig") ***
00333 ;;; eval: (add-to-list 'c-font-lock-extra-types "SnifsOptics") ***
00334 ;;; eval: (add-to-list 'c-font-lock-extra-types "SnifsDetector") ***
00335 ;;; eval: (add-to-list 'c-font-lock-extra-types "PlotLimits") ***
00336 ;;; eval: (add-to-list 'c-font-lock-extra-types "Plot") ***
00337 ;;; End: ***
00338 */
00339 

Generated on Tue Nov 23 18:04:18 2004 for Snifs by doxygen 1.3.3