Skip to content

Commit

Permalink
Merge pull request #129 from lsst-camera-dh/LSSTTD-1606_superbias_sub…
Browse files Browse the repository at this point in the history
…traction_w_rowcol

superbias handling
  • Loading branch information
jchiang87 authored Jun 14, 2022
2 parents a7203f6 + 9b89c3c commit e23cb86
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 14 deletions.
19 changes: 11 additions & 8 deletions harnessed_jobs/bias_frame_BOT/v0/bias_frame_jh_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,24 @@ def bias_frame_jh_task(det_name):
det_name)
return None

bias_frame, pca_files = bias_frame_task(run, det_name, bias_files)
superbias_file, bias_model_components \
= bias_frame_task(run, det_name, bias_files)
bias_stability_files = sorted(bias_stability_files)

if not os.environ.get('LCATR_USE_PCA_BIAS_FIT', "True") == 'True':
pca_files = None
bias_model_components = None
if siteUtils.get_analysis_run('bias') == 'rowcol':
pca_files = 'rowcol'
print("pca_files:", pca_files)
bias_model_components = 'rowcol', superbias_file
print("bias_model_components:", bias_model_components)
bias_stability_task(run, det_name, bias_stability_files,
pca_files=pca_files)
bias_model_components=bias_model_components)

if pca_files is not None and pca_files != 'rowcol':
pca_corrected_superbias(run, det_name, bias_files, pca_files)
if (bias_model_components is not None and
bias_model_components[0] != 'rowcol'):
pca_corrected_superbias(run, det_name, bias_files,
bias_model_components)

return bias_frame
return superbias_file


if __name__ == '__main__':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def plt_savefig(filename):
bias_run = siteUtils.get_analysis_run('bias')
if bias_run is not None and bias_run.lower() == 'rowcol':
for key in bias_frames:
bias_frames[key] = 'rowcol'
bias_frames[key] = ('rowcol', bias_frames[key])

# Dark mosaic
dark_files = None
Expand Down
15 changes: 10 additions & 5 deletions python/bot_eo_analyses.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,14 @@ def bias_filename(run, det_name):
bias_run = siteUtils.get_analysis_run('bias')
if bias_run is not None and bias_run.lower() == 'rowcol':
# This will set the bias_frame option for all tasks to
# 'rowcol' and so the eotest.sensor.MaskedCCD code will use
# the parallel+serial overscan model for bias subtraction.
return 'rowcol'
# ('rowcol', superbias_file) and so the eotest.sensor.MaskedCCD
# code will use the parallel+serial overscan correction and
# superbias subtraction for bias correction.
superbias_file = make_bias_filename(run, det_name)
bias_frame = siteUtils.dependency_glob(
superbias_file, description='superbias file:')
bias_frame = bias_frame[0] if bias_frame else None
return 'rowcol', bias_frame
elif bias_run is None:
if use_pca_bias:
file_prefix = make_file_prefix(run, det_name)
Expand Down Expand Up @@ -690,7 +695,7 @@ def image_stats(image, nsigma=10):


def bias_stability_task(run, det_name, bias_files, nsigma=10,
pca_files=None, llc_size=200):
bias_model_components=None, llc_size=200):
"""Compute amp-wise bias stability time histories and serial profiles."""
raft, slot = det_name.split('_')
file_prefix = make_file_prefix(run, det_name)
Expand All @@ -708,7 +713,7 @@ def bias_stability_task(run, det_name, bias_files, nsigma=10,
key = f'TEMP{i}'
if key in hdus['REB_COND'].header:
temps[key] = hdus['REB_COND'].header[key]
ccd = sensorTest.MaskedCCD(bias_file, bias_frame=pca_files)
ccd = sensorTest.MaskedCCD(bias_file, bias_frame=bias_model_components)
for amp in ccd:
# Retrieve the per row overscan subtracted imaging section.
amp_image = ccd.unbiased_and_trimmed_image(amp)
Expand Down
3 changes: 3 additions & 0 deletions python/stage_bot_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ def get_isr_files(det_name, run):
if isinstance(bias_fn, str):
if os.path.isfile(bias_fn):
files.add(bias_fn)
elif isinstance(bias_fn, (tuple, list)) and bias_fn[0] == 'rowcol':
if bias_fn[1] is not None:
files.add(bias_fn[1])
else:
files = files.union(bias_fn)
except IndexError:
Expand Down

0 comments on commit e23cb86

Please sign in to comment.