neuronsimulator / nrn

NEURON Simulator
http://nrn.readthedocs.io
Other
412 stars 119 forks source link

Trouble Plotting with PlotShape() #1470

Open bndrew opened 3 years ago

bndrew commented 3 years ago

NEURON setup

Minimal working example - MWE

apical = h.Section(name = "apical") soma = h.Section(name = "soma")

apical.connect(soma)

ps = h.PlotShape(False) ps.plot(plotly).show()


## Error:

Traceback (most recent call last): File "C:\Users\andre\Documents\yale\mcdougal\neuron_test.py", line 29, in ps.plot(plotly).show() File "c:\nrn\lib\python\neuron__init.py", line 1149, in call return _do_plot_on_plotly() File "c:\nrn\lib\python\neuron\init__.py", line 1072, in _do_plot_on_plotly variable, varobj, lo, hi, secs = get_plotshape_data(ctypes.py_object(self._data)) OSError: exception: access violation reading 0x0000000000000010

nrnhines commented 3 years ago

@ramcdougal I have to admit to no understanding of this graphic domain, but the issue does not seem related to windows and I get a segfault on my ubuntu desktop. I.e. after

pip install plotly

I get with the above script

>>> ps.plot(plotly).show()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'plotly' is not defined
>>> import plotly
>>> ps.plot(plotly).show()
Segmentation fault (core dumped)

A search for plotly on https://nrn.readthedocs.io/en/latest/ strangely turns up only

Search Results
Search finished, found 1 page(s) matching the search query.

... sphinx sphinx_rtd_theme jupyter nbconvert recommonmark matplotlib bokeh ipython plotnine numpy plotly ...

but there is nothing to click on to go to that page :) But https://nrn.readthedocs.io/en/latest/python/visualization/plotshapeclass.html does mention

(currently only matplotlib Figure objects, pyplot, and plotly are supported, with plotly support added in 7.8).

The pyplot example there also gives me a segfault. Even after working around the nonexistence problem for h.load_file('c91662.ses') and the fact that if one uses copy/paste directly to the python interpreter one needs a blank line between

        sec.v = 0
ps = h.PlotShape(False)  # False tells h.PlotShape not to use NEURON's gui