Basic-processing function

Data Structures

struct  muse_basicproc_params
 Structure of basic processing parameters. More...

Functions

muse_basicproc_paramsmuse_basicproc_params_new (cpl_parameterlist *aParameters, const char *aPrefix)
 Create a new structure of basic processing parameters.
muse_basicproc_paramsmuse_basicproc_params_new_from_propertylist (const cpl_propertylist *aHeader)
 Create a structure of basic processing parameters from a FITS header.
void muse_basicproc_params_delete (muse_basicproc_params *aBPars)
 Free a structure of basic processing parameters.
muse_imagelistmuse_basicproc_load (muse_processing *aProcessing, unsigned char aIFU, muse_basicproc_params *aBPars)
 Load the raw input files from disk and do basic processing.
muse_imagelistmuse_basicproc_load_reduced (muse_processing *aProcessing, unsigned char aIFU)
 Load reduced input files from disk.
cpl_table * muse_basicproc_get_illum (muse_imagelist *aImages, cpl_table *aTrace, cpl_table *aWave, cpl_table *aGeo)
 Get an illum/attached flat-field from an imagelist and prepare it for use.
cpl_error_code muse_basicproc_apply_illum (muse_pixtable *aPT, cpl_table *aAttached)
 Apply an illum/attached flat-field to a pixel table.
cpl_error_code muse_basicproc_apply_twilight (muse_pixtable *aPT, muse_datacube *aTwilight)
 Apply an attached flat-field to a pixel table.
muse_imagelistmuse_basicproc_combine_images_lampwise (muse_processing *aProcessing, unsigned char aIFU, muse_basicproc_params *aBPars, cpl_frameset ***aLabeledFrames)
 Combine several images into a lampwise image list.
cpl_error_code muse_basicproc_shift_pixtable (muse_pixtable *aPt, cpl_array *aLines, double aHalfWidth, double aBinWidth, float aLo, float aHi, unsigned char aIter)
 Compute wavelength corrections for science data based on reference sky lines.
cpl_error_code muse_basicproc_stats_append_header (cpl_image *aImage, cpl_propertylist *aHeader, const char *aPrefix, unsigned aStats)
 Compute image statistics of an image and add them to a header.
cpl_error_code muse_basicproc_stats_append_header_window (cpl_image *aImage, cpl_propertylist *aHeader, const char *aPrefix, unsigned aStats, int aX1, int aY1, int aX2, int aY2)
 Compute image statistics of an image window and add them to a header.
cpl_error_code muse_basicproc_qc_saturated (muse_image *aImage, const char *aPrefix)
 Add QC parameter about saturated pixels to a muse_image.

Detailed Description

This group contains functions that are common to some basic-processing recipes.


Function Documentation

cpl_error_code muse_basicproc_apply_illum ( muse_pixtable aPT,
cpl_table *  aAttached 
)

Apply an illum/attached flat-field to a pixel table.

Parameters:
aPT the pixel table
aAttached the table computed from the attached flat
Returns:
CPL_ERROR_NONE on success or a CPL error code on failure

This function expects the attached flat-field to be in form of a table, in the format created by muse_basicproc_prepare_attached().

Exceptions:
set and return CPL_ERROR_NULL_INPUT aPT, one of it's components, or aAttached are NULL

Definition at line 1813 of file muse_basicproc.c.

References muse_pixtable::header, MUSE_HDR_PT_ILLUM_MEAN, MUSE_HDR_PT_ILLUM_STDEV, MUSE_HDR_PT_ILLUMi, muse_pixtable_extracted_delete(), muse_pixtable_extracted_get_size(), muse_pixtable_extracted_get_slices(), muse_pixtable_origin_get_slice(), muse_utils_get_ifu(), and muse_pixtable::table.

cpl_error_code muse_basicproc_apply_twilight ( muse_pixtable aPT,
muse_datacube aTwilight 
)

Apply an attached flat-field to a pixel table.

Parameters:
aPT the pixel table
aTwilight the cube of the twilight skyflat exposure
Returns:
CPL_ERROR_NONE on success or a CPL error code on failure

This function applies the twilight-sky based illumination correction using a cube of the skyflat prepared by the muse_twilight recipe.

Spatially, the geometry-table based spatial pixel coordinates are used to find the nearest neighbor. In dispersion direction, the (up to two pixels) in the nearest wavelength plane(s) are interpolated linearly.

Exceptions:
set and return CPL_ERROR_NULL_INPUT aPT, one of it's components, or aAttached are NULL

Definition at line 1872 of file muse_basicproc.c.

References muse_datacube::data, muse_datacube::header, muse_pixtable::header, muse_pfits_get_cd(), muse_pfits_get_crpix(), muse_pfits_get_crval(), muse_pixtable_get_nrow(), muse_utils_get_ifu(), and muse_pixtable::table.

muse_imagelist* muse_basicproc_combine_images_lampwise ( muse_processing aProcessing,
unsigned char  aIFU,
muse_basicproc_params aBPars,
cpl_frameset ***  aLabeledFrames 
)

Combine several images into a lampwise image list.

Parameters:
aProcessing the processing structure
aIFU the IFU/channel number
aBPars basic processing parameters
aLabeledFrames optional output array of framesets containing used frames for each lamp
Returns:
the list as a muse_imagelist * or NULL on error

Combine several images into one, using method and parameters specified by aProcessing->parameters. Note that this function changes the input images if the "scale" option is used. If all images are found to be of the same lamp, they are all combined into a single output image, which is the only entry in the returned image list.

If aLabeledFrames is not NULL, it will contain a list of framesets or the same size as the returned imagelist. Each frameset contains the frames that were used to preprocess the image at the same index in the image list, and has to be deallocated using cpl_frameset_delete(). The returned pointer has to be deallocated with cpl_free(). The returned pointer will be NULL on error.

Exceptions:
set CPL_ERROR_NULL_INPUT, return NULL aProcessing is NULL
call muse_basicproc_load() with NULL parameter aBPars is NULL
propagate error code, return NULL image combination failed

Definition at line 2119 of file muse_basicproc.c.

References muse_image::header, muse_processing::inframes, muse_processing::intags, muse_basicproc_load(), muse_combine_images(), muse_combinepar_delete(), muse_combinepar_new(), muse_frameset_find_tags(), muse_imagelist_delete(), muse_imagelist_get(), muse_imagelist_get_size(), muse_imagelist_new(), muse_imagelist_set(), muse_processing::name, muse_processing::parameters, and muse_processing::usedframes.

cpl_table* muse_basicproc_get_illum ( muse_imagelist aImages,
cpl_table *  aTrace,
cpl_table *  aWave,
cpl_table *  aGeo 
)

Get an illum/attached flat-field from an imagelist and prepare it for use.

Parameters:
aImages image list to search for
aTrace trace table
aWave wavelength calibration table
aGeo geometry table
Returns:
the prepared CPL table or NULL on failure

This function finds and erases all attached flat-fields or illumination flat-fields from the input image lists. The first ILLUM found is then converted to a table that can be used by muse_basicproc_apply_illum() to correct a pixel table of a science exposure by the actual illumination.

Exceptions:
set CPL_ERROR_NULL_INPUT, return NULL one of the input pointers is NULL

Definition at line 1730 of file muse_basicproc.c.

References muse_image::header, muse_image_delete(), muse_imagelist_get(), muse_imagelist_get_size(), muse_imagelist_unset(), muse_pixtable_create(), muse_pixtable_delete(), and muse_utils_get_ifu().

muse_imagelist* muse_basicproc_load ( muse_processing aProcessing,
unsigned char  aIFU,
muse_basicproc_params aBPars 
)

Load the raw input files from disk and do basic processing.

Parameters:
aProcessing the processing structure
aIFU the IFU/channel number
aBPars basic processing parameters
Returns:
the muse_imagelist * or NULL on error

Read the raw input files from disk and store them as images in the images structure. Apply bad pixel table, bias, dark, and flat files to them, thereby adding two images with bad pixel information and variance to each of them, so that they are all of format muse_image. Saturated pixels are added to the bad pixel extension of every image.

For raw bias exposures, the overscan levels are checked against the first input file. A mean overscan level is then added to the header of the first image to be propagated into the final combined master bias.

For raw flat-field exposures, the gain is estimated from the data and compared to the one listed in the input FITS header.

The necessary calibrations for each step are loaded as required.

Exceptions:
propagate error from muse_processing_check_input(), return NULL input data is invalid somehow (NULL aProcessing pointer etc.)
set an error code, return NULL raw images could not be loaded
reset errors and continue applying the bad pixel table failed
set a cpl_error_code, return NULL saturation check failed
set a cpl_error_code, return NULL correcting quadrants by overscan fitting failed
set a cpl_error_code, return NULL computing overscan statistics and rejecting cosmic rays in overscans failed
set a cpl_error_code, return NULL images could not be trimmed
output warning and continue overscan correction was requested but failed
set a cpl_error_code, return NULL overscan check failed
set a cpl_error_code, return NULL applying bias failed
ignore errors and continue checking gain failed
set a cpl_error_code, return NULL coversion from adu to count failed
set a cpl_error_code, return NULL applying dark failed
set a cpl_error_code, return NULL carrying out cr rejection failed
set a cpl_error_code, return NULL applying simple sky subtraction failed
set a cpl_error_code, return NULL applying flat failed

Definition at line 1543 of file muse_basicproc.c.

References muse_imagelist_delete(), and muse_processing_check_input().

Referenced by muse_basicproc_combine_images_lampwise().

muse_imagelist* muse_basicproc_load_reduced ( muse_processing aProcessing,
unsigned char  aIFU 
)

Load reduced input files from disk.

Parameters:
aProcessing the processing structure
aIFU the IFU/channel number
Returns:
the muse_imagelist * or NULL on error

Read the reduced input files from disk and store them as images in the images structure.

Exceptions:
propagate error from muse_processing_check_input(), return NULL input data is invalid somehow (NULL aProcessing pointer etc.)

Definition at line 1633 of file muse_basicproc.c.

References muse_processing::inframes, muse_processing::intags, muse_frameset_find_tags(), muse_image_load(), muse_image_load_from_extensions(), muse_imagelist_new(), muse_imagelist_set(), and muse_processing_append_used().

void muse_basicproc_params_delete ( muse_basicproc_params aBPars  ) 

Free a structure of basic processing parameters.

Parameters:
aBPars the structure of basic processing parameters

This deallocates the string components and the structure itself.

Definition at line 163 of file muse_basicproc.c.

References muse_basicproc_params::crmethod, muse_basicproc_params::overscan, and muse_basicproc_params::rejection.

muse_basicproc_params* muse_basicproc_params_new ( cpl_parameterlist *  aParameters,
const char *  aPrefix 
)

Create a new structure of basic processing parameters.

Parameters:
aParameters the list of parameters
aPrefix the prefix of the recipe
Returns:
The basic processing parameters as muse_basicproc_params or NULL on error.

Create a new set of basic processing parameters from a recipe parameter list. It takes the parameters "overscan", "ovscreject", "ovscsigma", and "ovscignore" and converts them into the structure. If aPrefix contains "muse_scibasic", it also takes the parameters "cr", "xbox", "ybox", "passes", and "thres".

The error handling is done by the cpl_parameterlist functions that this function calls.

Use muse_basicproc_params_delete() to free memory allocated by this function.

Definition at line 82 of file muse_basicproc.c.

References muse_basicproc_params::crmethod, muse_basicproc_params::dcrpasses, muse_basicproc_params::dcrthres, muse_basicproc_params::dcrxbox, muse_basicproc_params::dcrybox, muse_cplparamerterlist_find_prefix(), muse_basicproc_params::overscan, muse_basicproc_params::ovscignore, muse_basicproc_params::ovscsigma, and muse_basicproc_params::rejection.

Referenced by muse_basicproc_params_new_from_propertylist().

muse_basicproc_params* muse_basicproc_params_new_from_propertylist ( const cpl_propertylist *  aHeader  ) 

Create a structure of basic processing parameters from a FITS header.

Parameters:
aHeader the FITS header
Returns:
The basic processing parameters as muse_basicproc_params or NULL on error.

This creates a new parameter list from the ESO.PRO.REC1 keywords present in the input FITS header, and then gives the result to muse_basicproc_params_new() to actually create the output structure.

Note:
This only works, if the input header is that of a product produced by the MUSE pipeline.

Use muse_basicproc_params_delete() to free memory allocated by this function.

Definition at line 138 of file muse_basicproc.c.

References muse_basicproc_params_new(), and muse_cplparameterlist_from_propertylist().

cpl_error_code muse_basicproc_qc_saturated ( muse_image aImage,
const char *  aPrefix 
)

Add QC parameter about saturated pixels to a muse_image.

Parameters:
aImage the image to count on and modify
aPrefix prefix of the QC header
Returns:
CPL_ERROR_NONE on success, another CPL error code on failure.

Count EURO3D_SATURATED pixels in the dq component of aImage and add a aPrefix+QC_BASIC_NSATURATED (if aPrefix does not contain a trailing space, one is added in between) keyword to its header component.

Exceptions:
return CPL_ERROR_NULL_INPUT aImage or its dq or header components, or aPrefix are NULL
propagate error code keyword updating failed

Definition at line 2459 of file muse_basicproc.c.

References muse_image::dq, and muse_image::header.

cpl_error_code muse_basicproc_shift_pixtable ( muse_pixtable aPt,
cpl_array *  aLines,
double  aHalfWidth,
double  aBinWidth,
float  aLo,
float  aHi,
unsigned char  aIter 
)

Compute wavelength corrections for science data based on reference sky lines.

Parameters:
aPt the pixel table with the science data
aLines array with the reference wavelengths of sky emission lines
aHalfWidth half-width of the wavelength region around each sky line
aBinWidth pixel size in Angstrom of the intermediate spectrum
aLo low sigma-clipping limit for the intermediate spectrum
aHi high sigma-clipping limit for the intermediate spectrum
aIter number of iterations for sigma-clipping the spectrum
Returns:
CPL_ERROR_NONE on success or another CPL error code on failure

This function subsequently calls muse_utils_pixtable_fit_line_gaussian() for all sky lines given in aLines. It computes a weighted mean offset and applies this shift in wavelength to the data in aPt.

The input array aLines needs to be of simple floating-point type.

Exceptions:
return CPL_ERROR_NULL_INPUT aPt and/or aLines are NULL
return CPL_ERROR_ILLEGAL_INPUT aLines is not of floating-point type

Definition at line 2304 of file muse_basicproc.c.

References muse_pixtable::header, MUSE_HDR_PT_LHI, MUSE_HDR_PT_LLO, muse_utils_get_ifu(), muse_utils_pixtable_fit_line_gaussian(), and muse_pixtable::table.

cpl_error_code muse_basicproc_stats_append_header ( cpl_image *  aImage,
cpl_propertylist *  aHeader,
const char *  aPrefix,
unsigned  aStats 
)

Compute image statistics of an image and add them to a header.

Parameters:
aImage the image to derive statistics for and add them to
aHeader the header to add them to
aPrefix the prefix of the output FITS keywords
aStats the statistics properties to compute
Returns:
a CPL error code on failure or CPL_ERROR_NONE on success

This function only supports a subset of the properties supported by cpl_stats_new_from_image(), see muse_basicproc_stats_append_header_window().

Definition at line 2365 of file muse_basicproc.c.

References muse_basicproc_stats_append_header_window().

cpl_error_code muse_basicproc_stats_append_header_window ( cpl_image *  aImage,
cpl_propertylist *  aHeader,
const char *  aPrefix,
unsigned  aStats,
int  aX1,
int  aY1,
int  aX2,
int  aY2 
)

Compute image statistics of an image window and add them to a header.

Parameters:
aImage the image to derive statistics for and add them to
aHeader the header to add them to
aPrefix the prefix of the output FITS keywords
aStats the statistics properties to compute
aX1 the lower left x-coordinate of the window
aY1 the lower left y-coordinate of the window
aX2 the upper right x-coordinate of the window
aY2 the upper right y-coordinate of the window
Returns:
a CPL error code on failure or CPL_ERROR_NONE on success

This function only supports a subset of the properties supported by cpl_stats_new_from_image_window(), namely median, mean, stdev, min, max, and flux,

Definition at line 2395 of file muse_basicproc.c.

Referenced by muse_basicproc_stats_append_header().


Generated on 26 Jan 2017 for MUSE Pipeline Reference Manual by  doxygen 1.6.1