MUSE Pipeline Reference Manual
2.1.1
|
Data Structures | |
struct | muse_basicproc_params |
Structure of basic processing parameters. More... | |
Functions | |
muse_basicproc_params * | muse_basicproc_params_new (cpl_parameterlist *aParameters, const char *aPrefix) |
Create a new structure of basic processing parameters. More... | |
muse_basicproc_params * | muse_basicproc_params_new_from_propertylist (const cpl_propertylist *aHeader) |
Create a structure of basic processing parameters from a FITS header. More... | |
void | muse_basicproc_params_delete (muse_basicproc_params *aBPars) |
Free a structure of basic processing parameters. More... | |
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. More... | |
muse_imagelist * | muse_basicproc_load_reduced (muse_processing *aProcessing, unsigned char aIFU) |
Load reduced input files from disk. More... | |
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. More... | |
cpl_error_code | muse_basicproc_apply_illum (muse_pixtable *aPT, cpl_table *aAttached) |
Apply an illum/attached flat-field to a pixel table. More... | |
cpl_error_code | muse_basicproc_apply_twilight (muse_pixtable *aPT, muse_datacube *aTwilight) |
Apply an attached flat-field to a pixel table. More... | |
cpl_error_code | muse_basicproc_mask_notch_filter (muse_pixtable *aPT, unsigned char aIFU) |
Mask the range of the NaD notch filter in the given pixel table. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
cpl_error_code | muse_basicproc_qc_saturated (muse_image *aImage, const char *aPrefix) |
Add QC parameter about saturated pixels to a muse_image. More... | |
This group contains functions that are common to some basic-processing recipes.
cpl_error_code muse_basicproc_apply_illum | ( | muse_pixtable * | aPT, |
cpl_table * | aAttached | ||
) |
Apply an illum/attached flat-field to a pixel table.
aPT | the pixel table |
aAttached | the table computed from the attached flat |
This function expects the attached flat-field to be in form of a table, in the format created by muse_basicproc_prepare_attached().
set and return CPL_ERROR_NULL_INPUT | aPT, one of it's components, or aAttached are NULL |
Definition at line 1842 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_DATA, muse_pixtable_extracted_delete(), muse_pixtable_extracted_get_size(), muse_pixtable_extracted_get_slices(), MUSE_PIXTABLE_ORIGIN, muse_pixtable_origin_get_slice(), MUSE_PIXTABLE_STAT, 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.
aPT | the pixel table |
aTwilight | the cube of the twilight skyflat exposure |
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.
set and return CPL_ERROR_NULL_INPUT | aPT, one of it's components, or aAttached are NULL |
Definition at line 1901 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_DATA, muse_pixtable_get_nrow(), MUSE_PIXTABLE_LAMBDA, MUSE_PIXTABLE_STAT, MUSE_PIXTABLE_XPOS, MUSE_PIXTABLE_YPOS, 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.
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 |
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.
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 2205 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.
aImages | image list to search for |
aTrace | trace table |
aWave | wavelength calibration table |
aGeo | geometry table |
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.
set CPL_ERROR_NULL_INPUT, return NULL | one of the input pointers is NULL |
Definition at line 1759 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.
aProcessing | the processing structure |
aIFU | the IFU/channel number |
aBPars | basic processing parameters |
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.
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 1572 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.
aProcessing | the processing structure |
aIFU | the IFU/channel number |
Read the reduced input files from disk and store them as images in the images structure.
propagate error from muse_processing_check_input(), return NULL | input data is invalid somehow (NULL aProcessing pointer etc.) |
Definition at line 1662 of file muse_basicproc.c.
References muse_pixtable::header, muse_processing::inframes, muse_processing::intags, muse_frameset_find_tags(), muse_image_load(), muse_image_load_from_extensions(), muse_imagelist_new(), muse_imagelist_set(), MUSE_PIXTABLE_DATA, muse_pixtable_extracted_delete(), muse_pixtable_extracted_get_size(), muse_pixtable_extracted_get_slices(), MUSE_PIXTABLE_ORIGIN, muse_pixtable_origin_get_slice(), muse_pixtable_restrict_wavelength(), muse_processing_append_used(), muse_utils_get_ifu(), and muse_pixtable::table.
cpl_error_code muse_basicproc_mask_notch_filter | ( | muse_pixtable * | aPT, |
unsigned char | aIFU | ||
) |
Mask the range of the NaD notch filter in the given pixel table.
aPT | the pixel table to mask the range in |
aIFU | the IFU number (for output) |
This function selects the range of wavelengths inside the notch filter (given by kMuseNa2LambdaMin and kMuseNa2LambdaMax) and sets the DQ entries to EURO3D_MISSDATA.
The function returns without clearing the table row selection.
set and return CPL_ERROR_NULL_INPUT | aPT or one of its components is NULL |
set and return CPL_ERROR_ILLEGAL_INPUT | instrument mode without notch filter found |
Definition at line 2050 of file muse_basicproc.c.
References muse_pixtable::header, muse_pfits_get_insmode(), muse_pfits_get_lamp_name(), muse_pfits_get_lamp_status(), muse_pfits_get_mode(), muse_pfits_get_shut_name(), muse_pfits_get_shut_status(), MUSE_PIXTABLE_DQ, MUSE_PIXTABLE_LAMBDA, and muse_pixtable::table.
void muse_basicproc_params_delete | ( | muse_basicproc_params * | aBPars | ) |
Free a structure of basic processing parameters.
aBPars | the structure of basic processing parameters |
This deallocates the string and muse_image components and the structure itself.
Definition at line 169 of file muse_basicproc.c.
References muse_basicproc_params::crmethod, muse_image::data, muse_basicproc_params::dcrpasses, muse_basicproc_params::dcrthres, muse_basicproc_params::dcrxbox, muse_basicproc_params::dcrybox, muse_image::dq, muse_basicproc_params::flatimage, muse_image::header, muse_processing::inframes, muse_processing::intags, muse_basicproc_params::keepflat, muse_badpix_table_def, muse_basicproc_params_delete(), muse_basicproc_params_new_from_propertylist(), muse_cosmics_dcr(), muse_cpltable_load(), muse_frameset_check_raw(), muse_frameset_find(), muse_frameset_find_master(), muse_image_adu_to_count(), muse_image_delete(), muse_image_divide(), muse_image_duplicate(), muse_image_load(), muse_image_load_from_extensions(), muse_image_load_from_raw(), muse_image_save(), muse_image_scale(), muse_image_subtract(), muse_image_variance_create(), muse_imagelist_delete(), muse_imagelist_get(), muse_imagelist_get_size(), muse_imagelist_is_uniform(), muse_imagelist_new(), muse_imagelist_set(), muse_pfits_get_binx(), muse_pfits_get_biny(), muse_pfits_get_chip_id(), muse_pfits_get_chip_name(), muse_pfits_get_exptime(), muse_pfits_get_gain(), muse_pfits_get_insmode(), muse_pfits_get_mode(), muse_pfits_get_pro_catg(), muse_pfits_get_read_id(), muse_pfits_get_read_name(), muse_processing_append_used(), muse_processing_check_intags(), muse_quadrants_get_window(), muse_quadrants_overscan_check(), muse_quadrants_overscan_correct(), muse_quadrants_overscan_polyfit_vertical(), muse_quadrants_overscan_stats(), muse_quadrants_trim_image(), muse_quality_set_saturated(), muse_utils_get_extension_for_ifu(), muse_utils_get_ifu(), muse_basicproc_params::overscan, muse_basicproc_params::ovscignore, muse_basicproc_params::ovscsigma, muse_basicproc_params::rejection, muse_imagelist::size, and muse_image::stat.
Referenced by muse_basicproc_params_delete().
muse_basicproc_params* muse_basicproc_params_new | ( | cpl_parameterlist * | aParameters, |
const char * | aPrefix | ||
) |
Create a new structure of basic processing parameters.
aParameters | the list of parameters |
aPrefix | the prefix of the recipe |
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.
The component "keepflat" is set to false, so that by default the flat-field image is not stored in the "flatimage" component.
Use muse_basicproc_params_delete() to free memory allocated by this function.
Definition at line 85 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.
aHeader | the FITS header |
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.
Use muse_basicproc_params_delete() to free memory allocated by this function.
Definition at line 143 of file muse_basicproc.c.
References muse_basicproc_params_new(), and muse_cplparameterlist_from_propertylist().
Referenced by muse_basicproc_params_delete().
cpl_error_code muse_basicproc_qc_saturated | ( | muse_image * | aImage, |
const char * | aPrefix | ||
) |
Add QC parameter about saturated pixels to a muse_image.
aImage | the image to count on and modify |
aPrefix | prefix of the QC header |
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.
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 2545 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.
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 |
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.
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 2390 of file muse_basicproc.c.
References muse_pixtable::header, MUSE_HDR_PT_LHI, MUSE_HDR_PT_LLO, MUSE_PIXTABLE_LAMBDA, 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.
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 |
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 2451 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.
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 |
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 2481 of file muse_basicproc.c.
Referenced by muse_basicproc_stats_append_header().