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

[ENH] Refactor stimulus for biphasic pulse trains and metadata #550

Open
jgranley opened this issue Jun 7, 2023 · 0 comments
Open

[ENH] Refactor stimulus for biphasic pulse trains and metadata #550

jgranley opened this issue Jun 7, 2023 · 0 comments

Comments

@jgranley
Copy link
Member

jgranley commented Jun 7, 2023

The current technique of storing stimuli as arrays of amplitudes over time is great for some current-spread charge-accumulation based models (e.g. Horsager, Nanduri). However, an increasing number of models now prefer to work with properties of the biphasic pulse trains instead of raw amplitudes (BiphasicAxonMap, new cortical model, MVG model, ~AxonMap). The current stimulus system is very cumbersome for working with these.

Currently, the workaround is to write select attributes of biphasic pulse trains to stimulus metadata. This is rather clunky, requires for the stimulus metadata to be meticulously maintained throughout prediction (#545), leads to issues when manipulating pulse trains (#435), and each of these models must parse the stimuli to make sure it's in the correct form, and override predict_percept to facilitate these stimuli (code duplication, unclear what requirements are for each model, hard to extend).

A better solution would be to refactor the Stimulus class to accommodate easy access to biphasic data across frames. It's not completely clear what the best solution is, but something along the following lines would be immensely helpful:

  • Add is_biphasic attribute to Stimulus objects. Similar to is_charge_balanced, this is responsible for checking if the stimulus meets biphasic requirements. In addition, we should consolidate biphasic requirements across models (e.g. are multiple pulses allowed, delay/interphase gaps, etc)
  • Add biphasic_data array, where each entry is an array (dict?) of biphasic properties (or the biphasic objects themselves) for each electrode. Could also allow for varying pulses over time on each electrode.
  • biphasic_data will be much smaller than data, so it might be possible (although not neccesary) to maintain only this for models that don't need data. This would avoid a lot of the floating point issues associated with stimulus construction for some use cases. Additionally, manipulating/copying data adds significant overhead to predict_percept.

This would also have the benefit of allowing image/video stimuli with more complicated (e.g. frequency) encodings.

A solution to this would also have to refactor existing models that use biphasic attributes to work with the new system.

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