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

Add past_fraction metadata param for controlling the vline position #220

Merged
merged 1 commit into from
Mar 1, 2020
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
14 changes: 14 additions & 0 deletions docs/metadata.rst
Original file line number Diff line number Diff line change
Expand Up @@ -403,9 +403,23 @@ ranges, except for channels that match these patterns: "Analog Input #*" and
"Clock". Channels with these names can be plotted if given explicitly by
``plots``.

.. _config-metadata-time-range:

Time Range
----------

The amount of time initially visible can be specified in seconds with
``t_width``.

The position of the vertical line, which represents the current time in each
plot, can be specified as a fraction of the plot range with ``past_fraction``.
A value of 0 places the vertical line at the left edge of each plot;
consequently, everything plotted is "in the future", occurring after the
current time. A value of 1 places the vertical line at the right edge of each
plot; consequently, everything plotted is "in the past", coming before the
current time. The default value of 0.3 causes the first 30% of the plot range
to display "the past" and the last 70% to display "the future".

.. _config-metadata-epoch-encoder:

Epoch Encoder Parameters
Expand Down
5 changes: 5 additions & 0 deletions neurotic/datasets/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,11 @@ def _defaults_for_key(key):
# amount of time in seconds to plot initially
't_width': 40,

# proportion of the plot range, between 0 and 1, to the left of the
# current time (in the "past"), indicated by the position of the
# vertical line
'past_fraction': 0.3,

# factor to subtract from each signal before rectification when
# calculating rectified area under the curve (RAUC)
# - can be None, 'mean', or 'median'
Expand Down
10 changes: 10 additions & 0 deletions neurotic/gui/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ def create_ephyviewer_window(self, theme='light', support_increased_line_width=F

win.add_view(trace_view)

trace_view.params['xratio'] = self.metadata.get('past_fraction', 0.3)
trace_view.params['auto_scale_factor'] = 0.02
trace_view.params['scatter_size'] = 5
trace_view.params['line_width'] = line_width
Expand Down Expand Up @@ -460,6 +461,7 @@ def create_ephyviewer_window(self, theme='light', support_increased_line_width=F
else:
win.add_view(trace_rauc_view)

trace_rauc_view.params['xratio'] = self.metadata.get('past_fraction', 0.3)
trace_rauc_view.params['line_width'] = line_width
trace_rauc_view.params['display_labels'] = True
trace_rauc_view.params['display_offset'] = True
Expand Down Expand Up @@ -499,6 +501,7 @@ def create_ephyviewer_window(self, theme='light', support_increased_line_width=F

freq_view = ephyviewer.TimeFreqViewer(source = trace_view.source, name = 'timefreqs')

freq_view.params['xratio'] = self.metadata.get('past_fraction', 0.3)
freq_view.params['scale_mode'] = 'by_channel'
freq_view.params['nb_column'] = 1
freq_view.params['colormap'] = 'gray'
Expand Down Expand Up @@ -549,6 +552,8 @@ def create_ephyviewer_window(self, theme='light', support_increased_line_width=F
# unit name may not have been found in the spike train list
pass

spike_train_view.params['xratio'] = self.metadata.get('past_fraction', 0.3)

########################################################################
# TRACES OF FIRING RATES

Expand All @@ -573,6 +578,7 @@ def create_ephyviewer_window(self, theme='light', support_increased_line_width=F
else:
win.add_view(trace_rates_view)

trace_rates_view.params['xratio'] = self.metadata.get('past_fraction', 0.3)
trace_rates_view.params['line_width'] = line_width
trace_rates_view.params['display_labels'] = True
trace_rates_view.params['display_offset'] = True
Expand Down Expand Up @@ -630,6 +636,8 @@ def create_ephyviewer_window(self, theme='light', support_increased_line_width=F
# unit burst name may not have been found in the epoch list
pass

epoch_view.params['xratio'] = self.metadata.get('past_fraction', 0.3)

########################################################################
# EPOCH ENCODER

Expand Down Expand Up @@ -669,6 +677,8 @@ def create_ephyviewer_window(self, theme='light', support_increased_line_width=F
epoch_encoder.params['label_fill_color'] = self.themes[theme]['label_fill_color']
# TODO add support for combo_cmap

epoch_encoder.params['xratio'] = self.metadata.get('past_fraction', 0.3)

########################################################################
# VIDEO

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# av # required but typically not installable via pip, try `conda install -c conda-forge av`
ephyviewer>=1.2.1
ephyviewer>=1.3.0
neo>=0.7.2
numpy
packaging
Expand Down