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

Error in passive_cable.getting_started() #22

Open
diegogcerdas opened this issue Oct 20, 2020 · 0 comments
Open

Error in passive_cable.getting_started() #22

diegogcerdas opened this issue Oct 20, 2020 · 0 comments

Comments

@diegogcerdas
Copy link

While running the introductory code for exercises 5:
import brian2 as b2 import matplotlib.pyplot as plt from neurodynex3.cable_equation import passive_cable from neurodynex3.tools import input_factory import numpy as np %matplotlib inline passive_cable.getting_started()

I get the following error trace:

_cython_magic_15f462c2d8ad86b6857db74f110ed9a8.cpp
C:\Users\dgcxb\anaconda3\envs\bmnn\lib\site-packages\numpy\core\include\numpy\npy_1_7_deprecated_api.h(14) : Warning Msg: Using deprecated NumPy API, disable it with #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
Creating library C:\Users\dgcxb.cython\brian_extensions\Users\dgcxb.cython\brian_extensions_cython_magic_15f462c2d8ad86b6857db74f110ed9a8.cp38-win_amd64.lib and object C:\Users\dgcxb.cython\brian_extensions\Users\dgcxb.cython\brian_extensions_cython_magic_15f462c2d8ad86b6857db74f110ed9a8.cp38-win_amd64.exp
Generating code
Finished generating code
_cython_magic_963f4ad1402bd5c688206467215aef7b.cpp
C:\Users\dgcxb\anaconda3\envs\bmnn\lib\site-packages\numpy\core\include\numpy\npy_1_7_deprecated_api.h(14) : Warning Msg: Using deprecated NumPy API, disable it with #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
Creating library C:\Users\dgcxb.cython\brian_extensions\Users\dgcxb.cython\brian_extensions_cython_magic_963f4ad1402bd5c688206467215aef7b.cp38-win_amd64.lib and object C:\Users\dgcxb.cython\brian_extensions\Users\dgcxb.cython\brian_extensions_cython_magic_963f4ad1402bd5c688206467215aef7b.cp38-win_amd64.exp
Generating code
Finished generating code
_cython_magic_7208c94ddee8df5b2361722452059636.cpp
C:\Users\dgcxb\anaconda3\envs\bmnn\lib\site-packages\numpy\core\include\numpy\npy_1_7_deprecated_api.h(14) : Warning Msg: Using deprecated NumPy API, disable it with #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
Creating library C:\Users\dgcxb.cython\brian_extensions\Users\dgcxb.cython\brian_extensions_cython_magic_7208c94ddee8df5b2361722452059636.cp38-win_amd64.lib and object C:\Users\dgcxb.cython\brian_extensions\Users\dgcxb.cython\brian_extensions_cython_magic_7208c94ddee8df5b2361722452059636.cp38-win_amd64.exp
Generating code
Finished generating code

Error compiling Cython file:

...
cdef double area
# namespace for function current
global _namespace_timedarray_4_values
global _namespace_num_timedarray_4_values
cdef _numpy.ndarray[double, ndim=1, mode='c'] _buf__timedarray_4_values = _namespace['_timedarray_4_values']
_namespace_timedarray_4_values = <double *> _buf__timedarray_4_values.data
^

C:\Users\dgcxb.cython\brian_extensions_cython_magic_36fb1bcd5ee8fe59860441ce2aa93114.pyx:221:37: Cannot convert 'double *' to Python object
cl : Command line warning D9025 : overriding '/W3' with '/w'
cl : Command line warning D9025 : overriding '/W3' with '/w'
cl : Command line warning D9025 : overriding '/W3' with '/w'

ZeroDivisionError Traceback (most recent call last)
~\anaconda3\envs\bmnn\lib\site-packages\brian2\codegen\runtime\cython_rt\cython_rt.py in run_block(self, block)
159 try:
--> 160 return compiled_code.main(self.namespace)
161 except Exception as exc:

_cython_magic_a4e948818012e0811dae587a5d0fef77.pyx in _cython_magic_a4e948818012e0811dae587a5d0fef77.main()

ZeroDivisionError: float division

The above exception was the direct cause of the following exception:

BrianObjectException Traceback (most recent call last)
in
----> 1 passive_cable.getting_started()

~\anaconda3\envs\bmnn\lib\site-packages\neurodynex3\cable_equation\passive_cable.py in getting_started()
106 """
107 current = input_factory.get_step_current(500, 510, unit_time=b2.us, amplitude=3. * b2.namp)
--> 108 voltage_monitor, cable_model = simulate_passive_cable(
109 length=0.5 * b2.mm, current_injection_location=[0.1 * b2.mm], input_current=current,
110 nr_compartments=100, simulation_time=2 * b2.ms)

~\anaconda3\envs\bmnn\lib\site-packages\neurodynex3\cable_equation\passive_cable.py in simulate_passive_cable(current_injection_location, input_current, length, diameter, r_longitudinal, r_transversal, e_leak, initial_voltage, capacitance, nr_compartments, simulation_time)
98 # set initial values and run for 1 ms
99 cable_model.v = initial_voltage
--> 100 b2.run(simulation_time)
101 return monitor_v, cable_model
102

~\anaconda3\envs\bmnn\lib\site-packages\brian2\units\fundamentalunits.py in new_f(*args, **kwds)
2383 get_dimensions(newkeyset[k]))
2384
-> 2385 result = f(*args, **kwds)
2386 if 'result' in au:
2387 if au['result'] == bool:

~\anaconda3\envs\bmnn\lib\site-packages\brian2\core\magic.py in run(duration, report, report_period, namespace, profile, level)
371 intended use. See MagicNetwork for more details.
372 '''
--> 373 return magic_network.run(duration, report=report, report_period=report_period,
374 namespace=namespace, profile=profile, level=2+level)
375 run.module = name

~\anaconda3\envs\bmnn\lib\site-packages\brian2\core\magic.py in run(self, duration, report, report_period, namespace, profile, level)
229 namespace=None, profile=False, level=0):
230 self._update_magic_objects(level=level+1)
--> 231 Network.run(self, duration, report=report, report_period=report_period,
232 namespace=namespace, profile=profile, level=level+1)
233

~\anaconda3\envs\bmnn\lib\site-packages\brian2\core\base.py in device_override_decorated_function(*args, **kwds)
276 return getattr(curdev, name)(*args, **kwds)
277 else:
--> 278 return func(*args, **kwds)
279
280 device_override_decorated_function.doc = func.doc

~\anaconda3\envs\bmnn\lib\site-packages\brian2\units\fundamentalunits.py in new_f(*args, **kwds)
2383 get_dimensions(newkeyset[k]))
2384
-> 2385 result = f(*args, **kwds)
2386 if 'result' in au:
2387 if au['result'] == bool:

~\anaconda3\envs\bmnn\lib\site-packages\brian2\core\network.py in run(self, duration, report, report_period, namespace, profile, level)
1074 else:
1075 for obj in active_objects:
-> 1076 obj.run()
1077
1078 timestep[0] += 1

~\anaconda3\envs\bmnn\lib\site-packages\brian2\core\base.py in run(self)
179 def run(self):
180 for codeobj in self._code_objects:
--> 181 codeobj()
182
183 contained_objects = property(fget=lambda self:self._contained_objects,

~\anaconda3\envs\bmnn\lib\site-packages\brian2\codegen\codeobject.py in call(self, **kwds)
105 self.namespace.update(**kwds)
106
--> 107 return self.run()
108
109 def run_block(self, block):

~\anaconda3\envs\bmnn\lib\site-packages\brian2\codegen\codeobject.py in run(self)
133 defined during the call of CodeGenerator.code_object.
134 '''
--> 135 return self.run_block('run')
136
137 def after_run(self):

~\anaconda3\envs\bmnn\lib\site-packages\brian2\codegen\runtime\cython_rt\cython_rt.py in run_block(self, block)
162 message = ('An exception occured during the execution of the {} '
163 'block of code object {}.\n').format(block, self.name)
--> 164 raise BrianObjectException(message, self.owner) from exc
165
166 def _insert_func_namespace(self, func):

BrianObjectException: Error encountered with object named "spatialneuron_1".
Object was created here (most recent call only, full details in debug log):
File "C:\Users\dgcxb\anaconda3\envs\bmnn\lib\site-packages\neurodynex3\cable_equation\passive_cable.py", line 85, in simulate_passive_cable
cable_model = b2.SpatialNeuron(morphology=cable_morphology, model=eqs, Cm=capacitance, Ri=r_longitudinal)

An exception occured during the execution of the run block of code object spatialneuron_1_spatialstateupdater_codeobject.
(See above for original error message and traceback.)

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

1 participant