Skip to content

Commit

Permalink
Update test
Browse files Browse the repository at this point in the history
  • Loading branch information
WenzDaniel committed Jan 15, 2024
1 parent 01b54d8 commit 2bef632
Showing 1 changed file with 25 additions and 24 deletions.
49 changes: 25 additions & 24 deletions tests/test_mini_analyses.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,31 +322,32 @@ def test_bokeh_selector(self):
from straxen.analyses.bokeh_waveform_plot import DataSelectionHist

p = self.st.get_array(nt_test_run_id, "peak_basics", seconds_range=(0, 10))
ds = DataSelectionHist("ds")
fig = ds.histogram2d(
p,
p["area"],
p["area"],
bins=10,
hist_range=((0, 200), (0, 2000)),
log_color_scale=True,
clim=(10, None),
undeflow_color="white",
)

import bokeh.plotting as bklt
with self.assertRaises(NotImplementedError):
ds = DataSelectionHist("ds")
fig = ds.histogram2d(
p,
p["area"],
p["area"],
bins=10,
hist_range=((0, 200), (0, 2000)),
log_color_scale=True,
clim=(10, None),
undeflow_color="white",
)

save_as = "test_data_selector.html"
bklt.save(fig, save_as)
self.assertTrue(os.path.exists(save_as))
os.remove(save_as)
self.assertFalse(os.path.exists(save_as))
# Also test if we can write it to the wiki
straxen.bokeh_to_wiki(fig)
straxen.bokeh_to_wiki(fig, save_as)
self.assertTrue(os.path.exists(save_as))
os.remove(save_as)
self.assertFalse(os.path.exists(save_as))
import bokeh.plotting as bklt

save_as = "test_data_selector.html"
bklt.save(fig, save_as)
self.assertTrue(os.path.exists(save_as))
os.remove(save_as)
self.assertFalse(os.path.exists(save_as))
# Also test if we can write it to the wiki
straxen.bokeh_to_wiki(fig)
straxen.bokeh_to_wiki(fig, save_as)
self.assertTrue(os.path.exists(save_as))
os.remove(save_as)
self.assertFalse(os.path.exists(save_as))

def test_nt_daq_plot(self):
"""Make an nt DAQ plot."""
Expand Down

0 comments on commit 2bef632

Please sign in to comment.