MUSE Pipeline Reference Manual
2.1.1
|
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_params * | muse_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_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. More... | |
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. More... | |
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. More... | |
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. 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... | |
Cosmic ray rejection statistics type.
Definition at line 71 of file muse_resampling.h.
Definition at line 81 of file muse_resampling.h.
enum muse_resampling_type |
Resampling types.
Definition at line 48 of file muse_resampling.h.
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.
aPixtable | the input pixel table |
aGrid | the input pixel grid |
aCube | the datacube (only the header component is used) |
aFilter | the filter response curve |
aParams | the structure of resampling parameters |
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.
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().
set CPL_ERROR_NULL_INPUT, return NULL | aPixtable, its table component, aGrid, aCube, its header component, or aParams are NULL |
set CPL_ERROR_ILLEGAL_INPUT, return NULL | the resampling method passed in aParams is MUSE_RESAMPLE_NEAREST or unknown |
integrate over the whole wavelength range | aFilter 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.
aPixtable | the MUSE pixel table to resample |
aParams | the structure of resampling parameters |
aGrid | if not NULL, use it to store the pixel grid pointer |
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.
set CPL_ERROR_NULL_INPUT, return NULL | the input pixel table or input param structure are NULL |
set CPL_ERROR_ILLEGAL_INPUT, return NULL | the input pixel table does not contain full geometry information |
set CPL_ERROR_UNSUPPORTED_MODE, return NULL | the WCS in the pixel table is neither in pixels nor degrees |
set CPL_ERROR_ILLEGAL_OUTPUT, return NULL | computed output size in at least one coordinate is not positive |
just create empty datacube and possibly return pixel grid | given method is MUSE_RESAMPLE_NONE |
set CPL_ERROR_UNSUPPORTED_MODE, return NULL | given method is unknown |
return NULL, propagate error code | resampling 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.
aPixtable | the MUSE pixel table to resample |
aParams | the structure of resampling parameters |
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().
set CPL_ERROR_NULL_INPUT, return NULL | aParams is NULL |
set CPL_ERROR_ILLEGAL_INPUT, return NULL | aParams->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.
aPixtable | the MUSE pixel table to resample |
aMethod | the value corresponding to a resampling method |
aDX | Step size in pixel direction |
aDLambda | the step size in wavelength direction (in Angstrom) |
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.
set CPL_ERROR_NULL_INPUT, return NULL | the input pixel table is NULL |
set CPL_ERROR_UNSUPPORTED_MODE, return NULL | the WCS in the pixel table is neither in pixels nor degrees |
set CPL_ERROR_UNSUPPORTED_MODE, return NULL | given method is unknown |
set CPL_ERROR_ILLEGAL_OUTPUT, return NULL | computed output size in at least one coordinate is not positive |
return NULL, propagate error code | resampling 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.
aParams | Pointer 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.
aMethod | the resampling type/method to set |
Passing MUSE_RESAMPLE_NONE is allowed; it signifies to create an empty datacube but cannot be used to resample to Euro3D.
set CPL_ERROR_ILLEGAL_INPUT, return NULL | an illegal method was given |
wcs component is left NULL, so it triggers valid defaults later | aWCS 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.
aParams | the resampling parameters |
aString | the string with the pixfrac number(s) |
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.
set and return CPL_ERROR_NULL_INPUT | aParams and/or aString are NULL |
set and return CPL_ERROR_ILLEGAL_INPUT | aString 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.
aParams | the resampling parameters |
aWCS | propertylist with a WCS |
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().
return CPL_ERROR_NULL_INPUT | aParams is NULL |
wcs component is left NULL, so it triggers valid defaults later | aWCS is NULL |
wcs component is set to NULL, return code is propagated | cpl_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.
aPixtable | The MUSE pixel table to resample |
aBinwidth | The bin width to use. |
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.
set CPL_ERROR_NULL_INPUT, return NULL | aPixtable or one of its components is NULL |
set CPL_ERROR_ILLEGAL_INPUT, return NULL | aPixtable 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.
aPixtable | The MUSE pixel table to resample |
aBinwidth | The bin width to use. |
aLo | Low rejection sigma limit, use 0. to ignore low outliers |
aHi | High rejection sigma limit, use 0. to ignore high outliers |
aIter | The number of iterations to use |
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.
set CPL_ERROR_NULL_INPUT, return NULL | aPixtable or one of its components is NULL |
set CPL_ERROR_ILLEGAL_INPUT, return NULL | aPixtable 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().