I realized while running newman15_validation.ipynb that adding the control loop (beyond just spike detection) is super slow. It's not even the opsin dynamics, but appears to be due to the fact that by using preprocess_ctrl_signals(), Light.update() gets called on every single timestep (by default 0.1 ms).
Solutions?
- Some low-hanging fruit would be to compare the output of
preprocess_ctrl_signal() and the previous stim values and only keep changes. This would only be useful for scenarios like square waves or long-enough pulses, though.
- The more robust, more general, but harder way would be to map from the control signal to modifications of the simulation variables via
run_regularly.
- Though at present,
Light assumes its values are all powers/irradiance. So, either take a step backward and don't enforce those units in the saved values or provide those via a StateMonitor instead

I realized while running
newman15_validation.ipynbthat adding the control loop (beyond just spike detection) is super slow. It's not even the opsin dynamics, but appears to be due to the fact that by usingpreprocess_ctrl_signals(),Light.update()gets called on every single timestep (by default 0.1 ms).Solutions?
preprocess_ctrl_signal()and the previous stim values and only keep changes. This would only be useful for scenarios like square waves or long-enough pulses, though.run_regularly.Lightassumes its values are all powers/irradiance. So, either take a step backward and don't enforce those units in the saved values or provide those via a StateMonitor instead