Dear PyRates developers,
first off, I want to say that I really like PyRates for its versatility and simple usage- so thanks a lot for creating it!
That being said, I have been trying to reproduce findings from David and Friston (2003), but ran into trouble getting the expected results with the newest version of PyRates.
This Jupyter Notebook included with PyRates (Simulation 2: Jansen-Rit model sensitivity to changes in the synaptic timescales), appears to reproduce Fig. 4 from the paper quite well (as also stated in the PyRates paper), but when I try to run it with the current master (after adapting a few lines to make it execute without complaining - more on that below), it produces different output:
Figures
Output-Figure included in .ipynb-File |
Result when running with current master |
|
|
reproduces David and Friston (2003) Fig. 4 |
produces different data |
Necessary changes
The changes required to execute the notebook-code with the current version were limited to the following:
results, params = grid_search(circuit_template="model_templates.jansen_rit.simple_jansenrit.JRC",
param_grid=params, param_map=param_map,
inputs={"PC/RPO_e_pc/u": inp}, outputs={"v": "PC/OBS/V"},
- dt=dt,
+ step_size=dt,
simulation_time=T, permute_grid=False, sampling_step_size=dts)
as well as
- freqs, power = fft(results[key], tmin=cut_off)
+ from pandas import DataFrame
+ freqs, power = fft(DataFrame(results[('v', key, 'PC')]), tmin=cut_off)
and, to make the graph more comparable (y-axis flip)
- tau_i = np.arange(1e-3, 63e-3, 5e-3)
+ tau_i = np.flip(np.arange(1e-3, 63e-3, 5e-3))
Steps taken so far
To investigate whether (and if so, at what point in the commit-history) the framework did actually produce the given plot, and to rule out that any updated dependencies may be the root of the problem, I checked out the newest commit that included the string notebook
in its commit message.
This happend to be c97e8ba, and indeed (after applying the same np.flip
adaption) it easily produces the following graph:
Result when running with c97e8ba |
|
appears to be working correctly (minimal differences due to random input) |
This must mean that somewhere since this commit, a change has been introduced that ever so slightly changes the behavior of the simple Jansen-Rit Model Circuit.
Interestingly enough, the properties of the signals that are produced within the usual ranges (τi = 20ms, τe = 10ms) do not change enough to cause noticable problems when reproducing other widely analysed features of the Jansen-Rit Model (e.g. the first part of the Jupyter Notebook).
As I have only recently started to dig into the deeper sections of the PyRates Code, I do not have any idea what kind of alteration may have caused such a subtle change, so I will probably start to try to single out the commit that introduces this change.
In the meantime, I would be glad if anybody could point me into the right direction.
Additional (possibly consequent?) problems
This change in behavior might also be responsible for the issue that made me aware of the problem in the first place:
When trying to reproduce Fig. 5 from the David and Friston paper, which required some minor changes to the model as well, I get the following result, which shows clear peaks in all conditions, while only the first and last are expected and all the other conditions should produce much more noisy, wider distributions:
Attempt to reproduce Fig. 5 from David and Friston |
|
While it is entirely possible that there is an issue in my modification to the model that causes this, I have not yet gotten around to fix the compatibilty-errors that prevent me from running my newer implementations on the c97e8ba version and testing whether it works as expected there.
To keep this issue fairly simple, I wanted to put the focus on the more obvious problem first (which, on solution, might even fix this alltogether) - but again, I would be happy to get any insights on this as well, and will gladly provide and explain my code if anybody is interested in figuring this out with me.
Thanks in advance