Skip to content

Commit

Permalink
Compatibility update for scaling of raw signals
Browse files Browse the repository at this point in the history
Needed for compatibility with NeuralEnsemble/ephyviewer#56
  • Loading branch information
jpgill86 committed Jul 2, 2019
1 parent 0337797 commit 959d7ca
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions neurotic/gui/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,13 @@ def create_ephyviewer_window(self, theme='light', support_increased_line_width=F
assert units_ratio.dimensionality.string == 'dimensionless', f"Channel \"{p['channel']}\" has units {sig_units} and cannot be converted to {p['units']}"
ylim_span = np.ptp(p['ylim'] * units_ratio.magnitude)
ylim_center = np.mean(p['ylim'] * units_ratio.magnitude)
trace_view.by_channel_params['ch{}'.format(i), 'gain'] = 1/ylim_span # rescale [ymin,ymax] across a unit
trace_view.by_channel_params['ch{}'.format(i), 'offset'] = -i - ylim_center/ylim_span # center [ymin,ymax] within the unit
if self.lazy:
# first rescale to real units
trace_view.by_channel_params['ch{}'.format(i), 'gain'] = trace_view.source.get_gains()[i]
trace_view.by_channel_params['ch{}'.format(i), 'offset'] = trace_view.source.get_offsets()[i]
trace_view.by_channel_params['ch{}'.format(i), 'gain'] *= 1/ylim_span # rescale [ymin,ymax] across a unit
trace_view.by_channel_params['ch{}'.format(i), 'offset'] *= 1/ylim_span # important if offset is not zero
trace_view.by_channel_params['ch{}'.format(i), 'offset'] += -i - ylim_center/ylim_span # center [ymin,ymax] within the unit

########################################################################
# TRACES OF RAUC
Expand Down

0 comments on commit 959d7ca

Please sign in to comment.