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] Add Grinten / Stevenick / Lozano model (Dynaphos) #547

Merged
merged 22 commits into from
Jun 23, 2023

Conversation

tallyhawley
Copy link
Member

@tallyhawley tallyhawley commented May 28, 2023

Description

Adds the Dynaphos model outlined in Grinten, Steveninck, Lozano (2022).

This is a model which cannot separate its temporal and spatial components. It extends BaseModel.

This is because each phosphene's brightness is not determined by instantaneous current, but by the effective current, which is affected by the memory trace (which builds up over time). This means that in order to determine the brightness at a given time step, we need to have calculated all prior time steps-- and time steps with identical instantaneous stimulus do not necessarily have identical percepts.

All model constants can be set in its constructor, but the default values are those specified in the paper.

It has a default frame rate of 50fps (dt = 20ms), but this can be set. If t_percept is not passed to predict_percept, a percept will be returned at a frame rate determined by dt.

The amplitude for each electrode at each time-step is determined by the maximum amplitude of the stimulus on that electrode over the duration of time step.

It takes any stimulus (with a time component), and assumes a default frequency & pulse duration of 300Hz and 0.17ms respectively. However, if the stimulus is a BiphasicPulseTrain, it will use the frequency and pulse duration specified in the stimulus metadata.

Activation and brightness trends are very similar to those seen in the referenced paper:
image
Pulse2percept implementation of the Dynaphos model
image
Original implementation of the Dynaphos model

Timing information (time to run predict_percept on a 1sec stimulus).
Model is built with default parameters.
Grid side length was set using xystep, and FPS was set using dt.
image

Closes #526

Type of Change

  • New feature (non-breaking change which adds functionality)

Checklist

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@tallyhawley tallyhawley changed the base branch from master to cortex May 28, 2023 08:06
@tallyhawley tallyhawley marked this pull request as ready for review June 12, 2023 21:58
@jgranley
Copy link
Member

Looks great! Looks likes its really fast too, was not expecting that with the raw python, but must be a good implementation

tallyhawley and others added 9 commits June 12, 2023 15:15
…nexpected saved percepts) (pulse2percept#556)

* fix fps keyword error in percept.save

* update imagestimulus save

* fix percepts saving like bacteria

* remove extension keyword & update image stim save

* update percept video save/load precision test

* throw error when trying to save multi-frame as static image

* wheels build error test

* test ubuntu wheel build fix

* Set default vmin to 0

* catch specifically TypeError for percept save

---------

Co-authored-by: Jacob Granley <jgranley@ucsb.edu>
…se2percept#557)

* update macos version to use next available runner

* Update wheels.yml (test)

---------

Co-authored-by: jgranley <jgranley@ucsb.edu>
@codecov-commenter
Copy link

codecov-commenter commented Jun 19, 2023

Codecov Report

❗ No coverage uploaded for pull request base (cortex@4a3ea98). Click here to learn what that means.
The diff coverage is n/a.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@            Coverage Diff            @@
##             cortex     #547   +/-   ##
=========================================
  Coverage          ?   93.19%           
=========================================
  Files             ?      121           
  Lines             ?    10356           
  Branches          ?        0           
=========================================
  Hits              ?     9651           
  Misses            ?      705           
  Partials          ?        0           
Flag Coverage Δ
unittests 93.19% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

* Revert "[FIX] Update GitHub wheels actions to use available MacOS runner (pulse2percept#557)"

This reverts commit 405d54e.

* test update wheel

* macos 12

* drop test for wheels on mac for py3.7

* test wheels

* manual exclude

* manual exclude wheels

* manual exclude wheels

* reinclude wheels
@jgranley jgranley merged commit 7c19da2 into pulse2percept:cortex Jun 23, 2023
15 checks passed
@tallyhawley tallyhawley mentioned this pull request Jun 23, 2023
7 tasks
@tallyhawley tallyhawley deleted the dynaphos branch December 21, 2023 23:24
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

Successfully merging this pull request may close these issues.

[ENH] Add Grinten / Stevenick / Lozano Model
3 participants