Skip to content

Conversation

@katduecker
Copy link
Collaborator

This is the latest version of the duecker_2025_ET_model, rebased to the current state of the branch. The model is open to all HNN developers at their own risk and discretion. This model is still under development, not peer-reviewed, and regular code changes are expected.

I will add guidelines on how to use the model to this PR. Please reach out to me if you have any questions!

@katduecker
Copy link
Collaborator Author

@ntolley yay! I made a small change this week which requires another round of optimization, which is a great chance to use Carolina's new initial params feature :) I will provide some guidance on how to use the model once that is done.

asoplata added a commit to asoplata/hnn-core that referenced this pull request Nov 6, 2025
This is the first commit of many to come where I'm going to extract the
parts of jonescompneurolab#1168 relevant to the new, proper voltage initialization.

The plan is:
1. We'll separate the changes to the "v_init" stuff and make it its own
PR onto `master`,
2. Change the tests that become broken as we go along,
3. Everyone reviews the changes (which will likely end up in a slightly
different form from how they currently exist in jonescompneurolab#1168),
4. We merge these voltage initialization changes into `master`,
5. Then finally, we merge/rebase the voltage initialization
changes (which are now on `master`) *back* into the code at jonescompneurolab#1168 .
6. Repeat the process for all code features included in the length jonescompneurolab#1168
work, until everything gets merged, piece-by-piece.

For starters, this commit consists of *only* the extracted changes to
`cell.py` and nothing else. Fortunately, in this case, the tests seem to
pass without having to change anything.
asoplata added a commit to asoplata/hnn-core that referenced this pull request Nov 6, 2025
This fixes what I think is a bug currently present in jonescompneurolab#1168, where the
L2's `soma` section did not have its universal voltage-initialization
value applied (but the dendrites did).

Additionally, @katduecker , I think the same bug is present in your
`_get_interneuron_soma()` function (which I've removed in this commit
since it's not relevant to the voltage-initialization). Your
`_get_interneuron_soma` takes a `v_init` value, but does not apply it in
`Section` creation. This was probably missed.

This also removes `NetworkBuilder.state_init()` like KD did, since it is
no longer needed, as the voltage initialization is completely moved over
to `cells_default.py` now.

With this, I think the voltage-initialization stuff has been completely
extracted from jonescompneurolab#1168. The only remaining work is to write new tests
specifically for the `v_init` where it is used.
asoplata added a commit to asoplata/hnn-core that referenced this pull request Nov 7, 2025
This fixes what I think is a bug currently present in jonescompneurolab#1168, where the
L2's `soma` section did not have its universal voltage-initialization
value applied (but the dendrites did).

Additionally, @katduecker , I think the same bug is present in your
`_get_interneuron_soma()` function (which I've removed in this commit
since it's not relevant to the voltage-initialization). Your
`_get_interneuron_soma` takes a `v_init` value, but does not apply it in
`Section` creation. This was probably missed.

This also removes `NetworkBuilder.state_init()` like KD did, since it is
no longer needed, as the voltage initialization is completely moved over
to `cells_default.py` now.

With this, I think the voltage-initialization stuff has been completely
extracted from jonescompneurolab#1168. The only remaining work is to write new tests
specifically for the `v_init` where it is used.
asoplata pushed a commit to asoplata/hnn-core that referenced this pull request Nov 7, 2025
This is the first commit of many to come where I'm going to extract the
parts of jonescompneurolab#1168 relevant to the new, proper voltage initialization.

The plan is:
1. We'll separate the changes to the "v_init" stuff and make it its own
PR onto `master`,
2. Change the tests that become broken as we go along,
3. Everyone reviews the changes (which will likely end up in a slightly
different form from how they currently exist in jonescompneurolab#1168),
4. We merge these voltage initialization changes into `master`,
5. Then finally, we merge/rebase the voltage initialization
changes (which are now on `master`) *back* into the code at jonescompneurolab#1168 .
6. Repeat the process for all code features included in the length jonescompneurolab#1168
work, until everything gets merged, piece-by-piece.

For starters, this commit consists of *only* the extracted changes to
`cell.py` and nothing else. Fortunately, in this case, the tests seem to
pass without having to change anything.

The original person who actually wrote this code was @katduecker, which
is why they are indicated as author. This version of the code that was
extracted from jonescompneurolab#1168 was done so by @asoplata .
asoplata pushed a commit to asoplata/hnn-core that referenced this pull request Nov 7, 2025
This does NOT pass tests

The original person who actually wrote this code was @katduecker, which
is why they are indicated as author. This version of the code that was
extracted from jonescompneurolab#1168 was done so by @asoplata .
asoplata pushed a commit to asoplata/hnn-core that referenced this pull request Nov 7, 2025
This also includes regenerated networks, since doing that is necessary
to allow the tests to pass as well.

The original person who actually wrote this code was @katduecker, which
is why they are indicated as author. This version of the code that was
extracted from jonescompneurolab#1168 was done so by @asoplata .
asoplata added a commit to asoplata/hnn-core that referenced this pull request Nov 7, 2025
This fixes what I think is a bug currently present in jonescompneurolab#1168, where the
L2's `soma` section did not have its universal voltage-initialization
value applied (but the dendrites did).

Additionally, @katduecker , I think the same bug is present in your
`_get_interneuron_soma()` function (which I've removed in this commit
since it's not relevant to the voltage-initialization). Your
`_get_interneuron_soma` takes a `v_init` value, but does not apply it in
`Section` creation. This was probably missed.

This also removes `NetworkBuilder.state_init()` like KD did, since it is
no longer needed, as the voltage initialization is completely moved over
to `cells_default.py` now.

With this, I think the voltage-initialization stuff has been completely
extracted from jonescompneurolab#1168. The only remaining work is to write new tests
specifically for the `v_init` where it is used.
# each trial needs unique event time vectors
for trial_idx in range(n_trials):
for drive in self.external_drives.values():
for d, drive in enumerate(self.external_drives.values()):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a not-yet-included reason why this enumerate was included? I don't believe it's used currently.

"""

return zero_val * np.exp(exp_term * x) + offset
return zero_val * (slope * np.exp(exp_term * x) + offset)
Copy link
Collaborator

Choose a reason for hiding this comment

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

There may be a bug here: offset is now multiplied by zero_val, but it wasn't before. In the current master code, offset is always 0, so this change does not break current tests. However, that doesn't mean it's not a bug; @katduecker are you sure that offset should be multiplied by zero_val? I can understand that that may be your very reason for introducing slope, but just wanted to double-check.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, this is what I want! The function is taken from Hay et al., 2011

gbar = gsoma * (-0.8696 + 2.087 * np.exp(x/323))

asoplata pushed a commit to asoplata/hnn-core that referenced this pull request Nov 7, 2025
I believe this adds the last of the code that is extracted from jonescompneurolab#1168
that is *not* the actual Duecker model itself, but instead code changes
that are used by the default model. These functions are not currently
tested at all, and I have not added tests for them for similar reasons
to
jonescompneurolab#1185 (comment)

After this, we should be able to make a PR that adds the actual Duecker
model itself. However, there will be additional work for that step: we
need to update `hnn_io.read_network_configuration` and the equivalent
`...write...` such that they support the Duecker model.

Continuing the pattern, this is based on top of jonescompneurolab#1187.
asoplata pushed a commit to asoplata/hnn-core that referenced this pull request Nov 12, 2025
I believe this adds the last of the code that is extracted from jonescompneurolab#1168
that is *not* the actual Duecker model itself, but instead code changes
that are used by the default model. These functions are not currently
tested at all, and I have not added tests for them for similar reasons
to
jonescompneurolab#1185 (comment)

After this, we should be able to make a PR that adds the actual Duecker
model itself. However, there will be additional work for that step: we
need to update `hnn_io.read_network_configuration` and the equivalent
`...write...` such that they support the Duecker model.

Continuing the pattern, this is based on top of jonescompneurolab#1187.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

3 participants