Skip to content

Commit

Permalink
Merge pull request #56 from lsst-camera-dh/LSSTTD-1469_access_to_nlc_…
Browse files Browse the repository at this point in the history
…spline_interpolation_params

provide interface to set nonlinearity correction spline interpolation parameters
  • Loading branch information
jchiang87 authored Jan 18, 2020
2 parents 6c9e0b7 + 8ecadf0 commit 6e285a1
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions python/bot_eo_analyses.py
Original file line number Diff line number Diff line change
Expand Up @@ -837,15 +837,21 @@ def repackage_summary_files():
repackager.write('{}_eotest_results.fits'.format(file_prefix))


def get_analysis_types(bot_eo_config_file=None):
""""Get the analysis types to be performed from the BOT-level EO config."""
def get_bot_eo_config(bot_eo_config_file=None):
"""Get the ConfigParser object from the BOT EO configuration file."""
bot_eo_config_file = siteUtils.get_bot_eo_config_file(bot_eo_config_file)

# Read in the analyses to be performed from the config file.
cp = configparser.ConfigParser(allow_no_value=True,
inline_comment_prefixes=("#", ))
cp.optionxform = str # allow for case-sensitive keys
cp.read(bot_eo_config_file)
return cp


def get_analysis_types(bot_eo_config_file=None):
""""Get the analysis types to be performed from the BOT-level EO config."""
cp = get_bot_eo_config(bot_eo_config_file)

analysis_types = []
if 'ANALYZE' not in cp:
Expand All @@ -856,7 +862,7 @@ def get_analysis_types(bot_eo_config_file=None):
return analysis_types


def get_nlc_func(det_name):
def get_nlc_func(det_name, bot_eo_config_file=None):
"""
Return the nonlinearity correction function for the specified
detector.
Expand All @@ -869,8 +875,16 @@ def get_nlc_func(det_name):
print(f'{file_prefix}_nlc.fits not found:', eobj)
return None

cp = get_bot_eo_config(bot_eo_config_file)
if 'NLC_PARAMS' in cp:
nlc_params = {k: siteUtils.cast(v) for k, v in cp['NLC_PARAMS'].items()}
else:
nlc_params = dict()

try:
nlc = sensorTest.NonlinearityCorrection.create_from_fits_file(nlc_file)
nlc = sensorTest.NonlinearityCorrection.create_from_fits_file(
nlc_file, **nlc_params)

except ValueError as eobj:
print(f'Error creating nlc from {nlc_file}:', eobj)
nlc = None
Expand Down

0 comments on commit 6e285a1

Please sign in to comment.