Skip to content

Commit

Permalink
make superflat file specifically for divisadero tearing analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
jchiang87 committed Sep 17, 2020
1 parent 123ebdb commit 7469329
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
1 change: 1 addition & 0 deletions data/BOT_jh_glob_patterns.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ overscan = flat_*_flat?_*
brighter_fatter = flat_*_flat?_*
qe = lambda_flat_*
tearing = sflat_flat_*[LH]*
divisadero_tearing = sflat_flat_*L*
scan_mode = scan_*_*
persistence_bias = bot_persistence_bias_*
persistence_dark = bot_persistence_dark_*
26 changes: 21 additions & 5 deletions harnessed_jobs/tearing_BOT/v0/raft_divisidero_tearing.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,37 @@
"""
def raft_divisidero_tearing(raft_name):
"""JH version of divisidero tearing analysis of BOT data."""
from collections import defaultdict
import json
import matplotlib.pyplot as plt
import siteUtils
from lsst.eotest.sensor.cteTask import superflat
import lsst.eotest.raft as raftTest
from bot_eo_analyses import get_raft_files_by_slot
from bot_eo_analyses import glob_pattern, bias_filename

run = siteUtils.getRunNumber()

try:
sflat_files = get_raft_files_by_slot(raft_name, 'median_sflat.fits')
except FileNotFoundError:
pattern = glob_pattern('divisadero_tearing', f'{raft_name}_*')
acq_jobname = siteUtils.getProcessName('BOT_acq')
bot_data = siteUtils.dependency_glob(pattern, acq_jobname=acq_jobname)
if not bot_data:
return

sflat_files = defaultdict(list)
for item in bot_data:
slot = item.split('.')[0].split('_')[-1]
sflat_files[slot].append(item)

median_sflats = dict()
for slot, files in sflat_files.items():
det_name = '_'.join((raft_name, slot))
outfile = f'{det_name}_{run}_median_sflat.fits'
bias_frame = bias_filename(run, det_name)
median_sflats[slot] = superflat(files, outfile=outfile,
bias_frame=bias_frame)

max_divisidero_tearing \
= raftTest.ana_divisidero_tearing(sflat_files, raft_name, run)
= raftTest.ana_divisidero_tearing(median_sflats, raft_name, run)
plt.savefig(f'{raft_name}_{run}_divisidero.png')

with open(f'{raft_name}_{run}_max_divisidero.json', 'w') as fd:
Expand Down

0 comments on commit 7469329

Please sign in to comment.