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

SectionList iteration no longer changes CAS. #6

Merged
merged 1 commit into from
May 20, 2022
Merged

SectionList iteration no longer changes CAS. #6

merged 1 commit into from
May 20, 2022

Conversation

nrnhines
Copy link
Contributor

@nrnhines
Copy link
Contributor Author

Though not quite relevant to this PR (because not related to NEURON + PYTHON API change) I would also suggest carefully reviewing any idiom use like:

stimulusClass.py:        stim = h.IClamp(0, axon.allseclist)

as the second arg is ignored and should probably be written

stim = h.IClamp(0, sec=axon.allseclist) # but still wrong as  allseclist seems to be a NEURON SectionList

The best syntax for POINT_PROCESS construction (and many other methods that need a currently accessed section and a location on that section) is to use the nrn.Segment idiom

stim = h.IClamp(axon.allseclist[0](0)) # assumes allseclist is just a normal Python list of nrn.Section:  for sec in allseclist: still works the same way. Of course if you are using h.SectionList methods not available  to Python list...

@chlubba chlubba merged commit ac3b7e7 into chlubba:master May 20, 2022
@chlubba
Copy link
Owner

chlubba commented May 20, 2022

Thank you very much for your contribution to PyPNS, @nrnhines. Merged.

@nrnhines
Copy link
Contributor Author

Just curious. Is there a simple setting so that python test.py produces deterministic results to allow comparison between runs with different versions of Python and NEURON. I often use Random123 so that I can validate threads and MPI runs as well.
https://nrn.readthedocs.io/en/latest/python/programming/math/random.html?highlight=random123#Random.Random123

@chlubba
Copy link
Owner

chlubba commented May 20, 2022

I cannot test this right now and make sure. But the only source of variability in the output of python test.py should be the tortuosity of the axon. Setting the random direction component to 0.0 instead of 0.2 would then make the output deterministic.

line 22:
rdc = 0.0 # random direction component

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

Successfully merging this pull request may close these issues.

Using PyPNS with up-to-date NEURON and Python
2 participants