-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
API: Use scalings #4595
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
API: Use scalings #4595
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -290,11 +290,12 @@ def transform(self, X): | |
|
||
def plot_patterns(self, info, components=None, ch_type=None, layout=None, | ||
vmin=None, vmax=None, cmap='RdBu_r', sensors=True, | ||
colorbar=True, scale=None, unit='a.u.', res=64, size=1, | ||
cbar_fmt='%3.1f', name_format='CSP%01d', show=True, | ||
show_names=False, title=None, mask=None, | ||
colorbar=True, scalings=None, unit='a.u.', res=64, | ||
size=1, cbar_fmt='%3.1f', name_format='CSP%01d', | ||
show=True, show_names=False, title=None, mask=None, | ||
mask_params=None, outlines='head', contours=6, | ||
image_interp='bilinear', average=None, head_pos=None): | ||
image_interp='bilinear', average=None, head_pos=None, | ||
scale=None): | ||
"""Plot topographic patterns of components. | ||
|
||
The patterns explain how the measured data was generated from the | ||
|
@@ -346,9 +347,9 @@ def plot_patterns(self, info, components=None, ch_type=None, layout=None, | |
a circle will be used (via .add_artist). Defaults to True. | ||
colorbar : bool | ||
Plot a colorbar. | ||
scale : dict | float | None | ||
Scale the data for plotting. If None, defaults to 1e6 for eeg, 1e13 | ||
for grad and 1e15 for mag. | ||
scalings : dict | float | None | ||
The scalings of the channel types to be applied for plotting. | ||
If None, defaults to ``dict(eeg=1e6, grad=1e13, mag=1e15)``. | ||
unit : dict | str | None | ||
The unit of the channel type used for colorbar label. If | ||
scale is None the unit is automatically determined. | ||
|
@@ -426,25 +427,23 @@ def plot_patterns(self, info, components=None, ch_type=None, layout=None, | |
# create an evoked | ||
patterns = EvokedArray(self.patterns_.T, info, tmin=0) | ||
# the call plot_topomap | ||
return patterns.plot_topomap(times=components, ch_type=ch_type, | ||
layout=layout, vmin=vmin, vmax=vmax, | ||
cmap=cmap, colorbar=colorbar, res=res, | ||
cbar_fmt=cbar_fmt, sensors=sensors, | ||
scale=scale, unit=unit, scale_time=1, | ||
time_format=name_format, size=size, | ||
show_names=show_names, title=title, | ||
mask_params=mask_params, mask=mask, | ||
outlines=outlines, contours=contours, | ||
image_interp=image_interp, show=show, | ||
average=average, head_pos=head_pos) | ||
return patterns.plot_topomap( | ||
times=components, ch_type=ch_type, layout=layout, | ||
vmin=vmin, vmax=vmax, cmap=cmap, colorbar=colorbar, res=res, | ||
cbar_fmt=cbar_fmt, sensors=sensors, | ||
scalings=scalings, unit=unit, scaling_time=1, | ||
time_format=name_format, size=size, show_names=show_names, | ||
title=title, mask_params=mask_params, mask=mask, outlines=outlines, | ||
contours=contours, image_interp=image_interp, show=show, | ||
average=average, head_pos=head_pos, scale=scale) | ||
|
||
def plot_filters(self, info, components=None, ch_type=None, layout=None, | ||
vmin=None, vmax=None, cmap='RdBu_r', sensors=True, | ||
colorbar=True, scale=None, unit='a.u.', res=64, size=1, | ||
colorbar=True, scalings=None, unit='a.u.', res=64, size=1, | ||
cbar_fmt='%3.1f', name_format='CSP%01d', show=True, | ||
show_names=False, title=None, mask=None, mask_params=None, | ||
outlines='head', contours=6, image_interp='bilinear', | ||
average=None, head_pos=None): | ||
average=None, head_pos=None, scale=None): | ||
"""Plot topographic filters of components. | ||
|
||
The filters are used to extract discriminant neural sources from | ||
|
@@ -496,9 +495,9 @@ def plot_filters(self, info, components=None, ch_type=None, layout=None, | |
a circle will be used (via .add_artist). Defaults to True. | ||
colorbar : bool | ||
Plot a colorbar. | ||
scale : dict | float | None | ||
Scale the data for plotting. If None, defaults to 1e6 for eeg, 1e13 | ||
for grad and 1e15 for mag. | ||
scalings : dict | float | None | ||
The scalings of the channel types to be applied for plotting. | ||
If None, defaults to ``dict(eeg=1e6, grad=1e13, mag=1e15)``. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't we need to add a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No we usually don't list deprecated params |
||
unit : dict | str | None | ||
The unit of the channel type used for colorbar label. If | ||
scale is None the unit is automatically determined. | ||
|
@@ -576,17 +575,15 @@ def plot_filters(self, info, components=None, ch_type=None, layout=None, | |
# create an evoked | ||
filters = EvokedArray(self.filters_, info, tmin=0) | ||
# the call plot_topomap | ||
return filters.plot_topomap(times=components, ch_type=ch_type, | ||
layout=layout, vmin=vmin, vmax=vmax, | ||
cmap=cmap, colorbar=colorbar, res=res, | ||
cbar_fmt=cbar_fmt, sensors=sensors, | ||
scale=scale, unit=unit, scale_time=1, | ||
time_format=name_format, size=size, | ||
show_names=show_names, title=title, | ||
mask_params=mask_params, mask=mask, | ||
outlines=outlines, contours=contours, | ||
image_interp=image_interp, show=show, | ||
average=average, head_pos=head_pos) | ||
return filters.plot_topomap( | ||
times=components, ch_type=ch_type, layout=layout, vmin=vmin, | ||
vmax=vmax, cmap=cmap, colorbar=colorbar, res=res, | ||
cbar_fmt=cbar_fmt, sensors=sensors, scalings=scalings, unit=unit, | ||
scaling_time=1, time_format=name_format, size=size, | ||
show_names=show_names, title=title, mask_params=mask_params, | ||
mask=mask, outlines=outlines, contours=contours, | ||
image_interp=image_interp, show=show, average=average, | ||
head_pos=head_pos, scale=scale) | ||
|
||
|
||
def _ajd_pham(X, eps=1e-6, max_iter=15): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -309,10 +309,10 @@ def test_stc_mpl(): | |
fig = stc.plot(subjects_dir=subjects_dir, time_unit='ms', views='dor', | ||
hemi='lh', smoothing_steps=2, subject='sample', | ||
backend='matplotlib', spacing='ico2', time_viewer=True) | ||
time_viewer = fig.time_viewer | ||
_fake_click(time_viewer, time_viewer.axes[0], (0.5, 0.5)) # change time | ||
time_viewer.canvas.key_press_event('ctrl+right') | ||
time_viewer.canvas.key_press_event('left') | ||
time_viewer = fig.time_viewer | ||
_fake_click(time_viewer, time_viewer.axes[0], (0.5, 0.5)) # change t | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lol did you do this just to avoid the pep monster? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes :) |
||
time_viewer.canvas.key_press_event('ctrl+right') | ||
time_viewer.canvas.key_press_event('left') | ||
assert_raises(ValueError, stc.plot, subjects_dir=subjects_dir, | ||
hemi='both', subject='sample', backend='matplotlib') | ||
assert_raises(ValueError, stc.plot, subjects_dir=subjects_dir, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can scalings also be 'auto' here, or is that just for the raw plot?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so, I think it's unique to
raw
currently