MUSE Pipeline Reference Manual  2.1.1
Data Structures | Enumerations | Functions | Variables
Flux calibration

Data Structures

struct  muse_flux_object
 Flux object to store data needed while computing the flux calibration. More...
 

Enumerations

Functions

muse_flux_objectmuse_flux_object_new (void)
 Allocate memory for a new muse_flux_object object. More...
 
void muse_flux_object_delete (muse_flux_object *aFluxObj)
 Deallocate memory associated to a muse_flux_object. More...
 
static double muse_flux_reference_table_sampling (cpl_table *aTable)
 Compute average sampling for a MUSE-format flux reference table. More...
 
cpl_error_code muse_flux_reference_table_check (cpl_table *aTable)
 Check and/or adapt the standard flux reference table format. More...
 
double muse_flux_response_interpolate (const cpl_table *aResponse, double aLambda, double *aError, muse_flux_interpolation_type aType)
 Compute linearly interpolated response of some kind at given wavelength. More...
 
muse_imagemuse_flux_integrate_cube (muse_datacube *aCube, cpl_apertures *aApertures, muse_flux_profile_type aProfile)
 Integrate the flux of the standard star(s) given a datacube. More...
 
cpl_error_code muse_flux_integrate_std (muse_pixtable *aPixtable, muse_flux_profile_type aProfile, muse_flux_object *aFluxObj)
 Reconstruct a cube, detect the standard star, and integrate its flux. More...
 
cpl_error_code muse_flux_response_compute (muse_flux_object *aFluxObj, muse_flux_selection_type aSelect, double aAirmass, const cpl_table *aReference, const cpl_table *aTellBands, const cpl_table *aExtinct)
 Compare measured flux distribution over wavelength with calibrated stellar fluxes and derive instrumental sensitivity curve. More...
 
cpl_error_code muse_flux_get_response_table (muse_flux_object *aFluxObj, muse_flux_smooth_type aSmooth)
 Get the table of the standard star response function. More...
 
cpl_error_code muse_flux_get_telluric_table (muse_flux_object *aFluxObj)
 Get the table of the telluric correction. More...
 
cpl_error_code muse_flux_compute_qc (muse_flux_object *aFluxObj)
 Compute QC parameters, related to on-sky throughput. More...
 
cpl_error_code muse_flux_compute_qc_zp (muse_flux_object *aFluxObj, const muse_table *aFilter, const char *aName)
 Compute QC zeropoint for given filter. More...
 
cpl_error_code muse_flux_calibrate (muse_pixtable *aPixtable, const muse_table *aResponse, const cpl_table *aExtinction, const muse_table *aTelluric)
 Convert the input pixel table from counts to fluxes. More...
 

Variables

const muse_cpltable_def muse_response_tellbands_def []
 Table definition for a telluric bands table.
 
const muse_cpltable_def muse_flux_responsetable_def []
 MUSE response table definition. More...
 
const muse_cpltable_def muse_flux_tellurictable_def []
 MUSE telluric correction table definition. More...
 

Detailed Description

Enumeration Type Documentation

Type of table interpolation to use.

There are several types of tables containing something like a "response" curve which contain at least a column "lambda" relevant to the MUSE pipeline. They all have to be interpolated (linearly) in wavelength. Depending on their content they have to be handled in slightly different ways.

Enumerator
MUSE_FLUX_RESP_FILTER 

filter response curve; column response

MUSE_FLUX_RESP_FLUX 

flux response curve; columns response, resperr

MUSE_FLUX_RESP_STD_FLUX 

standard star spectrum; columns flux, fluxerr

MUSE_FLUX_RESP_EXTINCT 

extinction curve; column extinction

MUSE_FLUX_TELLURIC 

telluric correction table: columns ftelluric, ftellerr

Definition at line 111 of file muse_flux.h.

Type of optimal profile to use.

Enumerator
MUSE_FLUX_PROFILE_MOFFAT 

Moffat profile

MUSE_FLUX_PROFILE_GAUSSIAN 

Gaussian profile

MUSE_FLUX_PROFILE_CIRCLE 

circular flux integration, with background annulus

MUSE_FLUX_PROFILE_EQUAL_SQUARE 

simplest version: non-optimal square integration

Definition at line 124 of file muse_flux.h.

Type of star selection to use.

Enumerator
MUSE_FLUX_SELECT_BRIGHTEST 

take the brightest star as standard

MUSE_FLUX_SELECT_NEAREST 

take the nearest source as standard

Definition at line 136 of file muse_flux.h.

Type of response curve smoothing to use.

Enumerator
MUSE_FLUX_SMOOTH_NONE 

no smoothing at all!

MUSE_FLUX_SMOOTH_MEDIAN 

sliding median of +/- 15 Angstrom width

MUSE_FLUX_SMOOTH_PPOLY 

piecewise cubic polynomial plus * median of +/- 15 Angstrom width

Definition at line 146 of file muse_flux.h.

Function Documentation

cpl_error_code muse_flux_calibrate ( muse_pixtable aPixtable,
const muse_table aResponse,
const cpl_table *  aExtinction,
const muse_table aTelluric 
)

Convert the input pixel table from counts to fluxes.

Parameters
aPixtablethe input pixel table containing the exposure to be flux calibrated
aResponsethe tabulated response curve with header
aExtinctionthe extinction curve
aTelluricthe telluric correction table with header
Returns
CPL_ERROR_NONE for success, any other cpl_error_code for failure.
Remarks
The resulting correction is directly applied and returned in the input pixel table.
This function adds a FITS header (MUSE_HDR_PT_FLUXCAL) with the boolean value 'T' to the pixel table, for information.

Loop through all pixels in the input pixel table, evaluate the response polynomial at the corresponding wavelength and multiply by the response factor. Treat the variance accordingly. Also multiply by the telluric correction factor, weighted by the airmass, for wavelengths redward of the start of the telluric absorption regions.

Quality Assessment:
Apply the flux calibration to the standard star exposure on which it was derived and compare the reference spectra with the flux-calibrated spectrum of the respective star.
Exceptions
return CPL_ERROR_NULL_INPUTthe input pixel table, its header, or the response table are NULL
return CPL_ERROR_INCOMPATIBLE_INPUTthe input pixel table data unit is not "count"
return CPL_ERROR_INCOMPATIBLE_INPUTthe flat-field spectrum correction status between aPixtable and aResponse does not match
output warning only, but continuethe flat-field spectrum correction status between aPixtable and aTelluric does not match
output warning, return CPL_ERROR_ILLEGAL_INPUTthe input pixel table data has non-positive exposure time
output warning and reset airmass to 0. to not do extinction correctionairmass value cannot be determined
output warning and continue without extinction correctionthe extinction curve is missing
output info message and continue without telluric correctionthe telluric correction table is missing

Definition at line 3083 of file muse_flux.c.

References muse_table::header, muse_pixtable::header, muse_astro_airmass(), MUSE_FLUX_RESP_EXTINCT, MUSE_FLUX_RESP_FLUX, muse_flux_response_interpolate(), MUSE_FLUX_TELLURIC, MUSE_HDR_PT_FFCORR, MUSE_HDR_PT_FLUXCAL, muse_pfits_get_exptime(), muse_pfits_get_pro_catg(), MUSE_PIXTABLE_DATA, muse_pixtable_get_nrow(), MUSE_PIXTABLE_LAMBDA, MUSE_PIXTABLE_STAT, muse_table::table, and muse_pixtable::table.

Referenced by muse_postproc_process_exposure().

cpl_error_code muse_flux_compute_qc ( muse_flux_object aFluxObj)

Compute QC parameters, related to on-sky throughput.

Parameters
aFluxObjMUSE flux object, containing integrated fluxes and the calculated telluric correction
Returns
CPL_ERROR_NONE on success, another CPL error code on failure

This uses approximately known parameters of the VLT to compute the throughput of MUSE + VLT + atmosphere using the parameters available in the aFluxObj structure.

If available, the final response curve (aFluxObj->response) is used. Then the QC parameters are also written to the output FITS header of the response. Otherwise, the (unsmoothed) sensitivity function (aFluxObj->sensitivity) is used, and the resulting values are just printed to screen/log. In both cases, a new table column "throughput" is created, or its contents are overwritten, if the column already exists.

The keywords written (if aFluxObj contains the response curve) are QC_STD_THRU for the throughput values and QC_STD_NAME for the name of the standard star (field) that gets transferred from the target name in the cube header.

Exceptions
set and return CPL_ERROR_NULL_INPUTinput flux object both its sensitivity and response components are NULL
set and return CPL_ERROR_DATA_NOT_FOUNDneither sensitivity nor response->table component could be duplicated

Definition at line 2858 of file muse_flux.c.

References muse_flux_object::cube, muse_table::header, muse_datacube::header, muse_pfits_get_targname(), muse_flux_object::response, muse_flux_object::sensitivity, and muse_table::table.

Referenced by muse_postproc_process_exposure().

cpl_error_code muse_flux_compute_qc_zp ( muse_flux_object aFluxObj,
const muse_table aFilter,
const char *  aName 
)

Compute QC zeropoint for given filter.

Parameters
aFluxObjMUSE flux object, containing integrated fluxes and the calculated telluric correction
aFiltertable contining the filter's throughput curve
aNamethe name of the filter
Returns
CPL_ERROR_NONE on success, another CPL error code on failure

This function integrates the aFluxObj->reference curve of the standard star over the filter function to compute its magnitude. Then, the final output response (aFluxObj->response, if available) or the unsmoothed sensitivity (aFluxObj->sensitivity) is used to create the measured spectrum of the standard star and integrate this as well. The zeropoint then is the difference between the two:

ZP = m_obs - m_ref = -2.5 log10(F_obs / F_ref)

Note
The input argument aName is used to create the keyword of the output QC parameter. It will be the part of the string after the last '_' in the filter's name. If NULL or aName does not contain an underscore, "UNKNOWN" will be used.
Exceptions
set and return CPL_ERROR_NULL_INPUTinput flux object both its sensitivity and response components, reference spectrum, aFilter, or its table component are NULL
set filter name for output FITS keyword to ,UNKNOWN"but continue" aName is NULL or does not contain an underscore

Definition at line 2972 of file muse_flux.c.

References muse_table::header, MUSE_FLUX_RESP_FILTER, MUSE_FLUX_RESP_STD_FLUX, muse_flux_response_interpolate(), muse_flux_object::reference, muse_flux_object::response, muse_flux_object::sensitivity, and muse_table::table.

cpl_error_code muse_flux_get_response_table ( muse_flux_object aFluxObj,
muse_flux_smooth_type  aSmooth 
)

Get the table of the standard star response function.

Parameters
aFluxObjMUSE flux object, containing integrated fluxes and the calculated response
aSmoothMUSE flux object, containing integrated fluxes and the
Returns
CPL_ERROR_NONE on success, another CPL error code on failure

Copy the response information from the sensitivity table of aFluxObj to a new table, also returned in the input aFluxObj.

To reject outliers, the reponse function is smoothed using either a median with 15 Angstrom halfwidth or a piecewise cubic polynomial followed by a sliding average of 15 Angstrom halfwidth.

For the median filter, the output errorbars are taken as the median absolute deviation in the same region, or the median of all input errorbars, whatever is larger. For the piecewise polynomial, the error of the fit and the standard deviation of the averaging region are propagated onto the original error of each point.

If smoothing was applied to the table, the unsmoothed values are tracked in extra table columns (with "_unsmoothed" postfix).

Exceptions
return CPL_ERROR_NULL_INPUTinput flux object or its sensitivity components are NULL
return CPL_ERROR_ILLEGAL_INPUTaSmooth is unknown

Definition at line 2644 of file muse_flux.c.

References muse_flux_object::cube, muse_table::header, muse_datacube::header, muse_cpltable_new(), MUSE_FLUX_SMOOTH_MEDIAN, MUSE_FLUX_SMOOTH_PPOLY, muse_pfits_get_mode(), muse_table_new(), MUSE_WCS_KEYS, muse_flux_object::response, muse_flux_object::sensitivity, and muse_table::table.

Referenced by muse_postproc_process_exposure().

cpl_error_code muse_flux_get_telluric_table ( muse_flux_object aFluxObj)

Get the table of the telluric correction.

Parameters
aFluxObjMUSE flux object, containing integrated fluxes and the calculated telluric correction
Returns
CPL_ERROR_NONE on success, another CPL error code on failure

Copy the telluric correction factors from the sensitivity table of aFluxObj to a new table, also returned in the input aFluxObj. Pad telluric regions with extra entries of ftelluric = 1 (for later interpolation), remove all other invalid entries to minimize the size of the returned table.

Note
The table column "ftellerr" currently contains an error that is at most 0.1, smaller than the distance between the telluric correction factor and 1., but 1e-4 as a mininum.
Exceptions
return CPL_ERROR_NULL_INPUTinput flux object or its sensitivity components are NULL

Definition at line 2752 of file muse_flux.c.

References muse_flux_object::cube, muse_table::header, muse_datacube::header, muse_cpltable_new(), muse_table_new(), MUSE_WCS_KEYS, muse_flux_object::sensitivity, muse_table::table, and muse_flux_object::telluric.

Referenced by muse_postproc_process_exposure().

muse_image* muse_flux_integrate_cube ( muse_datacube aCube,
cpl_apertures *  aApertures,
muse_flux_profile_type  aProfile 
)

Integrate the flux of the standard star(s) given a datacube.

Parameters
aCubeinput datacube with the standard star
aAperturesapertures of detected objects in the cube
aProfilethe spatial profile to use for flux integration
Returns
a muse_image * with the integrated fluxes of all objects or NULL on error
Remarks
aProfile can be one of MUSE_FLUX_PROFILE_GAUSSIAN, MUSE_FLUX_PROFILE_MOFFAT, MUSE_FLUX_PROFILE_CIRCLE, and MUSE_FLUX_PROFILE_EQUAL_SQUARE.

Use the input datacube (aCube) and the detections in it (aApertures) to determine the FWHM of the objects, and use it to define the flux integration window (as three times the FWHM). Integrate the flux of each object for all wavelength bins, using either simple flux integration or profile fitting depending on aProfile.

Note
The area over which the flux integration is measured, depends on the seeing. For most methods the half-size is at least 3x the measured FWHM at each wavelength. Only for MUSE_FLUX_PROFILE_CIRCLE, it is forced to be 4x the FWHM, where the FWHM is either the measured value or the DIMM seeing from the FITS header, depending on which is larger.

Store the flux measurements in a two-dimensional image, where each row corresponds to one detected object, and the three image components are data, data quality, and variance. It also carries a standard spectral WCS in its header component.

Exceptions
set CPL_ERROR_NULL_INPUT, return NULLinputs aCube or aApertures are NULL
set CPL_ERROR_ILLEGAL_INPUT, return NULLthe input profile type is unknown

Definition at line 1009 of file muse_flux.c.

References muse_image::data, muse_datacube::data, muse_image::dq, muse_datacube::dq, muse_datacube::header, muse_image::header, MUSE_FLUX_PROFILE_CIRCLE, MUSE_FLUX_PROFILE_EQUAL_SQUARE, MUSE_FLUX_PROFILE_GAUSSIAN, MUSE_FLUX_PROFILE_MOFFAT, muse_image_new(), muse_pfits_get_bunit(), muse_pfits_get_cd(), muse_pfits_get_crpix(), muse_pfits_get_crval(), muse_pfits_get_ctype(), muse_pfits_get_cunit(), muse_pfits_get_dec(), muse_pfits_get_exptime(), muse_pfits_get_fwhm_end(), muse_pfits_get_fwhm_start(), muse_pfits_get_mode(), muse_pfits_get_ra(), muse_quality_image_reject_using_dq(), muse_wcs_apply_cd(), muse_wcs_celestial_from_pixel(), muse_wcs_create_default(), muse_image::stat, and muse_datacube::stat.

Referenced by muse_flux_integrate_std().

cpl_error_code muse_flux_integrate_std ( muse_pixtable aPixtable,
muse_flux_profile_type  aProfile,
muse_flux_object aFluxObj 
)

Reconstruct a cube, detect the standard star, and integrate its flux.

Parameters
aPixtablethe input pixel table of the standard star exposure
aProfilethe spatial profile to use for flux integration
aFluxObjthe MUSE flux object to modify with the cube and integrated flux
Returns
CPL_ERROR_NONE on success, another CPL error code on failure
Remarks
The flux image returned in aFluxObj contains the flux measurements, with the fluxes in the data extension of the muse_image. The stat extension contains the measurement errors for each wavelength and the header element is used to propagate the WCS keywords to define the wavelength scale. Each image row contains the fluxes of one standard star, so that the vertical image size is equal to the measured stars on success.
aProfile can be one of MUSE_FLUX_PROFILE_GAUSSIAN, MUSE_FLUX_PROFILE_MOFFAT, MUSE_FLUX_PROFILE_CIRCLE, and MUSE_FLUX_PROFILE_EQUAL_SQUARE.

Resample the input pixel table to a cube, with wavelength sampling matched to the MUSE spectral sampling. Find objects (lowering the S/N between 50 and 5, in multiple steps) on the central plane of the cube. Create apertures for all detections and integrate their flux in each wavelength. See muse_flux_integrate_cube() for details on the flux integration.

Note
If the input pixel table contains data of an AO instrument mode, the notch filter flag (EURO3D_NOTCH_NAD) is reset before resampling into the cube, so that useful throughput values can be computed.

Both the resampled datacube and the flux measurements image are added into the aFluxObj structure (components intimage and cube).

Exceptions
return CPL_ERROR_NULL_INPUTinputs aPixtable or aFluxObj are NULL
return CPL_ERROR_ILLEGAL_INPUTthe input profile type is unknown
return CPL_ERROR_DATA_NOT_FOUNDno objects found

Definition at line 1362 of file muse_flux.c.

References muse_resampling_params::crsigma, muse_resampling_params::crtype, muse_flux_object::cube, muse_datacube::data, muse_datacube::dq, muse_pixtable::header, muse_flux_object::intimage, muse_datacube_save(), muse_flux_integrate_cube(), MUSE_FLUX_PROFILE_CIRCLE, MUSE_FLUX_PROFILE_EQUAL_SQUARE, MUSE_FLUX_PROFILE_GAUSSIAN, MUSE_FLUX_PROFILE_MOFFAT, muse_pfits_get_mode(), MUSE_PIXTABLE_DQ, muse_pixtable_get_nrow(), muse_pixtable_save(), muse_quality_image_reject_using_dq(), MUSE_RESAMPLE_WEIGHTED_DRIZZLE, MUSE_RESAMPLING_CRSTATS_MEDIAN, muse_resampling_cube(), muse_resampling_params_delete(), muse_resampling_params_new(), muse_resampling_params::pfx, and muse_pixtable::table.

Referenced by muse_postproc_process_exposure().

void muse_flux_object_delete ( muse_flux_object aFluxObj)

Deallocate memory associated to a muse_flux_object.

Parameters
aFluxObjinput MUSE flux object

Just calls the required *_delete() functions for each component before freeing the memory for the pointer itself. As a safeguard, it checks if a valid pointer was passed, so that crashes cannot occur.

Definition at line 89 of file muse_flux.c.

References muse_flux_object::cube, muse_flux_object::intimage, muse_datacube_delete(), muse_image_delete(), muse_table_delete(), muse_flux_object::reference, muse_flux_object::response, muse_flux_object::sensitivity, muse_flux_object::tellbands, and muse_flux_object::telluric.

muse_flux_object* muse_flux_object_new ( void  )

Allocate memory for a new muse_flux_object object.

Returns
a new muse_flux_object * or NULL on error
Remarks
The returned object has to be deallocated using muse_flux_object_delete().
This function does not allocate the contents of the elements, these have to be allocated with the respective *_new() functions.

Allocate memory to store the pointers of the muse_flux_object structure. Set the raref and decref components to NAN to signify that they are unset.

Definition at line 68 of file muse_flux.c.

References muse_flux_object::decref, and muse_flux_object::raref.

Referenced by muse_postproc_process_exposure().

cpl_error_code muse_flux_reference_table_check ( cpl_table *  aTable)

Check and/or adapt the standard flux reference table format.

Parameters
aTablethe input STD_FLUX_TABLE
Returns
CPL_ERROR_NONE on successful check or conversion, another cpl_error_code on failure.

We need a table with columns "lambda" and "flux" (and, optionally, "fluxerr") for the standard response calculation. The table columns all need to be in double format, and in the right units ("Angstrom", "erg/s/cm**2/Angstrom"). If the wrong units are used for "lambda" and/or "flux" the table is rejected completely as incompatible, if only "fluxerr" has an unrecognized unit, that column is erased.

Alternatively, we can accept HST CALSPEC tables which basically have the same information, just with different column names ("WAVELENGTH", "FLUX", and "STATERROR" plus "SYSERROR"), using different strings the the same units ("ANGSTROMS", "FLAM").

Note
This function cannot check, if the input table is in vacuum or air wavelengths. But if the input is in HST CALSPEC format, then it assumes that the wavelength given in the "WAVELENGTH" column are in vacuum. It then converts them to air wavelengths using the standard IAU conversion formula.
Exceptions
return CPL_ERROR_NULL_INPUTaTable is NULL
return CPL_ERROR_INCOMPATIBLE_INPUTa table with unrecognized format was found
propagate CPL errora (table column casting) operation did not work

Definition at line 170 of file muse_flux.c.

References muse_astro_wavelength_vacuum_to_air(), and muse_flux_reference_table_sampling().

Referenced by muse_postproc_process_exposure().

static double muse_flux_reference_table_sampling ( cpl_table *  aTable)
static

Compute average sampling for a MUSE-format flux reference table.

Parameters
aTablethe STD_FLUX_TABLE
Returns
The sampling in Angstrom per bin or 0 on error.
Exceptions
set CPL_ERROR_NULL_INPUT, return 0.aTable is NULL

Definition at line 121 of file muse_flux.c.

Referenced by muse_flux_reference_table_check().

cpl_error_code muse_flux_response_compute ( muse_flux_object aFluxObj,
muse_flux_selection_type  aSelect,
double  aAirmass,
const cpl_table *  aReference,
const cpl_table *  aTellBands,
const cpl_table *  aExtinct 
)

Compare measured flux distribution over wavelength with calibrated stellar fluxes and derive instrumental sensitivity curve.

Parameters
aFluxObjimage containing the standard flux measurements
aSelecthow to select the standard star
aAirmassthe corresponding airmass (passing 0.0 is allowed to switch off extinction correction)
aReferencetable containing the reference response for the star
aTellBandstable containing the telluric band regions (optional)
aExtinctthe extinction table
Returns
CPL_ERROR_NONE on success, another CPL error code on failure

Select the star in aFluxObj->intimage depending on aSelect, to be either the brightest or the nearest integrated object.

Note
If aSelect is MUSE_FLUX_SELECT_NEAREST, then aFluxObj->raref and aFluxObj->decref need to be filled (i.e. not NAN) with the coordinates of the real reference object on sky, otherwise MUSE_FLUX_SELECT_BRIGHTEST is assumed.

Compare the measured flux at each wavelength to the reference flux, and scale by airmass, to create the sensitivity function. Questionable entries (those within the telluric regions and outside the wavelength range of the MUSE setup), are marked, the ones outside subsequently removed. The telluric regions are interpolated over (using a 2nd order polynomial) or extrapolated (linearly), and telluric correction factors are computed for these regions, scaled by the airmass of the standard star exposure. The resulting curve is then extrapolated linearly to cover the wavelength range that MUSE can possibly cover with any pixel.

The real result of this function is the sensitivity table that gets added to aFluxObj.

Note
The sensitivity distribution is not smoothed or fit in any way, so it will contain outliers!

The sensitivity table produced here can be converted to the necessary STD_RESPONSE and STD_TELLURIC tables using muse_flux_get_response_table() and muse_flux_get_telluric_table().

Note
The reference table aReference will be duplicated as aFluxObj->reference on success.
Exceptions
return CPL_ERROR_NULL_INPUTinputs aFluxObj, its intimage component, or aReference table are NULL
return CPL_ERROR_ILLEGAL_INPUTaAirmass invalid (< 1.)
use builtin defaultsaTellBands is NULL
output warning, but continue, ignoring extinctionextinction table is missing

Definition at line 2070 of file muse_flux.c.

References muse_image::data, muse_flux_object::decref, muse_image::header, muse_flux_object::intimage, muse_astro_angular_distance(), MUSE_FLUX_SELECT_BRIGHTEST, MUSE_FLUX_SELECT_NEAREST, muse_pfits_get_bunit(), muse_flux_object::raref, muse_flux_object::reference, and muse_flux_object::sensitivity.

Referenced by muse_postproc_process_exposure().

double muse_flux_response_interpolate ( const cpl_table *  aResponse,
double  aLambda,
double *  aError,
muse_flux_interpolation_type  aType 
)

Compute linearly interpolated response of some kind at given wavelength.

Parameters
aResponsethe response table
aLambdawavelength to query
aErrorthe error connected to the interpolated datapoint, can be NULL
aTypeinterpolation type
Returns
The interpolated response; on error return 0. (1. for aType == MUSE_FLUX_TELLURIC).

This function uses binary search to linearly interpolate a response curve at the correct interval. The response table can be a filter (aType == MUSE_FLUX_RESP_FILTER), a flux response curve (MUSE_FLUX_RESP_FLUX), a standard star spectrum (MUSE_FLUX_RESP_STD_FLUX), an atmospheric extinction curve (MUSE_FLUX_RESP_EXTINCT), or a telluric correction (MUSE_FLUX_TELLURIC).

The table aResponse has to contain at least the column "lambda" (listing the wavelength in Angstroms). The other necessary columns depend on aType:

  • "throughput" (for filter curve, with the relative response for each wavelength),
  • "response" and "resperr" (for flux response curve, the response factor and its error, respectively),
  • "flux" and "fluxerr" (for standard star spectrum, the flux and its error, respectively),
  • "extinction" (for the extinction curve).
  • "ftelluric" and "ftellerr" (for the telluric correction factor and its error, respectively), All columns are expected to be of type CPL_TYPE_DOUBLE.
Exceptions
set CPL_ERROR_NULL_INPUT, return 0. or 1.the input filter is NULL
set CPL_ERROR_UNSUPPORTED_MODE, return 0. or 1.the type is unknown
propagate CPL error, return 0. or 1.the table has less than 1 rows
propagate CPL error, return 0. or 1.the table data could not be returned

Definition at line 338 of file muse_flux.c.

References MUSE_FLUX_RESP_EXTINCT, MUSE_FLUX_RESP_FILTER, MUSE_FLUX_RESP_FLUX, MUSE_FLUX_RESP_STD_FLUX, MUSE_FLUX_TELLURIC, muse_utils_fit_moffat_2d(), and muse_utils_iterate_fit_polynomial().

Referenced by muse_flux_calibrate(), muse_flux_compute_qc_zp(), muse_resampling_collapse_pixgrid(), and muse_utils_filter_fraction().

Variable Documentation

const muse_cpltable_def muse_flux_responsetable_def[]
Initial value:
= {
{ "lambda", CPL_TYPE_DOUBLE, "Angstrom", "%7.2f", "wavelength", CPL_TRUE },
{ "response", CPL_TYPE_DOUBLE,
"2.5*log10((count/s/Angstrom)/(erg/s/cm**2/Angstrom))", "%.4e",
"instrument response derived from standard star", CPL_TRUE },
{ "resperr", CPL_TYPE_DOUBLE,
"2.5*log10((count/s/Angstrom)/(erg/s/cm**2/Angstrom))", "%.4e",
"instrument response error derived from standard star", CPL_TRUE },
{ NULL, 0, NULL, NULL, NULL, CPL_FALSE }
}

MUSE response table definition.

A MUSE response table has the following columns:

  • 'lambda': the wavelength in Angstrom
  • "response": instrument response derived from standard star
  • "resperr": instrument response error derived from standard star

Definition at line 2190 of file muse_flux.c.

const muse_cpltable_def muse_flux_tellurictable_def[]
Initial value:
= {
{ "lambda", CPL_TYPE_DOUBLE, "Angstrom", "%7.2f", "wavelength", CPL_TRUE },
{ "ftelluric", CPL_TYPE_DOUBLE, "", "%.5f",
"the telluric correction factor, normalized to an airmass of 1", CPL_TRUE },
{ "ftellerr", CPL_TYPE_DOUBLE, "", "%.5f",
"the error of the telluric correction factor", CPL_TRUE },
{ NULL, 0, NULL, NULL, NULL, CPL_FALSE }
}

MUSE telluric correction table definition.

A MUSE telluric correction table has the following columns:

  • 'lambda': the wavelength in Angstrom
  • "ftelluric": the telluric correction factor, normalized to an airmass of 1
  • "ftellerr": the error of the telluric correction factor

Definition at line 2211 of file muse_flux.c.