MUSE Pipeline Reference Manual  1.0.2
Data Structures | Functions | Variables
Sky subtraction

Data Structures

struct  muse_sky_master
 Structure to hold the MASTER SKY result. More...
 
struct  muse_sky_params
 Structure to define the major settable sky parameters. More...
 
struct  muse_sky_fit_params
 Structure to define which slice parameters are fit. More...
 

Functions

cpl_array * muse_sky_slice_lsf_firstguess (const muse_sky_fit_params *aFitParams)
 Return the parametrization values of the first guess. More...
 
cpl_array * muse_sky_slice_lsf_set_param (muse_lsf_params *aLsf, const muse_sky_fit_params *aFitParams)
 Return the parametrization values for the specific LSF params. More...
 
muse_lsf_paramsmuse_sky_slice_apply_lsf_parametrization (const muse_lsf_params *aTemplate, const cpl_array *aPar, const muse_sky_fit_params *aFitParams)
 Convert a parametrization to LSF parameters. More...
 
muse_lsf_paramsmuse_lsf_params_fit (const cpl_array *aLambda, cpl_array *aData, const cpl_array *aStat, const cpl_table *aLines, muse_lsf_params *aFirstGuess, int aMaxIter, const muse_sky_fit_params *aFitParams)
 Fit all entries of one slice. More...
 
cpl_table * muse_sky_spectrum_from_cube (muse_datacube *aCube, const cpl_mask *aMask)
 Create a spectrum out of a cube by applying a mask. More...
 
muse_maskmuse_sky_create_skymask (muse_image *aImage, double aFraction, const char *aQCPrefix)
 Select spaxels to be considered as sky. More...
 
cpl_array * muse_sky_apply_lsf (const cpl_array *aLambda, const cpl_table *aLines, const muse_lsf_params *aLsf)
 Apply the LSF parameters to a spectrum. More...
 
void muse_sky_mark_cosmic (cpl_table *aSpectrum, muse_pixtable *aPixtable)
 Mark all pixel above a certain limit as COSMIC. More...
 
cpl_error_code muse_sky_save_continuum (muse_processing *aProcessing, const cpl_table *aContinuum, cpl_propertylist *aHeader)
 Save sky continuum table to file. More...
 
cpl_error_code muse_sky_lines_set_range (cpl_table *aLines, double aLow, double aHigh)
 Limit the lines in the table to a wavelength range. More...
 
cpl_error_code muse_sky_lines_save (muse_processing *aProcessing, const cpl_table *aLines, cpl_propertylist *aHeader)
 Save sky lines table to file. More...
 
cpl_table * muse_sky_lines_load (muse_processing *aProcessing)
 Load the sky data files. More...
 
cpl_error_code muse_sky_lines_apply_strength (cpl_table *aLines, const cpl_array *aStrength)
 Apply the line strengths to the lines. More...
 
cpl_error_code muse_sky_lines_cut (cpl_table *aLines, double aMinflux)
 Remove all lines below a certain flux limit. More...
 
cpl_table * muse_sky_lines_create (const cpl_table *aLines, const cpl_table *aOh_transitions, double aT_vibr)
 Create the emission lines from the OH transitions and other lines. More...
 
muse_sky_fit_paramsmuse_sky_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_sky_fit_params_delete (muse_sky_fit_params *params)
 Delete the fit parameter structure. More...
 
muse_lsf_paramsmuse_sky_lsf_params_fit (const cpl_array *aLambda, const cpl_array *aData, const cpl_array *aStat, const cpl_table *aLines, const cpl_array *aContinuum, const cpl_array *aSensitivity, muse_lsf_params *aFirstGuess, int aMaxIter, const muse_sky_fit_params *aFitParams)
 Fit all entries of one slice. More...
 
muse_sky_mastermuse_sky_master_fit (const cpl_array *aLambda, const cpl_array *aData, const cpl_array *aStat, const cpl_table *aLines)
 Fit all entries of the pixel table to the master sky. More...
 
cpl_table * muse_sky_continuum_load (muse_processing *aProcessing)
 Load the SKY_CONTINUUM spectrum. More...
 
muse_sky_mastermuse_sky_master_load (muse_processing *aProcessing)
 Load SKY_LINES, SKY_CONTINUUM, and LSF_PROFILE into a structure. More...
 
void muse_sky_qc_lines (cpl_propertylist *aHeader, cpl_table *aLines, const char *aPrefix)
 Fill a header with the QC parameters for the sky lines. More...
 
void muse_sky_qc_continuum (cpl_propertylist *aHeader, cpl_table *aContinuum, const char *aPrefix)
 Fill a header with the QC parameters for the sky continuum. More...
 
cpl_error_code muse_sky_subtract_rowbyrow_mask (muse_image *aImage, cpl_table *aTrace)
 Prepare an (object) mask for the sky row-by-row fitting. More...
 
cpl_error_code muse_sky_subtract_rowbyrow (muse_image *aImage, cpl_table *aTrace, float aRSigma, unsigned int aOrder)
 Subtract the sky row-by-row from a CCD-based image. More...
 
cpl_error_code muse_sky_subtract_slice (muse_pixtable *aPixtable, muse_sky_master *aMaster, muse_lsf_params *aLsf)
 Subtract the sky spectrum from the "data" column of a pixel table for one slice. More...
 
cpl_error_code muse_sky_subtract_pixtable (muse_pixtable *aPixtable, muse_sky_master *aMaster, muse_lsf_params **aLsf)
 Subtract the sky spectrum from the "data" column of a pixel table. More...
 

Variables

const muse_cpltable_def muse_fluxspectrum_def []
 Definition of the flux spectrum table structure. More...
 

Detailed Description

The sky subtraction consists of two steps: the calculation of the common sky parameters (continuum spectrum and emission line fluxes), and the actual subtraction of this spectrum applied to LSF parameters from each slice. The communication between these two steps is realized with the muse_sky_master structure.

As input for the master sky calculation a parameter file is used that will be read into a muse_sky_lines structure.

This type of file contains one or more binary tables with the relative fluxes on the sky emission lines. If both tables are present, they are merged, so that lines should not appear in both tables.

Columns:

Function Documentation

muse_lsf_params* muse_lsf_params_fit ( const cpl_array *  aLambda,
cpl_array *  aData,
const cpl_array *  aStat,
const cpl_table *  aLines,
muse_lsf_params aFirstGuess,
int  aMaxIter,
const muse_sky_fit_params aFitParams 
)

Fit all entries of one slice.

Parameters
aLambdaWavelength array [Angstrom].
aDataMeasured spectrum.
aStatThe variance spectrum.
aLinesList of emission lines.
aFirstGuessFirst guess for LSF params, or NULL.
aMaxIterMaximum number of iterations.
aFitParamsSpecification which parameters to fit
Returns
The fitted LSF parameters

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

Definition at line 131 of file muse_lsf_fit.c.

References muse_lsf_params::bin_width, muse_cpl_optimize_lvmq(), muse_cpltable_extract_column(), muse_lsf_params_delete_one(), muse_lsf_params_new(), muse_lsf_spectrum_get_lines(), muse_sky_fit_params_delete(), muse_sky_fit_params_new(), muse_sky_slice_apply_lsf_parametrization(), muse_sky_slice_lsf_firstguess(), muse_sky_slice_lsf_set_param(), and muse_lsf_params::slit_width.

cpl_array* muse_sky_apply_lsf ( const cpl_array *  aLambda,
const cpl_table *  aLines,
const muse_lsf_params aLsf 
)

Apply the LSF parameters to a spectrum.

Parameters
aLambdaWavelength bins [Angstrom]
aLinesList of emission lines.
aLsfLSF parameters
Returns
the resulting spectrum, in count.
Exceptions
set CPL_ERROR_NULL_INPUT, return NULL(aLambda != NULL) not fulfilled
set CPL_ERROR_NULL_INPUT, return NULL(aLines != NULL) not fulfilled
set CPL_ERROR_NULL_INPUT, return NULL(aLsf != NULL) not fulfilled

This function applies the instrument LSF to create a spectrum from a sky parametrization.

Pseudo code:
linespectrum = muse_sky_spectrum_set_lines(lines, aLsf)
spectrum = linespectrum + spectrum.continuum
return spectrum

Definition at line 168 of file muse_sky_common.c.

References muse_lsf_params::lambda_ref, muse_cplarray_poly1d(), muse_cpltable_extract_column(), muse_lsf_spectrum_get_lines(), and muse_lsf_params::sensitivity.

Referenced by muse_sky_master_fit().

cpl_table* muse_sky_continuum_load ( muse_processing aProcessing)

Load the SKY_CONTINUUM spectrum.

Parameters
aProcessingthe processing structure
Returns
The spectrum as cpl_table, or NULL

Definition at line 585 of file muse_sky_master.c.

References muse_processing::inframes, muse_cpltable_load(), muse_fluxspectrum_def, muse_frameset_find(), and muse_processing_append_used().

muse_mask* muse_sky_create_skymask ( muse_image aImage,
double  aFraction,
const char *  aQCPrefix 
)

Select spaxels to be considered as sky.

Parameters
aImageMUSE (white-light) image of the field of view.
aFractionFraction of spectra to select
aQCPrefixprefix for the QC keywords
Returns
A newly created bitmask for sky spaxels.

Use thresholding to create a mask of sky regions. The output mask contains a QC parameter aQCPrefix" THRESHOLD" in its header component.

Exceptions
set CPL_ERROR_NULL_INPUT, return NULLaImage is NULL

Definition at line 119 of file muse_sky_common.c.

References muse_image::data, muse_mask::header, muse_image::header, muse_mask::mask, muse_cplimage_get_percentile(), muse_image_reject_from_dq(), and muse_mask_new().

Referenced by muse_postproc_process_exposure().

void muse_sky_fit_params_delete ( muse_sky_fit_params params)

Delete the fit parameter structure.

Parameters
paramsStructure to destroy

Definition at line 93 of file muse_sky_lsf_fit.c.

Referenced by muse_lsf_params_fit().

muse_sky_fit_params* muse_sky_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 58 of file muse_sky_lsf_fit.c.

Referenced by muse_lsf_params_fit().

cpl_error_code muse_sky_lines_apply_strength ( cpl_table *  aLines,
const cpl_array *  aStrength 
)

Apply the line strengths to the lines.

Parameters
aLinesList of emission lines.
aStrengthArray of strengths, sorted by line group.
Return values
CPL_ERROR_NONEEverything went OK
CPL_ERROR_NULL_INPUT(aLines != NULL) not fulfilled
CPL_ERROR_NULL_INPUT(aStrength != NULL) not fulfilled

The line strengths are applied in-place, changing the emission lines list.

Definition at line 229 of file muse_sky_lines.c.

Referenced by muse_sky_master_fit().

cpl_table* muse_sky_lines_create ( const cpl_table *  aLines,
const cpl_table *  aOh_transitions,
double  aT_vibr 
)

Create the emission lines from the OH transitions and other lines.

Parameters
aLinesnon-OH lines table
aOh_transitionsOH transition table
aT_vibrstructure to hold vibrational transitions
Returns
the sky emission line table

If the input parameters are NULL, then the function returns an empty table (default).

Algorithm:
Create emission lines from OH transitions, append the additional emission lines, apply line strengths by group

Definition at line 377 of file muse_sky_lines.c.

Referenced by muse_sky_lines_load().

cpl_error_code muse_sky_lines_cut ( cpl_table *  aLines,
double  aMinflux 
)

Remove all lines below a certain flux limit.

Parameters
aLinesList of emission lines.
aMinfluxMinimal flux, in 10^-20 erg/(s cm^2 arcsec^2)
Return values
CPL_ERROR_NONEEverything went OK
CPL_ERROR_NULL_INPUT(aLines != NULL) not fulfilled

The line strengths are applied in-place, changing the emission lines list.

Definition at line 256 of file muse_sky_lines.c.

Referenced by muse_sky_lsf_params_fit().

cpl_table* muse_sky_lines_load ( muse_processing aProcessing)

Load the sky data files.

Parameters
aProcessingthe processing structure
Returns
Table with sky lines
Exceptions
set CPL_ERROR_NULL_INPUT, return NULL(aFile != NULL) not fulfilled

The file must consist of two extensions containing the OH transition table ("OH_TRANSITIONS") and the table of other lines ("LINES").

Definition at line 168 of file muse_sky_lines.c.

References muse_processing::inframes, muse_cpltable_load(), muse_frameset_find(), muse_processing_append_used(), muse_sky_lines_create(), and muse_sky_lines_lines_def.

cpl_error_code muse_sky_lines_save ( muse_processing aProcessing,
const cpl_table *  aLines,
cpl_propertylist *  aHeader 
)

Save sky lines table to file.

Parameters
aProcessingthe processing structure
aLinesthe sky lines table
aHeaderthe FITS header to use for the primary HDU
Returns
CPL_ERROR_NONE on success, another CPL error code on failure

The table extension is marked with and EXTNAME of "LINES".

Exceptions
return CPL_ERROR_NULL_INPUTone of the arguments is NULL
return CPL_ERROR_ILLEGAL_INPUTthe output frame could not be created

Definition at line 136 of file muse_sky_lines.c.

References muse_cpltable_append_file(), muse_processing_new_frame(), muse_sky_lines_lines_def, and muse_processing::outframes.

cpl_error_code muse_sky_lines_set_range ( cpl_table *  aLines,
double  aLow,
double  aHigh 
)

Limit the lines in the table to a wavelength range.

Parameters
aLinessky lines table
aLowlower limit, in Angstrom
aHighhigher limit, in Angstrom
Return values
CPL_ERROR_NONESuccess
CPL_ERROR_NULL_INPUT(aSkyData != NULL) not fulfilled

This function is used to improve the efficiency of the fits by removing lines outside of the data range.

Definition at line 108 of file muse_sky_lines.c.

Referenced by muse_postproc_process_exposure().

muse_lsf_params* muse_sky_lsf_params_fit ( const cpl_array *  aLambda,
const cpl_array *  aData,
const cpl_array *  aStat,
const cpl_table *  aLines,
const cpl_array *  aContinuum,
const cpl_array *  aSensitivity,
muse_lsf_params aFirstGuess,
int  aMaxIter,
const muse_sky_fit_params aFitParams 
)

Fit all entries of one slice.

Parameters
aLambdaWavelength array [Angstrom].
aDataMeasured spectrum.
aStatThe variance spectrum.
aLinesList of emission lines.
aContinuumContinuum spectrum, or NULL
aSensitivitySensitivity array, must correspond to aLambda.
aFirstGuessFirst guess for LSF params, or NULL.
aMaxIterMaximum number of iterations.
aFitParamsSpecification which parameters to fit
Returns
The fitted LSF parameters

Definition at line 427 of file muse_sky_lsf_fit.c.

References muse_cpl_optimize_lvmq(), muse_lsf_params_delete_one(), muse_lsf_params_new(), muse_sky_lines_cut(), muse_sky_slice_apply_lsf_parametrization(), muse_sky_slice_lsf_firstguess(), and muse_sky_slice_lsf_set_param().

void muse_sky_mark_cosmic ( cpl_table *  aSpectrum,
muse_pixtable aPixtable 
)

Mark all pixel above a certain limit as COSMIC.

Parameters
aSpectrumReference spectrum
aPixtablePixel table

Check each selected pixel of the pixel table against the reference spectrum. If the data value of the pixel is higher than the according value of the spectrum + 5 * variance, it is considered as cosmic. This works well for sky since we assume a homogenious illumination, strong variations are not expected here.

Definition at line 208 of file muse_sky_common.c.

References muse_cpltable_find_sorted(), and muse_pixtable::table.

muse_sky_master* muse_sky_master_fit ( const cpl_array *  aLambda,
const cpl_array *  aData,
const cpl_array *  aStat,
const cpl_table *  aLines 
)

Fit all entries of the pixel table to the master sky.

Parameters
aLambdaWavelength array [Angstrom].
aDataMeasured sky spectrum.
aStatVariance sky spectrum.
aLinesSky lines table.
Returns
Sky parametrization.
Exceptions
set CPL_ERROR_NULL_INPUT, return NULL(aLambda != NULL) not fulfilled
set CPL_ERROR_NULL_INPUT, return NULL(aData != NULL) not fulfilled
set CPL_ERROR_NULL_INPUT, return NULL(aStat != NULL) not fulfilled
set CPL_ERROR_NULL_INPUT, return NULL(aLines != NULL) not fulfilled
set CPL_ERROR_DATA_NOT_FOUND, return NULLaStat has no entries

Definition at line 463 of file muse_sky_master.c.

References muse_sky_master::continuum, muse_sky_master::lines, muse_sky_master::lsf, muse_cpl_optimize_lvmq(), muse_cpltable_copy_array(), muse_cpltable_new(), muse_fluxspectrum_def, muse_sky_apply_lsf(), muse_sky_lines_apply_strength(), and muse_sky_master_new().

Referenced by muse_postproc_process_exposure().

muse_sky_master* muse_sky_master_load ( muse_processing aProcessing)

Load SKY_LINES, SKY_CONTINUUM, and LSF_PROFILE into a structure.

Parameters
aProcessingthe processing structure
Returns
a muse_sky_master * or NULL on error
Exceptions
set CPL_ERROR_NULL_INPUT, return NULLinvalid processing pointer
propagate CPL error code, return NULLSKY_LINES, SKY_CONTINUUM, or LST_TABLE frame not found in input frameset of the processing structure

Definition at line 624 of file muse_sky_master.c.

References muse_sky_master::continuum, muse_processing::inframes, muse_sky_master::lines, muse_sky_master::lsf, muse_cpltable_load(), muse_fluxspectrum_def, muse_frameset_find(), muse_lsf_params_load(), muse_processing_append_used(), muse_sky_lines_lines_def, muse_sky_master_delete(), and muse_sky_master_new().

void muse_sky_qc_continuum ( cpl_propertylist *  aHeader,
cpl_table *  aContinuum,
const char *  aPrefix 
)

Fill a header with the QC parameters for the sky continuum.

Parameters
aHeaderheader to store the QC parameters for the sky continuum
aContinuumsky continuum table
aPrefixprefix for the QC keywords
Exceptions
set CPL_ERROR_NULL_INPUT and returnone of the input arguments is NULL
set CPL_ERROR_DATA_NOT_FOUND and returnaContinuum does not contain any rows

Definition at line 102 of file muse_sky_qc.c.

void muse_sky_qc_lines ( cpl_propertylist *  aHeader,
cpl_table *  aLines,
const char *  aPrefix 
)

Fill a header with the QC parameters for the sky lines.

Parameters
aHeaderheader with the QC parameters for the sky lines
aLinessky line table
aPrefixprefix for the QC keywords
Exceptions
set CPL_ERROR_NULL_INPUT and returnone of the input arguments is NULL
set CPL_ERROR_DATA_NOT_FOUND and returnaLines does not contain any rows

Definition at line 46 of file muse_sky_qc.c.

cpl_error_code muse_sky_save_continuum ( muse_processing aProcessing,
const cpl_table *  aContinuum,
cpl_propertylist *  aHeader 
)

Save sky continuum table to file.

Parameters
aProcessingthe processing structure
aContinuumthe sky continuum table
aHeaderthe FITS header to use for the primary HDU
Returns
CPL_ERROR_NONE on success, another CPL error code on failure

The table extension is marked with and EXTNAME of "CONTINUUM".

Exceptions
return CPL_ERROR_NULL_INPUTone of the arguments is NULL
return CPL_ERROR_ILLEGAL_INPUTthe output frame could not be created

Definition at line 264 of file muse_sky_common.c.

References muse_cpltable_append_file(), muse_processing_new_frame(), and muse_processing::outframes.

muse_lsf_params * muse_sky_slice_apply_lsf_parametrization ( const muse_lsf_params aTemplate,
const cpl_array *  aPar,
const muse_sky_fit_params aFitParams 
)

Convert a parametrization to LSF parameters.

Parameters
aTemplateTemplate for parametrization values
aParParametrization values
aFitParamsStructure defining slice parameter fitting flags
Returns
Pointer to a newly allocates LSF parameter structure.

This is the parametrization used in the SLICE procedure.

Definition at line 110 of file muse_sky_lsf_fit.c.

References muse_lsf_params::bin_width, muse_lsf_params::hermit, muse_lsf_params::lsf_width, muse_lsf_params_delete_one(), muse_lsf_params_new(), muse_lsf_params::sensitivity, and muse_lsf_params::slit_width.

Referenced by muse_lsf_params_fit(), and muse_sky_lsf_params_fit().

cpl_array * muse_sky_slice_lsf_firstguess ( const muse_sky_fit_params aFitParams)

Return the parametrization values of the first guess.

Parameters
aFitParamsStructure defining slice parameter fitting flags
Returns
An array containing the first guess values.

This array can be converted to lsf parametern using muse_lsf_slice_apply_lsf_parametrization().

Definition at line 314 of file muse_sky_lsf_fit.c.

Referenced by muse_lsf_params_fit(), and muse_sky_lsf_params_fit().

cpl_array * muse_sky_slice_lsf_set_param ( muse_lsf_params aLsf,
const muse_sky_fit_params aFitParams 
)

Return the parametrization values for the specific LSF params.

Parameters
aLsfslice LSF params.
aFitParamsStructure defining slice parameter fitting flags
Returns
An array containing the first guess values.

Definition at line 235 of file muse_sky_lsf_fit.c.

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

Referenced by muse_lsf_params_fit(), and muse_sky_lsf_params_fit().

cpl_table* muse_sky_spectrum_from_cube ( muse_datacube aCube,
const cpl_mask *  aMask 
)

Create a spectrum out of a cube by applying a mask.

Parameters
aCubeMUSE datacube.
aMaskMask image of sky regions.
Returns
Table with data spectrum.

Definition at line 70 of file muse_sky_common.c.

References muse_datacube::data, muse_datacube::dq, muse_datacube::header, muse_cpltable_new(), and muse_dataspectrum_def.

cpl_error_code muse_sky_subtract_pixtable ( muse_pixtable aPixtable,
muse_sky_master aMaster,
muse_lsf_params **  aLsf 
)

Subtract the sky spectrum from the "data" column of a pixel table.

Parameters
aPixtablePixel table to take lambda values from.
aMasterMaster sky parameters.
aLsfArray with slice specific LSF parameters.
Return values
CPL_ERROR_NONEif everything was OK.
Exceptions
set CPL_ERROR_NULL_INPUT, return CPL_ERROR_NULL_INPUT(aPixtable != NULL) not fulfilled
set CPL_ERROR_NULL_INPUT, return CPL_ERROR_NULL_INPUT(aPixtable->table != NULL) not fulfilled
set CPL_ERROR_DATA_NOT_FOUND, return CPL_ERROR_DATA_NOT_FOUND(aPixtable->table is a pixel table) not fulfilled
set CPL_ERROR_NULL_INPUT, return CPL_ERROR_NULL_INPUT(aMaster != NULL) not fulfilled
set CPL_ERROR_NULL_INPUT, return CPL_ERROR_NULL_INPUT(aLsfs != NULL) not fulfilled
Remarks
This function adds a FITS header (MUSE_HDR_PT_SKYSUB) with the boolean value 'T' to the pixel table, for information.

Definition at line 159 of file muse_sky_subtract.c.

References muse_sky_master::continuum, muse_pixtable::header, muse_sky_master::lines, muse_cpltable_check(), MUSE_HDR_PT_SKYSUB, muse_lsf_params_get(), muse_pixtable_def, muse_pixtable_extracted_delete(), muse_pixtable_extracted_get_size(), muse_pixtable_extracted_get_slices(), muse_pixtable_get_nrow(), muse_pixtable_origin_get_ifu(), muse_pixtable_origin_get_slice(), muse_pixtable_restrict_wavelength(), muse_sky_subtract_slice(), and muse_pixtable::table.

Referenced by muse_postproc_process_exposure().

cpl_error_code muse_sky_subtract_rowbyrow ( muse_image aImage,
cpl_table *  aTrace,
float  aRSigma,
unsigned int  aOrder 
)

Subtract the sky row-by-row from a CCD-based image.

Parameters
aImagethe image to subtract the sky from
aTracethe tracing table
aRSigmarejection sigma for the iterative polynomial fit
aOrderpolynomial order for the fit of each row
Returns
CPL_ERROR_NONE on success another cpl_error_code on failure.

This function is based on the method developed by Lutz Wisotzki end of 2010 and documented in Dec. 2011. This function expects non-relevant pixels to be masked in some way, i.e. only pixels with DQ values equal to EURO3D_GOODPIXEL are used in the fit, see muse_sky_subtract_rowbyrow(). Then go row by row through each slice on the raw image, do an iterative horizontal polynomial fit, and subtract it.

To find the slices on the image, this functions needs a trace table (aTrace). Alternatively, if aTrace is NULL, aImage needs to contain header keywords of the form ESO.DRS.MUSE.SLICEi.CENTER containing the approximate center of each slice. In that case, the row-by-row fit extends between the pixels flagged as EURO3D_MISSDATA on either side of this center.

Exceptions
return CPL_ERROR_NULL_INPUTaImage is NULL
return CPL_ERROR_ILLEGAL_INPUTno slices are found, because aTrace is NULL or faulty, and aImage does not contain slice center keywords

Definition at line 224 of file muse_sky_rowbyrow.c.

References muse_image::data, muse_image::dq, muse_image::header, muse_image_save(), muse_trace_polys_delete(), muse_trace_table_get_polys_for_slice(), muse_utils_iterate_fit_polynomial(), and muse_image::stat.

Referenced by muse_postproc_process_exposure().

cpl_error_code muse_sky_subtract_rowbyrow_mask ( muse_image aImage,
cpl_table *  aTrace 
)

Prepare an (object) mask for the sky row-by-row fitting.

Parameters
aImagethe image to create the mask for
aTracethe tracing table
Returns
CPL_ERROR_NONE on success another cpl_error_code on failure.

This function is based on the method developed by Lutz Wisotzki end of 2010 and documented in Dec. 2011: detect continuum objects by vertically medianing Masking object pixels rejected from an iterative first-order fit in each slice. The object pixels are marked as EURO3D_OBJECT in the DQ extension of the input image.

To find the slices on the image, this functions needs a trace table (aTrace). Alternatively, if aTrace is NULL, aImage needs to contain header keywords of the form ESO.DRS.MUSE.SLICEi.CENTER containing the approximate center of each slice. In that case, the row-by-row fit extends between the pixels flagged as EURO3D_MISSDATA on either side of this center.

Exceptions
return CPL_ERROR_NULL_INPUTaImage is NULL
return CPL_ERROR_ILLEGAL_INPUTno slices are found, because aTrace is NULL or faulty, and aImage does not contain slice center keywords

Definition at line 74 of file muse_sky_rowbyrow.c.

References muse_image::data, muse_image::dq, muse_image::header, muse_trace_polys_delete(), muse_trace_table_get_polys_for_slice(), and muse_utils_iterate_fit_polynomial().

Referenced by muse_postproc_process_exposure().

cpl_error_code muse_sky_subtract_slice ( muse_pixtable aPixtable,
muse_sky_master aMaster,
muse_lsf_params aLsf 
)

Subtract the sky spectrum from the "data" column of a pixel table for one slice.

Parameters
aPixtablePixel table to take lambda values from.
aMasterMaster sky parameters.
aLsfSlice specific LSF parameters.
Return values
CPL_ERROR_NONEif everything was OK.

The pixel table is sorted by wavelength in this function.

Definition at line 115 of file muse_sky_subtract.c.

References muse_cpltable_extract_column(), and muse_pixtable::table.

Referenced by muse_sky_subtract_pixtable().

Variable Documentation

const muse_cpltable_def muse_fluxspectrum_def[]
Initial value:
= {
{"lambda", CPL_TYPE_DOUBLE, "Angstrom", "%7.2f", "wavelength", CPL_TRUE},
{"flux", CPL_TYPE_DOUBLE, "erg/(s cm^2 arcsec^2)", "%e", "Flux", CPL_TRUE},
{ NULL, 0, NULL, NULL, NULL, CPL_FALSE }
}

Definition of the flux spectrum table structure.

  • lambda: wavelength [Angstrom]
  • flux: Flux [erg/(s cm^2 arcsec^2)]

The table can be expected to be sorted by the wavelength.

Definition at line 55 of file muse_sky_common.c.

Referenced by muse_sky_continuum_load(), muse_sky_master_fit(), and muse_sky_master_load().