Skip to content

preprocess_ctrl_signals() extremely inefficient #63

@kjohnsen

Description

@kjohnsen

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

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions