MUSE Pipeline Reference Manual  2.1.1
Data Structures | Functions
Imagelist processing for the four-extension image format

Data Structures

struct  muse_imagelist
 Structure definition for a collection of muse_images. More...
 

Functions

muse_imagelistmuse_imagelist_new (void)
 Create a new (empty) MUSE image list. More...
 
void muse_imagelist_delete (muse_imagelist *aList)
 Free the memory of the MUSE image list. More...
 
unsigned int muse_imagelist_get_size (muse_imagelist *aList)
 Return the number of stored images. More...
 
muse_imagemuse_imagelist_get (muse_imagelist *aList, unsigned int aIdx)
 Get the muse_image of given list index. More...
 
cpl_error_code muse_imagelist_set (muse_imagelist *aList, muse_image *aImage, unsigned int aIdx)
 Set the muse_image of given list index. More...
 
muse_imagemuse_imagelist_unset (muse_imagelist *aList, unsigned int aIdx)
 Unset the muse_image at given list index from the list. More...
 
int muse_imagelist_is_uniform (muse_imagelist *aList)
 Check that all images in the muse_imagelist have the same size. More...
 
void muse_imagelist_dump_statistics (muse_imagelist *aList)
 Show statistics of a muse_image list. More...
 
cpl_error_code muse_imagelist_scale_exptime (muse_imagelist *aList)
 Scale muse_images to a common exposure time. More...
 
cpl_bivector * muse_imagelist_compute_ron (muse_imagelist *aList, int aHalfsize, int aNSamples)
 Compute the read-out noise from bias images in an imagelist. More...
 

Detailed Description

Functions to handle lists of muse_images.

Function Documentation

cpl_bivector* muse_imagelist_compute_ron ( muse_imagelist aList,
int  aHalfsize,
int  aNSamples 
)

Compute the read-out noise from bias images in an imagelist.

Parameters
aListthe image list
aHalfsizehalf size of sample squares
aNSamplesnumber of sample squares
Returns
cpl_bivector * for read-out noise values of the quadrants or NULL on error

The output bivector has a length of 4, with one entry for RON (in the x-component) and RONERR (in y) for each quadrant.

This loops through all images in the input list and subtracts one from the next. From the difference image the RON is measured. So several RON values are derived (one less than the size of the input list) which are then averaged to create the final value. RONERR should be at most 10% of RON, so this function reruns cpl_flux_get_noise_window() until that is reached.

This function assumes that the input images are all bias images, that the GAIN value in the header is accurate, and that the images are still in the original adu.

Note
This function overwrites the stat component (the variance extension) of all images with the variance computed using the read-out noise derived here.

Uses the formula from "Handbook of CCD Astronomy" by Steve B. Howell (2000, Sect. 4.3, p. 53) to scale the measured values to the correct ones: RON = GAIN * sigma(B1 - B2) / sqrt(2) where sigma() is the read-out noise measured on the difference bias image and GAIN is in count/adu.

Exceptions
set CPL_ERROR_NULL_INPUT, return NULLaList is NULL
set CPL_ERROR_ILLEGAL_INPUT, return NULLaList has no elementes

Definition at line 364 of file muse_imagelist.c.

References muse_image::data, muse_image::header, list, muse_imagelist_get_size(), muse_pfits_get_gain(), muse_pfits_get_ron(), muse_quadrants_get_window(), muse_utils_get_ifu(), size, and muse_image::stat.

void muse_imagelist_delete ( muse_imagelist aList)

Free the memory of the MUSE image list.

Parameters
aListthe image list

Frees the memory of all muse_images in the list and the pointers to the image list and the list itself. As a safeguard, it checks if a valid pointer was passed, so that crashes cannot occur.

Definition at line 78 of file muse_imagelist.c.

References list, muse_image_delete(), and size.

Referenced by muse_basicproc_combine_images_lampwise(), muse_basicproc_load(), muse_basicproc_params_delete(), muse_dar_check(), muse_datacube_concat(), muse_datacube_delete(), muse_euro3dcube_delete(), muse_wave_calib(), muse_wave_calib_lampwise(), and muse_wcs_locate_sources().

void muse_imagelist_dump_statistics ( muse_imagelist aList)

Show statistics of a muse_image list.

Parameters
aListthe image list
Exceptions
return without doing anythingaList is NULL

Definition at line 269 of file muse_imagelist.c.

References muse_image::data, muse_image::header, muse_imagelist_get(), muse_pfits_get_exptime(), and size.

muse_image* muse_imagelist_get ( muse_imagelist aList,
unsigned int  aIdx 
)

Get the muse_image of given list index.

Parameters
aListthe image list
aIdxindex of the image to return, starting at 0
Returns
the corresponding muse_image or NULL on error

This function only returns a pointer to the actual image which remains in the image list and will be deallocated with it. So do not use muse_image_delete() on the pointer returned by this function.

Exceptions
set CPL_ERROR_NULL_INPUT, return NULLaList is NULL
set CPL_ERROR_ACCESS_OUT_OF_RANGE, return NULLaIdx does not exist in the list

Definition at line 126 of file muse_imagelist.c.

References list.

Referenced by muse_basicproc_combine_images_lampwise(), muse_basicproc_get_illum(), muse_basicproc_params_delete(), muse_combine_images(), muse_datacube_save_recimages(), muse_euro3dcube_delete(), muse_geo_measure_spots(), muse_imagelist_dump_statistics(), muse_imagelist_is_uniform(), muse_imagelist_scale_exptime(), muse_lsf_create_arcpixtable(), muse_pixtable_from_imagelist(), muse_wave_calib_lampwise(), and muse_wcs_optimize_solution().

unsigned int muse_imagelist_get_size ( muse_imagelist aList)
int muse_imagelist_is_uniform ( muse_imagelist aList)

Check that all images in the muse_imagelist have the same size.

Parameters
aListthe image list
Returns
0 when the list is uniform, a positive number if the list contains deviant images, a negative value on error.

Unlike cpl_imagelists, the types of the images are automatically equal, so this is not tested.

Note
Normally, the positive return value matches the number (starting at 1!) of the first deviant image in the list. If the list is empty, it returns
  1. If the number of images in the list should exceed INT_MAX, a negative number will be returned (due to integer overflow).
Exceptions
set CPL_ERROR_NULL_INPUT, return -1aList is NULL

Definition at line 240 of file muse_imagelist.c.

References muse_imagelist_get(), and size.

Referenced by muse_basicproc_params_delete().

muse_imagelist* muse_imagelist_new ( void  )
cpl_error_code muse_imagelist_scale_exptime ( muse_imagelist aList)

Scale muse_images to a common exposure time.

Parameters
aListthe image list
Returns
CPL_ERROR_NONE on success, another CPL error code on failure.

Scale all muse_images and their statistics by their exposure time (FITS keyword EXPTIME) relative to the first exposure in the input list. Reset their EXPTIME keyword to the value of the first exposure, too.

Exceptions
set and return CPL_ERROR_NULL_INPUTaList is NULL

Definition at line 308 of file muse_imagelist.c.

References muse_image::header, muse_image_scale(), muse_imagelist_get(), muse_pfits_get_exptime(), and size.

Referenced by muse_combine_images().

cpl_error_code muse_imagelist_set ( muse_imagelist aList,
muse_image aImage,
unsigned int  aIdx 
)

Set the muse_image of given list index.

Parameters
aListthe image list
aImagethe muse_image to set
aIdxindex of the image to return, starting at 0
Returns
CPL_ERROR_NONE on success of a CPL error on failure

If the index points to an existing muse_image in the list, that will be deallocated and replaced by the given image. Otherwise the list will be extended to store a new image at aIdx, possibly even with empty entries in between.

You should not deallocate the image after it has been inserted into an imagelist, since the muse_imagelist_delete() will deallocate its images.

Exceptions
return CPL_ERROR_NULL_INPUTaList or aImage are NULL
return CPL_ERROR_ILLEGAL_INPUTthe pointer to aImage was already added to aList

Definition at line 156 of file muse_imagelist.c.

References list, muse_image_delete(), and size.

Referenced by muse_basicproc_combine_images_lampwise(), muse_basicproc_load_reduced(), muse_basicproc_params_delete(), muse_dar_check(), muse_datacube_load(), muse_pixtable_to_imagelist(), muse_postproc_cube_resample_and_collapse(), muse_wave_calib(), muse_wave_calib_lampwise(), and muse_wcs_locate_sources().

muse_image* muse_imagelist_unset ( muse_imagelist aList,
unsigned int  aIdx 
)

Unset the muse_image at given list index from the list.

Parameters
aListthe image list
aIdxindex of the image to unset, starting at 0
Returns
The pointer to the removed muse_image or NULL on failure.

If the index points to an existing muse_image in the list, that will be erased from the list. The image at that position is returned by this function so that the user can deallocate it, if no longer needed. The rest of the images are moved to the previous position in the list and the size of the list is decreased by one.

Exceptions
set CPL_ERROR_NULL_INPUT, return NULLaList is NULL
set CPL_ERROR_ACCESS_OUT_OF_RANGE, return NULLaIdx does not exist in the list

Definition at line 200 of file muse_imagelist.c.

References list, and size.

Referenced by muse_basicproc_get_illum().