VISIR Pipeline Reference Manual  4.1.0
Functions
Functions to handle VISIR input data

Functions

static cpl_error_code visir_load_cube2_split_ (cpl_imagelist *alist, cpl_imagelist *blist, cpl_imagelist *packed, cpl_image *prevd)
 
static cpl_imagelist * load_range (const char *filename, cpl_type im_type, int iext, int pstart, int pend)
 
cpl_error_code visir_load_cube2_split (cpl_imagelist *alist, cpl_imagelist *blist, const irplib_framelist *rawframes, int pos, const int planestart, const int planeend)
 Load and split the data in a CUBE2 file. More...
 
static cpl_error_code visir_load_burst_ (cpl_imagelist *alist, cpl_imagelist *blist, cpl_imagelist *packed, const int ichopchange, const int ihalfcycle, const int trimlow, int const trimhigh)
 
static int get_to_off_plane (int chopchange, const int offset, const int ihalfcycle)
 
cpl_error_code visir_load_burst (cpl_imagelist *alist, cpl_imagelist *blist, const cpl_frame *frame, const cpl_propertylist *plist, const int ichopchange, const int ihalfcycle, const int planestart, const int planeend, const int trimlow, const int trimhigh)
 
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. More...
 
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. More...
 
static double get_cumoffsets (const cpl_propertylist *plist, double *x, double *y)
 
cpl_image ** visir_img_recombine_list (const char *recipename, const cpl_parameterlist *parlist, cpl_imagelist *nodded, const cpl_propertylist **plists, cpl_geom_combine combine_mode, cpl_boolean *pdid_resize)
 The VISIR imaging combination using cross correlation. More...
 
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. More...
 
cpl_imagelist * visir_load_hcycle (const irplib_framelist *rawframes, int pos)
 Load the HCYCLE images from a VISIR file. More...
 
cpl_error_code visir_image_reject_hot (cpl_image *self, const char *bpmfile)
 Reject the hot pixels in an image. More...
 
cpl_imagelist * visir_imagelist_load_last (const irplib_framelist *rawframes)
 Load the last frame of the input files to an image list. More...
 
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. More...
 

Detailed Description

Function Documentation

cpl_error_code visir_load_cube2_split ( cpl_imagelist *  alist,
cpl_imagelist *  blist,
const irplib_framelist *  rawframes,
int  pos,
const int  planestart,
const int  planeend 
)

Load and split the data in a CUBE2 file.

Parameters
alistThe list to be filled with A-frames
blistThe list to be filled with B-frames
rawframesThe rawframes
posThe position of the frame
planestartNumber of the first frame to load. Counting from 0
planeendNumber of the last frame to load + 1. Counting from 0
Returns
CPL_ERROR_NONE, or the relevant CPL_ERROR code.
See Also
visir_load_intermint()

The input VISIR file must have the format CUBE2 (DET FRAM TYPE = CUBE2) :

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

This function gets the chopping image set A1-B1, ..., (A1-B1+...+An-Bn)/n (also named INTERM-INT) out of it.

Definition at line 238 of file visir_inputs.c.

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

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
qclistAppend QC parameters here
selfThe combined image to collapse
parlistParameterlist w. maximum allowed eccentricity
recipenameThe recipe name in the parameterlist
modeVISIR_CHOPNOD_PERPENDICULAR, _PARALLEL or _AUTO
plistPropertylist 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 504 of file visir_inputs.c.

References visir_parameterlist_get_double(), visir_pfits_get_chop_posang(), 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
recipenameThe name of the calling recipe
parlisthte recipe parameter list
rawframesthe frames list
badpixthe optionally user provided bad pixels map
flatthe optionally user provided flat field
nodding_pOptional, pre-allocated array for nodding positions
do_spc_fixTrue iff spectro distortion correction is to be done
wlenCentral wavelength (ignored unless do_spc_fix is true)
resolSpectral 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 686 of file visir_inputs.c.

References irplib_framelist_contains(), irplib_framelist_get_const(), irplib_framelist_get_propertylist_const(), irplib_framelist_get_size(), visir_destripe_image(), 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_list ( const char *  recipename,
const cpl_parameterlist *  parlist,
cpl_imagelist *  nodded,
const cpl_propertylist **  plists,
cpl_geom_combine  combine_mode,
cpl_boolean *  pdid_resize 
)

The VISIR imaging combination using cross correlation.

Parameters
recipenameThe name of the calling recipe
parlistthe recipe parameter list
noddedList of nod combined images
plistsArray of property lists, same length as nodded images
combine_modeThe combine mode (first, union, intersect)
pdid_resizeSet to true if the combined image was resized
Returns
a pointer to the newly allocated image array or NULL on error
See Also
visir_img_recombine()

recombine variant taking a list as input, see visir_img_recombine for documentation

Definition at line 1224 of file visir_inputs.c.

References visir_parameterlist_get_bool(), visir_parameterlist_get_int(), and visir_parameterlist_get_string().

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
recipenameThe name of the calling recipe
parlistthe recipe parameter list
rawframesthe list of raw frames
badpixthe optionally user provided bad pixels map
flatthe optionally user provided flat field
combine_modeThe combine mode (first, union, intersect)
pdid_resizeSet to true if the combined image was resized
do_spc_fixTrue iff spectro distortion correction is to be done
wlenCentral wavelength (ignored unless do_spc_fix is true)
resolSpectral 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 1435 of file visir_inputs.c.

References irplib_framelist_get_propertylist_const(), irplib_framelist_get_size(), visir_img_recombine_list(), and visir_inputs_combine().

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

Load the HCYCLE images from a VISIR file.

Parameters
rawframesThe rawframes
posThe 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) :

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

This function gets the HCYCLE images

Definition at line 1533 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
selfThe image with hot pixels
bpmfileName 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 1550 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
rawframesList of frames with identical number of planes
Returns
the imagelist or NULL on error

Definition at line 1602 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
rawframesThe rawframes
posThe position of the frame
is_intermTrue iff the the requested image type is INTERM
Returns
the newly allocated imagelist
See Also
visir_load_intermint().

Definition at line 1639 of file visir_inputs.c.

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

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