-
Notifications
You must be signed in to change notification settings - Fork 52
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
[WIP] Make all plots with time end at stop #752
Closed
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
63649ef
ENH: Add time range to different plots
aritrasinha108 c81fe2f
set_tstop_oct25
tianqi-cheng bc9ea72
Update hnn_core/viz.py
tianqi-cheng 1981892
update_nov1
tianqi-cheng fdc6335
Update hnn_core/viz.py
tianqi-cheng 89042b7
add deprecation cycle tmin/tmax
katduecker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,6 @@ | |
|
||
from .viz import plot_dipole, plot_psd, plot_tfr_morlet | ||
|
||
|
||
def simulate_dipole(net, tstop, dt=0.025, n_trials=None, record_vsec=False, | ||
record_isec=False, postproc=False): | ||
"""Simulate a dipole given the experiment parameters. | ||
|
@@ -106,25 +105,20 @@ def simulate_dipole(net, tstop, dt=0.025, n_trials=None, record_vsec=False, | |
return dpls | ||
|
||
|
||
def _read_dipole_txt(fname, extension='.txt'): | ||
def _read_dipole_txt(fname): | ||
"""Read dipole values from a txt file and create a Dipole instance. | ||
|
||
Parameters | ||
---------- | ||
fname : str or io.StringIO | ||
Full path to the input file (.txt or .csv) or | ||
Content of file in memory as a StringIO | ||
fname : str | ||
Full path to the input file (.txt) | ||
|
||
Returns | ||
------- | ||
dpl : Dipole | ||
The instance of Dipole class | ||
""" | ||
if extension == '.csv': | ||
# read from a csv file ignoring the headers | ||
dpl_data = np.genfromtxt(fname, delimiter=',', | ||
skip_header=1, dtype=float) | ||
else: | ||
dpl_data = np.loadtxt(fname, dtype=float) | ||
dpl_data = np.loadtxt(fname, dtype=float) | ||
ncols = dpl_data.shape[1] | ||
if ncols not in (2, 4): | ||
raise ValueError( | ||
|
@@ -179,6 +173,10 @@ def read_dipole(fname): | |
The instance of Dipole class | ||
""" | ||
|
||
# For supporting tests in test_gui.py | ||
if isinstance(fname, StringIO): | ||
return _read_dipole_txt(fname) | ||
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. you will want to copy the |
||
|
||
fname = str(fname) | ||
if not os.path.exists(fname): | ||
raise FileNotFoundError('File not found at path %s.' % (fname,)) | ||
|
@@ -474,10 +472,12 @@ def plot(self, tmin=None, tmax=None, layer='agg', decim=None, ax=None, | |
|
||
Parameters | ||
---------- | ||
tmin : float or None | ||
Start time of plot (in ms). If None, plot entire simulation. | ||
tmax : float or None | ||
End time of plot (in ms). If None, plot entire simulation. | ||
tmin : float | None [deprecated] | ||
Start time of plot in milliseconds. | ||
If None, plot entire simulation. | ||
tmax : float | None [deprecated] | ||
End time of plot in milliseconds. | ||
If None, plot entire simulation. | ||
layer : str | ||
The layer to plot. Can be one of 'agg', 'L2', and 'L5' | ||
decimate : int | ||
|
@@ -489,11 +489,18 @@ def plot(self, tmin=None, tmax=None, layer='agg', decim=None, ax=None, | |
show : bool | ||
If True, show the figure | ||
|
||
(tmin and tmax are deprecated) | ||
tmin : float or None | ||
Start time of plot (in ms). If None, plot entire simulation. | ||
tmax : float or None | ||
End time of plot (in ms). If None, plot entire simulation. | ||
|
||
Returns | ||
------- | ||
fig : instance of plt.fig | ||
The matplotlib figure handle. | ||
""" | ||
|
||
return plot_dipole(self, tmin=tmin, tmax=tmax, ax=ax, layer=layer, | ||
decim=decim, color=color, show=show) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@katduecker here is the problem! Since the time you had copied
dipole.py
to your desktop the master branch has changed. Therefore these modifications are undoing the latest commits to the master branch.I would reccomend copying this function exactly as it's written on the current master branch and replacing it in your code. That way the only changes that show up in the diff are related to the
tstop
PR.If done correctly you will no longer see
_read_dipole_txt()
show up in the files changed.