VIRCAM Pipeline  2.3.12
Functions
Data Reduction Modules

Functions

int vircam_illum (casu_fits **images, cpl_table **mstds, cpl_propertylist **pl, int nimages, char *filt, cpl_table *phottab, int nbsize, cpl_table **illcor, float *illcor_rms, int *status)
 Work out the illumination correction. More...
 
int vircam_destripe (casu_fits *in, casu_mask *inbpm, int *status)
 Remove stripes from the background of an image. More...
 
int vircam_genbpm (casu_fits **flatlist, int nflatlist, float lthr, float hthr, cpl_array **bpm_array, int *nbad, float *badfrac, int *status)
 Generate a bad pixel mask from a list of dome flats. More...
 
int vircam_genlincur (double **fdata, int nimages, double *exps, double mindit, casu_tfits *chantab, int norder, cpl_table **lchantab, double **lindata, int *status)
 Generate a linearity curve for each readout channel in a list of images. More...
 
int vircam_lincor (casu_fits *infile, casu_tfits *lchantab, int kconst, int ndit, int *status)
 Apply linearity curves to data. More...
 
int vircam_grout (casu_tfits *intab, cpl_frameset *input_cats, cpl_frameset *input_confs, casu_tfits **outtab, int *status)
 Correct input tile catalogues. More...
 
int vircam_interleave (casu_fits **infiles, int ninputs, casu_fits **inconfs, int nconfs, int nsteps, cpl_propertylist **p, cpl_image **outimage, cpl_image **outconf, int *status)
 Interleave a set of microstepped observations. More...
 
int vircam_mosaic (cpl_frameset *infiles, cpl_frameset *inconf, int interp, int skyflag, float skywish_in, const char *expkey, int conflim, casu_fits **out, casu_fits **outc, int *status)
 Create a vircam mosaic. More...
 
int vircam_tilesky (casu_fits **inlist, int nfiles, casu_mask *mask, casu_fits **skyout, int *status)
 Work sky estimate from an input tile series. More...
 

Detailed Description

These are the main processing routines. Most of these also have a test recipe described on the test recipe page.

Function Documentation

◆ vircam_destripe()

int vircam_destripe ( casu_fits *  in,
casu_mask *  inbpm,
int *  status 
)

Remove stripes from the background of an image.

Name:
vircam_destripe
Purpose:
Remove stripes from the background of an image
Description:
Remove stripes from the background of an image by finding the median of each row and putting the value into a profile. Normalise the profile to zero median. Then subtract the normalised median for each row from the original data.
Language:
C
Parameters
inThe input image. This is corrected in-situ.
inbpmThe input image bad pixel mask.
statusAn input/output status that is the same as the returned values below.
Return values
CASU_OKif everything is ok
QC headers:
None
DRS headers:
The following DRS keywords are written to the plist propertylist
  • STRIPECOR A flag saying that the stripe correction has been done
  • STRIPERMS The RMS of the stripe profile
Other headers:
None
Author
Jim Lewis, CASU

Definition at line 87 of file vircam/vircam_destripe.c.

References casu_fits_get_ehu(), casu_fits_get_image(), casu_mask_get_data(), casu_medmad(), casu_medmadcut(), and casu_qmedsig().

◆ vircam_genbpm()

int vircam_genbpm ( casu_fits **  flatlist,
int  nflatlist,
float  lthr,
float  hthr,
cpl_array **  bpm_array,
int *  nbad,
float *  badfrac,
int *  status 
)

Generate a bad pixel mask from a list of dome flats.

Name:
vircam_genbpm
Purpose:
Generate a bad pixel mask from a list of dark corrected dome flat images.
Description:
A list of dark corrected dome flat images is given. A master flat is created from all the input flats in the list. Each input flat is then divided by the master. Bad pixels are marked on the new image as those that are above or below the threshold (in sigma) in the new image. Any pixel which has been marked as bad for more than a quarter of the input images is defined as bad in the output mask.
Language:
C
Parameters
flatlistThe list of input dark corrected dome flat images.
nflatlistThe number of input images
lthrThe low rejection threshold in units of sigma
hthrThe high rejection threshold in units of sigma
bpm_arrayThe output bad pixel mask
nbadThe number of bad pixels found
badfracThe fraction of pixels in the map that are bad
statusAn input/output status that is the same as the returned values below.
Return values
CASU_OKIf everything is ok
CASU_FATALThe flat combination failed
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 93 of file vircam_genbpm.c.

References casu_fits_get_image(), casu_getnpts(), casu_imcombine(), casu_medmad(), and casu_medsig().

◆ vircam_genlincur()

int vircam_genlincur ( double **  fdata,
int  nimages,
double *  exps,
double  mindit,
casu_tfits *  chantab,
int  norder,
cpl_table **  lchantab,
double **  lindata,
int *  status 
)

Generate a linearity curve for each readout channel in a list of images.

Name:
vircam_genlincur
Purpose:
Generate linearity coefficients for each readout channel of a detector given a median statistic for each channel in a sequence of dome flat field exposures.
Description:
Median flux estimates for each channel in a series of dark corrected dome flat exposures are given along with exposure timing information. The dome exposures must have been taken with a range of exposure times and using a stable light source. From the known reset/read time and exposure times, the linearity curve for each channel can be measured. The resulting coefficients are written to a new channel table, along with an estimate of the non-linearity at a nominal level and an estimate of the quality of the initial fit.
Language:
C
Parameters
fdataA 2d array of medians for each flat. The first index is the image number. The second index is the channel number.
nimagesThe number of input images
expsAn array of exposure times for the input images
minditThe reset/readout time
chantabThe input channel table
norderThe order of the fit. This will equal to the number of coefficients in the output table as according to the mathematic description of the algorithm, the zeroth coefficient is always zero.
lchantabThe output channel table with new linearity coefficients
lindataAn array of the linearised values of 'fdata'
statusAn input/output status that is the same as the returned values below.
Return values
CASU_OKif everything is ok
CASU_WARNif one or more channels have a failed fit
CASU_FATALif the channel table is invalid.
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 118 of file vircam_genlincur.c.

References casu_tfits_get_table(), vircam_chan_fill(), vircam_chan_free(), vircam_polyfit(), and vircam_solve_gauss().

◆ vircam_grout()

int vircam_grout ( casu_tfits *  intab,
cpl_frameset *  input_cats,
cpl_frameset *  input_confs,
casu_tfits **  outtab,
int *  status 
)

Correct input tile catalogues.

Name:
vircam_grout
Purpose:
Correct input tile catalogues for the effects of variable seeing and magnitude zeropoints of the images that went into that tile.
Description:
Variable conditions during the observations of the 6 pawprints of a VIRCAM tile can lead to spatial systematics in the fluxes measured from a tiled image. This routine takes that effect out.
Language:
C
Parameters
intabThe input tile catalogue
input_catsThe catalogues for the input pawprints that formed the tile
input_confsThe confidence maps for the input pawprints that formed the tile
outtabThe output tile catalogue
statusAn input/output status that is the same as the returned values below.
Return values
CASU_OKif everything is ok
CASU_FATALif image data fails to load
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 108 of file vircam_grout.c.

References casu_fits_get_image(), casu_fits_load(), casu_med(), casu_tfits_duplicate(), casu_tfits_get_ehu(), casu_tfits_get_table(), and casu_xytoxy_list().

◆ vircam_illum()

int vircam_illum ( casu_fits **  images,
cpl_table **  mstds,
cpl_propertylist **  pl,
int  nimages,
char *  filt,
cpl_table *  phottab,
int  nbsize,
cpl_table **  illcor,
float *  illcor_rms,
int *  status 
)

Work out the illumination correction.

Name:
vircam_illum
Purpose:
Work out the illumination correction
Description:
Work out the illumination correction from a set of images by dividing the image space into a number of cells. The median of photometric zeropoints for all the stars in a cell is compared with the median zeropoint over the whole set of images.
Language:
C
Parameters
imagesThe input data images
mstdsThe input matched standards catalogues (one for each image)
plThe list of extension header propertylists (one for each image catalogue)
nimagesThe number of images in the input lists
filtThe filter for the observations
phottabThe photometric calibration table for VIRCAM
nbsizeThe size of the side of a cell in pixels
illcorThe illumination correction table for this detector
illcor_rmsThe RMS of the illumination correction
statusAn input/output status that is the same as the returned values below.
Return values
CASU_OKif everything is ok
CASU_WARNif there weren't any photometric standards or all the objects in the catalogue failed.
CASU_FATALif there is a problem with the photometric calibration table
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 1406 of file vircam_utils.c.

Referenced by vircam_jmp_illum().

◆ vircam_interleave()

int vircam_interleave ( casu_fits **  infiles,
int  ninputs,
casu_fits **  inconfs,
int  nconfs,
int  nsteps,
cpl_propertylist **  p,
cpl_image **  outimage,
cpl_image **  outconf,
int *  status 
)

Interleave a set of microstepped observations.

Name:
vircam_interleave
Purpose:
Interleave a set of microstepped observations
Description:
A set of microstepped observations and their confidence maps (optional) are given. The cartesian offsets as well as the background medians for each image are also given. The observations and optionally the confidence maps are interleaved onto a finer grid defined by the number of steps in the microstep series. If input confidence maps are given, then an output confidence map will also be generated.
Language:
C
Parameters
infilesThe list of input microstepped observation images. Their extension propertylists need to have: ESO DRS XOFFMICRO (the microstep offset in X), ESO DRS YOFFMICRO (the microstep offset in Y) and ESO DRS BACKMED (the background median). These have to be added by the calling routine.
ninputsThe number of input observation images
inconfsThe list of input confidence maps. If the list is NULL or has a size of zero, then no output confidence map will be created. If the list has a size that is less than the size of the input files list, then only the first one will be used (i.e. each input image has the same confidence map). If the list has the same number as the input images then all of the listed confidence maps will be used to form the output confidence map.
nconfsThe number of input confidence maps
nstepsThe number of steps in the microstep pattern, e.g. for a 3x3 microstep pattern, this should be set to 3.
pA propertylist that will be used for the output image. This will be the header for the first image in the input image frameset (infiles) with appropriate modifications to the WCS.
outimageThe output interleaved image
outconfThe output confidence map
statusAn input/output status that is the same as the returned values below.
Return values
CASU_OKif everything is ok
CASU_FATALif a failure occurs in either accessing input data or the input image list has not images in it.
QC headers:
None
DRS headers:
The following DRS keywords are written to the p propertylist
  • PROV**** The provenance keywords
Author
Jim Lewis, CASU

Definition at line 117 of file vircam/vircam_interleave.c.

References casu_crpixshift(), casu_fits_get_ehu(), casu_fits_get_image(), casu_fits_get_phu(), casu_prov(), casu_rescalecd(), and vircam_timestamp().

Referenced by vircam_jmp_interleave().

◆ vircam_lincor()

int vircam_lincor ( casu_fits *  infile,
casu_tfits *  lchantab,
int  kconst,
int  ndit,
int *  status 
)

Apply linearity curves to data.

Name:
vircam_lincor
Purpose:
Apply linearity curves to data.
Description:
Correct the data in an image for its non-linearity. This is done with the help of a linearity channel table and some basic timing information from the header.
Language:
C
Parameters
infileThe input image. This should probably be a series of dome flat exposures of a stable light source with varying exposure times.
lchantabThe linearity channel table
kconstIf this is set, then the value of k is constant for the image. This is true (for example) if the reset time equals the read time.
nditSet to the number of co-adds there are in the input data.
statusAn input/output status that is the same as the returned values below.
Return values
CASU_OKif everything is ok
CASU_FATALif the data array can't be mapped for the input image or the linearity channel table is invalid.
QC headers:
None
DRS headers:
The following DRS keywords are written to the infile extension header
  • LINCOR The name of the originating FITS file for the linearity table
Author
Jim Lewis, CASU

Definition at line 382 of file vircam_genlincur.c.

References casu_fits_get_ehu(), casu_fits_get_fullname(), casu_fits_get_image(), casu_tfits_get_filename(), casu_tfits_get_table(), vircam_chan_d2r(), vircam_chan_fill(), vircam_chan_free(), vircam_chan_r2a(), vircam_pfits_get_ditdelay(), vircam_pfits_get_exptime(), and vircam_pfits_get_mindit().

◆ vircam_mosaic()

int vircam_mosaic ( cpl_frameset *  infiles,
cpl_frameset *  inconf,
int  interp,
int  skyflag,
float  skywish_in,
const char *  expkey,
int  conflim,
casu_fits **  out,
casu_fits **  outc,
int *  status 
)

Create a vircam mosaic.

Name:
vircam_mosaic
Purpose:
Create a mosaic from a list of vircam pawprints
Description:
A mosaic is generated from (nominally six) pawprints of a vircam observation. The backgrounds are matched by scaling to exposure time (which should in theory be all the same, but maybe not...) and by photometric zeropoint. This requires the header item ESO QC MAGZPT to be present. If this is missing then this counts as a fatal error. If they are present, but if any one of them is set to zero, then a warning message is issued but the stacking continues without the photometric scaling.
Language:
C
Parameters
infilesA frameset with the input stacks
inconfA frameset with the input confidence maps
interpThe interpolation algorithm: 0 => nearest neighbour, 1 => bilinear interpolation
skyflagA flag for how you want the sky. 0 => don't adjust the input skies at all, 1 => set the background sky to the value of skywish_in, 2 => set the background sky to the average background for each input image
expkeyThe FITS keyword for the exposure time
conflimA lower limit to be placed on the input confidence. Pixels with confidence below this limit will be ignored.
outThe output mosaic
outcThe output confidence map
statusAn input/output status that is the same as the returned values below.
Return values
CASU_OKif everything is ok
CASU_FATALif there was some error detected in the input images
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 167 of file vircam_mosaic.c.

References casu_fits_delete(), casu_fits_get_ehu(), casu_fits_load(), casu_fits_wrap(), and casu_qmedsig().

◆ vircam_tilesky()

int vircam_tilesky ( casu_fits **  inlist,
int  nfiles,
casu_mask *  mask,
casu_fits **  skyout,
int *  status 
)

Work sky estimate from an input tile series.

Name:
vircam_tilesky
Purpose:
Work a sky estimate from an input tile
Description:
A list of images from a whole tile is given. These are broken up into groups that all have the same position within the jitter sequence. An intermediate sky is formed from each group and then a final output sky is formed from the intermediate sky files.
Language:
C
Parameters
inlistThe input images from the tile
nfilesThe number of images in the jitter series
maskThe bad pixel mask derived from the confidence map.
skyoutThe output sky map
statusAn input/output status that is the same as the returned values below.
Return values
CASU_OKif everything is ok
CASU_FATALif something went wrong. An error message will appear.
Author
Jim Lewis, CASU

Definition at line 94 of file vircam_sky.c.

References casu_fits_get_image(), casu_fits_get_phu(), casu_fits_wrap(), casu_imcombine(), casu_inpaint(), casu_mask_get_data(), casu_mask_get_size_x(), casu_mask_get_size_y(), vircam_pfits_get_jitteri(), and vircam_pfits_get_njsteps().