Skip to content

Commit

Permalink
Merge pull request #97 from jpgill86/xratio-params
Browse files Browse the repository at this point in the history
Add xratio parameter to viewers for controlling vline position
  • Loading branch information
jpgill86 committed Feb 29, 2020
2 parents 2707a0b + ca1a374 commit 202fd71
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 15 deletions.
6 changes: 3 additions & 3 deletions ephyviewer/epochencoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

default_params = [
{'name': 'xsize', 'type': 'float', 'value': 3., 'step': 0.1},
{'name': 'xratio', 'type': 'float', 'value': 0.3, 'step': 0.1, 'limits': (0,1)},
{'name': 'background_color', 'type': 'color', 'value': 'k'},
{'name': 'vline_color', 'type': 'color', 'value': '#FFFFFFAA'},
{'name': 'label_fill_color', 'type': 'color', 'value': '#222222DD'},
Expand Down Expand Up @@ -70,8 +71,6 @@ def __init__(self, **kargs):

self.viewBox.doubleclicked.connect(self.show_params_controller)

self._xratio = 0.3

self.initialize_plot()

self.on_range_visibility_changed(None, refresh=False)
Expand Down Expand Up @@ -401,7 +400,8 @@ def get_settings(self):

def refresh(self):
xsize = self.params['xsize']
t_start, t_stop = self.t-xsize*self._xratio , self.t+xsize*(1-self._xratio)
xratio = self.params['xratio']
t_start, t_stop = self.t-xsize*xratio , self.t+xsize*(1-xratio)
self.request_data.emit(t_start, t_stop, [0])

def on_data_ready(self, t_start, t_stop, visibles, data):
Expand Down
6 changes: 3 additions & 3 deletions ephyviewer/epochviewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

default_params = [
{'name': 'xsize', 'type': 'float', 'value': 3., 'step': 0.1},
{'name': 'xratio', 'type': 'float', 'value': 0.3, 'step': 0.1, 'limits': (0,1)},
{'name': 'background_color', 'type': 'color', 'value': 'k'},
{'name': 'vline_color', 'type': 'color', 'value': '#FFFFFFAA'},
{'name': 'label_fill_color', 'type': 'color', 'value': '#222222DD'},
Expand Down Expand Up @@ -98,8 +99,6 @@ def __init__(self, **kargs):
self.viewBox.doubleclicked.connect(self.show_params_controller)
self.initialize_plot()

self._xratio = 0.3

self.thread = QT.QThread(parent=self)
self.datagrabber = DataGrabber(source=self.source)
self.datagrabber.moveToThread(self.thread)
Expand Down Expand Up @@ -134,7 +133,8 @@ def initialize_plot(self):

def refresh(self):
xsize = self.params['xsize']
t_start, t_stop = self.t-xsize*self._xratio , self.t+xsize*(1-self._xratio)
xratio = self.params['xratio']
t_start, t_stop = self.t-xsize*xratio , self.t+xsize*(1-xratio)
visibles, = np.nonzero(self.params_controller.visible_channels)
self.request_data.emit(t_start, t_stop, visibles)

Expand Down
6 changes: 3 additions & 3 deletions ephyviewer/spiketrainviewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

default_params = [
{'name': 'xsize', 'type': 'float', 'value': 3., 'step': 0.1},
{'name': 'xratio', 'type': 'float', 'value': 0.3, 'step': 0.1, 'limits': (0,1)},
{'name': 'scatter_size', 'type': 'float', 'value': 0.8, 'limits': (0,np.inf)},
{'name': 'background_color', 'type': 'color', 'value': 'k'},
{'name': 'vline_color', 'type': 'color', 'value': '#FFFFFFAA'},
Expand Down Expand Up @@ -79,8 +80,6 @@ def __init__(self, **kargs):

self.viewBox.doubleclicked.connect(self.show_params_controller)

self._xratio = 0.3

self.initialize_plot()


Expand Down Expand Up @@ -136,7 +135,8 @@ def initialize_plot(self):

def refresh(self):
xsize = self.params['xsize']
t_start, t_stop = self.t-xsize*self._xratio , self.t+xsize*(1-self._xratio)
xratio = self.params['xratio']
t_start, t_stop = self.t-xsize*xratio , self.t+xsize*(1-xratio)
visibles, = np.nonzero(self.params_controller.visible_channels)
self.request_data.emit(t_start, t_stop, visibles)

Expand Down
5 changes: 3 additions & 2 deletions ephyviewer/timefreqviewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

default_params = [
{'name': 'xsize', 'type': 'float', 'value': 3., 'step': 0.1},
{'name': 'xratio', 'type': 'float', 'value': 0.3, 'step': 0.1, 'limits': (0,1)},
{'name': 'nb_column', 'type': 'int', 'value': 4},
{'name': 'background_color', 'type': 'color', 'value': 'k'},
{'name': 'vline_color', 'type': 'color', 'value': '#FFFFFFAA'},
Expand Down Expand Up @@ -262,7 +263,6 @@ def __init__(self, **kargs):
self.initialize_time_freq()


self._xratio = 0.3
self.last_wt_maps = {}

self.threads = []
Expand Down Expand Up @@ -395,7 +395,8 @@ def refresh(self):
visible_channels = self.params_controller.visible_channels

xsize = self.params['xsize']
t_start, t_stop = self.t-xsize*self._xratio , self.t+xsize*(1-self._xratio)
xratio = self.params['xratio']
t_start, t_stop = self.t-xsize*xratio , self.t+xsize*(1-xratio)

for c in range(self.source.nb_channel):
if visible_channels[c]:
Expand Down
9 changes: 5 additions & 4 deletions ephyviewer/traceviewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

default_params = [
{'name': 'xsize', 'type': 'float', 'value': 3., 'step': 0.1},
{'name': 'xratio', 'type': 'float', 'value': 0.3, 'step': 0.1, 'limits': (0,1)},
{'name': 'ylim_max', 'type': 'float', 'value': 10.},
{'name': 'ylim_min', 'type': 'float', 'value': -10.},
{'name': 'scatter_size', 'type': 'float', 'value': 10., 'limits': (0,np.inf)},
Expand Down Expand Up @@ -430,8 +431,6 @@ def __init__(self, useOpenGL=None, **kargs):

self.initialize_plot()

self._xratio = 0.3

self.last_sigs_chunk = None

self.thread = QT.QThread(parent=self)
Expand Down Expand Up @@ -534,7 +533,8 @@ def auto_scale(self):
#~ print('auto_scale', self.last_sigs_chunk)
if self.last_sigs_chunk is None:
xsize = self.params['xsize']
t_start, t_stop = self.t-xsize*self._xratio , self.t+xsize*(1-self._xratio)
xratio = self.params['xratio']
t_start, t_stop = self.t-xsize*xratio , self.t+xsize*(1-xratio)
visibles, = np.nonzero(self.params_controller.visible_channels)
total_gains = self.params_controller.total_gains
total_offsets = self.params_controller.total_offsets
Expand All @@ -548,7 +548,8 @@ def auto_scale(self):
def refresh(self):
#~ print('TraceViewer.refresh', 't', self.t)
xsize = self.params['xsize']
t_start, t_stop = self.t-xsize*self._xratio , self.t+xsize*(1-self._xratio)
xratio = self.params['xratio']
t_start, t_stop = self.t-xsize*xratio , self.t+xsize*(1-xratio)
visibles, = np.nonzero(self.params_controller.visible_channels)
total_gains = self.params_controller.total_gains
total_offsets = self.params_controller.total_offsets
Expand Down

0 comments on commit 202fd71

Please sign in to comment.