Skip to content

Commit

Permalink
gwsumm: configured flake8 and addressed all issues
Browse files Browse the repository at this point in the history
  • Loading branch information
duncanmmacleod committed Mar 19, 2019
1 parent 458c552 commit 40db733
Show file tree
Hide file tree
Showing 49 changed files with 301 additions and 572 deletions.
332 changes: 0 additions & 332 deletions ez_setup.py

This file was deleted.

8 changes: 2 additions & 6 deletions gwsumm/archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def write_data_archive(outfile, channels=True, timeseries=True,
rows.append((
chan.ndsname,
chan.sample_rate.to('Hz').value if
chan.sample_rate is not None else 0,
chan.sample_rate is not None else 0,
str(getattr(chan, 'frametype', None)) or '',
str(chan.unit) if chan.unit else '',
))
Expand Down Expand Up @@ -158,7 +158,7 @@ def write_data_archive(outfile, channels=True, timeseries=True,
for key in globalv.TRIGGERS:
archive_table(globalv.TRIGGERS[key], key, group)

except: # if it fails for any reason, reinstate the backup
except Exception: # if it fails for any reason, reinstate the backup
if backup:
restore_backup(backup, outfile)
raise
Expand Down Expand Up @@ -236,10 +236,6 @@ def read_data_archive(sourcefile):

# -- segments ---------------------------

try:
group = h5file['segments']
except KeyError:
group = dict()
for name, dataset in h5file.get('segments', {}).items():
dqflag = DataQualityFlag.read(h5file, path=dataset.name,
format='hdf5')
Expand Down
9 changes: 5 additions & 4 deletions gwsumm/channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ def _new(channel, find_parent=True):
parts = re_channel.findall(name)

# match single raw channel for LIGO
if (len(parts) == 1 and
if (
len(parts) == 1 and
new.ifo in ('H1', 'L1') and
not re.search(r'\.[a-z]+\Z', name)
):
Expand Down Expand Up @@ -203,7 +204,7 @@ def get_channel(channel, find_parent=True, timeout=5):
# handle special characters in channel name
rename = name
for cchar in ['+', '*', '^', '|']:
rename = rename.replace(cchar, '\%s' % cchar)
rename = rename.replace(cchar, r'\%s' % cchar)
found = globalv.CHANNELS.sieve(name=rename, exact_match=True)
# match normal channel
else:
Expand Down Expand Up @@ -279,9 +280,9 @@ def update_channel_params():
c.type = 's-trend'

# update sample_rate based on trend type
if c.type is 'm-trend' and c.sample_rate is None:
if c.type == 'm-trend' and c.sample_rate is None:
c.sample_rate = 1/60.
elif c.type is 's-trend' and c.sample_rate is None:
elif c.type == 's-trend' and c.sample_rate is None:
c.sample_rate = 1.
return

Expand Down
Loading

0 comments on commit 40db733

Please sign in to comment.