VIRCAM Pipeline 2.3.15
Functions

These are utility routines of various types. More...

Functions

const char * vircam_get_license (void)
 
void vircam_exten_range (int inexten, const cpl_frame *fr, int *out1, int *out2)
 
void vircam_madfit (int npts, float *xdata, float *ydata, float *intercept, float *slope)
 
void vircam_linfit (int npts, double *xdata, double *ydata, double *intercept, double *slope, double *sig)
 
int vircam_solve_gauss (double **a, double *b, int m)
 
int vircam_polyfit (const cpl_array *xarray, const cpl_array *yarray, int ncoefs, int ilim, int niter, float lclip, float hclip, cpl_array **polycf, double *sigfit)
 
void vircam_difference_image (cpl_image *master, cpl_image *prog, unsigned char *bpm, cpl_table *chantab, int ncells, int oper, float *global_diff, float *global_rms, cpl_image **diffim, cpl_table **diffimstats)
 
cpl_table * vircam_create_diffimg_stats (int nrows)
 
int * vircam_dummy_confidence (long n)
 
int vircam_is_dummy (cpl_propertylist *p)
 
cpl_table * vircam_illcor_newtab (int nrows)
 
void vircam_timestamp (char *out, int n)
 
int vircam_check_crval (cpl_propertylist *phu, cpl_propertylist *ehu)
 
void vircam_copywcs (cpl_propertylist *p1, cpl_propertylist *p2)
 
void vircam_cull (cpl_frameset *in, float lthr, float hthr, int ndit, int jst, int jfn, cpl_array **mins, cpl_array **maxs, cpl_array **aves, cpl_frameset **out, int *status)
 

Detailed Description

These are utility routines of various types.

Author
Jim Lewis, CASU

Function Documentation

◆ vircam_check_crval()

int vircam_check_crval ( cpl_propertylist *  phu,
cpl_propertylist *  ehu 
)
Name:
vircam_check_crval
Purpose:
Check CRVAL == 0 problem
Description:
The extension header is checked to see if CRVAL values exist. If they don't that's an error. If they do and they are exactly zero, then this is considered an error. In this case the primary header is searched for RA and DEC values and these are silently substituted into the extension header as CRVALs
Language:
C
Parameters
phuThe primary header propertylist
ehuThe extension header propertylist
Return values
CASU_OKif everything is ok
CASU_FATALif no values of CRVAL are in the extension or no values of RA,DEC are available in the primary
Author
Jim Lewis, CASU

Definition at line 1148 of file vircam_utils.c.

References vircam_pfits_get_crval1(), vircam_pfits_get_crval2(), vircam_pfits_get_dec(), and vircam_pfits_get_ra().

◆ vircam_copywcs()

void vircam_copywcs ( cpl_propertylist *  p1,
cpl_propertylist *  p2 
)
Name:
vircam_copywcs
Purpose:
Copy a WCS from one propertylist to another
Description:
Copy a full WCS from the first propertylist into the second one
Language:
C
Parameters
p1The first input propertylist. This is the source of the WCS
p2The second input propertylist. The WCS will be copied to this
Returns
Nothing
Author
Jim Lewis, CASU

Definition at line 1207 of file vircam_utils.c.

◆ vircam_create_diffimg_stats()

cpl_table * vircam_create_diffimg_stats ( int  nrows)
Name:
vircam_create_diffimg_stats
Purpose:
Create an empty difference image stats table
Description:
Create an empty difference image stats table
Language:
C
Parameters
nrowsThe number of rows for the table
Returns
The cpl_table pointer for the new stats table
Author
Jim Lewis, CASU

Definition at line 960 of file vircam_utils.c.

Referenced by vircam_difference_image().

◆ vircam_cull()

void vircam_cull ( cpl_frameset *  in,
float  lthr,
float  hthr,
int  ndit,
int  jst,
int  jfn,
cpl_array **  mins,
cpl_array **  maxs,
cpl_array **  aves,
cpl_frameset **  out,
int *  status 
)
Name:
vircam_cull
Purpose:
Work out which images in a flat field frameset to remove
Description:
Get stats on images in a frameset. Work out which ones to remove. Send out status flags for dodgy results.
Language:
C
Parameters
inThe input frameset
lthrThe lower threshold
hthrThe upper threshold
nditThe number of DITs in the exposure
jstThe first extension to be tested
jfnThe last extension to be tested
minsAn array of minimum flux values for each extension
maxsAn array of maximum flux values for each extension
avesAn array of average flux values for each extension
outThe output frameset with frames to be kept
statusAn output status. 0 -> all ok, 1 -> only one extension is being used and that particular detector is dead, 2-> all of the images in the nominated detector are outside of the flux thresholds. The nominated detector is either (1) the first live detector in the case where we user looking at multiple detectors, or (2) the only detector in the case where we're only looking at 1.
Returns
Nothing
Author
Jim Lewis, CASU

Definition at line 1258 of file vircam_utils.c.

References vircam_pfits_get_detlive().

◆ vircam_difference_image()

void vircam_difference_image ( cpl_image *  master,
cpl_image *  prog,
unsigned char *  bpm,
cpl_table *  chantab,
int  ncells,
int  oper,
float *  global_diff,
float *  global_rms,
cpl_image **  diffim,
cpl_table **  diffimstats 
)
Name:
vircam_difference_image
Purpose:
Create a difference/ratio image and difference/ratio image stats table
Description:
A difference/ratio image is created from an input image and a master image. A global difference and RMS are calculated from the difference image. If a channel table has been included, then a difference image stats table will be created. This breaks up the difference image into cells and calculates some basic stats in each cell.
Language:
C
Parameters
masterThe master calibration image
progThe new mean image
bpmInput bad pixel mask
chantabThe channel table for the detector
ncellsThe number of cells per channel
operThe operation to be performed:
  • 1. Subtract the images
  • 2. Divide the images
global_diffThe median difference over the whole difference image
global_rms
The rms difference over the whole difference image
diffimThe output difference/ratio image
diffimstatsThe output difference/ratio image statistics table
Returns

Nothing
Author
Jim Lewis, CASU

Definition at line 762 of file vircam_utils.c.

References casu_meansig(), casu_medmad(), and vircam_create_diffimg_stats().

◆ vircam_dummy_confidence()

int * vircam_dummy_confidence ( long  n)
Name:
vircam_dummy_confidence
Purpose:
Create a dummy confidence map with all pixels equally good
Description:
An integer array is returned with all values equal to 100. This array will need to be deallocated when you're finished with it.
Language:
C
Parameters
nThe number of pixels
Returns
The output dummy confidence map. This array will need to be deallocated when you're finished with it.
Author
Jim Lewis, CASU

Definition at line 1006 of file vircam_utils.c.

◆ vircam_exten_range()

void vircam_exten_range ( int  inexten,
const cpl_frame *  fr,
int *  out1,
int *  out2 
)
Name:
vircam_exten_range
Purpose:
Define the range of image extensions to use
Description:
If the input extension specified is zero, then all the extensions in a vircam MEF should be done. If not, then just the extension specified should be done.
Language:
C
Parameters
inextenInput image extension from the recipe invocation
frAn input frame used to test whether the requested frame(s) exist or not
out1Lower part of extension range (-1 if there is an error)
out2Upper part of extension range (-1 if there is an error)
Returns
Nothing
Author
Jim Lewis, CASU

Definition at line 165 of file vircam_utils.c.

◆ vircam_get_license()

const char * vircam_get_license ( void  )
Name:
vircam_get_license
Purpose:
Get the pipeline copyright and license
Description:
The function returns a pointer to the statically allocated license string. This string should not be modified using the returned pointer.
Language:
C
Returns
The copyright and license string
Author
Jim Lewis, CASU

Definition at line 116 of file vircam_utils.c.

◆ vircam_illcor_newtab()

cpl_table * vircam_illcor_newtab ( int  nrows)
Name:
vircam_illcor_newtab
Purpose:
Create a new illumination correction table
Description:
Given the number of rows, create an illumination correction table with no information in it.
Language:
C
Parameters
nrowsThe number of rows in the table
Returns
The pointer to the new table
Author
Jim Lewis, CASU

Definition at line 1064 of file vircam_utils.c.

Referenced by vircam_illum(), and vircam_jmp_save_illum().

◆ vircam_is_dummy()

int vircam_is_dummy ( cpl_propertylist *  p)
Name:
vircam_is_dummy
Purpose:
See if an image or table is a dummy output product
Description:
The input propertylist is searched for the key ESO DRS IMADUMMY. If it exists, then this header is part of a dummy image or table.
Language:
C
Parameters
pThe input propertylist
Author
Jim Lewis, CASU

Definition at line 1033 of file vircam_utils.c.

◆ vircam_linfit()

void vircam_linfit ( int  npts,
double *  xdata,
double *  ydata,
double *  intercept,
double *  slope,
double *  sig 
)
Name:
vircam_linfit
Purpose:
Fit a line to data using standard linear least squares
Description:
Standard linear fit routine,
Language:
C
Parameters
nptsThe number of data points
xdataThe X data
ydataThe Y data
interceptThe fitted intercept
slopeThe fitted slope
sigThe fit error
Returns

Nothing
Author
Jim Lewis, CASU

Definition at line 382 of file vircam_utils.c.

◆ vircam_madfit()

void vircam_madfit ( int  npts,
float *  xdata,
float *  ydata,
float *  intercept,
float *  slope 
)
Name:
vircam_madfit
Purpose:
Fit a line to data by minimising the sum of MADs
Description:
Standard linear fit routine, with the modification that the minimisation scheme is done on the sum of MADs.
Language:
C
Parameters
nptsThe number of data points
xdataThe X data
ydataThe Y data
interceptThe fitted intercept
slopeThe fitted slope
Returns

Nothing
Author
Jim Lewis, CASU

Definition at line 239 of file vircam_utils.c.

◆ vircam_polyfit()

int vircam_polyfit ( const cpl_array *  xarray,
const cpl_array *  yarray,
int  ncoefs,
int  ilim,
int  niter,
float  lclip,
float  hclip,
cpl_array **  polycf,
double *  sigfit 
)
Name:
vircam_polyfit
Purpose:
Fit a polynomial to a set of points
Description:
Fit a polynomial to a set of points. If requested the fit will be done iteratively. If requested the lower order coefficients will be defined as zero. This is done by adjusting the parameter ilim. The number of coefficients returned will be ncoefs - ilim.
Language:
C
Parameters
xarrayThe independent variable array
yarrayThe dependent variable array
ncoefsThe requested polynomial order plus 1.
ilimThe number of low order coefficients not to fit.
niterThe number of iterations
lclipThe number of sigma for the lower clipping threshold
hclipThe number of sigma for the upper clipping threshold
polycfThe returned array of polynomial coefficients.
sigfitThe total error of the fit
Return values
CASU_OKIf everything went OK
CASU_FATALIf there was some sort of error
Author
Jim Lewis, CASU

Definition at line 571 of file vircam_utils.c.

References vircam_solve_gauss().

Referenced by vircam_genlincur().

◆ vircam_solve_gauss()

int vircam_solve_gauss ( double **  a,
double *  b,
int  m 
)
Name:
vircam_solve_gauss
Purpose:
Use Gauss-elimination method to solve for fit coefficients
Description:
This is a standard Gauss-elimination method routine.
Language:
C
Parameters
aThe matrix part of the system (a[m][m])
bThe vector part of the system (b[m]). The output fit coefficients overwrite the input values in this vector.
mThe size of the vectors
Return values
CASU_OKIf everything went OK
CASU_FATALIf matrix a has a zero determinant
Author
Jim Lewis, CASU

Definition at line 456 of file vircam_utils.c.

Referenced by vircam_genlincur(), and vircam_polyfit().

◆ vircam_timestamp()

void vircam_timestamp ( char *  out,
int  n 
)
Name:
vircam_timestamp
Purpose:
Create a timestamp string
Description:
Create a timestamp string similar to DATE-OBS. This can be used to associate files together.
Language:
C
Parameters
outThe output string. It should be at least 25 characters long. NB: if it isn't at least 25 characters long (and provided you haven't done something stupid like pass in a value of n which is larger than the size of the string) then the output value will truncated to n characters
nThe maximum size of the string.
Returns
Nothing
Author
Jim Lewis, CASU

Definition at line 1102 of file vircam_utils.c.

Referenced by vircam_interleave().