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

Is PyPNS working with new versions of NEURON. #1831

Closed
nrnhines opened this issue May 19, 2022 · 11 comments
Closed

Is PyPNS working with new versions of NEURON. #1831

nrnhines opened this issue May 19, 2022 · 11 comments

Comments

@nrnhines
Copy link
Member

nrnhines commented May 19, 2022

When I use NEURON-8.1.0 with python3.9 on my linux desktop and install PyPNS from github and run

python -i test.py

I get

	1 
Creating axon 0
Myelinated fiber diameter: [0.97982345]
Number of segments for myelinated axon: 2208

Starting simulation of axon 0
Elapsed time to calculate voltage and membrane current...
352.09 s
Elapsed time to calculate extracellular potential...
21.15 s
Overall processing of axon 0 took 385.83 s.
...

Figure_1

Note: https://www.neuron.yale.edu/phpBB/viewtopic.php?p=19436#p19436

@nrnhines
Copy link
Member Author

Using NEURON -- VERSION 7.6.7 HEAD (603da174f) 2019-04-19
configured with

(pypns-39) hines@hines-t7500:~/tmp/pypns/build$ ../configure --prefix=`pwd`/install --with-nrnpython=python3.9 --without-iv --disable-rx3d
make -j 4 install

Generates the stdout/stderr

(pypns-39) hines@hines-t7500:~/tmp/pypns$ python3.9 -i test.py
	1 
Creating axon 0
Myelinated fiber diameter: [1.28313846]
Number of segments for myelinated axon: 1944

Starting simulation of axon 0
Elapsed time to calculate voltage and membrane current...
185.42 s
Elapsed time to calculate extracellular potential...
22.12 s
Overall processing of axon 0 took 217.44 s.
...

and the figure

Figure_2

@nrnhines
Copy link
Member Author

Using NEURON -- VERSION 7.8.2 HEAD (09b151ecb) 2020-12-16 give yet a third set of numbers

Creating axon 0
Myelinated fiber diameter: [1.59591649]
Number of segments for myelinated axon: 1724

Starting simulation of axon 0
Elapsed time to calculate voltage and membrane current...
218.84 s

And a figure similar to 8.1.0 above (though different in detail).

image

@nrnhines
Copy link
Member Author

nrnhines commented May 19, 2022

It seems likely that a major part (or all) of the issue stems from #596 change due to issue #509 . Building the version just prior to this change, NEURON -- VERSION 8.0.dev-117-g10da6c2a2 generates
image
However NEURON -- VERSION 8.0.dev-118-g5a7e42cdc 2020-06-15 exhibits the problem.

Note that to speed things up, I modified test.py so that

--- a/test.py
+++ b/test.py
@@ -9,7 +9,7 @@ import numpy as np
 
 # ----------------------------- simulation params ---------------------------
 
-tStop=50
+tStop=10
 dt=0.0025

Also note that there are many places in the code that make use of randomness and I could not immediately figure out how to make the simulation deterministic.

@nrnhines
Copy link
Member Author

The versions that contain that commit are:

$ git tag --contains 5a7e42cdc
7.8.1
7.8.2
8.0.0
8.0.1
8.0.2
8.0a
8.1.0
8.1a
8.2.dev

@AnaMachadoLuis
Copy link

Hello,

I tried to replicate some of the figures (https://github.com/chlubba/PyPNS-PaperFigures) of the PyPNS paper using neuron 8.0, PyPNS (with chlubba/PyPNS#6) and python 3.9 (windows 10), to understand if everything was working and I could use this set up.

The test.py generates the same results that are above represented when it's used neuron 7.6.7.

test py

I was also able to reproduce figure 7 (a, b, c) from the paper. However, I'm not able to replicate the content of figures 8 and 9.

Is it possible that there is still some incompatibility between neuron recent versions and PyPNS?

Figures generated

fig. 8
fig8

fig. 9
fig_9A_unmyelinated

fig_9A_myelinated

Figures in the paper

fig. 8
fig_8_paper

fig. 9
fig_9_paper

@nrnhines nrnhines reopened this May 23, 2022
@nrnhines
Copy link
Member Author

@AnaMachadoLuis Thanks, I was hoping someone would check on those figures. I suspect the issue is the same. Can you tell me how to run those
figures. I presume the randomness does not affect the qualitative behavior too severely?

@AnaMachadoLuis
Copy link

Yes, of course. First I also considered that the influence of randomness could be an explanation, but then after looking more carefully at the differences between the figures I obtained and the ones in the paper, I realized they are quite significant.

This repository https://github.com/chlubba/PyPNS-PaperFigures contains the scripts to generate the figures in the PyPNS paper. There is a python script (sometimes two in the case when some previous calculations are necessary) for every figure.

In the same directory should be the following elements:

-python script to generate the desired figure (I ran it as a jupyter notebook)
-folder Fields (also in the https://github.com/chlubba/PyPNS-PaperFigures repository)
-compiled mod files (the mods folder is in https://github.com/chlubba/PyPNS.  In the directory of this folder, I ran the command nrnivmodl from the console, after which some files are compiled)

folder

@nrnhines
Copy link
Member Author

nrnhines commented May 25, 2022

@AnaMachadoLuis
I don't understand how to run fig8 and fig9. I'm using Linux Ubuntu and I have folders

/home/hines/tmp/hack/PyPNS-PaperFigures
/home/hines/tmp/hack/pypns # clone of PyPNS

The former is my working directory.
to find PyPNS, I

export PYTHONPATH=$PYTHONPATH:/home/hines/tmp/hack/pypns

and to make sure I have the mod files

nrnivmodl ../pypns/mods

Then I tried for fig8 and got:

(py39) hines@hines-t7500:~/tmp/hack/PyPNS-PaperFigures$ python -i ___paper_fig8_profileZ.py
  File "/home/hines/tmp/hack/PyPNS-PaperFigures/___paper_fig8_profileZ.py", line 9
    rc('text.latex', preamble='\usepackage{sfmath}')
                                                   ^
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 0-1: truncated \uXXXX escape
>>> 
(py39) hines@hines-t7500:~/tmp/hack/PyPNS-PaperFigures$ export PYTHONPATH=$PYTHONPATH:/home/hines/tmp/hack/pypns^C
(py39) hines@hines-t7500:~/tmp/hack/PyPNS-PaperFigures$ python -i ___paper_fig8_profileZ.py
  File "/home/hines/tmp/hack/PyPNS-PaperFigures/___paper_fig8_profileZ.py", line 9
    rc('text.latex', preamble='\usepackage{sfmath}')
                                                   ^
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 0-1: truncated \uXXXX escape
>>> 

Any suggestions?

@nrnhines
Copy link
Member Author

nrnhines commented May 25, 2022

By using /home/hines/tmp/hack/pypns as my current working directory I was able to

(py39) hines@hines-t7500:~/tmp/hack/pypns$ python -i ../PyPNS-PaperFigures/___paper_fig9A_SFAP_timecourse.py

and see similar results for
NEURON -- VERSION 7.6.7 HEAD (603da17) 2019-04-19
image

and
NEURON -- VERSION 8.2.dev-54-gfe112466a master (fe11246) 2022-05-25
image

@AnaMachadoLuis
Copy link

AnaMachadoLuis commented May 25, 2022

@nrnhines
I also got the same error but couldn't find a solution, so I just commented the line of code which was causing problems.

Ok, I can see the results are the same, even though they don't match the contents of the original figures. But based on this, it  should not be a NEURON version problem.

Thank you.

@nrnhines
Copy link
Member Author

@AnaMachadoLuis
Thanks for the hint about Figure 8. Here are my results for

(py39) hines@hines-t7500:~/tmp/hack/pypns$ python -i ../PyPNS-PaperFigures/___paper_fig8_profileZ.py

NEURON -- VERSION 7.6.7 HEAD (603da17) 2019-04-19
image

'NEURON -- VERSION 8.2.dev-54-gfe112466a master (fe11246) 2022-05-25'
image

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

2 participants