Skip to content

Commit

Permalink
Fix Data.calc_bg_cache with empty channels
Browse files Browse the repository at this point in the history
  • Loading branch information
tritemio committed Feb 28, 2018
1 parent a9442ad commit 9a5f601
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions fretbursts/burstlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -1837,6 +1837,14 @@ def calc_bg(self, fun, time_s=60, tail_min_us=500, F_bg=2,
BG_err_dol[sel] = [err_ch[sel] for err_ch in BG_err]
Th_us_dol[sel] = [th_ch[sel] for th_ch in Th_us]

# Fill Lim and Ph_p with zeros for empty channels
# This is needed for bg_calc_cache to be able to save data to disk
for i, (lim, ph_p) in enumerate(zip(Lim, Ph_p)):
if len(lim) == 0:
assert len(ph_p) == 0
Lim[i] = [(0, 0)] * nperiods
Ph_p[i] = [(0, 0)] * nperiods

self.add(bg=BG_dol, bg_err=BG_err_dol, bg_th_us=Th_us_dol,
Lim=Lim, Ph_p=Ph_p,
bg_fun=fun, bg_fun_name=fun.__name__,
Expand Down

0 comments on commit 9a5f601

Please sign in to comment.