Functions to handle VISIR input data


Functions

cpl_image ** visir_img_collapse_beam (cpl_propertylist *qclist, const cpl_image *self, const cpl_parameterlist *parlist, const char *recipename, visir_chopnod_mode mode, const cpl_propertylist *plist)
 Collapse the 3/4 beams of a combined image.
cpl_imagelist * visir_inputs_combine (const char *recipename, const cpl_parameterlist *parlist, const irplib_framelist *rawframes, const char *badpix, const char *flat, int *nodding_p, cpl_boolean do_spc_fix, double wlen, visir_spc_resol resol)
 The VISIR input data re-combination is performed here.
cpl_image ** visir_img_recombine (const char *recipename, const cpl_parameterlist *parlist, const irplib_framelist *rawframes, const char *badpix, const char *flat, cpl_geom_combine combine_mode, cpl_boolean *pdid_resize, cpl_boolean do_spc_fix, double wlen, visir_spc_resol resol)
 The VISIR imaging combination using cross correlation.
cpl_imagelist * visir_load_hcycle (const irplib_framelist *rawframes, int pos)
 Load the HCYCLE images from a VISIR file.
cpl_error_code visir_image_reject_hot (cpl_image *self, const char *bpmfile)
 Reject the hot pixels in an image.
cpl_imagelist * visir_imagelist_load_last (const irplib_framelist *rawframes)
 Load the last frame of the input files to an image list.
cpl_imagelist * visir_load_imagelist (const irplib_framelist *rawframes, int pos, cpl_boolean is_interm)
 Load either a INTERM or Half-Cycle cube from a VISIR file.

Function Documentation

cpl_image** visir_img_collapse_beam ( cpl_propertylist *  qclist,
const cpl_image *  self,
const cpl_parameterlist *  parlist,
const char *  recipename,
visir_chopnod_mode  mode,
const cpl_propertylist *  plist 
)

Collapse the 3/4 beams of a combined image.

Parameters:
self The combined image to collapse
qclist Append QC parameters here
parlist Parameterlist w. maximum allowed eccentricity
recipename The recipe name in the parameterlist
mode VISIR_CHOPNOD_PERPENDICULAR, _PARALLEL or _AUTO
plist Propertylist of the 1st raw image
Returns:
A pointer to the newly allocated image array or NULL on error
See also:
visir_img_recombine()
The returned images array contains 2 images:
  • the combined image
  • the contribution map

If not null, the returned image array arr must be deallocated like this: cpl_image_delete(arr[0]); cpl_image_delete(arr[1]); cpl_free(arr);

Definition at line 142 of file visir_inputs.c.

References visir_parameterlist_get_double(), visir_pfits_get_chop_throw(), visir_pfits_get_chopnod_dir(), and visir_pfits_get_pixscale().

cpl_imagelist* visir_inputs_combine ( const char *  recipename,
const cpl_parameterlist *  parlist,
const irplib_framelist *  rawframes,
const char *  badpix,
const char *  flat,
int *  nodding_p,
cpl_boolean  do_spc_fix,
double  wlen,
visir_spc_resol  resol 
)

The VISIR input data re-combination is performed here.

Parameters:
recipename The name of the calling recipe
parlist hte recipe parameter list
rawframes the frames list
badpix the optionally user provided bad pixels map
flat the optionally user provided flat field
nodding_p Optional, pre-allocated array for nodding positions
do_spc_fix True iff spectro distortion correction is to be done
wlen Central wavelength (ignored unless do_spc_fix is true)
resol Spectral resolution (ignored unless do_spc_fix is true)
Returns:
a pointer to the newly allocated nodded images set or NULL.
The input list of files has to contain an even number if files: 2*n.

Let's suppose n=2. We have here 4 input files.

Each file is a 'INTERM' type of file produced by IRACE. If A and B are the two images produced by the 2 chopping positions, an 'INTERM' file contains (example with 3 chopping cycles):

A1-B1 ((A1-B1) + (A2-B2)) / 2 ((A1-B1) + (A2-B2) + (A3-B3)) / 3

The first step of the algorithm is to convert each of these 4 files in:

A1-B1 A2-B2 A3-B3

The glitches are removed from each image of each image set (if requested).

The image sets are purged from their bad images (if requested).

Each input file/cube (f) is then averaged (avg(f)) and normalised by a factor defined like this: factor(f) = nod_pos(f) * DIT * nimages * 2 where nod_pos(f) is 1 is the object is observed in the center of the image and -1 if the sky is observed in the center (object is on the side).

Each pair of files (f1, f2) is then reduce to one nodded image: nodded = (avg(f1)/factor(f1) + avg(f2)/factor(f2))/2

Each nodded image is then flatfielded and bad pixels corrected if requested.

If no bad pixel map is provided, and if the auto_bpm flag is set, the first file hcycle image is used to determine a map of bad pixels: the pixels whose value is bigger than VISIR_HCYCLE_BPM_THRESHOLD are flagged as bad.

Each nodded image (there should be 2 in this example) shall represent a bright star in the center with 2 shadows. The shadow comes from the chopping (A-B), and it is duplicated because of the nodding (2 files used to create nodded).

The nodded images are returned in an image set.

Two modes are allowed : the staring mode where all nod_pos=1 (no nodding) and the nodding mode where in each pair, there must be one nod_pos=1 and one nod_pos=-1.

The NODPOS keyword is used to determine if the object (val=A, nod_pos=1) or the sky (val=B, nod_pos=-1) is in the center. If this keyword is missing in the header, a user can provide an ascii file containing 0 (for A positions) or 1 (for B positions) in each line (as many lines as input files) : # Example with 4 input files 1 0 2 1 3 1 4 0

If the passed nodding_p is not NULL, it must be a pointer to an allocated integers array containing one element per input frame. Something like nodding_p = cpl_malloc(nb_input_frames * sizeof(int)); must be done by the caller function. nodding_p is filled with 1 if the file correspond to an object observation, and with -1 for the sky.

The returned image set must be deallocated with cpl_imagelist_delete().

Definition at line 325 of file visir_inputs.c.

References irplib_framelist_contains(), irplib_framelist_get_const(), irplib_framelist_get_propertylist_const(), irplib_framelist_get_size(), visir_load_imagelist(), visir_parameterlist_get_bool(), visir_parameterlist_get_double(), visir_parameterlist_get_int(), visir_parameterlist_get_string(), visir_pfits_get_dit(), and visir_pfits_get_nodpos().

Referenced by visir_img_recombine().

cpl_image** visir_img_recombine ( const char *  recipename,
const cpl_parameterlist *  parlist,
const irplib_framelist *  rawframes,
const char *  badpix,
const char *  flat,
cpl_geom_combine  combine_mode,
cpl_boolean *  pdid_resize,
cpl_boolean  do_spc_fix,
double  wlen,
visir_spc_resol  resol 
)

The VISIR imaging combination using cross correlation.

Parameters:
recipename The name of the calling recipe
parlist the recipe parameter list
rawframes the list of raw frames
badpix the optionally user provided bad pixels map
flat the optionally user provided flat field
combine_mode The combine mode (first, union, intersect)
pdid_resize Set to true if the combined image was resized
do_spc_fix True iff spectro distortion correction is to be done
wlen Central wavelength (ignored unless do_spc_fix is true)
resol Spectral resolution (ignored unless do_spc_fix is true)
Returns:
a pointer to the newly allocated image array or NULL on error
See also:
visir_inputs_combine()
The input files are first recombined to create the nodded images using visir_inputs_combine().

The created nodded images are then shifted and added to create the final combined image. The offsets stored in the SEQ.CUMOFFSETX and Y keywords of the frames whose nod_pos==1 are used as first estimate. If the offsets keywords are missing in the header, a user can provide an ascii file containing the x and y offsets of each input pair of file as here: # Example with 4 input files # file nb. x offset y offset 1 0 0 # correspond to file 1 2 -10 10 # correspond to file 4

A cross-correlation method is used to refine the offsets before the shift&add. The cross-correlation needs anchor points that typically are bright objects. These are automatically detected but can also be provided by the user through an ascii file containing as many lines as objects, and for each one the x and y positions of the object in the image: # Example with 1 object # obj nb. x pos y pos 1 125 135 # correspond to object 1

The returned images array contains 2 images:

  • the combined image
  • the contribution map

If not null, the returned image array arr must be deallocated like this: cpl_image_delete(arr[0]); cpl_image_delete(arr[1]); cpl_free(arr);

Definition at line 852 of file visir_inputs.c.

References irplib_framelist_get_propertylist_const(), irplib_framelist_get_size(), visir_inputs_combine(), visir_parameterlist_get_bool(), visir_parameterlist_get_int(), visir_parameterlist_get_string(), visir_pfits_get_cumoffsetx(), and visir_pfits_get_cumoffsety().

cpl_imagelist* visir_load_hcycle ( const irplib_framelist *  rawframes,
int  pos 
)

Load the HCYCLE images from a VISIR file.

Parameters:
rawframes The rawframes
pos The frame to load
Returns:
The newly allocated image set with the HCYCLE frames
The input file is a VISIR file can have the format CUBE1 (DET FRAM TYPE = CUBE1) :
  • chopping cube (INTERM-INT: A1-B1, ..., (A1-B1+...+An-Bn)/n)
  • first HCYCLE frame
  • INT image

or the format CUBE2 (DET FRAM TYPE = CUBE2) :

  • HCYCLE frame nb 1
  • A1-B1
  • ...
  • HCYCLE frame nb n
  • (A1-B1+...+An-Bn)/n
  • INT

This function gets the HCYCLE images

Definition at line 1085 of file visir_inputs.c.

References visir_load_imagelist().

cpl_error_code visir_image_reject_hot ( cpl_image *  self,
const char *  bpmfile 
)

Reject the hot pixels in an image.

Parameters:
self The image with hot pixels
bpmfile Name of file with bad-pixel-map, or NULL
Returns:
CPL_ERROR_NONE, or the relevant CPL_ERROR code.
Iff a name of a bad pixel map FITS file is provided it is used for the cleaning. Otherwise auto-cleaning is done.

Definition at line 1102 of file visir_inputs.c.

cpl_imagelist* visir_imagelist_load_last ( const irplib_framelist *  rawframes  ) 

Load the last frame of the input files to an image list.

Parameters:
rawframes List of frames with identical number of planes
Returns:
the imagelist or NULL on error

Definition at line 1154 of file visir_inputs.c.

References irplib_framelist_contains(), irplib_framelist_get_propertylist_const(), irplib_imagelist_load_framelist(), and visir_pfits_get_naxis3().

cpl_imagelist* visir_load_imagelist ( const irplib_framelist *  rawframes,
int  pos,
cpl_boolean  is_interm 
)

Load either a INTERM or Half-Cycle cube from a VISIR file.

Parameters:
rawframes The rawframes
pos The position of the frame
is_interm True iff the the requested image type is INTERM
Returns:
the newly allocated imagelist
See also:
visir_load_intermint().

Definition at line 1191 of file visir_inputs.c.

References irplib_framelist_get_const(), irplib_framelist_get_propertylist_const(), visir_pfits_get_chop_ncycles(), visir_pfits_get_frame_type(), and visir_pfits_get_naxis3().

Referenced by visir_inputs_combine(), visir_load_hcycle(), and visir_spc_phot_sensit().


Generated on Thu Mar 24 11:59:40 2011 for VISIR Pipeline Reference Manual by  doxygen 1.5.8