Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed a few issues discovered in testing on python3 #260

Merged
merged 3 commits into from
Apr 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions gwsumm/archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,9 @@ def archive_table(table, key, parent):
the h5py group in which to add this dataset

"""
# copy table so we can modify meta without impacting anything
table = table.copy(copy_data=False)

if len(table) == 0:
warnings.warn("%r table is empty and will not be archived" % key)
return
Expand Down
15 changes: 9 additions & 6 deletions gwsumm/tabs/etg.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,20 +187,23 @@ def from_ini(cls, config, section, **kwargs):
]
# override from config
if config.has_option(section, 'loudest-columns'):
new.loudest['columns'] = map(
new.loudest['columns'] = list(map(
lambda s: re_quote.sub('', s),
config.get(section, 'loudest-columns').split(','))
config.get(section, 'loudest-columns').split(',')
))
if config.has_option(section, 'loudest-labels'):
new.loudest['labels'] = map(
new.loudest['labels'] = list(map(
lambda s: re_quote.sub('', s),
config.get(section, 'loudest-labels').split(','))
config.get(section, 'loudest-labels').split(',')
))
else:
new.loudest['labels'] = [' '.join(map(str.title, s.split('_')))
for s in new.loudest['columns']]
if config.has_option(section, 'loudest-rank'):
new.loudest['rank'] = map(
new.loudest['rank'] = list(map(
lambda c: re_quote.sub('', c),
config.get(section, 'loudest-rank').split(','))
config.get(section, 'loudest-rank').split(',')
))
if config.has_option(section, 'loudest-dt'):
new.loudest['dt'] = config.getfloat(section, 'loudest-dt')
else:
Expand Down
11 changes: 7 additions & 4 deletions gwsumm/tabs/sei.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,12 @@

import numpy

from MarkupPy import markup

from gwpy.time import Time

from gwdetchar.io import html as gwhtml

from .registry import (get_tab, register_tab)
from .. import (globalv, html)
from ..config import GWSummConfigParser
Expand Down Expand Up @@ -297,7 +301,7 @@ def write_state_html(self, state):
totals[i][j] = c
# add row total
totals[i][-1] = totals[i].sum()
page.th(totals[i][-1])
page.th(str(totals[i][-1]))
page.tr.close()
page.tbody.close()

Expand All @@ -306,8 +310,7 @@ def write_state_html(self, state):
page.tr(class_='header')
page.th('Totals')
for i in range(totals.shape[1]):
t = totals[:, i].sum()
page.th(t)
page.th(str(totals[:, i].sum()))
page.tr.close()
page.thead.close()
page.table.close()
Expand Down Expand Up @@ -381,7 +384,7 @@ def write_state_html(self, state):
rows[-1].append('<br>'.join(assoc))
else:
rows[-1].append('-')
page.add(str(html.table(
page.add(str(gwhtml.table(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch @duncanmmacleod, I don't know how I missed this one!

headers, rows,
caption=('List of %s watch-dog trips in interval [%d .. %d) - '
'trips are considered \'associated\' if they fall within '
Expand Down