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

extract/incl/extract.h File Reference

extract specific function prototyping and define More...

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define FMP_XC   1027.
#define FMP_YC   1770.
 Center of distortion.

#define FMP_LENSSNORM   1.e2
#define FMP_ANGLENORM   6.e-2
#define FMP_POSITNORM   1.e3
#define FMP_ALPHANORM   1.e-8
 Normalization factors.

#define FMP_IPSFNORM   1.e2
#define FMP_XPSFNORM   0.5
 Normalization factors.

#define FMP_IPUPNORM   60.
#define FMP_XPUPNORM   0.3
#define FMP_SPUPNORM   0.1
 Normalization factors.

#define FMX_TOOFAR   2.
 Limit factor (in interpsec unit) for neighbourhood criterion.

#define FMX_SIGMA_CLIP   5.
 Sigma-clipping factor for the threshold computation.

#define MASK_NPARAM   16
 Number of mask adjustable parameters.


Functions

void nllsqfit_noderiv ()
 Allow nllsqfit_bnd to be used without derivatives.

int get_lenses_col (E3D_file *frame, char *lab_col, void *zlens, int *il)
 Get spaxel-related quantities from table.

double RD_frame_interp (IMAGE2D *frame, double x, double y)
 Interpolated RD_frame.

void spatial_filter (int nrow, float X[], float Y[], float Z[], float rad, char method, int minNnb, int Nnb[])
 Spatial filtering (median or average) of arrays.

int dump_dbgArray (void *array, int type, int npts, char *dbgname, SPECTRUM *refspec)
int dump_spec_mem (SPECTRUM *spectrum, char *name, char *ident, char *unit, int fclass)
void put_tiger_arrays (TIGERfile *frame, int no_lens, void *signal, void *noise, int data_type, int npix, double start)
 Store arrays as cube spectra in signal and/or noise channels.

int dump_2Darray (void **array, int data_type, int npix[], char *name)
 Dump a 2D-array in an image (starts={0,0}, steps={1,1}).

long nllsqfit_lorentz (long *mode, long *npts, long *npar, long *ldfj, double par[], double f[], double fjac[], long *nstate, long *iuser, double x_n_sig[])
long nllsqfit_gaussian (long *mode, long *npts, long *npar, long *ldfj, double par[], double f[], double fjac[], long *nstate, long *iuser, double x_n_sig[])
long nllsqfit_NNgaussian (long *mode, long *npts, long *npar, long *ldfj, double par[], double f[], double fjac[], long *nstate, long *iuser, double x_n_sig[])
long nllsqfit_quad (long *mode, long *npts, long *npar, long *ldfj, double par[], double f[], double fjac[], long *nstate, long *iuser, double x_n_sig[])
int discard_null_mpups (int npup, int **ilist, int **jlist, float **value, int ppup[])
 Remove empty classes from mpup list.

int detect_mpups (IMAGE2D mpup, double threshold, int *ppup[], double *fpup[], float *xpup[], float *ypup[])
 Detect mpups in input frame and compute associated quantities.

int study_triangulation (IMAGE2D mpup, float xpup[], float ypup[], int npup, int iadj[], int iend[], double xtri[], double ytri[], double stri[], double ltri[], double atri[])
 Study of the (raw) mpup triangulation.

void mpup_orders (double fpup[], int opup[], int npup, double f[3], double df[3])
 Classify mpups according to their orders and compute mean fluxes.

void rotate_coord (float x[], float y[], int n, float x0, float y0, float angle, float xr[], float yr[])
 Rotate coordinates.

int select_mpup_dist (float x0, float y0, float maxdist, int npup, float xpup[], float ypup[], int opup[], int icen[])
 Select mpups according to distance criterion.

int select_mpup_sharpest_smooth (float maxdist, int npup, float xpup[], float ypup[], int opup[], float spup[], int icen[])
 Select mpups closest to the (median-smoothed) sharpest one.

double gaussian_mpup (double arr[], int n, double x, double step, double par[], double dpar[], double fit[])
 Fit a pure gaussian profile (nllsqfit_gaussian) to the mpup.

long nllsqfit_distMLA (long *mode, long *npts, long *npar, long *ldfj, double *par, double f[], double fjac[], long *nstate, long *iuser, double user[])
void model_distMLA (int npup, double dpar[], int npar, float xd[], float yd[], float rd[])
double set_geoPSF (float scale)
double geoPSF (double x)
 Geometric PSF profile, according to global parameters.

long nllsqfit_globalPSF (long *mode, long *npts, long *npar, long *ldfj, double *par, double fvec[], double fjac[], long *nstate, long *iuser, double x_n_sig[])
double globalPSF (double x, double psfpar[])
 Global PSF profile, according to parameters psfpar.

double deconv_globalPSF (int ngpsf, double psfpar[], double decfac)
 Partial deconvolution of the global PSF.

double set_corePSF (double psfpar[])
long nllsqfit_localPSFn (long *mode, long *npts, long *npar, long *ldfj, double *par, double fvec[], double fjac[], long *nstate, long *iuser, double x_n_sig[])
double final_mpup (double xarr[], int npts, double start, double step, double xloc[], double dxloc[], double xfit[])
 Final fit (nllsqfit_localPSFn) of the mpup profile.

int search_extrema (double line[], int npts, int imin[], double fmin[], int imax[], double fmax[], int *nlmin)
 Look for extrema (one minimum + one maximum) in current line.

int search_pack (double line[], int *curpeak, int imax[], int nmax, double threshold, int *packpb, int *packpe)
 Look for next pack of peak in current line.

int locate_peak (max_lines line, double x)
 Locate a peak in a sorted max line from its position.

int find_nearest_peak (Maxima_Set *maxset, int iline, float x)
 Find nearest peak in a given line of a maxima set.

int find_nearest_max (Maxima_Set *maxset, float x, float y, int *iline, int *ipeak)
 Find nearest line and peak in the maxima set.

int open_max (char *maxname, Maxima_Set *maxset)
 Open a max file.

int pup_get_maxdata (Maxima_Set *maxset, float xpup, float ypup, float lbdapup, SnifsOptics *optics, float pixsize, double lstep, double *lbda[], double *dx[], double *sigma[])
 Associate lens number and max data.

long nllsqfit_maxpack (long *mode, long *npts, long *npar, long *ldfj, double par[], double fvec[], double fjac[], long *nstate, long *iuser, double x_n_sig[])
double fit_maxpack (double xarr[], double sarr[], int npts, int npeak, double packpar[], double dpackpar[], double xfit[])
 Simultaneous fit of a pack of peaks.

float read_lbdaref (void *anyfile)
 Read reference wavelength in descriptor MPUP_LBDAPUP.

Channel read_channel (void *anyfile)
 Read channel in descriptor CHANNEL.

int read_focus (void *anyfile)
 Read camera/collimator position.

int read_default_snifs_config (const Channel channel, SnifsConfig *config)
 Read default SNIFS configuration.

void optics2dval (const SnifsOptics *Optics, double *dval)
 SnifsOptics structure to double array convertor

void dval2optics (const double *dval, SnifsOptics *Optics)
int write_snifs_config_to_mask (TABLE *mask, SnifsConfig *config)
 Write configuration structures to mask.

int read_snifs_config_from_mask (TABLE *mask, SnifsConfig *config)
 Set configuration structure from mask.

void print_snifs_optics (const SnifsOptics *Optics)
 Print out a Tiger_optics structure elements.

void print_snifs_telescope (const Telescope *UHT)
 Print out a Telescope structure elements.

void print_snifs_detector (const SnifsDetector *CCD)
 Print out a Detector structure elements.

void print_snifs_config (const SnifsConfig *config)
 Print out the full SNIFS config.

int read_PSFgeo_param (void *anyfile, double *geo_param[])
int read_PSFglobal_param (void *anyfile, double *psf_param[])
int read_PSFlocal_ng (void *anyfile)
int read_corePSF (void *anyfile, CorePSF *psf)
 Set the CorePSF psf from mask descriptors.

void free_corePSF (CorePSF *psf)
 CorePSF structure memory cleaner.

double xdisp_profile (CorePSF *psf, SpectrumCCD *spectrum, float x)
 Integral over a pixel of the cross-dispersion model profile.

double blaze_function (const Grism *grism, int order, double lambda)
 Return the blaze function of the grism.

double lateral_color_ampl (const CameraCollimator *element, double lambda)
 Compute lateral color for camera or collimator.

double collimator_forward (const CameraCollimator *collimator, double gamma, double lambda, double r)
 Light propagation through the collimator, forward.

double camera_forward (const CameraCollimator *camera, double lambda, double tantheta)
 Light propagation through the camera, forward.

double invert_camcoll (double y, double e, double b)
 Inversion of $y=x(ex^2+b)$.

void rotation_2D (double *x, double *y, double theta)
 2D-rotation

void refraction (double *x, double *y, double *z, double n1, double n2)
 Refraction law from 1 to 2.

void grating_forward (double *x, double *y, double *z, double lambda, double n, double g_per_mm, int order)
 Light propagation through a grating, forward.

void grating_backward (double *x, double *y, double *z, double lambda, double n, double g_per_mm, int order)
 Light propagation through a grating, backward.

double sellmeier_index (double lambda, const double sellcoeffs[])
 Compute refractive index from Sellmeier coefficients.

void grism_forward (const Grism *grism, double lambda, double *x, double *y, double *z, int order)
 Light propagation through a grism, forward.

void grism_backward (const Grism *grism, double lambda, double *x, double *y, double *z, int order)
 Light propagation through a grism, backward.

void snifs_optics_forward (const SnifsOptics *optics, double xmla, double ymla, double *xccd, double *yccd, double lambda, int order)
 Light propagation through the Snifs instrument, forward.

void snifs_optics_backward (const SnifsOptics *optics, double xccd, double yccd, double *xmla, double *ymla, double lambda, int order)
 Light propagation through the Snifs instrument, backward.

void snifs_optics_test_forward (const SnifsOptics *optics, double xmla, double ymla, double *xccd, double *yccd, double lambda, int order)
 Testing version of snifs_optics_forward.

void snifs_optics_CCD2MLA (const SnifsOptics *optics, double xccd, double yccd, double *xmla, double *ymla, double pixsize, double lbdaref)
 Wrapper to snifs_optics_backward, [CCD/px] to [MLA/mm].

void snifs_optics_MLA2CCD (const SnifsOptics *optics, double xmla, double ymla, double *xccd, double *yccd, double pixsize, double lbda, int order)
 Wrapper to snifs_optics_forward, [MLA/mm] to [CCD/px].

void plot_set_limits (const float x[], const float y[], int n, PlotLimits *limits)
 Set limits of the plot.

void plot_increase_limits (PlotLimits *limits)
 Increase plot limits by 10% (or to valid range if min=max).

int inside_plot_limits (float x, float y, PlotLimits limits)
 Test if point is inside plot limits.

int plot_compticks (int nticks, float min, float max, float *first, float *step)
void plot_set_device (char *devname)
 Set the DISLIN output device or file from the device name.

void plot_start (Plot *plot, float scale)
 Initialize and set various default quantities for a DISLIN 2D-plot.

void plot_axes (const Plot *plot, char *xlabel, char *ylabel)
 Plot the axes in a DISLIN 2D-plot.

void plot_title (char *title)
 Plot the title strings.

void plot_set_bkgnd (IMAGE2D *bkgndima, Plot *plot, float mincut, float maxcut, int *nx, int *ny, float ***zmat)
 Set a background plot.

void plot_max (const Maxima_Set *maxset, const Plot *plot, const double shift[])
 Plot max data.

void plot_lens (const SnifsOptics *optics, int nopup, float xppup, float yppup, int nlbda, const float lbda[], int order, const Plot *plot, float lbdaref, float pixsize, int dxnc, double dxcoeff[], const double shift[], double *xmla, double *ymla)
 Plot a lens spectrum onto the CCD.

void plot_lens_tab (const SnifsOptics *optics, float xppup, float yppup, int nlbda, const float lbda[], int order, TABLE *table, const int colid[], int row, float lbdaref, float pixsize, int dxnc, double dxcoeff[], const double shift[], double *xmla, double *ymla)
 Plot a lens spectrum onto the CCD (table storage).

void plot_array_err (const PlotSymbol *symbol, float x[], float y[], int n, float dx[], float dy[])
 DISLIN curve with errors.

void plot_initialize (Plot *plot, const char *devname, const PlotLimits *limits, const PlotSymbol *symbol, float mincut, float maxcut)
 Initialize a Plot structure.

void norm_mask_param (Channel channel, double par[MASK_NPARAM])
 Mask parameters normalization.

void unnorm_mask_param (Channel channel, double par[MASK_NPARAM])
 Mask parameters unnormalization.

void set_mask_param_limits (double par[MASK_NPARAM], double parlb[MASK_NPARAM], double parub[MASK_NPARAM])
 Set limits to mask parameters.

void optics2mask_param (SnifsOptics *optics, double par[MASK_NPARAM])
 Copy mask parameters from SnifsOptics.

void mask_param2optics (double par[MASK_NPARAM], SnifsOptics *optics)
 Copy mask parameters to SnifsOptics.

void print_mask_param (double par[MASK_NPARAM])
 Print-out (non-normalized) mask parameters.

void print_mask_param_in (double par[MASK_NPARAM], double parlb[MASK_NPARAM], double parub[MASK_NPARAM])
 Print-out (non-norm.) mask parameters (including fit boundaries).

void print_mask_param_out (double par[MASK_NPARAM], double epar[MASK_NPARAM])
 Print-out (non-norm.) mask parameters (including fit errors).

int open_mask (char *maskname, TABLE *mask, char *mode)
 Open a mask table.

int read_local_model (TABLE *mask, int flag, double ***coeff)
 Read local coeffs from mask (position adjusment or sigma).

int has_local_model (int nc, double coeff[])
 Check if the local adjustment is valid (i.e. some coeffs are non-null).

int read_mask_arc (TABLE *mask, char *maskname, char *refname)
 Read reference arc from mask, including path.

int read_spectra_refcoord (TABLE *mask, SpectrumCCD spectra[])
 Set basic quantities of an array of CCD spectra from mask columns.

int read_spectra_chromatic_model (TABLE *mask, int flag, SpectrumCCD spectra[])
int open_image (IMAGE2D *frame, char *name, char *mode, int class, char *type)
 Open a frame and check FCLASS.

int open_image_ext (IMAGE2D *signal, IMAGE2D *variance, char *name, char *mode, int class, char *type)
float read_mean_RoN (void *anyfile, Channel channel)
 Compute mean RoN from RDNOISE descriptors.

float read_jdate (void *anyfile)
 Read JDATE descriptor (defaulted to 0) from open file.

float check_jdate (char *arcname, float cal_jdate, char *objname, float obj_jdate)
 Check julian date consistency between two exposures.

void read_ima_axes (IMAGE2D *inframe, char xlab[], char ylab[])
 Read axes labels (LABX and LABY) from (reconstructed) image.

int extract_arc (const IMAGE2D *frame, int npix, double **tab)
 Extract central part of arc exposure.

void negate_2D (double **I, int nx, int ny)
 Negate a nx*ny 2D array.

void complex_product_2D (double **AR, double **AI, double **BR, double **BI, int nx, int ny, double **CR, double **CI)
 Compute the complex product C = A * B for nx*ny 2D arrays.

int FFT2D_real (double **in, int nx, int ny, double **outR, double **outI)
 FFT of a nx*ny 2D real dataset.

int iFFT2D_real (double **inR, double **inI, int nx, int ny, double **outR)
 Inverse FFT (real part) of a nx*ny 2D dataset.

int correlation2D (double **A, double **B, int nx, int ny, double **X)
 Compute correlation of nx*ny 2D arrays A and B.

long nllsqfit_2Dgauss (long *mode, long *npts, long *npar, long *ldfj, double *par, double *f, double *fjac, long *nstate, long *iuser, double *user)
int Fit_Xpeak (double **ref_tab, double **cur_tab, int nx, int ny, int winx, int winy, double par[6], double epar[6])
int good_neighbor (float *ylo, float *yup, int *neighbors, float y)
 Find the good neighbor among 2 candidates.

int good_neighbor_spectrum (SpectrumCCD spectra[], int neighbors[], float y)
 Find the good neighbor among 2 candidates.

void interpolate_y2lbda (int n, double y[], double signal[], double variance[], int yofl_deg, float yofl_coeffs[], SPECTRUM *spectrum, SPECTRUM *noise)
 Interpolate CCD spectrum to cube spectrum.

void comp_mean_disp (double parpeak[6], double eparpeak[6], double *msig, double *emsig)
 Convert correlation-peak quantities to intrinsic quantities.

void print_parpeak (double parpeak[6], double eparpeak[6])
 Print-out correlation-peak quantities.

int comp_calibration_offsets (char *refName, char *arcName, float *arcAirmass, float *arcJDate, char *arc2Name, float *arc2Airmass, float *arc2JDate, float offset[2])
 Compute the offset between reference and calibration frames.

int comp_specres (char *arcName, float *specres)


Detailed Description

extract specific function prototyping and define

Copyright:
(c) 2002 IPNL
Date:
Date
2005/10/05 22:44:30
Author:
Yannick Copin <y.copin@ipnl.in2p3.fr>

Author
ycopin
Version:
Revision
1.42
Id
extract.h,v 1.42 2005/10/05 22:44:30 ycopin Exp

Note:
Can somebody explain me the use of const and extern declarations?

Definition in file extract.h.


Define Documentation

#define FMP_XC   1027.
 

Definition at line 27 of file extract.h.

Referenced by main().

#define FMP_YC   1770.
 

Center of distortion.

Definition at line 28 of file extract.h.

Referenced by main().

#define FMP_LENSSNORM   1.e2
 

Definition at line 29 of file extract.h.

Referenced by main(), and nllsqfit_distMLA().

#define FMP_ANGLENORM   6.e-2
 

Definition at line 30 of file extract.h.

Referenced by main(), and nllsqfit_distMLA().

#define FMP_POSITNORM   1.e3
 

Definition at line 31 of file extract.h.

Referenced by main(), and nllsqfit_distMLA().

#define FMP_ALPHANORM   1.e-8
 

Normalization factors.

Definition at line 32 of file extract.h.

Referenced by main(), and nllsqfit_distMLA().

#define FMP_IPSFNORM   1.e2
 

Definition at line 36 of file extract.h.

Referenced by main(), and nllsqfit_globalPSF().

#define FMP_XPSFNORM   0.5
 

Normalization factors.

Definition at line 37 of file extract.h.

Referenced by main(), and nllsqfit_globalPSF().

#define FMP_IPUPNORM   60.
 

Definition at line 41 of file extract.h.

Referenced by final_mpup(), nllsqfit_localPSF(), and nllsqfit_localPSFn().

#define FMP_XPUPNORM   0.3
 

Definition at line 42 of file extract.h.

Referenced by final_mpup(), nllsqfit_localPSF(), and nllsqfit_localPSFn().

#define FMP_SPUPNORM   0.1
 

Normalization factors.

Definition at line 43 of file extract.h.

Referenced by final_mpup(), nllsqfit_localPSF(), and nllsqfit_localPSFn().

#define FMX_TOOFAR   2.
 

Limit factor (in interpsec unit) for neighbourhood criterion.

Definition at line 48 of file extract.h.

Referenced by main(), and search_pack().

#define FMX_SIGMA_CLIP   5.
 

Sigma-clipping factor for the threshold computation.

Definition at line 54 of file extract.h.

Referenced by main().

#define MASK_NPARAM   16
 

Number of mask adjustable parameters.

Definition at line 59 of file extract.h.

Referenced by set_mask_param_limits().


Function Documentation

void nllsqfit_noderiv  ) 
 

Allow nllsqfit_bnd to be used without derivatives.

Definition at line 25 of file least_sq.c.

Referenced by main().

int get_lenses_col E3D_file *  frame,
char *  lab_col,
void *  zlens,
int *  il
 

Get spaxel-related quantities from table.

Parameters:
frame E3D file structure
lab_col Column label
zlens List of quantities
il List of table rows
Returns:
Status
Note:
Based on get_lenses_coord

Todo:
In the E3D case, one has to specify the science table extension name in which to look to for the specified column. For the moment, look in the table associated to the cube (the data table?)

Definition at line 41 of file io.c.

References InputIO.

Referenced by main().

double RD_frame_interp IMAGE2D *  frame,
double  x,
double  y
 

Interpolated RD_frame.

Read a frame at a given world-coordinate (x,y). E.g. if

\[ (x,y) = (startx + i\times stepx, starty + j\times stepy) \]

then returns RD_frame(frame,i,j).

Parameters:
frame Input frame
x 
y Input world coordinates
Returns:
Interpolated value (or MAXDOUBLE if outside frame)

Definition at line 121 of file io.c.

References x.

Referenced by nllsqfit_mask().

void spatial_filter int  nrow,
float  X[],
float  Y[],
float  Z[],
float  rad,
char  method,
int  minNnb,
int  Nnb[]
 

Spatial filtering (median or average) of arrays.

Parameters:
nrow Nb of input coordinates
X 
Y Input coordinates
Z Input values/Filtered values
rad Radius of filtering [coord]
method Filtering method
  • 'A': average,
  • 'M': median,
minNnb Minimal nb of neighbors. If <0, exclude central point.
Nnb Ouput nb of neighbors (or NULL)

Definition at line 36 of file filter.c.

Referenced by select_mpup_sharpest_smooth().

int dump_dbgArray void *  array,
int  type,
int  npts,
char *  dbgname,
SPECTRUM *  refspec
 

Definition at line 19 of file dump.c.

Referenced by main().

int dump_spec_mem SPECTRUM *  spectrum,
char *  name,
char *  ident,
char *  unit,
int  fclass
 

Dump a memory spectrum (as created with create_spec_mem) to disk

Parameters:
spectrum spectrum structure to be dumped
name spectrum filename
ident identifier
unit units
fclass file class
Returns:
status 0 if OK

Definition at line 64 of file dump.c.

Referenced by main().

void put_tiger_arrays TIGERfile *  frame,
int  no_lens,
void *  signal,
void *  noise,
int  data_type,
int  npix,
double  start
 

Store arrays as cube spectra in signal and/or noise channels.

Parameters:
frame destination cube
no_lens destination lens
signal array to be stored in signal, of type data_type (NULL if none)
noise array to be stored in noise, of type data_type (NULL if none)
data_type arrays data-type (INT, FLOAT, etc., not necessarily the same as frame)
npix number of points in signal and noise arrays
start start coord. of signal and noise arrays
Warning:
According to the I/O library (at least in the TIGER format), if a datacube spaxel has both signal and noise spectra, all the spaxels of this datacube should have both.

Definition at line 109 of file dump.c.

Referenced by main().

int dump_2Darray void **  array,
int  data_type,
int  npix[],
char *  name
 

Dump a 2D-array in an image (starts={0,0}, steps={1,1}).

Parameters:
array Input 2D-array
data_type Array data_type
npix Array size (npix[0] x npix[1])
name Name of the output image
Returns:
Creation status
Note:
There's a fundamental incompatibility between the image and 2D-array data ordering: images have i index running faster, while 2D-arrays have j index running faster. Hence, e.g., two very similar routines, nllsqfit_2Dgauss and nllsqfit_2Dgauss_ima.

Definition at line 174 of file dump.c.

Referenced by extract_arc(), and Fit_Xpeak().

long nllsqfit_lorentz long *  mode,
long *  npts,
long *  npar,
long *  ldfj,
double  par[],
double  f[],
double  fjac[],
long *  nstate,
long *  iuser,
double  x_n_sig[]
 

Normalized Lorentz fit w/ nllsqfit_bnd proc. The array x_n_sig[0..2*npts-1] is filled prior to call with

  • x_n_sig[0..npts-1]: x
  • x_n_sig[npts..2*npts-1]: y-sigma Fit function:

    \[ f_{I,\mu,\sigma}(x) = \frac{I}{\sigma\pi} \frac{1}{1+\left(\frac{x-\mu}{\sigma}\right)^2} \]

    with $I,\mu,\sigma$ in par[0,1,2]

Definition at line 35 of file nllsqfit_fn.c.

References x.

long nllsqfit_gaussian long *  mode,
long *  npts,
long *  npar,
long *  ldfj,
double  par[],
double  f[],
double  fjac[],
long *  nstate,
long *  iuser,
double  x_n_sig[]
 

Normalized Gaussian fit w/ nllsqfit_bnd proc. The array x_n_sig[0..2*npts-1] is filled prior to call with

  • x_n_sig[0..npts-1]: x
  • x_n_sig[npts..2*npts-1]: y-sigma Fit function:

    \[ f_{I,\mu,\sigma}(x) = \frac{I}{\sigma\sqrt{2*\pi}} \exp{-\frac{1}{2}\left(\frac{x-\mu}{\sigma}\right)^2} \]

    with $I,\mu,\sigma$ in par[0,1,2]

Definition at line 84 of file nllsqfit_fn.c.

References x.

Referenced by gaussian_mpup().

long nllsqfit_NNgaussian long *  mode,
long *  npts,
long *  npar,
long *  ldfj,
double  par[],
double  f[],
double  fjac[],
long *  nstate,
long *  iuser,
double  x_n_sig[]
 

Non-normalized Gaussian fit w/ nllsqfit_bnd proc. The array x_n_sig[0..2*npts-1] is filled prior to call with

  • x_n_sig[0..npts-1]: x
  • x_n_sig[npts..2*npts-1]: y-sigma Fit function:

    \[ f_{I,\mu,\sigma}(x) = I\exp{-\frac{1}{2}\left(\frac{x-\mu}{\sigma}\right)^2} \]

    with $I,\mu,\sigma$ in par[0,1,2]

Definition at line 132 of file nllsqfit_fn.c.

References x.

long nllsqfit_quad long *  mode,
long *  npts,
long *  npar,
long *  ldfj,
double  par[],
double  f[],
double  fjac[],
long *  nstate,
long *  iuser,
double  x_n_sig[]
 

Quadratic fit w/ nllsqfit_bnd proc. The array x_n_sig[0..2*npts-1] is filled prior to call with

  • x_n_sig[0..npts-1]: x
  • x_n_sig[npts..2*npts-1]: y-sigma Fit function:

    \[ f_{a,b,c}(x) = a*(x-b)^2 + c \]

    with $a,b,c$ in par[0,1,2]

Definition at line 179 of file nllsqfit_fn.c.

References x.

Referenced by main().

int discard_null_mpups int  npup,
int **  ilist,
int **  jlist,
float **  value,
int  ppup[]
 

Remove empty classes from mpup list.

Parameters:
npup Nb of classes (input)
ilist i-index of pixels in mpups (2D-array)
jlist j-index of pixels in mpups (2D-array)
value flux of pixels in mpups (2D-array)
ppup nb of pixels in mpups
Returns:
Nb of non-null mpups

Definition at line 47 of file proc_mpup.c.

Referenced by detect_mpups().

int detect_mpups IMAGE2D  mpup,
double  threshold,
int *  ppup[],
double *  fpup[],
float *  xpup[],
float *  ypup[]
 

Detect mpups in input frame and compute associated quantities.

Parameters:
mpup input frame
threshold detection limit for the mpups
ppup nb of pixels in mpups (dynamically allocated)
fpup total flux in mpups (dynamically allocated)
xpup centroid (x) of mpups (dynamically allocated)
ypup centroid (y) of mpups (dynamically allocated)
Returns:
total number of mpups

Definition at line 84 of file proc_mpup.c.

References discard_null_mpups(), MEDSIG2GAUSSIG, MERGENEIGHBOR, SNIFS_LENS_NX, SNIFS_LENS_NY, and SNIFS_LENS_PX.

Referenced by main().

Here is the call graph for this function:

int study_triangulation IMAGE2D  mpup,
float  xpup[],
float  ypup[],
int  npup,
int  iadj[],
int  iend[],
double  xtri[],
double  ytri[],
double  stri[],
double  ltri[],
double  atri[]
 

Study of the (raw) mpup triangulation.

Will clean up the raw mpup triangulation to keep only unique good-shape (half-square) triangles, and compute triangle quantities (center, surface, shortest lengthes, orientation). The xtri,...,atri double arrays should be allocated prior to call with size npup*6 (except ltri, of size npup*12).

Parameters:
mpup mpup frame
xpup 
ypup mpup positions
npup nb of mpups
iadj 
iend triangulation vectors, as issued from TRMESH
xtri 
ytri triangle barycenter (length: ntri)
stri triangle surface (length: ntri)
ltri shortest sides length (length: 2*ntri)
atri triangle orientation (length: ntri)
Returns:
final number of triangles (ntri)
Note:
If compilation variable HAVE_LIBDISLIN is defined, a graphical output of the triangulation can be stored in dislin_triangulation.eps using the graphical library DISLIN (in debug-mode).

Bug:
In previous versions of find_mpup, npts is initialized to iend[0]-1 instead of iend[0].

Definition at line 279 of file proc_mpup.c.

References DISLIN, Plot::Limits, plot_axes(), plot_increase_limits(), plot_initialize(), plot_set_limits(), plot_start(), plot_title(), SNIFS_LENS_PX, and Plot::Symbol.

Referenced by main().

Here is the call graph for this function:

void mpup_orders double  fpup[],
int  opup[],
int  npup,
double  f[3],
double  df[3]
 

Classify mpups according to their orders and compute mean fluxes.

Parameters:
fpup mpup flux
opup mpup order
npup nb of mpups
f mean flux for each mpup class
df flux dispersion for each mpup class

Definition at line 443 of file proc_mpup.c.

Referenced by main().

void rotate_coord float  x[],
float  y[],
int  n,
float  x0,
float  y0,
float  angle,
float  xr[],
float  yr[]
 

Rotate coordinates.

Parameters:
x 
y input coord.
n 
x0 
y0 center of rotation
angle angle of rotation (trigonometric radians)
xr 
yr rotated coord.

Definition at line 484 of file proc_mpup.c.

References angle, and x.

Referenced by main().

int select_mpup_dist float  x0,
float  y0,
float  maxdist,
int  npup,
float  xpup[],
float  ypup[],
int  opup[],
int  icen[]
 

Select mpups according to distance criterion.

Parameters:
x0 
y0 Center of reference
maxdist Maximal distance (minimal if <0)
npup 
xpup 
ypup 
opup Mpups number, position and order
icen Selected indices
Returns:
Nb of selected mpups

Definition at line 518 of file proc_mpup.c.

Referenced by select_mpup_sharpest_smooth().

int select_mpup_sharpest_smooth float  maxdist,
int  npup,
float  xpup[],
float  ypup[],
int  opup[],
float  spup[],
int  icen[]
 

Select mpups closest to the (median-smoothed) sharpest one.

Parameters:
maxdist Smoothing distance/Maximal distance
npup 
xpup 
ypup 
opup 
spup Mpups number, position, order and dispersion
icen Selected indices
Returns:
Nb of selected mpups

Definition at line 555 of file proc_mpup.c.

References minmax_f(), select_mpup_dist(), and spatial_filter().

Referenced by main().

Here is the call graph for this function:

double gaussian_mpup double  arr[],
int  npts,
double  start,
double  step,
double  par[],
double  dpar[],
double  fit[]
 

Fit a pure gaussian profile (nllsqfit_gaussian) to the mpup.

Parameters:
arr profile array to be adjusted
npts nb of points in profile
start starting coordinate of the profile
step step of the profile
par parameters of the fit
dpar error on the parameters
fit adjusted profile (zero-ed if error)
Returns:
RMS if OK, -status otherwise (as returned by nllsqfit_bnd)

Definition at line 66 of file fit_mpup.c.

References nllsqfit_gaussian().

Referenced by main().

Here is the call graph for this function:

long nllsqfit_distMLA long *  mode,
long *  npup,
long *  npar,
long *  ldfj,
double *  par,
double  f[],
double  fjac[],
long *  nstate,
long *  iuser,
double  user[]
 

Fitting procedure for the MLA distortion. Distortion law: $ 1 + \alpha*r^2$. Parameters to be adjusted: lenssize, angle, (xc,yc), alpha.

To be used with nllsqfit_bnd. Derivatives have been checked.

Note:
Make use of global variables

If compilation variable USE_R4_DIST is defined, an extra term is added to the distortion law: $ 1 + \alpha*r^2 + \beta*r^4$

Definition at line 113 of file fit_mpup.c.

References alpha, angle, dist, FMP_ALPHANORM, FMP_ANGLENORM, FMP_LENSSNORM, FMP_POSITNORM, glmlaml, glmlanl, glmlaxlc, glmlaxpup, glmlaylc, glmlaypup, xc, and yc.

Referenced by main().

void model_distMLA int  npup,
double  dpar[],
int  npar,
float  xd[],
float  yd[],
float  rd[]
 

Reconstruct the mpup positions according to the dist. parameters computed from nllsqfit_distMLA.

Note:
Make use of global variables

Definition at line 220 of file fit_mpup.c.

References alpha, angle, DISLIN, dist, glmlaml, glmlanl, glmlaxlc, glmlaxpup, glmlaylc, glmlaypup, Plot::Limits, plot_axes(), plot_increase_limits(), plot_initialize(), plot_set_limits(), plot_start(), plot_title(), Plot::Symbol, xc, and yc.

Referenced by main().

Here is the call graph for this function:

double set_geoPSF float  scale  ) 
 

Set the geometric PSF (described by the global (allocated) arrays glIgeo, glXgeo and glSgeo) as a glnggeo -component model from an external ad-hoc analysis (see fit_mpupgeo), for a given spatial scale.

Parameters:
scale spatial scale on CCD (in px)
Returns:
norm of the geometric PSF

Definition at line 354 of file fit_mpup.c.

References GEOPUP3G_I0, GEOPUP3G_I1, GEOPUP3G_S0, GEOPUP3G_S1, GEOPUP3G_X1, GEOPUP5G_I0, GEOPUP5G_I1, GEOPUP5G_I2, GEOPUP5G_S0, GEOPUP5G_S1, GEOPUP5G_S2, GEOPUP5G_X1, GEOPUP5G_X2, GEOPUP7G_I0, GEOPUP7G_I1, GEOPUP7G_I2, GEOPUP7G_I3, GEOPUP7G_S0, GEOPUP7G_S1, GEOPUP7G_S2, GEOPUP7G_S3, GEOPUP7G_X1, GEOPUP7G_X2, GEOPUP7G_X3, glIgeo, glnggeo, glSgeo, and glXgeo.

Referenced by main().

double geoPSF double  x  ) 
 

Geometric PSF profile, according to global parameters.

Definition at line 427 of file fit_mpup.c.

References glIgeo, glnggeo, glSgeo, glXgeo, and x.

Referenced by main().

long nllsqfit_globalPSF long *  mode,
long *  npts,
long *  npar,
long *  ldfj,
double *  par,
double  fvec[],
double  fjac[],
long *  nstate,
long *  iuser,
double  x_n_sig[]
 

Fitting procedure for the global PSF parameters: glnggeo(>0)-gaussian profile (x) glngpsf(>0)-gaussian global PSF simultaneously adjusted on npup mpups.

To be used with nllsqfit_bnd. Derivatives have been checked.

Note:
Make use of global variables

Bug:
In n_gauss_pup (in SAURON/find_mpup), Is and Ss are ngauss*ngauss (here npsf*npsf) instead of NGGEOPUP*ngauss (here ngeo*npsf)

Definition at line 454 of file fit_mpup.c.

References FMP_IPSFNORM, FMP_XPSFNORM, glIgeo, glnggeo, glngpsf, glpcen, glSgeo, glXgeo, Ipsf, Ipup, Is, Spsf, Ss, and Xpup.

Referenced by main().

double globalPSF double  x,
double  psfpar[]
 

Global PSF profile, according to parameters psfpar.

Definition at line 555 of file fit_mpup.c.

References glngpsf, and x.

Referenced by main().

double deconv_globalPSF int  ngpsf,
double  psfpar[],
double  decfac
 

Partial deconvolution of the global PSF.

Parameters:
ngpsf number of gaussian components in global PSF
psfpar description of the global PSF
decfac deconvolution factor (Sdec = Smin*sqrt(decfac))
Returns:
norm of the partially deconvolved global PSF

Definition at line 577 of file fit_mpup.c.

Referenced by main().

double set_corePSF double  psfpar[]  ) 
 

Set the core PSF (described by the global (allocated) arrays glIpsf and glSpsf) as the convolution of the geom. PSF (glnggeo>0 components) and the global PSF (glngpsf>=0 components).

Parameters:
psfpar description of the global PSF (if glngpsf>0)
Returns:
norm of the core PSF

Definition at line 627 of file fit_mpup.c.

References glIgeo, glIpsf, glnggeo, glngpsf, glSgeo, and glSpsf.

Referenced by main().

long nllsqfit_localPSFn long *  mode,
long *  npts,
long *  npar,
long *  ldfj,
double *  par,
double  fvec[],
double  fjac[],
long *  nstate,
long *  iuser,
double  x_n_sig[]
 

Fitting procedure for the local PSF parameters: fixed glnggeo(>0)-gaussian profile (x) fixed glngpsf(>=0)-gaussian global PSF (x) glngloc-gaussian local PSF adjusted on a single mpup.

To be used with nllsqfit_bnd. Derivatives have been checked.

Note:
Make use of global variables

Definition at line 668 of file fit_mpup.c.

References FMP_IPUPNORM, FMP_SPUPNORM, FMP_XPUPNORM, glIpsf, glnggeo, glngloc, glngpsf, glSpsf, glXgeo, Ipup, Is, Spup, Ss, x, and Xpup.

Referenced by final_mpup().

double final_mpup double  xarr[],
int  npts,
double  start,
double  step,
double  xloc[],
double  dxloc[],
double  xfit[]
 

Final fit (nllsqfit_localPSFn) of the mpup profile.

Parameters:
xarr profile array to be adjusted
npts nb of points in profile
start starting coordinate of the profile
step step of the profile
xloc parameters of the fit (initialized to initial guess)
dxloc error on the parameters
xfit adjusted profile (zero-ed if error)
Returns:
RMS if OK, -status otherwise (as returned by nllsqfit_bnd)
Note:
Make use of global variables

Definition at line 776 of file fit_mpup.c.

References FMP_IPUPNORM, FMP_SPUPNORM, FMP_XPUPNORM, glngloc, and nllsqfit_localPSFn().

Referenced by main().

Here is the call graph for this function:

int search_extrema double  line[],
int  npts,
int  imin[],
double  fmin[],
int  imax[],
double  fmax[],
int *  nlmin
 

Look for extrema (one minimum + one maximum) in current line.

Parameters:
line Current line
npts Nb of points in current line
imin Minima indices
fmin Minima fluxes
imax Maxima indices
fmax Maxima fluxes
nlmin Nb of minima found
Returns:
Nb of maxima found
Warning:
imin and imax contain the extrema indices, not the coord.

Definition at line 38 of file proc_max.c.

Referenced by main().

int search_pack double  line[],
int *  curpeak,
int  imax[],
int  nmax,
double  threshold,
int *  packpb,
int *  packpe
 

Look for next pack of peak in current line.

Parameters:
line Current line
curpeak Current peak (will be updated)
imax Maxima indices
nmax Nb of maxima in current line
threshold 
packpb Index of 1st peak in pack
packpe Index of last peak in pack
Returns:
nb of peaks in current pack (0 if no more pack)

Definition at line 85 of file proc_max.c.

References FMX_TOOFAR, and SNIFS_INTERSP.

Referenced by main().

int locate_peak max_lines  line,
double  x
 

Locate a peak in a sorted max line from its position.

Parameters:
line Input max line (monotingly sorted, assumed non-empty)
x Target value
Returns:
Index i (in -1,nb_max-1) such that line.maxima[i].xcoord <= x < ...[i+1]
Note:
Log_2(n) algorithm adapted from locate_sorted
Warning:
In some case, the xcoord of the max line are not strictly increasing!

Definition at line 125 of file proc_max.c.

References x.

Referenced by find_nearest_peak().

int find_nearest_peak Maxima_Set *  maxset,
int  iline,
float  x
 

Find nearest peak in a given line of a maxima set.

Parameters:
maxset Input maxima set
iline Input line
x Input coordinate
Returns:
Peak index (in 0..n-1)
Note:
Input line is supposed to have a peak, i.e. maxset->line[iline].nb_max > 0

Definition at line 159 of file proc_max.c.

References locate_peak(), and x.

Referenced by find_nearest_max().

Here is the call graph for this function:

int find_nearest_max Maxima_Set *  maxset,
float  x,
float  y,
int *  iline,
int *  ipeak
 

Find nearest line and peak in the maxima set.

Parameters:
maxset Input maxima set
x 
y Input coordinates
iline 
ipeak Nearest max. point is maxset->line[iline].maxima[ipeak]
Returns:
Status OK || UNKNOWN

Definition at line 191 of file proc_max.c.

References find_nearest_peak(), and x.

Referenced by nllsqfit_mask(), and pup_get_maxdata().

Here is the call graph for this function:

int open_max char *  maxname,
Maxima_Set *  maxset
 

Open a max file.

Parameters:
maxname Name of the max file
maxset Max structure
Returns:
Error status

Definition at line 222 of file proc_max.c.

Referenced by main().

int pup_get_maxdata Maxima_Set *  maxset,
float  xpup,
float  ypup,
float  lbdapup,
SnifsOptics optics,
float  pixsize,
double  lstep,
double *  lbda[],
double *  dx[],
double *  sigma[]
 

Associate lens number and max data.

Parameters:
maxset Input maxima set
xpup 
ypup Mpup coordinates [px]
lbdapup Mpup ref. wavelength [AA]
optics Snifs optics
pixsize Pixel size [mm]
lstep Lambda step (from optics->filter.inf_util to optics->filter.sup_util)
lbda Lambda where max positions have been found (array to be freed)
dx Corresponding offset (max - computed position) (array to be freed)
sigma Corresponding max local PSF sigma (array to be freed)
Returns:
Number of max points associated to that lens
Warning:
This is a tricky task to make the association between the lenses and the max quantities... Some ad-hoc criteria on maximal distance to max position and/or X-disp. sigma are applied (see e.g. MAX_XDISPSIG_B).

Definition at line 262 of file proc_max.c.

References BLUE_CHANNEL, SnifsOptics::channel, SnifsOptics::filter, find_nearest_max(), MAX_XDISPSIG_B, MAX_XDISPSIG_R, MIN_XDISPSIG_B, MIN_XDISPSIG_R, SNIFS_INTERSP, snifs_optics_CCD2MLA(), and snifs_optics_MLA2CCD().

Referenced by main().

Here is the call graph for this function:

long nllsqfit_maxpack long *  mode,
long *  npts,
long *  npar,
long *  ldfj,
double  par[],
double  fvec[],
double  fjac[],
long *  nstate,
long *  iuser,
double  x_n_sig[]
 

Fitting procedure for the pack cross-dispersion profile: fixed glnggeo(>0)-gaussian profile (x) fixed glngpsf(>=0)-gaussian global PSF (x) 1-gaussian local PSF simultaneously adjusted.

To be used with nllsqfit_bnd. Derivatives have been checked.

Note:
Make use of global variables

Previous version known as n_3gausspup

See nllsqfit_globalPSFn for further development tips (including multi-gaussian local PSF)

Definition at line 61 of file fit_max.c.

References FMX_IPEAKNORM, FMX_SPEAKNORM, FMX_XPEAKNORM, glIpsf, glnggeo, glngpsf, glSpsf, glXgeo, Ipeak, Speak, and Xpeak.

Referenced by fit_maxpack().

double fit_maxpack double  xarr[],
double  sarr[],
int  npts,
int  npeak,
double  packpar[],
double  dpackpar[],
double  xfit[]
 

Simultaneous fit of a pack of peaks.

Parameters:
xarr multi-peak profile to be adjusted
sarr associated multi-peak error profile (or NULL)
npts nb of pixels in profile
npeak nb of peaks in profile
packpar parameters of the fit (initial guess/fit result)
dpackpar error on the parameters
xfit adjusted multi-peak profile
Returns:
RMS if OK, -status otherwise (as returned by nllsqfit_bnd)
Note:
Previously known as Fit_pack

Definition at line 179 of file fit_max.c.

References FMX_IPEAKNORM, FMX_SPEAKNORM, FMX_XPEAKNORM, FMX_XPEAKOFFS, glipeaknorm, glngloc, glxpeakoffs, nllsqfit_maxpack(), and SNIFS_INTERSP.

Referenced by main().

Here is the call graph for this function:

float read_lbdaref void *  anyfile  ) 
 

Read reference wavelength in descriptor MPUP_LBDAPUP.

Definition at line 33 of file proc_config.c.

References MPUP_LBDAPUP.

Referenced by main().

Channel read_channel void *  anyfile  ) 
 

Read channel in descriptor CHANNEL.

Definition at line 60 of file proc_config.c.

References BLUE_CHANNEL, Channel, CHANNEL, channel_names, RED_CHANNEL, and UNKNOWN_CHANNEL.

Referenced by comp_calibration_offsets(), main(), read_focus(), and read_snifs_config_from_mask().

int read_focus void *  anyfile  ) 
 

Read camera/collimator position.

If the focus position xCFOCUS (x=B or R, as read from CHANNEL descriptor) is absent, return the rank of the frame in the calling sequence

Parameters:
anyfile Input file
Returns:
Focus position

Definition at line 106 of file proc_config.c.

References Channel, channel_names, read_channel(), SPECFOC, and UNKNOWN_CHANNEL.

Referenced by main().

Here is the call graph for this function:

int read_default_snifs_config const Channel  channel,
SnifsConfig config
 

Read default SNIFS configuration.

Parameters:
channel Channel
config Configuration
Returns:
Error status
Warning:
This procedure will have to be updated according to the file specifications and headers, to include:
  • update of snifs_instrument.h, including:
    • CCD gains, RON (e.g. standard vs. quick), darks, format
    • Red MLA angle
  • update of structures in tiger_items.h (not yet):
    • Tiger_optics does not include lateral color coefficients
    • Detector does not include ReadOut Noise

Beware the definition of rotz. The dispersion orientation is "red is down, blue is up" (same as OASIS), but to keep the grism orientation rotz around 0 (and not $\pi$), we need to aff $\pi$ in optics_signature.c probably because of internal folding.

Open questions and current answers:

Bug:
In structure Tiger_optics, g_per_mm should be a DOUBLE.

Definition at line 163 of file proc_config.c.

References Grism::A, Telescope::aperture, Grism::blaze, BLUE_CHANNEL, SnifsOptics::camera, SnifsConfig::ccd, CCDB_GAIN, CCDB_NAME, CCDB_NX, CCDB_NY, CCDB_PIX, CCDB_RON, CCDR_GAIN, CCDR_NAME, CCDR_NX, CCDR_NY, CCDR_PIX, CCDR_RON, SnifsOptics::center, Telescope::central_obscuration, SnifsOptics::channel, channel_names, SnifsOptics::collimator, SnifsDetector::dark, DFLT_BLU_CFG_NAME, DFLT_RED_CFG_NAME, CameraCollimator::distor, SnifsOptics::enlarger, SnifsOptics::filter, CameraCollimator::focal, Telescope::fratio, Grism::g_per_mm, SnifsDetector::gain, Grism::grating, SnifsOptics::grism, Material::id, CameraCollimator::LateralColor, material_names, material_sellcoeffs, SnifsOptics::MLA, SnifsConfig::name, SnifsDetector::name, Material::name, SnifsDetector::nx, SnifsDetector::ny, SnifsConfig::optics, SnifsDetector::pixsize, Grism::prism, RED_CHANNEL, SnifsDetector::ron, Grism::rotz, Telescope::scale, Material::sellcoeffs, Grism::set, SNIFS_GAMMA, SNIFS_LENS_MM, SNIFSB_CAM_A1, SNIFSB_CAM_A2, SNIFSB_CAM_A3, SNIFSB_CAM_E, SNIFSB_CAM_F, SNIFSB_COLL_A1, SNIFSB_COLL_A2, SNIFSB_COLL_A3, SNIFSB_COLL_E, SNIFSB_COLL_F, SNIFSB_FILT_E, SNIFSB_FILT_H, SNIFSB_FILT_L, SNIFSB_FILT_S, SNIFSB_GRISM_ANG, SNIFSB_GRISM_BLA, SNIFSB_GRISM_D, SNIFSB_GRISM_GLA, SNIFSB_GRISM_GRA, SNIFSB_GRISM_RES, SNIFSB_LBDA_REF, SNIFSB_LENS_AN, SNIFSB_LENS_PX, SNIFSR_CAM_A1, SNIFSR_CAM_A2, SNIFSR_CAM_A3, SNIFSR_CAM_E, SNIFSR_CAM_F, SNIFSR_COLL_A1, SNIFSR_COLL_A2, SNIFSR_COLL_A3, SNIFSR_COLL_E, SNIFSR_COLL_F, SNIFSR_FILT_E, SNIFSR_FILT_H, SNIFSR_FILT_L, SNIFSR_FILT_S, SNIFSR_GRISM_ANG, SNIFSR_GRISM_BLA, SNIFSR_GRISM_D, SNIFSR_GRISM_GLA, SNIFSR_GRISM_GRA, SNIFSR_GRISM_RES, SNIFSR_LBDA_REF, SNIFSR_LENS_AN, SNIFSR_LENS_PX, SnifsConfig::telescope, Grism::tiltx, Grism::tilty, UHT_COBS, UHT_DIAM, UHT_FOCR, UHT_SCALE, and Grism::w_disp.

Referenced by main().

void optics2dval const SnifsOptics Optics,
double *  dval
 

SnifsOptics structure to double array convertor

Definition at line 344 of file proc_config.c.

References Grism::A, Grism::blaze, SnifsOptics::camera, SnifsOptics::center, SnifsOptics::collimator, CameraCollimator::distor, SnifsOptics::enlarger, SnifsOptics::filter, CameraCollimator::focal, Grism::g_per_mm, SnifsOptics::grism, CameraCollimator::LateralColor, SnifsOptics::MLA, Grism::rotz, Grism::tiltx, Grism::tilty, and Grism::w_disp.

Referenced by write_snifs_config_to_mask().

void dval2optics const double *  dval,
SnifsOptics Optics
 

int write_snifs_config_to_mask TABLE *  mask,
SnifsConfig config
 

Write configuration structures to mask.

Parameters:
mask Output mask
config Configuration
Returns:
Status

Bug:
Could there be a bug when char *confname[lg_ident+1] while RD_desc(mask,CONFIG_NAME,CHAR,lg_ident,confname)? Does RD_desc add the null character?

Definition at line 438 of file proc_config.c.

References Telescope::aperture, SnifsConfig::ccd, CCD_NAME, Telescope::central_obscuration, CHANNEL, SnifsOptics::channel, channel_names, CONFIG_NAME, SnifsDetector::dark, DFLT_BLU_CFG_NAME, DFLT_RED_CFG_NAME, ERROR_DESC, Telescope::fratio, SnifsDetector::gain, Grism::grating, SnifsOptics::grism, Material::id, MSK_DCCDPAR, MSK_DOPTPAR, MSK_DTELPAR, MSK_FCCDPAR, MSK_FTELPAR, MSK_ICCDPAR, MSK_IOPTPAR, SnifsConfig::name, SnifsDetector::name, SnifsDetector::nx, SnifsDetector::ny, SnifsConfig::optics, optics2dval(), SnifsDetector::pixsize, Grism::prism, SnifsDetector::ron, Telescope::scale, Grism::set, and SnifsConfig::telescope.

Referenced by main().

Here is the call graph for this function:

int read_snifs_config_from_mask TABLE *  mask,
SnifsConfig config
 

Set configuration structure from mask.

Parameters:
mask Mask
config Configuration
Returns:
Status

Definition at line 550 of file proc_config.c.

References Telescope::aperture, SnifsConfig::ccd, CCD_NAME, Telescope::central_obscuration, SnifsOptics::channel, CONFIG_NAME, SnifsDetector::dark, dval2optics(), ERROR_DESC, Telescope::fratio, SnifsDetector::gain, Grism::grating, SnifsOptics::grism, Material::id, material_names, material_sellcoeffs, MSK_DCCDPAR, MSK_DOPTPAR, MSK_DTELPAR, MSK_FCCDPAR, MSK_FTELPAR, MSK_ICCDPAR, MSK_IOPTPAR, SnifsConfig::name, Material::name, SnifsDetector::name, SnifsDetector::nx, SnifsDetector::ny, SnifsConfig::optics, SnifsDetector::pixsize, Grism::prism, read_channel(), SnifsDetector::ron, Telescope::scale, Material::sellcoeffs, Grism::set, and SnifsConfig::telescope.

Referenced by main().

Here is the call graph for this function:

void print_snifs_optics const SnifsOptics Optics  ) 
 

Print out a Tiger_optics structure elements.

Definition at line 649 of file proc_config.c.

References Grism::A, Grism::blaze, SnifsOptics::camera, SnifsOptics::channel, channel_names, SnifsOptics::collimator, CameraCollimator::distor, SnifsOptics::enlarger, SnifsOptics::filter, CameraCollimator::focal, Grism::g_per_mm, Grism::grating, SnifsOptics::grism, CameraCollimator::LateralColor, SnifsOptics::MLA, Material::name, Grism::prism, Grism::rotz, Grism::tiltx, Grism::tilty, and Grism::w_disp.

Referenced by print_snifs_config().

void print_snifs_telescope const Telescope UHT  ) 
 

Print out a Telescope structure elements.

Definition at line 702 of file proc_config.c.

References Telescope::aperture, Telescope::central_obscuration, Telescope::fratio, and Telescope::scale.

Referenced by print_snifs_config().

void print_snifs_detector const SnifsDetector CCD  ) 
 

Print out a Detector structure elements.

Definition at line 716 of file proc_config.c.

References SnifsDetector::dark, SnifsDetector::gain, SnifsDetector::name, SnifsDetector::nx, SnifsDetector::ny, SnifsDetector::pixsize, and SnifsDetector::ron.

Referenced by print_snifs_config().

void print_snifs_config const SnifsConfig config  ) 
 

Print out the full SNIFS config.

Definition at line 731 of file proc_config.c.

References SnifsConfig::ccd, SnifsConfig::name, SnifsConfig::optics, print_snifs_detector(), print_snifs_optics(), print_snifs_telescope(), and SnifsConfig::telescope.

Referenced by main().

Here is the call graph for this function:

int read_PSFgeo_param void *  anyfile,
double *  geo_param[]
 

Read geometric PSF model from descriptors MPUP_NGGEO and MPUP_GEOPAR

Parameters:
anyfile Input file
geo_param Output parameter array (3*nggeo)
Returns:
Number of gaussian components in PSF model (nggeo>0 or -1)
geo_param

Todo:
Add a description.
Note:
Previously in proc_config.c (<1.27)

Definition at line 38 of file proc_psf.c.

References MPUP_GEOPAR, and MPUP_NGGEO.

Referenced by main(), and read_corePSF().

int read_PSFglobal_param void *  anyfile,
double *  psf_param[]
 

Read global PSF model from descriptors MPUP_NGPSF and MPUP_PSFPAR

Parameters:
anyfile Input file
psf_param Output parameter array (1+2*ngpsf)
Returns:
Number of gaussian components in PSF model (ngpsf>0 or -1)
psf_param
psf_param[0] = geometric pupil scale
Note:
Previously in proc_config.c (<1.27)

Definition at line 74 of file proc_psf.c.

References MPUP_NGPSF, and MPUP_PSFPAR.

Referenced by main(), and read_corePSF().

int read_PSFlocal_ng void *  anyfile  ) 
 

Read number of components in local PSF model from descriptor MPUP_NGLOC

Parameters:
anyfile Input file
Returns:
Number of gaussian components in PSF model (ngloc or MAXINT)
Note:
Previously in proc_config.c (<1.27)

Definition at line 109 of file proc_psf.c.

References MPUP_NGLOC.

Referenced by main(), and read_corePSF().

int read_corePSF void *  anyfile,
CorePSF psf
 

Set the CorePSF psf from mask descriptors.

Parameters:
anyfile Open file from which to read PSF-keywords (mask)
psf CorePSF structure to be set
Returns:
Error status
Note:
Gather calls to read_PSFgeo_param, read_PSFglobal_param, read_PSFlocal_ng and re-implement set_corePSF (still part of find_mpup)

Definition at line 137 of file proc_psf.c.

References CorePSF::Igeo, CorePSF::Ipsf, CorePSF::nggeo, CorePSF::ngloc, CorePSF::ngpsf, CorePSF::norm, read_PSFgeo_param(), read_PSFglobal_param(), read_PSFlocal_ng(), CorePSF::scale, CorePSF::Sgeo, CorePSF::Spsf, and CorePSF::Xgeo.

Referenced by main().

Here is the call graph for this function:

void free_corePSF CorePSF psf  ) 
 

CorePSF structure memory cleaner.

Definition at line 228 of file proc_psf.c.

References CorePSF::Igeo, CorePSF::Ipsf, CorePSF::nggeo, CorePSF::ngloc, CorePSF::ngpsf, CorePSF::Sgeo, CorePSF::Spsf, and CorePSF::Xgeo.

double xdisp_profile CorePSF psf,
SpectrumCCD spectrum,
float  x
 

Integral over a pixel of the cross-dispersion model profile.

Parameters:
psf Core-PSF description
spectrum CCD spectrum description
x Position [px]
Returns:
Integral of cross-dispersion model over one pixel around x
Note:
Object-oriented version of Mpup_PSF.

Definition at line 249 of file proc_psf.c.

References SpectrumCCD::Ics, CorePSF::nggeo, CorePSF::ngpsf, SpectrumCCD::Scs, x, and CorePSF::Xgeo.

Referenced by main().

double blaze_function const Grism grism,
int  order,
double  lambda
 

Return the blaze function of the grism.

Parameters:
grism Grism structure
order Order
lambda Wavelength [AA]
Returns:
Blaze function
In the normal configuration, the blaze function of a grism is given by

\[ B = \left(\frac{\sin^2\Theta}{\Theta}\right) \]

with

  • $\Theta = \pi\cos\gamma(n_r\sin i - \sin r) / \rho / \lambda $, $\gamma$ being the blaze angle and $\rho$ the line density of the grating
  • $i = \alpha' - \gamma$ where $\alpha' = \arcsin(n_g/n_r \sin A)$ with $n_g$ and $n_r$ the ref. index of prism glass and grating resine resp. and $A$ the grism angle
  • $r = \beta - \gamma$ where $\beta = \arcsin(n_g\sin A - m\rho\lambda)$ with $m$ the diffraction order.

Note:
See `Redefinition of the blue grating' (E.P., SNIFS/02-004) for an extensive description.

Definition at line 51 of file optics_signature.c.

References Grism::A, Grism::blaze, Grism::g_per_mm, Grism::grating, Grism::prism, Material::sellcoeffs, and sellmeier_index().

Referenced by plot_lens().

Here is the call graph for this function:

double lateral_color_ampl const CameraCollimator element,
double  lambda
 

Compute lateral color for camera or collimator.

Parameters:
element CameraCollimator structure
lambda Input wavelength [AA]
Returns:
Lateral color term

Definition at line 81 of file optics_signature.c.

References CameraCollimator::LateralColor.

Referenced by camera_forward(), and collimator_forward().

double collimator_forward const CameraCollimator collimator,
double  gamma,
double  lambda,
double  r
 

Light propagation through the collimator, forward.

Parameters:
collimator CameraCollimator structure
gamma Spectrograph magnification (fcam/fcoll)
lambda Input wavelength
r Input radius [units of fcoll]
Returns:
tan(output angle)
The collimator equation is

\[ \tan\theta = \frac{r}{f_{coll}} (1+e_{coll}\frac{r}{f_{coll}}^2+\frac{a_{coll}}{\gamma}) \]

Definition at line 111 of file optics_signature.c.

References CameraCollimator::distor, CameraCollimator::focal, and lateral_color_ampl().

Referenced by snifs_optics_forward(), and snifs_optics_test_forward().

Here is the call graph for this function:

double camera_forward const CameraCollimator camera,
double  lambda,
double  tantheta
 

Light propagation through the camera, forward.

Parameters:
camera CameraCollimator structure
lambda Input wavelength [AA]
tantheta tan(input angle)
Returns:
Output radius [units of fcam]
The camera equation is

\[ \frac{r}{f_{cam}} = \tan\theta(1+e_{cam}\tan^2\theta+a_{cam}) \]

Definition at line 139 of file optics_signature.c.

References CameraCollimator::distor, CameraCollimator::focal, and lateral_color_ampl().

Referenced by snifs_optics_forward(), and snifs_optics_test_forward().

Here is the call graph for this function:

double invert_camcoll double  y,
double  e,
double  b
 

Inversion of $y=x(ex^2+b)$.

Inversion of $y=x(ex^2+b)$ using analytical solutions from GSL

gsl_poly_solve_cubic solves $x^3 + a x^2 + b x + c = 0$. Our eq. can be written $x^3 + b/e x - y/e = 0$

Definition at line 161 of file optics_signature.c.

References x.

void rotation_2D double *  x,
double *  y,
double  theta
 

2D-rotation

Parameters:
x 
y Input/output coordinates
theta Rotation angle [rad]

Definition at line 260 of file optics_signature.c.

References x.

void refraction double *  x,
double *  y,
double *  z,
double  n1,
double  n2
 

Refraction law from 1 to 2.

Parameters:
x 
y 
z Input/output vector
n1 Indice of first material
n2 Indice of second material

Definition at line 310 of file optics_signature.c.

References x.

Referenced by grism_backward(), grism_forward(), and snifs_optics_test_forward().

void grating_forward double *  x,
double *  y,
double *  z,
double  lambda,
double  n,
double  g_per_mm,
int  order
 

Light propagation through a grating, forward.

The grooves of the (transmission) grating are aligned along x. The propagation is done from material (n) to air (1).

Parameters:
x 
y 
z Input/output vector
lambda Input wavelength [AA]
n Refractive index
g_per_mm Nb of grooves [1/mm]
order Order of dispersion (0,1,2,...)

Definition at line 334 of file optics_signature.c.

References x.

Referenced by grism_forward(), and snifs_optics_test_forward().

void grating_backward double *  x,
double *  y,
double *  z,
double  lambda,
double  n,
double  g_per_mm,
int  order
 

Light propagation through a grating, backward.

The grooves of the (transmission) grating are aligned along x. The back-propagation is done from air (1) to material (n).

Parameters:
x 
y 
z Input/output vector
lambda Input wavelength [AA]
n Refractive index
g_per_mm Nb of grooves/mm
order Order of dispersion (0,1,2,...)

Definition at line 358 of file optics_signature.c.

References x.

Referenced by grism_backward().

double sellmeier_index double  lambda,
const double  sellcoeffs[]
 

Compute refractive index from Sellmeier coefficients.

Sellmeier expansion for refractive index:

\[ n(\lambda)^2 = 1+\sum_{i=1}^3\frac{B_i\lambda^2}{\lambda^2-C_i} \]

with $\lambda$ in microns.

Parameters:
lambda Input wavelength [AA]
sellcoeffs Sellmeier coeffs (B1,B2,B3,C1,C2,C3) as defined in snifs_materials.h
Returns:
Refractive index at input wavelength

Definition at line 388 of file optics_signature.c.

Referenced by blaze_function(), grism_backward(), grism_forward(), and snifs_optics_test_forward().

void grism_forward const Grism grism,
double  lambda,
double *  x,
double *  y,
double *  z,
int  order
 

Light propagation through a grism, forward.

Parameters:
grism Grism structure
lambda Input wavelength [AA]
x 
y 
z Input/output vector
order Order of dispersion

Definition at line 413 of file optics_signature.c.

References Grism::A, Grism::g_per_mm, grating_forward(), Grism::prism, refraction(), Grism::rotz, Material::sellcoeffs, sellmeier_index(), Grism::tiltx, Grism::tilty, x, x_rotation, y_rotation, and z_rotation.

Referenced by snifs_optics_forward(), and snifs_optics_test_forward().

Here is the call graph for this function:

void grism_backward const Grism grism,
double  lambda,
double *  x,
double *  y,
double *  z,
int  order
 

Light propagation through a grism, backward.

Parameters:
grism Grism structure
lambda Input wavelength [AA]
x 
y 
z Input/output vector
order Order of dispersion

Definition at line 454 of file optics_signature.c.

References Grism::A, Grism::g_per_mm, grating_backward(), Grism::prism, refraction(), Grism::rotz, Material::sellcoeffs, sellmeier_index(), Grism::tiltx, Grism::tilty, x, x_rotation, y_rotation, and z_rotation.

Referenced by snifs_optics_backward(), and snifs_optics_test_forward().

Here is the call graph for this function:

void snifs_optics_forward const SnifsOptics optics,
double  xmla,
double  ymla,
double *  xccd,
double *  yccd,
double  lambda,
int  order
 

Light propagation through the Snifs instrument, forward.

Parameters:
optics Optical structure
xmla 
ymla MLA coordinates [mm]
xccd 
yccd Image coordinates [mm]
lambda Wavelength [AA]
order Order of dispersion
Warning:
The collimator, the grism and the camera are supposed to be perfectly aligned

Bug:
In previous optics_signature functions, the computation of the direction vector is probably wrong by the sign of the x and y components. However, since the tilts of the grism are adjusted, there should not be any incidence.

Definition at line 504 of file optics_signature.c.

References SnifsOptics::camera, camera_forward(), SnifsOptics::collimator, collimator_forward(), CameraCollimator::focal, SnifsOptics::grism, grism_forward(), and x.

Referenced by main(), and snifs_optics_MLA2CCD().

Here is the call graph for this function:

void snifs_optics_backward const SnifsOptics optics,
double  xccd,
double  yccd,
double *  xmla,
double *  ymla,
double  lambda,
int  order
 

Light propagation through the Snifs instrument, backward.

Parameters:
optics Optical structure
xccd 
yccd Image coordinates [mm]
xmla 
ymla MLA coordinates [mm]
lambda Wavelength [AA]
order Order of dispersion
Warning:
The collimator, the grism and the camera are supposed to be perfectly aligned

I'm not sure about the (x,y,z) definition: should it be backward-ed too? Probably not, as whatever_backward just invert the whatever equation, but the light always propagate in the same direction.

Definition at line 571 of file optics_signature.c.

References SnifsOptics::camera, camera_backward, SnifsOptics::collimator, collimator_backward, CameraCollimator::focal, SnifsOptics::grism, grism_backward(), and x.

Referenced by main(), and snifs_optics_CCD2MLA().

Here is the call graph for this function:

void snifs_optics_test_forward const SnifsOptics optics,
double  xmla,
double  ymla,
double *  xccd,
double *  yccd,
double  lambda,
int  order
 

Testing version of snifs_optics_forward.

Definition at line 623 of file optics_signature.c.

References Grism::A, SnifsOptics::camera, camera_backward, camera_forward(), SnifsOptics::collimator, collimator_backward, collimator_forward(), CameraCollimator::focal, Grism::g_per_mm, grating_forward(), SnifsOptics::grism, grism_backward(), grism_forward(), Grism::prism, refraction(), Grism::rotz, Material::sellcoeffs, sellmeier_index(), Grism::tiltx, Grism::tilty, x, x_rotation, y_rotation, and z_rotation.

Referenced by main().

Here is the call graph for this function:

void snifs_optics_CCD2MLA const SnifsOptics optics,
double  xccd,
double  yccd,
double *  xmla,
double *  ymla,
double  pixsize,
double  lbdaref
 

Wrapper to snifs_optics_backward, [CCD/px] to [MLA/mm].

Parameters:
optics Optical structure
xccd 
yccd Image coordinates [px]
xmla 
ymla MLA coordinates [mm]
pixsize Pixel size [mm]
lbdaref Ref. wavelength [AA]

Definition at line 771 of file optics_signature.c.

References SnifsOptics::center, and snifs_optics_backward().

Referenced by main(), nllsqfit_mask(), plot_lens(), plot_lens_tab(), and pup_get_maxdata().

Here is the call graph for this function:

void snifs_optics_MLA2CCD const SnifsOptics optics,
double  xmla,
double  ymla,
double *  xccd,
double *  yccd,
double  pixsize,
double  lbda,
int  order
 

Wrapper to snifs_optics_forward, [MLA/mm] to [CCD/px].

Parameters:
optics Optical structure
xmla 
ymla MLA coordinates [mm]
xccd 
yccd Image coordinates [px]
pixsize Pixel size [mm]
lbda Wavelength [AA]
order Order

Definition at line 800 of file optics_signature.c.

References SnifsOptics::center, and snifs_optics_forward().

Referenced by main(), nllsqfit_mask(), plot_lens(), plot_lens_tab(), and pup_get_maxdata().

Here is the call graph for this function:

void plot_set_limits const float  x[],
const float  y[],
int  n,
PlotLimits limits
 

Set limits of the plot.

If the PlotLimits structure has never been set (ie = 0,0,0,0), it is set according to the min and max of the input arrays. Otherwise, it is updated to include these min and max.

Parameters:
x 
y Input arrays
n Size of input arrays
limits PlotLimits structure.
Note:
See DISLIN routine setscl.

Definition at line 52 of file proc_plot.c.

References x, PlotLimits::xmax, PlotLimits::xmin, PlotLimits::ymax, and PlotLimits::ymin.

Referenced by main(), model_distMLA(), and study_triangulation().

void plot_increase_limits PlotLimits limits  ) 
 

Increase plot limits by 10% (or to valid range if min=max).

Definition at line 81 of file proc_plot.c.

References PlotLimits::xmax, PlotLimits::xmin, PlotLimits::ymax, and PlotLimits::ymin.

Referenced by main(), model_distMLA(), and study_triangulation().

int inside_plot_limits float  x,
float  y,
PlotLimits  limits
 

Test if point is inside plot limits.

Parameters:
x 
y Input coordinates
limits Plot limits
Returns:
TRUE or FALSE

Definition at line 107 of file proc_plot.c.

References x, PlotLimits::xmax, PlotLimits::xmin, PlotLimits::ymax, and PlotLimits::ymin.

Referenced by plot_lens(), and plot_max().

int plot_compticks int  nticks,
float  min,
float  max,
float *  first,
float *  step
 

Compute reasonable first and step values to get approx. nticks ticks over range min-max

Parameters:
nticks Requested (approximate) nb of ticks in input range
min 
max Input range
first First value
step Step value
Returns:
Actual number of ticks

Definition at line 127 of file proc_plot.c.

Referenced by main(), and plot_axes().

void plot_set_device char *  devname  ) 
 

Set the DISLIN output device or file from the device name.

The device name devname can be either:

  • an empty string, for traditionnal ASCII output
  • a standard DISLIN device

Parameters:
devname Output device or file (or empty string for ASCII output)

Definition at line 161 of file proc_plot.c.

Referenced by main(), and plot_start().

void plot_start Plot plot,
float  scale
 

Initialize and set various default quantities for a DISLIN 2D-plot.

Parameters:
plot Plot structure
scale Plot scaling.
  • if scale=0, default scale (2/3 of the whole window) is used
  • if scale>0, the scale is used
  • if scale<0, the scale is used such that the plot is isoscale in x and y.
Note:
This routine has to be called from DISLIN level 0 (i.e. before any call to to disini) and will set it to 1 (e.g. suitable for plot_axes).

Definition at line 210 of file proc_plot.c.

References Plot::devname, Plot::Limits, plot_set_device(), PlotLimits::xmax, PlotLimits::xmin, PlotLimits::ymax, and PlotLimits::ymin.

Referenced by main(), model_distMLA(), and study_triangulation().

Here is the call graph for this function:

void plot_axes const Plot plot,
char *  xlabel,
char *  ylabel
 

Plot the axes in a DISLIN 2D-plot.

Parameters:
plot Plot structure
xlabel X-axis label
ylabel Y-axis label
Note:
This routine has to be called from DISLIN level 1 (i.e. after a call to plot_start) and will set it to 3 (e.g. suitable for title).

Definition at line 272 of file proc_plot.c.

References Plot::Limits, Plot::maxcut, Plot::mincut, NTICKS, plot_compticks(), PlotLimits::xmax, PlotLimits::xmin, PlotLimits::ymax, and PlotLimits::ymin.

Referenced by main(), model_distMLA(), and study_triangulation().

Here is the call graph for this function:

void plot_title char *  string  ) 
 

Plot the title strings.

Parameters:
string Title string
The title string (of length 4*lg_ident+1) contains the (up to 4) title chunks separated with newlines.

Definition at line 310 of file proc_plot.c.

Referenced by main(), model_distMLA(), and study_triangulation().

void plot_set_bkgnd IMAGE2D *  bkgndima,
Plot plot,
float  mincut,
float  maxcut,
int *  nx,
int *  ny,
float ***  zmat
 

Set a background plot.

Parameters:
bkgndima Background image
plot Plot structure
mincut 
maxcut LUT cuts (in percentile of histogram)
nx 
ny 
zmat Resulting 2D array (nx$\times$ny)

Todo:
Set the limits so that the border spaxels are displayed completely.

Definition at line 345 of file proc_plot.c.

References histo_threshold(), Plot::Limits, Plot::maxcut, MAXNBIN, Plot::mincut, subframe_histo(), PlotLimits::xmax, PlotLimits::xmin, PlotLimits::ymax, and PlotLimits::ymin.

Referenced by main().

Here is the call graph for this function:

void plot_max const Maxima_Set *  maxset,
const Plot plot,
const double  shift[]
 

Plot max data.

Parameters:
maxset Max structure
plot Plot definition
shift Offset (NULL if none)

Definition at line 429 of file proc_plot.c.

References PlotSymbol::color, Plot::devname, inside_plot_limits(), Plot::Limits, NCOORD, PlotSymbol::shape, PlotSymbol::size, Plot::Symbol, and x.

Referenced by main().

Here is the call graph for this function:

void plot_lens const SnifsOptics optics,
int  nopup,
float  xppup,
float  yppup,
int  nlbda,
const float  lbda[],
int  order,
const Plot plot,
float  lbdaref,
float  pixsize,
int  dxnc,
double  dxcoeff[],
const double  shift[],
double *  xmla,
double *  ymla
 

Plot a lens spectrum onto the CCD.

Parameters:
optics Optical structure
nopup Mpup number (needed just for labelling)
xppup 
yppup Mpup coordinates [px]
nlbda 
lbda Wavelength array to be plotted
order Order of dispersion
plot Plot structure
lbdaref Ref. wavelength [AA]
pixsize Pixel size [mm]
dxnc Nb of coefficients in local adjustment
dxcoeff Coefficients of the local adjustment (1st-order)
shift Offset (NULL if none)
xmla 
ymla MLA coordinates [mm] Set to MAXDOUBLE if unknown (will then be computed)

Definition at line 530 of file proc_plot.c.

References blaze_function(), PlotSymbol::color, Plot::devname, SnifsOptics::filter, SnifsOptics::grism, inside_plot_limits(), Plot::Limits, NCOORD, PlotSymbol::shape, PlotSymbol::size, snifs_optics_CCD2MLA(), snifs_optics_MLA2CCD(), and Plot::Symbol.

Referenced by main().

Here is the call graph for this function:

void plot_lens_tab const SnifsOptics optics,
float  xppup,
float  yppup,
int  nlbda,
const float  lbda[],
int  order,
TABLE *  table,
const int  colid[],
int  row,
float  lbdaref,
float  pixsize,
int  dxnc,
double  dxcoeff[],
const double  shift[],
double *  xmla,
double *  ymla
 

Plot a lens spectrum onto the CCD (table storage).

Parameters:
optics Optical structure
xppup 
yppup Mpup coordinates [px]
nlbda 
lbda Wavelength array to be plotted
order Order of dispersion
table Output table (previously created)
colid Output column IDs (previously created) xlbda_1, ylbda_1, ... , xlbda_nlbda, ylbda_nlbda
row Row in output table
lbdaref Ref. wavelength [AA]
pixsize Pixel size [mm]
dxnc Nb of coefficients in local adjustment
dxcoeff Coefficients of the local adjustment (1st-order)
shift Offset (NULL if none)
xmla 
ymla MLA coordinates [mm] Set to MAXDOUBLE if unknown (will then be computed)

Definition at line 662 of file proc_plot.c.

References SnifsOptics::filter, snifs_optics_CCD2MLA(), and snifs_optics_MLA2CCD().

Referenced by main().

Here is the call graph for this function:

void plot_array_err const PlotSymbol symbol,
float  x[],
float  y[],
int  n,
float  dx[],
float  dy[]
 

DISLIN curve with errors.

Parameters:
symbol PlotSymbol structure
x data-x
y data-y
n data size
dx sym. error in x (or NULL if none)
dy sym. error in y (or NULL if none)

Definition at line 715 of file proc_plot.c.

References PlotSymbol::color, PlotSymbol::shape, PlotSymbol::size, and x.

Referenced by main().

void plot_initialize Plot plot,
const char *  devname,
const PlotLimits limits,
const PlotSymbol symbol,
float  mincut,
float  maxcut
 

Initialize a Plot structure.

Parameters:
plot Plot structure
devname Device name (empty for ASCII)
limits PlotLimits structure (or NULL)
symbol PlotSymbol structure (or NULL)
mincut 
maxcut z-axis limits

Definition at line 758 of file proc_plot.c.

References PlotSymbol::color, Plot::devname, Plot::Limits, Plot::maxcut, Plot::mincut, PlotSymbol::shape, PlotSymbol::size, Plot::Symbol, PlotLimits::xmax, PlotLimits::xmin, PlotLimits::ymax, and PlotLimits::ymin.

Referenced by main(), model_distMLA(), and study_triangulation().

void norm_mask_param Channel  channel,
double  par[MASK_NPARAM]
 

Mask parameters normalization.

Definition at line 29 of file proc_mask.c.

References BLUE_CHANNEL, CCDB_NX, CCDB_NY, CCDR_NX, CCDR_NY, NB_CHANNELS, RED_CHANNEL, SNIFSB_CAM_A1, SNIFSB_CAM_A2, SNIFSB_CAM_A3, SNIFSB_CAM_E, SNIFSB_CAM_F, SNIFSB_COLL_A1, SNIFSB_COLL_A2, SNIFSB_COLL_A3, SNIFSB_COLL_E, SNIFSB_COLL_F, SNIFSB_GRISM_ANG, SNIFSR_CAM_A1, SNIFSR_CAM_A2, SNIFSR_CAM_A3, SNIFSR_CAM_E, SNIFSR_CAM_F, SNIFSR_COLL_A1, SNIFSR_COLL_A2, SNIFSR_COLL_A3, SNIFSR_COLL_E, SNIFSR_COLL_F, SNIFSR_GRISM_ANG, and UNKNOWN_CHANNEL.

Referenced by main().

void unnorm_mask_param Channel  channel,
double  par[MASK_NPARAM]
 

Mask parameters unnormalization.

Definition at line 90 of file proc_mask.c.

References BLUE_CHANNEL, CCDB_NX, CCDB_NY, CCDR_NX, CCDR_NY, NB_CHANNELS, RED_CHANNEL, SNIFSB_CAM_A1, SNIFSB_CAM_A2, SNIFSB_CAM_A3, SNIFSB_CAM_E, SNIFSB_CAM_F, SNIFSB_COLL_A1, SNIFSB_COLL_A2, SNIFSB_COLL_A3, SNIFSB_COLL_E, SNIFSB_COLL_F, SNIFSB_GRISM_ANG, SNIFSR_CAM_A1, SNIFSR_CAM_A2, SNIFSR_CAM_A3, SNIFSR_CAM_E, SNIFSR_CAM_F, SNIFSR_COLL_A1, SNIFSR_COLL_A2, SNIFSR_COLL_A3, SNIFSR_COLL_E, SNIFSR_COLL_F, SNIFSR_GRISM_ANG, and UNKNOWN_CHANNEL.

Referenced by main(), and nllsqfit_mask().

void set_mask_param_limits double  par[MASK_NPARAM],
double  parlb[MASK_NPARAM],
double  parub[MASK_NPARAM]
 

Set limits to mask parameters.

Definition at line 143 of file proc_mask.c.

References LIMITS_RANGE, and MASK_NPARAM.

Referenced by main().

void optics2mask_param SnifsOptics optics,
double  par[MASK_NPARAM]
 

Copy mask parameters from SnifsOptics.

Definition at line 182 of file proc_mask.c.

References Grism::A, SnifsOptics::camera, SnifsOptics::center, SnifsOptics::collimator, CameraCollimator::distor, CameraCollimator::focal, SnifsOptics::grism, CameraCollimator::LateralColor, Grism::rotz, Grism::tiltx, and Grism::tilty.

Referenced by main().

void mask_param2optics double  par[MASK_NPARAM],
SnifsOptics optics
 

Copy mask parameters to SnifsOptics.

Definition at line 215 of file proc_mask.c.

References Grism::A, SnifsOptics::camera, SnifsOptics::center, SnifsOptics::collimator, CameraCollimator::distor, CameraCollimator::focal, SnifsOptics::grism, CameraCollimator::LateralColor, Grism::rotz, Grism::tiltx, and Grism::tilty.

Referenced by main(), and nllsqfit_mask().

void print_mask_param double  par[MASK_NPARAM]  ) 
 

Print-out (non-normalized) mask parameters.

Definition at line 248 of file proc_mask.c.

Referenced by nllsqfit_mask().

void print_mask_param_in double  par[MASK_NPARAM],
double  parlb[MASK_NPARAM],
double  parub[MASK_NPARAM]
 

Print-out (non-norm.) mask parameters (including fit boundaries).

Definition at line 284 of file proc_mask.c.

References pmpin_line().

Referenced by main().

Here is the call graph for this function:

void print_mask_param_out double  par[MASK_NPARAM],
double  epar[MASK_NPARAM]
 

Print-out (non-norm.) mask parameters (including fit errors).

Definition at line 333 of file proc_mask.c.

References pmpout_line().

Referenced by main().

Here is the call graph for this function:

int open_mask char *  maskname,
TABLE *  mask,
char *  mode
 

Open a mask table.

Parameters:
maskname Name of the mask
mask Mask structure
mode I/O mode (same as open_table)
Returns:
Error status

Definition at line 369 of file proc_mask.c.

Referenced by main().

int read_local_model TABLE *  mask,
int  flag,
double ***  coeff
 

Read local coeffs from mask (position adjusment or sigma).

Parameters:
mask Mask table
flag 1: dx (position adjustment), 2: sigma (X-disp.)
coeff Coefficients of the local model
Returns:
Nb of coeff. in the local model

Definition at line 403 of file proc_mask.c.

References MSK_DXNC, and MSK_SIGNC.

Referenced by main().

int has_local_model int  nc,
double  coeff[]
 

Check if the local adjustment is valid (i.e. some coeffs are non-null).

Parameters:
nc Nb of coeff. in the local model
coeff Coefficients of the local model
Returns:
True if some coeffs are non-null

Definition at line 465 of file proc_mask.c.

Referenced by main().

int read_mask_arc TABLE *  mask,
char *  maskname,
char *  refname
 

Read reference arc from mask, including path.

Parameters:
mask Mask table
maskname Mask name (from the cmd-line)
refname Output name
Returns:
Status
Note:
What did happen to the path field of the mask table?

Definition at line 487 of file proc_mask.c.

References MSK_ARC.

Referenced by main().

int read_spectra_refcoord TABLE *  mask,
SpectrumCCD  spectra[]
 

Set basic quantities of an array of CCD spectra from mask columns.

Parameters:
mask Input mask
spectra CCD spectra allocated array
Returns:
Error status

Definition at line 31 of file proc_spectra.c.

References SpectrumCCD::I, SpectrumCCD::J, LAB_COL_I, LAB_COL_J, SpectrumCCD::no, x, SpectrumCCD::xref, and SpectrumCCD::yref.

Referenced by main().

int read_spectra_chromatic_model TABLE *  mask,
int  flag,
SpectrumCCD  spectra[]
 

Read CCD spectra chromatic models from mask (position adjusment or sigma)

Parameters:
mask Mask table
flag 1: dx (position adjustment), 2: sigma (X-disp.)
spectra CCD spectra allocated array
Returns:
Nb of coeff. in the local model or negative error status
Note:
Object-oriented version of read_local_model

Definition at line 87 of file proc_spectra.c.

References SpectrumCCD::dx, MSK_DXNC, MSK_SIGNC, and SpectrumCCD::sig.

Referenced by main().

int open_image IMAGE2D *  frame,
char *  name,
char *  mode,
int  class,
char *  type
 

Open a frame and check FCLASS.

Parameters:
frame Frame structure
name Name of the frame
mode I/O mode (same as open_frame)
class Required FCLASS
  • >0 for a known fclass
  • 0 if unknown (no check)
  • <0 to disable check explicitely
type The msg will be ("Opening %s frame",type)
Returns:
Error status

Definition at line 36 of file proc_misc.c.

Referenced by comp_calibration_offsets(), comp_specres(), main(), and open_image_ext().

int open_image_ext IMAGE2D *  signal,
IMAGE2D *  variance,
char *  name,
char *  mode,
int  class,
char *  type
 

Open a frame (possibly with extensions [signal] and [variance]) and check FCLASS

Parameters:
signal Frame structure with signal
variance Frame structure with variance (or NULL if not needed)
name Name of the frame
mode I/O mode (same as open_frame)
class Required FCLASS
  • >0 for a known fclass
  • 0 if unknown (no check)
  • <0 to disable check explicitely
type The msg will be ("Opening %s frame",type)
Returns:
Error status

Definition at line 88 of file proc_misc.c.

References open_image().

Referenced by main().

Here is the call graph for this function:

float read_mean_RoN void *  anyfile,
Channel  channel
 

Compute mean RoN from RDNOISE descriptors.

Definition at line 126 of file proc_misc.c.

References BLUE_CHANNEL, CCDB_RON, CCDR_RON, channel_names, and RDNOISE2.

Referenced by main().

float read_jdate void *  anyfile  ) 
 

Read JDATE descriptor (defaulted to 0) from open file.

Definition at line 155 of file proc_misc.c.

References JDATE.

Referenced by comp_calibration_offsets(), and main().

float check_jdate char *  arcname,
float  cal_jdate,
char *  objname,
float  obj_jdate
 

Check julian date consistency between two exposures.

Definition at line 180 of file proc_misc.c.

Referenced by main().

void read_ima_axes IMAGE2D *  inframe,
char  xlab[],
char  ylab[]
 

Read axes labels (LABX and LABY) from (reconstructed) image.

Definition at line 209 of file proc_misc.c.

Referenced by main().

int extract_arc const IMAGE2D *  frame,
int  npix,
double **  tab
 

Extract central part of arc exposure.

Parameters:
frame Input arc frame
npix Size of the central part
tab Output central part (npix x npix allocated 2D-array)
Returns:
Error status

Definition at line 38 of file proc_corr.c.

References DBG_PREFIX, and dump_2Darray().

Referenced by comp_calibration_offsets(), comp_specres(), and main().

Here is the call graph for this function:

void negate_2D double **  I,
int  nx,
int  ny
 

Negate a nx*ny 2D array.

Note:
Replace the NAG routine C06GCF

Definition at line 88 of file proc_corr.c.

Referenced by correlation2D(), and iFFT2D_real().

void complex_product_2D double **  AR,
double **  AI,
double **  BR,
double **  BI,
int  nx,
int  ny,
double **  CR,
double **  CI
 

Compute the complex product C = A * B for nx*ny 2D arrays.

Parameters:
AR Real part of A
AI Imaginary part of A
BR Real part of B
BI Imaginary part of B
nx 
ny Size of the input arrays
CR Real part of C (allocated nx*ny 2D array)
CI Imaginary part of C (allocated nx*ny 2D array)

Definition at line 112 of file proc_corr.c.

Referenced by correlation2D().

int FFT2D_real double **  in,
int  nx,
int  ny,
double **  outR,
double **  outI
 

FFT of a nx*ny 2D real dataset.

Parameters:
in Input real dataset
nx 
ny Size of the input dataset
outR Real part of FFT (allocated nx*ny 2D array)
outI Imaginary part of FFT (allocated nx*ny 2D array)
Returns:
Error status (from C06FUF)
Warning:
Uses NAG routine C06FUF.

Definition at line 141 of file proc_corr.c.

Referenced by correlation2D().

int iFFT2D_real double **  inR,
double **  inI,
int  nx,
int  ny,
double **  outR
 

Inverse FFT (real part) of a nx*ny 2D dataset.

Parameters:
inR 
inI Input complex dataset (inI is returned negated)
nx 
ny Size of the input dataset
outR Real part of iFFT (allocated nx*ny 2D array)
Returns:
Error status (from C06FUF)
Warning:
Uses NAG routine C06FUF.

Definition at line 193 of file proc_corr.c.

References negate_2D().

Referenced by correlation2D().

Here is the call graph for this function:

int correlation2D double **  A,
double **  B,
int  nx,
int  ny,
double **  X
 

Compute correlation of nx*ny 2D arrays A and B.

Parameters:
A Input array (reference)
B Input array
nx 
ny Size of the input arrays
X Correlation (allocated nx*ny 2D array)
Returns:
Error status

Definition at line 251 of file proc_corr.c.

References complex_product_2D(), FFT2D_real(), iFFT2D_real(), and negate_2D().

Referenced by Fit_Xpeak().

Here is the call graph for this function:

long nllsqfit_2Dgauss long *  mode,
long *  npts,
long *  npar,
long *  ldfj,
double *  par,
double *  f,
double *  fjac,
long *  nstate,
long *  iuser,
double *  user
 

Single 2D-gaussian fitting procedure (e.g. for the cross-correlation peak). Parameters to be adjusted: position offset (x,y), intensity, dispersion (Sx,Sy) and background level.

To be used with nllsqfit_bnd. Derivatives have been checked.

Note:
Previously known as nllsqfit_Xpeak.

This routine uses a 2D-array oriented array ordering (j is the fastest index). A very similar routine nllsqfit_2Dgauss_ima included in center_gauss.c has an image-oriented array ordering (i is then the fastest index).

Warning:
Not very generic routine. It needs a "dirty trick" on input parameters to pass 2D-sizes to nllsqfit_bnd. See Fit_Xpeak for example.

Definition at line 303 of file proc_corr.c.

Referenced by Fit_Xpeak().

int Fit_Xpeak double **  ref_tab,
double **  cur_tab,
int  nx,
int  ny,
int  winx,
int  winy,
double  par[6],
double  epar[6]
 

Compute correlation between 2 arc rasters and fit a 2D-gaussian to the central peak (6 parameters: position offset (x,y), intensity, dispersion (Sx,Sy) and background level), in order to measure relative offsets or focus-quality.

Parameters:
ref_tab Reference 2D-array
cur_tab Input 2D-array (could be a copy of ref. for auto-correlation)
nx 
ny Input arrays size
winx 
winy Fitting window half-width (be sure to fit in input arrays)
par Adjusted parameters
epar Error on adjusted parameters
Returns:
Error status

Definition at line 362 of file proc_corr.c.

References correlation2D(), DBG_PREFIX, dump_2Darray(), nllsqfit_2Dgauss(), TOO_CLOSE, and x.

Referenced by comp_calibration_offsets(), comp_specres(), and main().

Here is the call graph for this function:

int good_neighbor float *  ylo,
float *  yup,
int *  neighbors,
float  y
 

Find the good neighbor among 2 candidates.

Parameters:
ylo 
yup Total spectral extensions
neighbors Candidates index array
y Current position
Returns:
Good neighbor index

Definition at line 37 of file proc_extract.c.

int good_neighbor_spectrum SpectrumCCD  spectra[],
int  neighbors[],
float  y
 

Find the good neighbor among 2 candidates.

Parameters:
spectra Array of CCD spectra
neighbors Candidates index array
y Current position
Returns:
Good neighbor index
Note:
Object-oriented version of good_neighbor.

Definition at line 72 of file proc_extract.c.

References SpectrumCCD::total.

Referenced by main().

void interpolate_y2lbda int  n,
double  y[],
double  signal[],
double  variance[],
int  yofl_deg,
float  yofl_coeffs[],
SPECTRUM *  spectrum,
SPECTRUM *  noise
 

Interpolate CCD spectrum to cube spectrum.

Parameters:
n Size of the CCD arrays
y CCD-position array (in decreasing order: from top to bottom, ie from blue to red)
signal Extracted signal array
variance Extracted variance array (or NULL)
yofl_deg Degree of the y(lambda) polynomial
yofl_coeffs Coeffs of the y(lambda) polynomial
spectrum Initialized signal lambda-spectrum
noise Initialized variance lambda-spectrum (or NULL)
Variance interpolation
It is not clear how to interpolate the variance spectrum. Let's say the signal is linearly interpolated: $s = \alpha s_1 + \beta s_2$. Logically, one should then write for the variance: $v = \alpha^2 v_1 + \beta^2 v_2$. But this discards the covariance introduced between v_1 and v_2. On the other hand, one could simply linearly interpolate the variance: $v = \alpha v_1 + \beta v_2$, which is not statistically correct, but might be a better 'physical' approximation. This is the approach adopted here.

Definition at line 122 of file proc_extract.c.

Referenced by main().

void comp_mean_disp double  parpeak[6],
double  eparpeak[6],
double *  msig,
double *  emsig
 

Convert correlation-peak quantities to intrinsic quantities.

Parameters:
parpeak 
eparpeak X-corr. peak fit parameters and errors (x-, y-offset, intensity, x-, y-sigma, background)
msig 
emsig Mean dispersion and error

Definition at line 35 of file proc_shift.c.

Referenced by main(), and print_parpeak().

void print_parpeak double  parpeak[6],
double  eparpeak[6]
 

Print-out correlation-peak quantities.

Note:
Includes a call to comp_mean_disp

Definition at line 54 of file proc_shift.c.

References comp_mean_disp().

Referenced by comp_calibration_offsets(), comp_specres(), and main().

Here is the call graph for this function:

int comp_calibration_offsets char *  refName,
char *  arcName,
float *  arcAirmass,
float *  arcJDate,
char *  arc2Name,
float *  arc2Airmass,
float *  arc2JDate,
float  offset[2]
 

Compute the offset between reference and calibration frames.

Parameters:
refName Name of the input reference calibration frame
arcName Name of the calibration frame
arcAirmass 
arcJDate Airmass and julian date of the calibration frame
arc2Name Name of the 2nd calibration frame (if any, or NULL)
arc2Airmass 
arc2JDate Airmass and julian date of the 2nd calibration frame
offset Computed calibration offset [px]
Returns:
Error status
Warning:
Logically, but conter-intuitively, it computes the offset to be subtracted to the reference frame (from which the optical model is derived) to get back to the calibration frame position (to which the optical model has to be applied)!

Definition at line 90 of file proc_shift.c.

References ARCWIDTH, Channel, channel_names, extract_arc(), Fit_Xpeak(), open_image(), print_parpeak(), read_airmass(), read_channel(), and read_jdate().

Referenced by main().

Here is the call graph for this function:

int comp_specres char *  arcName,
float *  specres
 

Definition at line 211 of file proc_shift.c.

References ARCWIDTH, extract_arc(), Fit_Xpeak(), open_image(), and print_parpeak().

Referenced by main().

Here is the call graph for this function:


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