MUSE Pipeline Reference Manual  2.1.1
Data Structures | Enumerations | Functions
Resampling

Data Structures

struct  muse_datacube
 Structure definition of a MUSE datacube. More...
 
struct  muse_euro3dcube
 Structure definition of a Euro3D datacube. More...
 
struct  muse_resampling_params
 Resampling parameters. More...
 

Enumerations

Functions

muse_resampling_paramsmuse_resampling_params_new (muse_resampling_type aMethod)
 Create the resampling parameters structure. More...
 
cpl_error_code muse_resampling_params_set_pixfrac (muse_resampling_params *aParams, const char *aString)
 Set resampling pixfrac given a string that can contain up to three floating-point values. More...
 
cpl_error_code muse_resampling_params_set_wcs (muse_resampling_params *aParams, const cpl_propertylist *aWCS)
 Set an output WCS (and wavelength scale) in the resampling parameters. More...
 
void muse_resampling_params_delete (muse_resampling_params *aParams)
 Delete a resampling parameters structure. More...
 
muse_euro3dcubemuse_resampling_euro3d (muse_pixtable *aPixtable, muse_resampling_params *aParams)
 Resample a pixel table onto a regular grid structure representing a Euro3D format file. More...
 
muse_datacubemuse_resampling_cube (muse_pixtable *aPixtable, muse_resampling_params *aParams, muse_pixgrid **aGrid)
 Resample a pixel table onto a regular grid structure representing a FITS NAXIS=3 datacube. More...
 
muse_imagemuse_resampling_collapse_pixgrid (muse_pixtable *aPixtable, muse_pixgrid *aGrid, muse_datacube *aCube, const muse_table *aFilter, muse_resampling_params *aParams)
 Integrate a pixel table / pixel grid along the wavelength direction. More...
 
muse_imagemuse_resampling_image (muse_pixtable *aPixtable, muse_resampling_type aMethod, double aDX, double aDLambda)
 Resample a pixel table onto a two-dimensional regular grid. More...
 
cpl_table * muse_resampling_spectrum (muse_pixtable *aPixtable, double aBinwidth)
 Resample the selected pixels of a pixel table into a spectrum. More...
 
cpl_table * muse_resampling_spectrum_iterate (muse_pixtable *aPixtable, double aBinwidth, float aLo, float aHi, unsigned char aIter)
 Iteratively resample selected pixels of a pixel table into spectrum. More...
 

Detailed Description

Enumeration Type Documentation

Cosmic ray rejection statistics type.

Enumerator
MUSE_RESAMPLING_CRSTATS_IRAF 

IRAF-like statistics for cosmic ray rejection, * using mean and the data variance

MUSE_RESAMPLING_CRSTATS_MEAN 

Mean/standard deviation statistics for cosmic ray rejection

MUSE_RESAMPLING_CRSTATS_MEDIAN 

Median/MAD statistics for cosmic ray rejection

Definition at line 71 of file muse_resampling.h.

Enumerator
MUSE_RESAMPLING_DISP_AWAV 

linear air-wavelength (CTYPEj="AWAV")

MUSE_RESAMPLING_DISP_AWAV_LOG 

logarithmic air-wavelength (CTYPEj="AWAV-LOG")

MUSE_RESAMPLING_DISP_WAVE 

linear vacuum-wavelength (CTYPEj="WAVE")

MUSE_RESAMPLING_DISP_WAVE_LOG 

logarithmic vacuum-wavelength (CTYPEj="WAVE-LOG")

Definition at line 81 of file muse_resampling.h.

Resampling types.

Enumerator
MUSE_RESAMPLE_NEAREST 

Nearest neighbor resampling

MUSE_RESAMPLE_WEIGHTED_RENKA 

Weighted resampling using Renka weighting function

MUSE_RESAMPLE_WEIGHTED_LINEAR 

Weighted resampling using inverse distance weighting function

MUSE_RESAMPLE_WEIGHTED_QUADRATIC 

Weighted resampling using quadratic inverse distance weighting function

MUSE_RESAMPLE_WEIGHTED_DRIZZLE 

Weighted resampling using a drizzle-like weighting scheme

MUSE_RESAMPLE_WEIGHTED_LANCZOS 

Weighted resampling using a lanczos-like restricted sinc for weighting

MUSE_RESAMPLE_NONE 

No resampling, just create pixel grid; last value, can be used for range checking

Definition at line 48 of file muse_resampling.h.

Function Documentation

muse_image* muse_resampling_collapse_pixgrid ( muse_pixtable aPixtable,
muse_pixgrid aGrid,
muse_datacube aCube,
const muse_table aFilter,
muse_resampling_params aParams 
)

Integrate a pixel table / pixel grid along the wavelength direction.

Parameters
aPixtablethe input pixel table
aGridthe input pixel grid
aCubethe datacube (only the header component is used)
aFilterthe filter response curve
aParamsthe structure of resampling parameters
Returns
A muse_image * of the field of view or NULL on error.

Loop through all pixels of the output image and integrate along the wavelength direction, using the requested resampling scheme to interpolate pixels of all wavelengths onto the output 2D image. The filter response curve is used weight the pixel data values according to their wavelength.

Note
Only weighted resampling types are allowed, MUSE_RESAMPLE_NEAREST is not supported.

Optionally, if the environment variable MUSE_COLLAPSE_USE_VARIANCE is set to something positive, the variance information in the input pixel table will be used to weight the data according to their S/N.

XXX this function copies large parts of muse_resampling_cube_weighted().

Exceptions
set CPL_ERROR_NULL_INPUT, return NULLaPixtable, its table component, aGrid, aCube, its header component, or aParams are NULL
set CPL_ERROR_ILLEGAL_INPUT, return NULLthe resampling method passed in aParams is MUSE_RESAMPLE_NEAREST or unknown
integrate over the whole wavelength rangeaFilter is NULL

Definition at line 2394 of file muse_resampling.c.

References muse_wcs::cd22, muse_image::data, muse_image::dq, muse_datacube::header, muse_image::header, muse_pixtable::header, muse_wcs::iscelsph, muse_resampling_params::ld, muse_resampling_params::method, MUSE_FLUX_RESP_FILTER, muse_flux_response_interpolate(), MUSE_HDR_PT_LHI, MUSE_HDR_PT_LLO, muse_image_delete(), muse_image_new(), muse_pfits_get_cd(), muse_pfits_get_crval(), muse_pixgrid_2d_create(), muse_pixgrid_delete(), muse_pixgrid_get_count(), muse_pixgrid_get_index(), muse_pixgrid_get_rows(), MUSE_PIXTABLE_DATA, MUSE_PIXTABLE_DQ, muse_pixtable_dump(), MUSE_PIXTABLE_LAMBDA, MUSE_PIXTABLE_STAT, MUSE_PIXTABLE_WCS_CELSPH, muse_pixtable_wcs_check(), MUSE_PIXTABLE_WEIGHT, MUSE_PIXTABLE_XPOS, MUSE_PIXTABLE_YPOS, MUSE_RESAMPLE_NEAREST, MUSE_RESAMPLE_NONE, MUSE_RESAMPLE_WEIGHTED_DRIZZLE, MUSE_RESAMPLE_WEIGHTED_LANCZOS, MUSE_RESAMPLE_WEIGHTED_LINEAR, MUSE_RESAMPLE_WEIGHTED_QUADRATIC, MUSE_RESAMPLE_WEIGHTED_RENKA, muse_utils_filter_copy_properties(), muse_utils_filter_fraction(), muse_wcs_celestial_from_pixel_fast(), muse_wcs_get_scales(), MUSE_WCS_KEYS, muse_wcs_new(), muse_wcs_projplane_from_pixel_fast(), muse_resampling_params::pfx, muse_resampling_params::rc, muse_image::stat, muse_table::table, and muse_pixtable::table.

Referenced by muse_postproc_cube_resample_and_collapse().

muse_datacube* muse_resampling_cube ( muse_pixtable aPixtable,
muse_resampling_params aParams,
muse_pixgrid **  aGrid 
)

Resample a pixel table onto a regular grid structure representing a FITS NAXIS=3 datacube.

Parameters
aPixtablethe MUSE pixel table to resample
aParamsthe structure of resampling parameters
aGridif not NULL, use it to store the pixel grid pointer
Returns
A muse_datacube * for the output FITS datacube (and its bad pixels, variance and headers) or NULL on error.

This function implements the resampling scheme discussed in Sect. 2.2 of the DRLDesign document: First, convert the input pixel table into a regular grid of cells, storing the input pixels in their nearest cell. To resample, then loop through all cells, sampling surrounding pixels depending on the requested method. Values that rise aHSigma above the surrounding values, i.e. cosmic rays, are removed at this stage. Store the output pixels (their values, bad pixel status, and variance) in a muse_datacube structure to be used to store 3xFITS_NAXIS=3 files.

Note
This function changes some of the components of aParams. Specifically, dx, dy, and dlambda may be changed after calling this function!
Quality Assessment:
Using the INM, different astronomical scenes can be created to be used for quality checks. When creating a scene with a few well separated point sources, one knows the flux of each source at each wavelength. If this function works correctly, the flux should be conserved and can be compared to the expected value (using some tolerance). If using a scene with sky emission lines, one can measure the wavelengths and dispersions in a few of the sky lines. They should be at the same wavelength for all spaxels and this position should agree with the position determined from the INM-created data. Additionally, a (visual) comparison of monochromatic maps created from INM input frames can be compared to maps derived from output cubes created by this routine. If all intermediate calibrations were derived correctly, both should look similar.
Exceptions
set CPL_ERROR_NULL_INPUT, return NULLthe input pixel table or input param structure are NULL
set CPL_ERROR_ILLEGAL_INPUT, return NULLthe input pixel table does not contain full geometry information
set CPL_ERROR_UNSUPPORTED_MODE, return NULLthe WCS in the pixel table is neither in pixels nor degrees
set CPL_ERROR_ILLEGAL_OUTPUT, return NULLcomputed output size in at least one coordinate is not positive
just create empty datacube and possibly return pixel gridgiven method is MUSE_RESAMPLE_NONE
set CPL_ERROR_UNSUPPORTED_MODE, return NULLgiven method is unknown
return NULL, propagate error coderesampling fails

Definition at line 2134 of file muse_resampling.c.

References muse_resampling_params::crsigma, muse_resampling_params::crtype, muse_datacube::data, muse_datacube::dq, muse_resampling_params::dx, muse_datacube::header, muse_pixtable::header, muse_resampling_params::ld, muse_resampling_params::method, muse_datacube_delete(), MUSE_HDR_PT_FFCORR, MUSE_HDR_PT_LLO, MUSE_HDR_PT_XLO, MUSE_HDR_PT_YLO, muse_pfits_get_crpix(), muse_pixgrid_create(), muse_pixgrid_delete(), MUSE_PIXTABLE_DATA, muse_pixtable_get_type(), MUSE_PIXTABLE_TYPE_FULL, MUSE_PIXTABLE_WCS_CELSPH, muse_pixtable_wcs_check(), MUSE_PIXTABLE_WCS_PIXEL, MUSE_RESAMPLE_NEAREST, MUSE_RESAMPLE_NONE, MUSE_RESAMPLE_WEIGHTED_DRIZZLE, MUSE_RESAMPLE_WEIGHTED_LANCZOS, MUSE_RESAMPLE_WEIGHTED_LINEAR, MUSE_RESAMPLE_WEIGHTED_QUADRATIC, MUSE_RESAMPLE_WEIGHTED_RENKA, MUSE_RESAMPLING_DISP_AWAV, MUSE_RESAMPLING_DISP_AWAV_LOG, MUSE_RESAMPLING_DISP_WAVE, MUSE_RESAMPLING_DISP_WAVE_LOG, muse_utils_memory_dump(), MUSE_WCS_KEYS, muse_resampling_params::pfx, muse_resampling_params::rc, muse_datacube::stat, muse_pixtable::table, and muse_resampling_params::tlambda.

Referenced by muse_dar_check(), muse_flux_integrate_std(), muse_postproc_cube_resample_and_collapse(), muse_postproc_process_exposure(), muse_resampling_euro3d(), and muse_wcs_locate_sources().

muse_euro3dcube* muse_resampling_euro3d ( muse_pixtable aPixtable,
muse_resampling_params aParams 
)

Resample a pixel table onto a regular grid structure representing a Euro3D format file.

Parameters
aPixtablethe MUSE pixel table to resample
aParamsthe structure of resampling parameters
Returns
a muse_euro3dcube * for the output Euro3D data or NULL on error

See muse_resampling_cube() for the description of the algorithm. This function uses that output cube and converts it into a Euro3D table structure.

This function decides from the FITS keywords available in the pixel table header if the data was corrected for DAR and which reference wavelength was used, see muse_dar_correct().

Quality Assessment:
See muse_resampling_cube().
Exceptions
set CPL_ERROR_NULL_INPUT, return NULLaParams is NULL
set CPL_ERROR_ILLEGAL_INPUT, return NULLaParams->method is not a real resampling type
return NULL, propagate error code of muse_resampling_cube()resampling fails

Definition at line 1847 of file muse_resampling.c.

References muse_datacube::data, muse_datacube::dq, muse_euro3dcube::dtable, muse_resampling_params::dx, muse_euro3dcube::gtable, muse_euro3dcube::hdata, muse_datacube::header, muse_euro3dcube::header, muse_euro3dcube::hgroup, muse_wcs::iscelsph, muse_resampling_params::method, muse_astro_airmass(), muse_astro_parangle(), muse_cpltable_new(), muse_datacube_delete(), muse_euro3dcube_e3d_data_def, muse_euro3dcube_e3d_grp_def, MUSE_HDR_PT_DAR_NAME, muse_pfits_get_cd(), muse_pfits_get_crval(), muse_pfits_get_ctype(), muse_pfits_get_cunit(), muse_pfits_get_pres_start(), muse_pfits_get_rhum(), muse_pfits_get_temp(), MUSE_PIXTABLE_DATA, MUSE_PIXTABLE_STAT, MUSE_PIXTABLE_WCS_CELSPH, muse_pixtable_wcs_check(), MUSE_RESAMPLE_NONE, muse_resampling_cube(), muse_wcs_celestial_from_pixel_fast(), muse_wcs_new(), muse_wcs_projplane_from_pixel_fast(), muse_datacube::stat, and muse_pixtable::table.

Referenced by muse_postproc_cube_resample_and_collapse().

muse_image* muse_resampling_image ( muse_pixtable aPixtable,
muse_resampling_type  aMethod,
double  aDX,
double  aDLambda 
)

Resample a pixel table onto a two-dimensional regular grid.

Parameters
aPixtablethe MUSE pixel table to resample
aMethodthe value corresponding to a resampling method
aDXStep size in pixel direction
aDLambdathe step size in wavelength direction (in Angstrom)
Returns
a muse_image * on success or NULL on error
Remarks
This function can be used instead of muse_resampling_cube() or muse_resampling_euro3d() for visual assessment of the wavelength calibration quality in the muse_wavecal recipe or for sky subtraction during post-processing.
The output is an image in which the y-axis is the wavelength direction and the x-axis represents the spatial domain within the slices, with all slices placed adjacent.
aMethod can be either MUSE_RESAMPLE_WEIGHTED_RENKA or MUSE_RESAMPLE_NEAREST (see Sect. 2.2.2 and 2.2.4 of the DRLDesign document). Other interpolation methods are not supported.
No horizontal interpolation (in cross-dispersion direction) is done. These resampling methods only use information in the wavelength direction to find the output value, as it is not clear what the real spatial relationship of neighboring grid points is when stored in a 2D grid.

Loop through all the pixels in the regular output grid and interpolate as discussed in DRLDesign document (2.2). The result is stored in a muse_image structure, so that the headers and the data component of this image can be saved as a FITS NAXIS=2 image.

Quality Assessment:
This method is only used for quick visual check, good quality is not expected.
Exceptions
set CPL_ERROR_NULL_INPUT, return NULLthe input pixel table is NULL
set CPL_ERROR_UNSUPPORTED_MODE, return NULLthe WCS in the pixel table is neither in pixels nor degrees
set CPL_ERROR_UNSUPPORTED_MODE, return NULLgiven method is unknown
set CPL_ERROR_ILLEGAL_OUTPUT, return NULLcomputed output size in at least one coordinate is not positive
return NULL, propagate error coderesampling fails

Definition at line 2968 of file muse_resampling.c.

References muse_image::data, muse_image::dq, muse_image::header, muse_pixtable::header, muse_cplimage_concat_x(), MUSE_HDR_PT_FFCORR, MUSE_HDR_PT_LHI, MUSE_HDR_PT_LLO, muse_image_delete(), muse_image_new(), muse_pixtable_extracted_delete(), muse_pixtable_extracted_get_size(), muse_pixtable_extracted_get_slices(), muse_pixtable_get_nrow(), muse_pixtable_get_type(), MUSE_PIXTABLE_TYPE_SIMPLE, MUSE_PIXTABLE_WCS_CELSPH, muse_pixtable_wcs_check(), MUSE_PIXTABLE_WCS_PIXEL, MUSE_PIXTABLE_XPOS, MUSE_RESAMPLE_NEAREST, MUSE_RESAMPLE_WEIGHTED_RENKA, muse_wcs_get_scales(), muse_image::stat, and muse_pixtable::table.

void muse_resampling_params_delete ( muse_resampling_params aParams)

Delete a resampling parameters structure.

Parameters
aParamsPointer to the structure.

This only calls cpl_free, but it's nice to have a function that reverses muse_resampling_params_new().

Definition at line 218 of file muse_resampling.c.

References muse_wcs::cd22, muse_datacube::data, muse_datacube::dq, muse_resampling_params::dx, muse_datacube::header, muse_pixtable::header, muse_wcs::iscelsph, muse_resampling_params::ld, muse_resampling_params::method, muse_astro_posangle(), muse_badpix_table_def, muse_cplarray_new_from_delimited_string(), muse_cpltable_new(), MUSE_HDR_PT_LHI, MUSE_HDR_PT_LLO, MUSE_HDR_PT_XHI, MUSE_HDR_PT_XLO, MUSE_HDR_PT_YHI, MUSE_HDR_PT_YLO, muse_pfits_get_cd(), muse_pfits_get_crpix(), muse_pfits_get_crval(), muse_pfits_get_ctype(), muse_pfits_get_dateobs(), muse_pfits_get_mjdobs(), muse_pfits_get_mode(), muse_pixgrid_get_count(), muse_pixgrid_get_index(), muse_pixgrid_get_rows(), MUSE_PIXTABLE_DATA, MUSE_PIXTABLE_DQ, muse_pixtable_dump(), MUSE_PIXTABLE_LAMBDA, MUSE_PIXTABLE_ORIGIN, muse_pixtable_origin_get_ifu(), muse_pixtable_origin_get_x(), muse_pixtable_origin_get_y(), MUSE_PIXTABLE_STAT, MUSE_PIXTABLE_WCS_CELSPH, muse_pixtable_wcs_check(), MUSE_PIXTABLE_WCS_PIXEL, MUSE_PIXTABLE_WEIGHT, MUSE_PIXTABLE_XPOS, MUSE_PIXTABLE_YPOS, muse_quadrants_coords_to_raw(), MUSE_RESAMPLE_WEIGHTED_DRIZZLE, MUSE_RESAMPLE_WEIGHTED_LANCZOS, MUSE_RESAMPLE_WEIGHTED_LINEAR, MUSE_RESAMPLE_WEIGHTED_QUADRATIC, MUSE_RESAMPLE_WEIGHTED_RENKA, MUSE_RESAMPLING_CRSTATS_IRAF, MUSE_RESAMPLING_CRSTATS_MEDIAN, MUSE_RESAMPLING_DISP_AWAV_LOG, MUSE_RESAMPLING_DISP_WAVE_LOG, muse_wcs_celestial_from_pixel_fast(), muse_wcs_get_scales(), muse_wcs_new(), muse_wcs_pixel_from_celestial(), muse_wcs_pixel_from_projplane(), muse_wcs_projplane_from_celestial(), muse_wcs_projplane_from_pixel(), muse_wcs_projplane_from_pixel_fast(), muse_resampling_params::pfx, muse_resampling_params::rc, muse_datacube::stat, muse_pixtable::table, muse_resampling_params::tlambda, and muse_resampling_params::wcs.

Referenced by muse_dar_check(), muse_flux_integrate_std(), muse_postproc_process_exposure(), and muse_wcs_locate_sources().

muse_resampling_params* muse_resampling_params_new ( muse_resampling_type  aMethod)

Create the resampling parameters structure.

Parameters
aMethodthe resampling type/method to set
Returns
Pointer to the newly created structure or NULL on error.

Passing MUSE_RESAMPLE_NONE is allowed; it signifies to create an empty datacube but cannot be used to resample to Euro3D.

Exceptions
set CPL_ERROR_ILLEGAL_INPUT, return NULLan illegal method was given
wcs component is left NULL, so it triggers valid defaults lateraWCS is NULL

Definition at line 82 of file muse_resampling.c.

References muse_resampling_params::ld, muse_resampling_params::method, MUSE_RESAMPLE_NONE, muse_resampling_params::pfx, and muse_resampling_params::rc.

Referenced by muse_dar_check(), muse_flux_integrate_std(), muse_postproc_process_exposure(), and muse_wcs_locate_sources().

cpl_error_code muse_resampling_params_set_pixfrac ( muse_resampling_params aParams,
const char *  aString 
)

Set resampling pixfrac given a string that can contain up to three floating-point values.

Parameters
aParamsthe resampling parameters
aStringthe string with the pixfrac number(s)
Returns
CPL_ERROR_NONE on success, another CPL error code on failure.

The idea is that a user gives comma-delimited strings like "0.6", "0.8,0.6", or "0.81,0.79,0.6" and the pipeline interprets this as 3D drizzle pixfrac, spatial + spectral pixfrac, and horizontal, spatial, and spectral pixfrac, respectively.

Exceptions
set and return CPL_ERROR_NULL_INPUTaParams and/or aString are NULL
set and return CPL_ERROR_ILLEGAL_INPUTaString contains 0 or more than 4 values

Definition at line 118 of file muse_resampling.c.

References muse_cplarray_new_from_delimited_string(), and muse_resampling_params::pfx.

cpl_error_code muse_resampling_params_set_wcs ( muse_resampling_params aParams,
const cpl_propertylist *  aWCS 
)

Set an output WCS (and wavelength scale) in the resampling parameters.

Parameters
aParamsthe resampling parameters
aWCSpropertylist with a WCS
Returns
CPL_ERROR_NONE on success, another CPL error code on failure.

Passing aWCS as NULL is allowed, it signifies to free and NULL out an existing WCS, the tlambda component is then set to MUSE_RESAMPLING_DISP_AWAV. Otherwise, tlambda is set to MUSE_RESAMPLING_DISP_AWAV (as default) or another valid muse_resampling_dispersion_type, and wcs is filled using cpl_wcs_new_from_propertylist().

Exceptions
return CPL_ERROR_NULL_INPUTaParams is NULL
wcs component is left NULL, so it triggers valid defaults lateraWCS is NULL
wcs component is set to NULL, return code is propagatedcpl_wcs_new_from_propertylist() fails

Definition at line 169 of file muse_resampling.c.

References muse_pfits_get_ctype(), MUSE_RESAMPLING_DISP_AWAV, MUSE_RESAMPLING_DISP_AWAV_LOG, MUSE_RESAMPLING_DISP_WAVE, MUSE_RESAMPLING_DISP_WAVE_LOG, muse_resampling_params::tlambda, and muse_resampling_params::wcs.

cpl_table* muse_resampling_spectrum ( muse_pixtable aPixtable,
double  aBinwidth 
)

Resample the selected pixels of a pixel table into a spectrum.

Parameters
aPixtableThe MUSE pixel table to resample
aBinwidthThe bin width to use.
Returns
A table with a spectrum or NULL on error.

This function carries out a linear interpolation of all selected pixels of a pixel table into a 1D spectrum. The output spectrum is represented as a table and may not be contiguous.

Exceptions
set CPL_ERROR_NULL_INPUT, return NULLaPixtable or one of its components is NULL
set CPL_ERROR_ILLEGAL_INPUT, return NULLaPixtable does not match the definition of a pixel table

Definition at line 3112 of file muse_resampling.c.

References muse_pixtable::header, muse_cpltable_check(), muse_cpltable_new(), muse_dataspectrum_def, MUSE_HDR_PT_LHI, MUSE_HDR_PT_LLO, MUSE_PIXTABLE_DATA, muse_pixtable_def, MUSE_PIXTABLE_DQ, MUSE_PIXTABLE_LAMBDA, MUSE_PIXTABLE_STAT, MUSE_PIXTABLE_WEIGHT, and muse_pixtable::table.

Referenced by muse_pixtable_append_ff(), muse_postproc_process_exposure(), and muse_resampling_spectrum_iterate().

cpl_table* muse_resampling_spectrum_iterate ( muse_pixtable aPixtable,
double  aBinwidth,
float  aLo,
float  aHi,
unsigned char  aIter 
)

Iteratively resample selected pixels of a pixel table into spectrum.

Parameters
aPixtableThe MUSE pixel table to resample
aBinwidthThe bin width to use.
aLoLow rejection sigma limit, use 0. to ignore low outliers
aHiHigh rejection sigma limit, use 0. to ignore high outliers
aIterThe number of iterations to use
Returns
A table with a spectrum or NULL on error.

This function carries out a linear interpolation of all selected pixels of a pixel table into a 1D spectrum, using muse_resampling_spectrum().

This function uses the first version of the spectrum is checked against the original pixels in each spectral bin, to reject outliers outside the ranges spectrum - aLo * stddev and spectrum + aHi * stddev. The flagged pixel table is then used to compute another version of the spectrum, until aIter is reached. Before exiting the function, the flags are removed again from the original pixel table.

Note that this works well for regions where the spectrum changes very little (i.e. the sky background), but it is likely to reject science content in areas covered by objects.

The output spectrum is represented as a table and may not be contiguous.

Exceptions
set CPL_ERROR_NULL_INPUT, return NULLaPixtable or one of its components is NULL
set CPL_ERROR_ILLEGAL_INPUT, return NULLaPixtable does not match the definition of a pixel table

Definition at line 3242 of file muse_resampling.c.

References muse_pixtable::header, muse_cpltable_check(), muse_cpltable_find_sorted(), MUSE_PIXTABLE_DATA, muse_pixtable_def, MUSE_PIXTABLE_DQ, MUSE_PIXTABLE_LAMBDA, muse_pixtable_reset_dq(), muse_resampling_spectrum(), and muse_pixtable::table.

Referenced by muse_postproc_process_exposure(), and muse_utils_pixtable_fit_line_gaussian().