Skip to content

Commit

Permalink
Import bokeh.palletes correctly, fixes #911 (#912)
Browse files Browse the repository at this point in the history
* Import bokeh.palletes correctly, fixes #911

* Move imports into test functions
  • Loading branch information
maxnoe authored and kosack committed Jan 3, 2019
1 parent 25b35cf commit 76f1c7e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
10 changes: 8 additions & 2 deletions ctapipe/visualization/bokeh.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@
import numpy as np
from bokeh.plotting import figure
from bokeh.events import Tap
from bokeh.models import (ColumnDataSource, TapTool, palettes, Span, ColorBar,
LinearColorMapper)
from bokeh import palettes
from bokeh.models import (
ColumnDataSource,
TapTool,
Span,
ColorBar,
LinearColorMapper,
)
from ctapipe.utils.rgbtohex import intensity_to_hex

PLOTARGS = dict(tools="", toolbar_location=None, outline_line_color='#595959')
Expand Down
17 changes: 15 additions & 2 deletions ctapipe/visualization/tests/test_bokeh.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import numpy as np
import pytest
from ctapipe.visualization.bokeh import CameraDisplay, WaveformDisplay, \
FastCameraDisplay, intensity_to_hex


def test_camera_display_create():
from ctapipe.visualization.bokeh import CameraDisplay
CameraDisplay()


def test_camera_geom(example_event):
from ctapipe.visualization.bokeh import CameraDisplay

t = list(example_event.r0.tels_with_data)[0]
geom = example_event.inst.subarray.tel[t].camera
c_display = CameraDisplay(geom)
Expand All @@ -24,6 +25,8 @@ def test_camera_geom(example_event):


def test_camera_image(example_event):
from ctapipe.visualization.bokeh import CameraDisplay, intensity_to_hex

t = list(example_event.r0.tels_with_data)[0]
geom = example_event.inst.subarray.tel[t].camera
n_pixels = geom.pix_x.value.size
Expand All @@ -47,6 +50,7 @@ def test_camera_image(example_event):


def test_camera_enable_pixel_picker(example_event):
from ctapipe.visualization.bokeh import CameraDisplay
t = list(example_event.r0.tels_with_data)[0]
geom = example_event.inst.subarray.tel[t].camera
n_pixels = geom.pix_x.value.size
Expand All @@ -61,6 +65,7 @@ def test_camera_enable_pixel_picker(example_event):


def test_fast_camera_display_create(example_event):
from ctapipe.visualization.bokeh import FastCameraDisplay
t = list(example_event.r0.tels_with_data)[0]
geom = example_event.inst.subarray.tel[t].camera

Expand All @@ -73,6 +78,8 @@ def test_fast_camera_display_create(example_event):


def test_fast_camera_image(example_event):
from ctapipe.visualization.bokeh import FastCameraDisplay, intensity_to_hex

t = list(example_event.r0.tels_with_data)[0]
geom = example_event.inst.subarray.tel[t].camera

Expand All @@ -91,10 +98,14 @@ def test_fast_camera_image(example_event):


def test_waveform_display_create():
from ctapipe.visualization.bokeh import WaveformDisplay

WaveformDisplay()


def test_waveform_values():
from ctapipe.visualization.bokeh import WaveformDisplay

wf = np.ones(30)
w_display = WaveformDisplay(wf)

Expand All @@ -109,6 +120,8 @@ def test_waveform_values():


def test_span():
from ctapipe.visualization.bokeh import WaveformDisplay

wf = np.ones(30)
w_display = WaveformDisplay(wf)
w_display.enable_time_picker()
Expand Down

0 comments on commit 76f1c7e

Please sign in to comment.