Closed hvangeffen closed 9 months ago
As far as NEURON is concerned, there can be many finitialize
callbacks, with each one responsible for solving is part of the problem. (e.g. maybe one handles calcium initialization in a certain cell type.)
Also, there are multiple points in the initialization where the callbacks can be invoked.
As far as NEURON is concerned, there can be many
finitialize
callbacks, with each one responsible for solving is part of the problem. (e.g. maybe one handles calcium initialization in a certain cell type.)
In that case is there a way to dynamically create c function to be passed to hoc install
sym = hoc_install(FINITIALIZE_RULE, function_type, 0, &hoc_top_level_symlist);
sym->u.u_proc->defn.pf = finitialize_callback;
sym->u.u_proc->nauto = 0;
sym->u.u_proc->nobjauto = 0;
Or add a callback function accepting an argument. I would like to be able to do something like:
sym = hoc_install(FINITIALIZE_RULE, function_type, 0, &hoc_top_level_symlist);
sym->u.u_proc->defn.pf = [func_name]() { mexEvalString(func_name + "()"); hoc_ret(); hoc_pushx(0); };
sym->u.u_proc->nauto = 0;
sym->u.u_proc->nobjauto = 0;
Also, there are multiple points in the initialization where the callbacks can be invoked.
As in the same function could be invoked multiple times during the initialization or can you specify when adding the callback when it should be invoked?
FInitializeHandler
takes an optional numeric argument to specify at which point in the initialization process the callback should be invoked:
https://nrn.readthedocs.io/en/8.2.3/python/simctrl/programmatic.html#FInitializeHandler
If MATLAB cannot dynamically generate C callbacks, the string for invoking the function could have an argument in it... E.g. instead of callback()
we could do callback(73)
You could get the argument in position 1 via getarg(1)
... This returns a double*
Closes #11, closes #9