MUSE Pipeline Reference Manual  2.5.2
Data Structures | Functions | Variables
Line Spread Function related functions

Data Structures

struct  muse_lsf_cube
 Data cube/stacked image list containing the LSF for one IFU. More...
 
struct  muse_lsf_params
 Structure definition of detector (slice) parameters. More...
 
struct  muse_lsf_fit_params
 Structure to define which slice parameters are fit. More...
 

Functions

muse_pixtable * muse_lsf_create_arcpixtable (muse_imagelist *aImages, cpl_table *aTrace, cpl_table *aWave, cpl_table *aArcLines, int aQuality, double aWindow)
 Read images and combine the arc lines into one pixtable. More...
 
cpl_error_code muse_lsf_fit_slice (const muse_pixtable *aPixtable, cpl_image *aLsfImage, muse_wcs *aWCS, double aLsfRegressionWindow)
 Compute the LSF for all wavelengths of one slice. More...
 
muse_lsf_cube * muse_lsf_cube_new (double aLsfHalfRange, cpl_size aNLsf, cpl_size aNLambda, const cpl_propertylist *aHeader)
 Create a new LSF datacube. More...
 
void muse_lsf_cube_delete (muse_lsf_cube *aLsfCube)
 Deallocate the memory for the LSF cube. More...
 
cpl_error_code muse_lsf_cube_save (muse_lsf_cube *aLsfCube, const char *aFileName)
 Save the LSF cube to disk. More...
 
muse_lsf_cube ** muse_lsf_cube_load_all (muse_processing *aProcessing)
 Load all LSF cubes for all IFUs into an array. More...
 
void muse_lsf_cube_delete_all (muse_lsf_cube **aLsfCube)
 Delete all LSF cubes. More...
 
muse_lsf_cube * muse_lsf_cube_load (const char *aFileName, unsigned char aIFU)
 Load a LSF cube for one single IFU from disk. More...
 
cpl_image * muse_lsf_average_cube_all (muse_lsf_cube **aLsfCube, muse_pixtable *aPixtable)
 Create an average image from all LSF cubes. More...
 
muse_wcs * muse_lsf_cube_get_wcs_all (muse_lsf_cube **aLsfCubes)
 Get the world coordinate representative of all LSF cubes. More...
 
cpl_error_code muse_lsf_fold_rectangle (cpl_image *aLsfImage, const muse_wcs *aWCS, double aBinWidth)
 Filter an LSF image with a rectangle to model spectrum binning. More...
 
cpl_error_code muse_lsf_apply (const cpl_image *aLsfImage, const muse_wcs *aWCS, cpl_array *aVal, double aLambda)
 Apply the LSF to a number of data points of one slice. More...
 
cpl_error_code muse_lsf_apply_slice (muse_pixtable *aPixtable, double aWavelength, double aFlux, cpl_image *aLsfImage, muse_wcs *aLsfWCS)
 Add line spread function to a MUSE slice of a pixtable. More...
 
muse_lsf_params * muse_lsf_params_new (cpl_size n_sensit, cpl_size n_lsf_width, cpl_size n_hermit)
 Create a new lsf_params structure. More...
 
cpl_size muse_lsf_params_get_size (muse_lsf_params **aParams)
 Count the number of entries in the array. More...
 
void muse_lsf_params_delete (muse_lsf_params *aParams)
 Delete an allocated muse_lsf_params structure. More...
 
void muse_lsf_params_delete_all (muse_lsf_params **aParams)
 Delete an allocated array of muse_lsf_params structure. More...
 
cpl_error_code muse_lsf_params_save (const muse_lsf_params **aLsfParams, const char *aFile)
 Save slice LSF parameters to the extension "slice" on disk. More...
 
muse_lsf_params ** muse_lsf_params_load (const char *aFile, muse_lsf_params **aParams, int aIFU)
 Load slice LSF parameters from the extension "SLICE_PARAM". More...
 
muse_lsf_params ** muse_processing_lsf_params_load (muse_processing *aProcessing, int aIFU)
 Load slice LSF parameters. More...
 
muse_lsf_params * muse_lsf_params_get (muse_lsf_params **aParams, int aIFU, int aSlice)
 Get the slice LSF parameters for one slice. More...
 
static cpl_array * muse_lsf_G (cpl_array *aX, cpl_array *aCoeffs)
 Helper function "G" for integrated damped gauss-hermitean function. More...
 
cpl_error_code muse_lsf_params_apply (const muse_lsf_params *aLsfParams, cpl_array *aVal, double aLambda)
 Apply the MUSE LSF function to a single line. More...
 
cpl_array * muse_lsf_params_spectrum (const cpl_array *aLambda, cpl_table *aLines, const muse_lsf_params *aLsfParams)
 Create spectrum for a single slice. More...
 
muse_lsf_fit_params * muse_lsf_fit_params_new (cpl_boolean aOffset, cpl_boolean aRefraction, cpl_size aSensitivity, cpl_size aSlitWidth, cpl_size aBinWidth, cpl_size aLSFWidth, cpl_size aHermit3, cpl_size aHermit4, cpl_size aHermit5, cpl_size aHermit6)
 Create a new fit parameter structure. More...
 
void muse_lsf_fit_params_delete (muse_lsf_fit_params *params)
 Delete the fit parameter structure. More...
 
muse_lsf_params * muse_lsf_params_fit (muse_pixtable *aPixtable, cpl_table *aLines, int aMaxIter)
 Fit all entries of one slice. More...
 
double muse_lsf_fwhm_lambda (const muse_lsf_params *aDP, double aLambda, double aSampling, unsigned int aLength)
 Measure the FWHM of an LSF at a given wavelength. More...
 

Variables

const muse_cpltable_def muse_lsfparams_def []
 Definition of a lsf parameters table. More...
 

Detailed Description

Function Documentation

cpl_error_code muse_lsf_apply ( const cpl_image *  aLsfImage,
const muse_wcs *  aWCS,
cpl_array *  aVal,
double  aLambda 
)

Apply the LSF to a number of data points of one slice.

Parameters
aLsfImageThe slice specific image from the LSF cube
aWCSThe WCS of the image.
aValArray with wavelengths [A]. Will be replaced by the normalized LSF data points
aLambdaLine wavelength reference [A].
Returns
CPL_ERROR_NONE if everything went OK or another CPL error code on failure
Return values
CPL_ERROR_NULL_INPUT(aLsfImage) not fulfilled
CPL_ERROR_NULL_INPUT(aWCS) not fulfilled
CPL_ERROR_NULL_INPUT(aVal) not fulfilled

Definition at line 923 of file muse/muse_lsf.c.

References muse_wcs::cd22, muse_wcs::crpix2, muse_wcs::crval2, and muse_cplarray_interpolate_linear().

Referenced by muse_lsf_apply_slice(), and muse_sky_lines_spectrum().

cpl_error_code muse_lsf_apply_slice ( muse_pixtable *  aPixtable,
double  aWavelength,
double  aFlux,
cpl_image *  aLsfImage,
muse_wcs *  aLsfWCS 
)

Add line spread function to a MUSE slice of a pixtable.

Parameters
aPixtabletable containing one slice, with wavelength and an lsf column
aWavelengthline wave length
aFluxline flux
aLsfImageimage containing the line spread function for the slice
aLsfWCSWCS definition for aLsfImage

This will add the LSF for one line to the pixtable. The pixtable is required to hold an "lsf" column with values set to zero. Subsequent calls of this function add the line spread functions of each call.

Definition at line 1010 of file muse/muse_lsf.c.

References muse_cplarray_add_window(), muse_cplarray_find_sorted(), muse_cpltable_extract_column(), muse_lsf_apply(), MUSE_PIXTABLE_LAMBDA, and muse_pixtable::table.

Referenced by muse_raman_add_lsf().

cpl_image * muse_lsf_average_cube_all ( muse_lsf_cube **  aLsfCube,
muse_pixtable *  aPixtable 
)

Create an average image from all LSF cubes.

Parameters
aLsfCubearray of all LSF cubes
aPixtablepixtable for the weighting, or NULL
Returns
Average LSF image

All images from all cubes are squeezed into one image. If a pixtable is given, each IFU/slice is weighted with the number of entries in the pixtable for this IFU/slice.

Definition at line 781 of file muse/muse_lsf.c.

References muse_pixtable_get_nrow(), MUSE_PIXTABLE_ORIGIN, muse_pixtable_origin_get_ifu(), muse_pixtable_origin_get_slice(), and muse_pixtable::table.

Referenced by muse_postproc_process_exposure().

muse_pixtable * muse_lsf_create_arcpixtable ( muse_imagelist *  aImages,
cpl_table *  aTrace,
cpl_table *  aWave,
cpl_table *  aArcLines,
int  aQuality,
double  aWindow 
)

Read images and combine the arc lines into one pixtable.

Parameters
aImageslist of arc images
aTracetable containing the trace solution
aWavetable containing the wavelength calibration solution
aArcLinesarc reference line table
aQualityminimal line quality to select
aWindowwavelength window around each line
Returns
combined pixel table or NULL on error
Exceptions
set CPL_ERROR_NULL_INPUT, return NULL(aImages) not fulfilled
set CPL_ERROR_NULL_INPUT, return NULL(aTrace) not fulfilled
set CPL_ERROR_NULL_INPUT, return NULL(aWave) not fulfilled
set CPL_ERROR_NULL_INPUT, return NULL(aArcLines) not fulfilled

Create pixel tables from all images in the aImages list, select the pixels around each arc line, and store the resulting pixels in a new pixtable.

The output pixel table will have additional columns line_lambda, line_flux, and line_background, containing the reference wavelength, the estimated flux, and the background level of the corresponding line.

Definition at line 250 of file muse/muse_lsf.c.

References muse_pixtable::header, muse_cpltable_new(), muse_imagelist_get(), muse_imagelist_get_size(), muse_pfits_get_mode(), muse_pixtable_create(), MUSE_PIXTABLE_DATA, muse_pixtable_def, muse_pixtable_delete(), muse_pixtable_extracted_delete(), muse_pixtable_extracted_get_size(), muse_pixtable_extracted_get_slices(), muse_utils_header_get_lamp_names(), muse_wave_lines_covered_by_data(), muse_wave_lines_get_lampname(), and muse_pixtable::table.

void muse_lsf_cube_delete ( muse_lsf_cube *  aLsfCube)

Deallocate the memory for the LSF cube.

Parameters
aLsfCubeThe LSF cube to deallocate

Definition at line 584 of file muse/muse_lsf.c.

References muse_lsf_cube::header, muse_lsf_cube::img, and muse_lsf_cube::wcs.

Referenced by muse_lsf_cube_delete_all(), and muse_lsf_cube_load().

void muse_lsf_cube_delete_all ( muse_lsf_cube **  aLsfCube)

Delete all LSF cubes.

Parameters
aLsfCubearray of 48 data cubes

Definition at line 696 of file muse/muse_lsf.c.

References muse_lsf_cube_delete().

Referenced by muse_lsf_cube_load_all(), and muse_postproc_properties_delete().

muse_wcs * muse_lsf_cube_get_wcs_all ( muse_lsf_cube **  aLsfCubes)

Get the world coordinate representative of all LSF cubes.

Parameters
aLsfCubesthe array of LSF cubes
Returns
a representative WCS or NULL on error

Since apparently nobody messed with the cube's WCS, it is enough to just return the first WCS found.

XXX this should really check that all WCSs are identical!

Exceptions
set CPL_ERROR_NULL_INPUT, return NULLaLsfCubes are NULL

Definition at line 860 of file muse/muse_lsf.c.

References muse_lsf_cube::wcs.

Referenced by muse_postproc_process_exposure().

muse_lsf_cube * muse_lsf_cube_load ( const char *  aFileName,
unsigned char  aIFU 
)

Load a LSF cube for one single IFU from disk.

Parameters
aFileNameFITS file name
aIFUthe IFU number
Returns
the LSF cube.
Exceptions
set CPL_ERROR_NULL_INPUT, return NULL(aFileName) not fulfilled

Definition at line 718 of file muse/muse_lsf.c.

References muse_wcs::cd22, muse_wcs::crpix2, muse_wcs::crval2, muse_lsf_cube::header, muse_lsf_cube::img, muse_lsf_cube_delete(), muse_pfits_get_cd(), muse_pfits_get_crpix(), muse_pfits_get_crval(), and muse_lsf_cube::wcs.

Referenced by muse_lsf_cube_load_all().

muse_lsf_cube ** muse_lsf_cube_load_all ( muse_processing *  aProcessing)

Load all LSF cubes for all IFUs into an array.

Parameters
aProcessingthe processing structure
Returns
array of up to kMuseNumIFUs LSF cubes or NULL on error

This function output a warning message, if one of the files from the input frameset cannot be loaded or if the LSFs for one of the IFUs cannot be found.

Exceptions
set CPL_ERROR_NULL_INPUT, return NULL(aProcessing) not fulfilled

Definition at line 648 of file muse/muse_lsf.c.

References muse_processing::inframes, muse_frameset_find(), muse_lsf_cube_delete_all(), muse_lsf_cube_load(), and muse_processing_append_used().

muse_lsf_cube * muse_lsf_cube_new ( double  aLsfHalfRange,
cpl_size  aNLsf,
cpl_size  aNLambda,
const cpl_propertylist *  aHeader 
)

Create a new LSF datacube.

Parameters
aLsfHalfRangeHalf width of the range in LSF direction
aNLsfNumber of data points in LSF direction
aNLambdaNumber of data points in line wavelength direction
aHeaderHeader to derive the LSF cube header from (can be NULL)
Returns
The newly created data cube.

Definition at line 546 of file muse/muse_lsf.c.

References muse_wcs::cd22, muse_wcs::crpix2, muse_wcs::crval2, muse_lsf_cube::header, muse_lsf_cube::img, MUSE_WCS_KEYS, and muse_lsf_cube::wcs.

cpl_error_code muse_lsf_cube_save ( muse_lsf_cube *  aLsfCube,
const char *  aFileName 
)

Save the LSF cube to disk.

Parameters
aLsfCubeThe LSF cube
aFileNameFITS file name

Definition at line 603 of file muse/muse_lsf.c.

References muse_wcs::cd22, muse_wcs::crpix2, muse_wcs::crval2, muse_lsf_cube::header, muse_lsf_cube::img, and muse_lsf_cube::wcs.

Referenced by muse_processing_save_cube().

void muse_lsf_fit_params_delete ( muse_lsf_fit_params *  params)
muse_lsf_fit_params* muse_lsf_fit_params_new ( cpl_boolean  aOffset,
cpl_boolean  aRefraction,
cpl_size  aSensitivity,
cpl_size  aSlitWidth,
cpl_size  aBinWidth,
cpl_size  aLSFWidth,
cpl_size  aHermit3,
cpl_size  aHermit4,
cpl_size  aHermit5,
cpl_size  aHermit6 
)

Create a new fit parameter structure.

Parameters
aOffsetSet to CPL_True if the offset is to be fit
aRefractionset to CPL_True if the atmospheric refraction is to be fit
aSensitivityOrder of the sensitivity fit parameter
aSlitWidthOrder of the slit width fit parameter
aBinWidthOrder of the bin width fit parameter
aLSFWidthOrder of the LSF width fit parameter
aHermit3Order of the 3rd order hermitean fit parameter
aHermit4Order of the 4rd order hermitean fit parameter
aHermit5Order of the 5rd order hermitean fit parameter
aHermit6Order of the 6rd order hermitean fit parameter
Returns
Pointer to a newly allocates fit parameter structure.

Definition at line 677 of file muse_lsf_params.c.

Referenced by muse_lsf_params_fit().

cpl_error_code muse_lsf_fit_slice ( const muse_pixtable *  aPixtable,
cpl_image *  aLsfImage,
muse_wcs *  aWCS,
double  aLsfRegressionWindow 
)

Compute the LSF for all wavelengths of one slice.

Parameters
aPixtableSpecial pixel table with arc lines.
aLsfImageImage to store the LSF.
aWCSThe WCS of the image.
aLsfRegressionWindowThe Regression window in LSF direction.
Returns
CPL_ERROR_NONE if everything went OK or another CPL error code on failure
Return values
CPL_ERROR_NULL_INPUT(aPixtable) not fulfilled
CPL_ERROR_NULL_INPUT(aLsfImage) not fulfilled
CPL_ERROR_NULL_INPUT(aWCS) not fulfilled
CPL_ERROR_ILLEGAL_INPUT(aLsfRegressionWindow > 0) not fulfilled

The pixel table is assumed to be restricted to one slice.

The LSF is computed as a twodimensional regression fit, with the wavelength of the pixel in the x (LSF) direction, and the arc line reference wavelength in y direction. The regression window in x (LSF) direction is taken as parameter; in y (line wavelength) direction always the full range is used.

As fit, a polynomial fit with order 2 in x (LSF) and order 3 in y (line wavelength) direction is used. One fit per x value is done.

After the fit, the according pixels in the image are set to the LSF. If a fit did not succeed, the pixels in the according image column are set invalid.

Definition at line 443 of file muse/muse_lsf.c.

References muse_wcs::cd22, muse_wcs::crpix2, muse_wcs::crval2, muse_cpltable_find_sorted(), muse_pixtable_get_nrow(), MUSE_PIXTABLE_LAMBDA, MUSE_PIXTABLE_ORIGIN, muse_pixtable_origin_get_ifu(), muse_pixtable_origin_get_slice(), and muse_pixtable::table.

cpl_error_code muse_lsf_fold_rectangle ( cpl_image *  aLsfImage,
const muse_wcs *  aWCS,
double  aBinWidth 
)

Filter an LSF image with a rectangle to model spectrum binning.

Parameters
aLsfImageThe LSF image. Filtering is in-place.
aWCSThe WCS of the image.
aBinWidthThe width of the rectangle.
Returns
CPL_ERROR_NONE on success another CPL error code on failure.
Exceptions
return CPL_ERROR_NULL_INPUTaLsfImage and/or aWcs are NULL
return CPL_ERROR_ILLEGAL_INPUTaBinWidth is not positive

Definition at line 885 of file muse/muse_lsf.c.

Referenced by muse_postproc_process_exposure().

double muse_lsf_fwhm_lambda ( const muse_lsf_params *  aDP,
double  aLambda,
double  aSampling,
unsigned int  aLength 
)

Measure the FWHM of an LSF at a given wavelength.

Parameters
aDPthe LSF parameters (for one IFU and slice)
aLambdawavelength at which to evaluate the LSF
aSamplingsampling of the spectrum in Angstrom
aLengthlength of spectrum in pixels
Returns
The FWHM of the LSF at this wavelength or 0. on error.

This function creates a spectrum of given aLength with given resolution (aSampling), fills it with a line with a reference flux (1.0) at the given wavelength aLambda. This spectrum is then used to measures peak intensity, searches for the position where the intensity reaches half the peak, to derive the FWHM from this.

Exceptions
set CPL_ERROR_NULL_INPUT, return 0.aDP is NULL
set CPL_ERROR_ILLEGAL_INPUT, return 0.aDP contains lsf_width of zero or one
set CPL_ERROR_ILLEGAL_OUTPUT, return 0.FWHM is outside the test spectrum for the given parameters

Definition at line 1260 of file muse_lsf_params.c.

References muse_lsf_params::lsf_width, and muse_lsf_params_spectrum().

static cpl_array* muse_lsf_G ( cpl_array *  aX,
cpl_array *  aCoeffs 
)
static

Helper function "G" for integrated damped gauss-hermitean function.

Parameters
aXX values array to apply
aCoeffspointer to five values for the damping polynomial
Returns
The return value array.
Exceptions
set CPL_ERROR_NULL_INPUT, return 0.0(aX != NULL) not fulfilled
set CPL_ERROR_NULL_INPUT, return 0.0(aCoeffs != NULL) not fulfilled
Pseudo code:
R(x) = aCoeffs[0] * x**4 + aCoeffs[1] * x**3
     + aCoeffs[2] * x**2 + aCoeffs[3] * x + aCoeffs[4]

G(x) =  exp(-0.5 * x**2)
      + R(x) * exp(-x**2) / 60
      + x * sqrt(Pi/2) * erf(x * sqrt(0.5))

Definition at line 484 of file muse_lsf_params.c.

References muse_cplarray_erf(), muse_cplarray_exp(), and muse_cplarray_poly1d().

Referenced by muse_lsf_params_apply().

cpl_error_code muse_lsf_params_apply ( const muse_lsf_params *  aLsfParams,
cpl_array *  aVal,
double  aLambda 
)

Apply the MUSE LSF function to a single line.

Parameters
aLsfParamsLSF parameters
aValArray with wavelengths [A]. Will be replaced by the normalized LSF data points
aLambdaLine wavelength reference [A].
Return values
CPL_ERROR_NONEEverything went OK
CPL_ERROR_NULL_INPUT(aLsfParamsImage) not fulfilled
CPL_ERROR_NULL_INPUT(aWCS) not fulfilled
CPL_ERROR_NULL_INPUT(aVal) not fulfilled
Pseudo code:
x = (aVal - aLambda) / aLsfParams.width
slit_width = aLsfParams.slit_width / aLsfParams.width
bin_width  = aLsfParams.bin_width  / aLsfParams.width

aVal = G(x + slit_width/2 + bin_width/2) - G(x - slit_width/2 + bin_width/2)
  -    G(x + slit_width/2 - bin_width/2) + G(x - slit_width/2 - bin_width/2)

Definition at line 539 of file muse_lsf_params.c.

References muse_lsf_params::bin_width, muse_lsf_params::hermit, muse_lsf_params::lambda_ref, muse_lsf_params::lsf_width, muse_cplarray_poly1d_double(), muse_lsf_G(), and muse_lsf_params::slit_width.

Referenced by muse_lsf_params_spectrum().

void muse_lsf_params_delete ( muse_lsf_params *  aParams)

Delete an allocated muse_lsf_params structure.

Parameters
aParamsStructure to delete.

Definition at line 117 of file muse_lsf_params.c.

References muse_lsf_params::hermit, muse_lsf_params::lsf_width, and muse_lsf_params::sensitivity.

Referenced by muse_lsf_fit_params_delete(), muse_lsf_params_delete_all(), and muse_lsf_params_fit().

void muse_lsf_params_delete_all ( muse_lsf_params **  aParams)

Delete an allocated array of muse_lsf_params structure.

Parameters
aParamsStructure to delete.

Definition at line 136 of file muse_lsf_params.c.

References muse_lsf_params_delete().

Referenced by muse_postproc_properties_delete().

muse_lsf_params* muse_lsf_params_fit ( muse_pixtable *  aPixtable,
cpl_table *  aLines,
int  aMaxIter 
)

Fit all entries of one slice.

Parameters
aPixtablePixel table created from an arc exposure.
aLinesList of emission lines.
aMaxIterMaximum number of iterations.
Returns
The fitted LSF parameters or NULL on error.

As a quality measure, the LSF fitted lines are subtracted from the measured spectrum.

Exceptions
set CPL_ERROR_NULL_INPUT, return NULLaPixtable is NULL

Definition at line 1067 of file muse_lsf_params.c.

References muse_lsf_params::bin_width, muse_cpl_optimize_lvmq(), muse_cpltable_extract_column(), muse_lsf_fit_params_delete(), muse_lsf_fit_params_new(), muse_lsf_params_delete(), muse_lsf_params_new(), muse_lsf_params_spectrum(), MUSE_PIXTABLE_DATA, MUSE_PIXTABLE_LAMBDA, MUSE_PIXTABLE_ORIGIN, muse_pixtable_origin_get_ifu(), muse_pixtable_origin_get_slice(), MUSE_PIXTABLE_STAT, muse_lsf_params::slit_width, and muse_pixtable::table.

muse_lsf_params* muse_lsf_params_get ( muse_lsf_params **  aParams,
int  aIFU,
int  aSlice 
)

Get the slice LSF parameters for one slice.

Returns
Pointer to parameter structure.

Definition at line 452 of file muse_lsf_params.c.

Referenced by muse_sky_subtract_lines_old().

cpl_size muse_lsf_params_get_size ( muse_lsf_params **  aParams)

Count the number of entries in the array.

Parameters
aParamsLSF parameter array
Returns
Number of entries in the array.

Definition at line 99 of file muse_lsf_params.c.

Referenced by muse_lsf_params_load().

muse_lsf_params** muse_lsf_params_load ( const char *  aFile,
muse_lsf_params **  aParams,
int  aIFU 
)

Load slice LSF parameters from the extension "SLICE_PARAM".

Parameters
aFileFile name (file must exist, is written as extension)
aParamsNULL-terminated array of LSF parameters to append to, or NULL.
aIFUthe IFU/channel number, or 0 for all IFUs/channels
Returns
NULL-terminated array of LSF parameters.

The extension "SLICE_PARAM" (or "CHANnn.SLICE_PARAM") is expected to be a table with the slice dependent LSF parameters.

Definition at line 297 of file muse_lsf_params.c.

References muse_lsf_params::bin_width, muse_lsf_params::hermit, muse_lsf_params::lsf_width, muse_cpltable_get_array_copy(), muse_cpltable_load(), muse_lsf_params_get_size(), muse_lsf_params_new(), muse_lsf_params::sensitivity, and muse_lsf_params::slit_width.

Referenced by muse_processing_lsf_params_load().

muse_lsf_params* muse_lsf_params_new ( cpl_size  n_sensit,
cpl_size  n_lsf_width,
cpl_size  n_hermit 
)

Create a new lsf_params structure.

Parameters
n_sensitOrder of polynomial sensitivity parametrization.
n_lsf_widthOrder of polynomial lsf width parametrization.
n_hermitOrder of polynomial parametrization of hermitean coefficients.
Returns
Structure to hold the data.

All polynomial parametrizations are meant as wavelength dependent.

Definition at line 63 of file muse_lsf_params.c.

References muse_lsf_params::bin_width, muse_lsf_params::hermit, muse_lsf_params::lambda_ref, muse_lsf_params::lsf_width, muse_lsf_params::sensitivity, and muse_lsf_params::slit_width.

Referenced by muse_lsf_fit_params_delete(), muse_lsf_params_fit(), and muse_lsf_params_load().

cpl_error_code muse_lsf_params_save ( const muse_lsf_params **  aLsfParams,
const char *  aFile 
)

Save slice LSF parameters to the extension "slice" on disk.

Parameters
aLsfParamsNULL-terminated array of LSF parameters.
aFileFile name (file must exist, is written as extension)
Return values
CPL_ERROR_NONEif everything went OK
CPL_ERROR_NULL_INPUT(aLsfParams != NULL) not fulfilled
CPL_ERROR_DATA_NOT_FOUND(*aLsfParams != NULL) not fulfilled
CPL_ERROR_NULL_INPUT(aFile != NULL) not fulfilled

The slice parameters are converted to a table structure:

  • ifu: IFU number
  • slice: slice number within the IFU
  • sensitivitysensitivity, relative to the reference
  • lsf_width: LSF gauss-hermitean width [Angstrom]
  • hermit3: 3rd order hermitean coefficient
  • hermit4: 4th order hermitean coefficient
  • hermit5: 5th order hermitean coefficient
  • hermit6: 6th order hermitean coefficient

Definition at line 203 of file muse_lsf_params.c.

References muse_cpltable_append_file().

cpl_array* muse_lsf_params_spectrum ( const cpl_array *  aLambda,
cpl_table *  aLines,
const muse_lsf_params *  aLsfParams 
)

Create spectrum for a single slice.

Parameters
aLambdaWavelength array.
aLinesSky emission line table
aLsfParamsLSF parameters to use return the spectrum as cpl_array

The values in the returned array correspond to the wavelengths in the aLambda parameter.

Pseudo code:
spectrum = 0
for line in aLines:
    spectrum += muse_lsf_line_apply(aLambda - line.lambda, line.lambda) * line.flux
return spectrum

Definition at line 623 of file muse_lsf_params.c.

References muse_cplarray_add_window(), muse_cplarray_find_sorted(), and muse_lsf_params_apply().

Referenced by muse_lsf_fit_params_delete(), muse_lsf_fwhm_lambda(), muse_lsf_params_fit(), and muse_sky_subtract_lines_old().

muse_lsf_params** muse_processing_lsf_params_load ( muse_processing *  aProcessing,
int  aIFU 
)

Load slice LSF parameters.

Parameters
aProcessingthe processing structure
aIFUthe IFU/channel number, or 0 for all IFUs/channels
Returns
a pointer to the LSF params or NULL on error
Exceptions
set CPL_ERROR_NULL_INPUT, return NULLinvalid processing pointer
propagate CPL error code, return NULLLST_TABLE frame not found in input frameset of the processing structure

The input files must be tables with the slice dependent LSF parameters.

Definition at line 387 of file muse_lsf_params.c.

References muse_processing::inframes, muse_frameset_find(), muse_lsf_params_load(), and muse_processing_append_used().

Variable Documentation

const muse_cpltable_def muse_lsfparams_def[]
Initial value:
= {
{"ifu", CPL_TYPE_INT, NULL, "%i", "IFU number", CPL_TRUE},
{"slice", CPL_TYPE_INT, NULL, "%i", "slice number within the IFU", CPL_TRUE},
{"sensitivity", CPL_TYPE_DOUBLE | CPL_TYPE_POINTER, NULL, "%e",
"detector sensitivity, relative to the reference", CPL_TRUE},
{"offset", CPL_TYPE_DOUBLE, NULL, "%e", "wavelength calibration offset", CPL_TRUE},
{"refraction", CPL_TYPE_DOUBLE, NULL, "%e", "relative refraction index", CPL_TRUE},
{"slit_width", CPL_TYPE_DOUBLE, "Angstrom", "%e", "slit width", CPL_TRUE},
{"bin_width", CPL_TYPE_DOUBLE, "Angstrom", "%e", "bin width", CPL_TRUE},
{"lsf_width", CPL_TYPE_DOUBLE | CPL_TYPE_POINTER, "Angstrom", "%e",
" LSF gauss-hermitean width", CPL_TRUE},
{"hermit3", CPL_TYPE_DOUBLE | CPL_TYPE_POINTER, NULL, "%e",
"3rd order hermitean coefficient", CPL_TRUE},
{"hermit4", CPL_TYPE_DOUBLE | CPL_TYPE_POINTER, NULL, "%e",
"4th order hermitean coefficient", CPL_TRUE},
{"hermit5", CPL_TYPE_DOUBLE | CPL_TYPE_POINTER, NULL, "%e",
"5th order hermitean coefficient", CPL_TRUE},
{"hermit6", CPL_TYPE_DOUBLE | CPL_TYPE_POINTER, NULL, "%e",
"6th order hermitean coefficient", CPL_TRUE},
{ NULL, 0, NULL, NULL, NULL, CPL_FALSE }
}

Definition of a lsf parameters table.

  • ifu: IFU number
  • slice: slice number within the IFU
  • sensitivitysensitivity, relative to the reference
  • lsf_width: LSF gauss-hermitean width [Angstrom]
  • hermit3: 3rd order hermitean coefficient
  • hermit4: 4th order hermitean coefficient
  • hermit5: 5th order hermitean coefficient
  • hermit6: 6th order hermitean coefficient

Definition at line 161 of file muse_lsf_params.c.