Skip to content

Commit

Permalink
Avoid dangerous variable reuse
Browse files Browse the repository at this point in the history
  • Loading branch information
titodalcanton committed Apr 16, 2019
1 parent be07219 commit 43d4c88
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions pycbc/strain/strain.py
Original file line number Diff line number Diff line change
Expand Up @@ -1271,7 +1271,7 @@ def __init__(self, frame_src, channel_name, start_time,
# State channel
if state_channel is not None:
valid_mask = pycbc.frame.flag_names_to_bitmask(self.analyze_flags)
logging.info('State channel %s interpreted as mask %s = good',
logging.info('State channel %s interpreted as bitmask %s = good',
state_channel, bin(valid_mask))
self.state = pycbc.frame.StatusBuffer(
frame_src,
Expand All @@ -1283,25 +1283,21 @@ def __init__(self, frame_src, channel_name, start_time,

# low latency dq channel
if data_quality_channel is not None:
sb_kwargs = dict(max_buffer=max_buffer,
force_update_cache=force_update_cache,
increment_update_cache=increment_update_cache)
if len(self.data_quality_flags) == 1 \
and self.data_quality_flags[0] == 'veto_nonzero':
veto_nonzero = True
sb_kwargs['valid_on_zero'] = True
logging.info('DQ channel %s interpreted as zero = good',
data_quality_channel)
else:
veto_nonzero = False
valid_mask = pycbc.frame.flag_names_to_bitmask(
sb_kwargs['valid_mask'] = pycbc.frame.flag_names_to_bitmask(
self.data_quality_flags)
logging.info('DQ channel %s interpreted as mask %s = good',
logging.info('DQ channel %s interpreted as bitmask %s = good',
data_quality_channel, bin(valid_mask))
self.dq = pycbc.frame.StatusBuffer(
frame_src,
data_quality_channel, start_time,
max_buffer=max_buffer,
valid_mask=valid_mask,
force_update_cache=force_update_cache,
increment_update_cache=increment_update_cache,
valid_on_zero=veto_nonzero)
self.dq = pycbc.frame.StatusBuffer(frame_src, data_quality_channel,
start_time, **sb_kwargs)

self.highpass_frequency = highpass_frequency
self.highpass_reduction = highpass_reduction
Expand Down

0 comments on commit 43d4c88

Please sign in to comment.