Page 1 of 1

Parameter and MultiCompartmentReaction Error

Posted: Thu Aug 01, 2019 3:42 pm
by amerg
I've been reading through the documentation and tutorials and I'm a bit confused on the rxd.Parameter object. I've used it to set different values between nodes for the rate in a rxd.Rate object, so I'm familiar with that usage. However, when I tried to use Parameter by multiplying a Species to set the rate of an rxd.MultiCompartmentReaction using this code:

Code: Select all

g_ip3r = rxd.Parameter(self.cyt, initial=g_ip3r_val)
ip3r_flux = rxd.MultiCompartmentReaction(ca[er], ca[cyt],  g_ip3r*(o5_ip3r[cyt]), membrane=cyt_er_membrane)
where o5_ip3r is a Species, I get this error.

Code: Select all

File "/home/adam/neuron/nrn/lib/python/neuron/rxd/", line 431, in nodes
  File "/home/adam/neuron/nrn/lib/python/neuron/rxd/", line 52, in _do_init
  File "/home/adam/neuron/nrn/lib/python/neuron/rxd/", line 1486, in _init
  File "/home/adam/neuron/nrn/lib/python/neuron/rxd/", line 662, in _update_node_data
    if r is not None: r._update_indices()
  File "/home/adam/neuron/nrn/lib/python/neuron/rxd/", line 193, in _update_indices
    active_regions = src_regions + dest_regions
TypeError: unsupported operand type(s) for +: 'set' and 'set'
I do not get this error if g_ip3r is replaced by a non Parameter object such as a float, but I do get the error if Species is replaced by a float. Is this due to my mistake, a bug, or is this a built-in limitation of Parameter and MultiCompartmentReaction? Thanks.

Re: Parameter and MultiCompartmentReaction Error

Posted: Thu Aug 15, 2019 5:25 pm
by adamjhn
Thanks for letting us know about this bug, it will be fixed in the next release. As you have identified, one workaround is to use a float instead of a Parameter.
Alternatively, like the calcium wave example, you could define the Parameter on the membrane instead of the cytosol;

Code: Select all

g_ip3r = rxd.Parameter(cyt_er_membrane, initial=g_ip3r_val)