Skip to content
Snippets Groups Projects
Commit a7fcf7e2 authored by Paul McCarthy's avatar Paul McCarthy
Browse files

Bug fix to contrast vector normalisation - sum of squares, not squared

sum. 'Current time course' settings only shown if current time course is
being shown. Other little changes.
parent b9715c92
No related branches found
No related tags found
No related merge requests found
...@@ -210,7 +210,7 @@ class FEATImage(fslimage.Image): ...@@ -210,7 +210,7 @@ class FEATImage(fslimage.Image):
if not fullmodel: if not fullmodel:
contrast = np.array(contrast) contrast = np.array(contrast)
contrast /= np.sqrt(contrast.sum() ** 2) contrast /= np.sqrt((contrast ** 2).sum())
x, y, z = xyz x, y, z = xyz
numEVs = self.numEVs() numEVs = self.numEVs()
......
...@@ -30,11 +30,6 @@ class TimeSeriesControlPanel(fslpanel.FSLViewPanel): ...@@ -30,11 +30,6 @@ class TimeSeriesControlPanel(fslpanel.FSLViewPanel):
tsProps = ['demean', tsProps = ['demean',
'usePixdim', 'usePixdim',
'showCurrent'] 'showCurrent']
curProps = ['currentColour',
'currentAlpha',
'currentLineWidth',
'currentLineStyle']
plotProps = ['xLogScale', plotProps = ['xLogScale',
'yLogScale', 'yLogScale',
'smooth', 'smooth',
...@@ -48,22 +43,6 @@ class TimeSeriesControlPanel(fslpanel.FSLViewPanel): ...@@ -48,22 +43,6 @@ class TimeSeriesControlPanel(fslpanel.FSLViewPanel):
props.makeWidget(self.__widgets, tsPanel, prop), props.makeWidget(self.__widgets, tsPanel, prop),
displayName=strings.properties[tsPanel, prop]) displayName=strings.properties[tsPanel, prop])
self.__widgets.AddGroup('currentSettings',
strings.labels[self, 'currentSettings'])
# TODO Hide these when tsPanel.showCurrent is false
for prop in curProps:
if prop == 'currentAlpha':
kwargs = {'showLimits' : False, 'spin' : False}
else:
kwargs = {}
self.__widgets.AddWidget(
props.makeWidget(self.__widgets, tsPanel, prop, **kwargs),
displayName=strings.properties[tsPanel, prop],
groupName='currentSettings')
self.__widgets.AddGroup( self.__widgets.AddGroup(
'plotSettings', 'plotSettings',
strings.labels[tsPanel, 'plotSettings']) strings.labels[tsPanel, 'plotSettings'])
...@@ -115,6 +94,12 @@ class TimeSeriesControlPanel(fslpanel.FSLViewPanel): ...@@ -115,6 +94,12 @@ class TimeSeriesControlPanel(fslpanel.FSLViewPanel):
self._name, self._name,
self.__selectedOverlayChanged) self.__selectedOverlayChanged)
tsPanel.addListener('showCurrent',
self._name,
self.__showCurrentChanged)
self.__showCurrentChanged()
# This attribute keeps track of the currently # This attribute keeps track of the currently
# selected overlay, but only if said overlay # selected overlay, but only if said overlay
# is a FEATImage. # is a FEATImage.
...@@ -131,6 +116,44 @@ class TimeSeriesControlPanel(fslpanel.FSLViewPanel): ...@@ -131,6 +116,44 @@ class TimeSeriesControlPanel(fslpanel.FSLViewPanel):
display.removeListener('name', self._name) display.removeListener('name', self._name)
def __showCurrentChanged(self, *a):
widgets = self.__widgets
tsPanel = self.__tsPanel
showCurrent = tsPanel.showCurrent
areShown = widgets.HasGroup('currentSettings')
if (not showCurrent) and areShown:
widgets.RemoveGroup('currentSettings')
elif showCurrent and (not areShown):
self.__widgets.AddGroup('currentSettings',
strings.labels[self, 'currentSettings'])
colour = props.makeWidget(widgets, tsPanel, 'currentColour')
alpha = props.makeWidget(widgets, tsPanel, 'currentAlpha',
showLimits=False, spin=False)
lineWidth = props.makeWidget(widgets, tsPanel, 'currentLineWidth')
lineStyle = props.makeWidget(widgets, tsPanel, 'currentLineStyle')
self.__widgets.AddWidget(
colour,
displayName=strings.properties[tsPanel, 'currentColour'],
groupName='currentSettings')
self.__widgets.AddWidget(
alpha,
displayName=strings.properties[tsPanel, 'currentAlpha'],
groupName='currentSettings')
self.__widgets.AddWidget(
lineWidth,
displayName=strings.properties[tsPanel, 'currentLineWidth'],
groupName='currentSettings')
self.__widgets.AddWidget(
lineStyle,
displayName=strings.properties[tsPanel, 'currentLineStyle'],
groupName='currentSettings')
def __selectedOverlayNameChanged(self, *a): def __selectedOverlayNameChanged(self, *a):
display = self._displayCtx.getDisplay(self.__selectedOverlay) display = self._displayCtx.getDisplay(self.__selectedOverlay)
self.__widgets.RenameGroup( self.__widgets.RenameGroup(
......
...@@ -29,6 +29,7 @@ import fsl.utils.transform as transform ...@@ -29,6 +29,7 @@ import fsl.utils.transform as transform
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
class TimeSeries(plotpanel.DataSeries): class TimeSeries(plotpanel.DataSeries):
...@@ -198,7 +199,7 @@ class FEATTimeSeries(TimeSeries): ...@@ -198,7 +199,7 @@ class FEATTimeSeries(TimeSeries):
self.overlay, self.overlay,
self.coords) self.coords)
pets.colour = (1, 0, 0) pets.colour = (0.7, 0, 0)
pets.alpha = self.alpha pets.alpha = self.alpha
pets.label = self.label pets.label = self.label
pets.lineWidth = self.lineWidth pets.lineWidth = self.lineWidth
...@@ -322,7 +323,6 @@ class TimeSeriesPanel(plotpanel.PlotPanel): ...@@ -322,7 +323,6 @@ class TimeSeriesPanel(plotpanel.PlotPanel):
self.addListener('usePixdim', self._name, self.draw) self.addListener('usePixdim', self._name, self.draw)
self.addListener('showCurrent', self._name, self.draw) self.addListener('showCurrent', self._name, self.draw)
csc = self.__currentSettingsChanged csc = self.__currentSettingsChanged
self.addListener('currentColour', self._name, csc) self.addListener('currentColour', self._name, csc)
self.addListener('currentAlpha', self._name, csc) self.addListener('currentAlpha', self._name, csc)
...@@ -344,7 +344,12 @@ class TimeSeriesPanel(plotpanel.PlotPanel): ...@@ -344,7 +344,12 @@ class TimeSeriesPanel(plotpanel.PlotPanel):
tss.extend(self.__currentTs.getModelTimeSeries()) tss.extend(self.__currentTs.getModelTimeSeries())
for ts in tss: for ts in tss:
ts.colour = self.currentColour
# Don't change the colour for associated
# time courses (e.g. model fits)
if ts is self.__currentTs:
ts.colour = self.currentColour
ts.alpha = self.currentAlpha ts.alpha = self.currentAlpha
ts.lineWidth = self.currentLineWidth ts.lineWidth = self.currentLineWidth
ts.lineStyle = self.currentLineStyle ts.lineStyle = self.currentLineStyle
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment