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

S2F imaging #56

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

S2F imaging #56

wants to merge 9 commits into from

Conversation

raahijogani
Copy link

Add S2F model for calcium imaging.

Copy link
Member

@kjohnsen kjohnsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking pretty good. Main things:

  • the features and interface can and should be reused more with S2F (i.e., in a Sensor base class)
  • the tests can be unified and a little stronger
  • the functions for different sensors are getting a bit out of hand....what if we kept a csv file with all the available sensors and parameters? Where a param is missing, we can leave it blank, and throw an error when trying to load a model that needs it.
    • This would be more elegant for parameters shared between S2F and NAOMi (sigma_noise, dFF_1AP )

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason you removed the Sensor base class? It would be even more important now that this functionality is shared between multiple child classes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh...because Sensor was a SynapseDevice...ok, well hopefully we can still do this with NAOMiGECI inheriting from SynapseDevice and Sensor and S2FGECI just the latter

class S2FGECI(SynapseDevice):
"""Base class for S2F GECI models"""

rise: Quantity = field(kw_only=True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will need docstrings for all these things. Don't worry about it till everything else is done though; best not to waste time documenting things that are in flux

F0: float = field(kw_only=True, default=0.0)
sigma_noise: float = field(kw_only=True, default=0.0)
threshold: float = field(kw_only=True, default=1e-3)
spike_monitors: dict[NeuronGroup, SpikeMonitor] = field(factory=dict, init=False)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'd probably want this to be private.

Also, if it's a dict with NG keys, how do you handle multiple injections into the same neuron group? Or do we take a shortcut assuming you inject all at the same time with scope.inject_sensor_for_targets()? I don't remember

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we combine tests for NAOMi and S2F? Ideally, the existing NAOMi test_geci() test should work for both. And your S2F tests should too. I would keep a single test_sensor.py file and programmatically plug in both.

assert isinstance(model_light, S2FLightDependentGECI)


@pytest.mark.parametrize(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rather than parametrizing an s2f-specific test with s2f-specific params, you could refactor this as a general GECI test parameterized by different sensors

sigma_noise=0.01,
)
model.connect_to_neuron_group(ng)
assert "test_ng" in model.spike_monitors
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could use a test of tricky multi-inject scenarios

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should remove these meaningless notebook changes from the PR

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't S2F sensors use focus_depth like NAOMi? That should be a feature general to all sensors (including voltage sensors which we haven't thought about implementing yet).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to see the spike pattern to compare to the resulting Ca++ traces

@@ -18,7 +18,7 @@ classifiers = [
packages = [{ include = "cleo" }]

[tool.poetry.dependencies]
python = ">=3.9,<3.13"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a limit on the minor version since sometimes new Python versions break things. But we can try it. Poetry has this ^ operator that means anything the same or higher within the major version

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
python = ">=3.9,<3.13"
python = "^3.9"

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.

2 participants