soxspipe.commonutils.response_function¶
Given a standard star extracted spectrum, generate the instrument response function needed to flux calibrate science spectra
- Author:
Marco Landoni & David Young
- Date Created:
July 28, 2023
Module Contents¶
Classes¶
Given a standard star extracted spectrum, generate the instrument response function needed to flux calibrate science spectra |
API¶
- class soxspipe.commonutils.response_function.response_function(log, stdExtractionPath, recipeName, sofName, settings=False, qcTable=False, productsTable=False, startNightDate='', stdNotFlatExtractionPath='', orderJoins=None)[source][source]¶
Bases:
objectGiven a standard star extracted spectrum, generate the instrument response function needed to flux calibrate science spectra
Key Arguments: -
log– logger -settings– the settings dictionary -stdExtractionPath– fits binary table containing the extracted standard spectrum -recipeName– name of the recipe as it appears in the settings dictionary -settings– the pipeline settings -sofName– name of the originating SOF file -qcTable– the data frame to collect measured QC metrics -productsTable– the data frame to collect output products -startNightDate– YYYY-MM-DD date of the observation night. Default “” -stdNotFlatExtractionPath– fits binary table containing the extracted standard spectrum without flat correction. Default “”. -orderJoins– a list of tuples indicating the orders to be joined together in the response function fitting. Default None.Usage:
To setup your logger, settings and database connections, please use the
fundamentalspackage (see tutorial here <http://fundamentals.readthedocs.io/en/latest/#tutorial>_).To initiate a response_function object, use the following:
from soxspipe.commonutils import response_function response = response_function( log=log, settings=settings, recipeName=recipeName, sofName=sofName, stdExtractionPath=stdExtractionPath qcTable=qcTable, productsTable=productsTable, startNightDate=startNightDate stdNotFlatExtractionPath=stdNotFlatExtractionPath, orderJoins=orderJoins, ) qcTable, productsTable = response.get()
Initialization
- get()[source][source]¶
get the response_function object
Return: -
response_function– a set of polynomial coefficients
- plot_response_curve(stdExtWave, stdExtWaveNotFlat, stdExtFlux, binCentreWave, binCentreWaveOriginal, binIntegratedFlux, absToExtFluxRatio, responseFuncCoeffs, stdEfficiencyEstimate)[source][source]¶
generate a QC plot for the response curve
Key Arguments:
stdExtWave– the extracted standard star wavelengthstdExtFlux– the extracted standard star fluxstdExtWaveNotFlat– the extracted standard star wavelength (not flattened)binCentreWave– binned wavelengths after clipping (during fitting)binCentreWaveOriginal– binned wavelengthsbinIntegratedFlux– binned fluxabsToExtFluxRatio– the ratio of the absolute flux vs the extraction fluxresponseFuncCoeffs– the response function coefficientsstdEfficiencyEstimate– the estimated instrument efficiency
Return: -
plotFilePath– the path to the QC plot PDF
- write_response_function_to_file(responseFuncCoeffs, polyOrder)[source][source]¶
write out the fitted polynomial solution coefficients to file
Key Arguments:
responseFuncCoeffs– the response curve coefficientspolyOrder– the order of polynomial used to fit the curve
Return:
responseCurvePath– path to the saved file