Skip to content
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

Indexing error while running zero-crossing events in the Van der Pol oscillator #129

Open
Shibabrat opened this issue Sep 26, 2017 · 3 comments

Comments

@Shibabrat
Copy link

I am replicating the results in the tutorial here
http://www.ni.gsu.edu/~rclewley/PyDSTool/Tutorial/Tutorial_VdP.html

But computing the fixed points in the 3rd code segment throws the following error:

Traceback (most recent call last):

File "", line 12, in
fp_coord = pp.find_fixedpoints(vdp, n=4, eps=1e-8)[0]

File "/Users/shibabrat/anaconda/lib/python3.6/site-packages/PyDSTool-0.90.2-py3.6.egg/PyDSTool/Toolbox/phaseplane.py", line 1350, in find_fixedpoints
x0 = array([x0_coords[i][d_posns[i]] for i in range(D)])

File "/Users/shibabrat/anaconda/lib/python3.6/site-packages/PyDSTool-0.90.2-py3.6.egg/PyDSTool/Toolbox/phaseplane.py", line 1350, in
x0 = array([x0_coords[i][d_posns[i]] for i in range(D)])

IndexError: only integers, slices (:), ellipsis (...), numpy.newaxis (None) and integer or boolean arrays are valid indices

Can someone kindly direct me on how to resolve this issue? I am running this test on the clone of the github repo.

Thanks,
Naik

@tristan3214
Copy link

I'm getting the same error.

@tristan3214
Copy link

I played around with the source code and it appears the d_posns is the issue. It is a float array that is being used in line 1350 (in phaseplane.py) to index x0_coords, which is causing the index error. I don't know a whole lot of what the code is doing, but when I place int(d_posns[i]) in as the index it solves my problem. I can't guarantee this is a fix but I know it worked because I get the same answer for fixed points in pplane for Matlab.

@tensionhead
Copy link
Contributor

tensionhead commented Dec 10, 2017

I am running in exactly the same issue, numpy >= 1.?? requires strictly integer arrays as indexers. It seems as if PyDSTool for python3 does not respect this atm.
As 'd_posns' is an instance of the 'base_n_counter' class in phaseplane.py, I changed:

self.counter = np.zeros((d,))

to

self.counter = np.zeros((d,), dtype = int)

in init of the counter class to solve that issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants