-
Notifications
You must be signed in to change notification settings - Fork 70
[MRG] feat: Extracting Katharina's voltage-initialization changes #1185
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
base: master
Are you sure you want to change the base?
[MRG] feat: Extracting Katharina's voltage-initialization changes #1185
Conversation
|
I think this is ready for review and merge as-is. Note that as far as I can tell, this does NOT change the initial conditions of any simulation, and output appears to be identical to how it was before. (You can check this with one of the final tests, which is I was planning on writing tests for the new voltage-initialization, but as it turns out we have very, very little testing of However, since #1168 includes a large number of changes to |
|
This will resolve #996 . |
a7833bd to
a0acfdb
Compare
|
Force-pushed in order to remove an incorrect statement in an earlier commit message. (I previously thought that this would change the initial membrane voltages, but I see Katharina went to pains to not do that, and it's correct that the initial membrane voltages for each section are now still the same as they were under the old code). |
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 .
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 .
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 .
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.
a0acfdb to
80863e1
Compare
|
Another force-push in order to label @katduecker as the author of most of the commits, since she was the one who wrote the code originally (and this way she gets explicit credit). Is this okay with you Katharina? No more force-pushes should be necessary. |
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.
| section_data["Ra"] = self.Ra | ||
| section_data["end_pts"] = self.end_pts | ||
| section_data["nseg"] = self.nseg | ||
| section_data["v"] = self._v |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not that it matters but should this be self._v?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this updated? seems like this should be resolved
|
|
||
|
|
||
| def _get_pyr_soma(p_all, cell_type): | ||
| # KD: In the new model, the basal dendrites are differently tuned from the apical |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My fault , but should it read "Tuning of the basal dendrites in duecker_ET_model is different from apical dendrites"?
| assert isinstance(override_params, dict) | ||
| p_all = compare_dictionaries(p_all, override_params) | ||
|
|
||
| all_v_init = -71.46 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does an extra variable add anything here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe just to type the number once since it's reused below?
|
@asoplata thanks Austin looks great to me, and thanks for giving me the credits for it! |
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.
| Ra : float | ||
| axial resistivity in ohm-cm | ||
| end_pts : list of [x, y, z] | ||
| v : float |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| v : float | |
| v0 : float |
Just a thought, with math notation an underscore zero typically denotes the initial value
| diam=dend_prop["diam"], | ||
| Ra=dend_prop["Ra"], | ||
| cm=dend_prop["cm"], | ||
| v=v, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason not to include v in the dend_prop dictionary?
|
@asoplata and @katduecker this looks quite clean to me! Is it worth adding an explicit unit test that manually defines the initial membrane potential? The best test would be to record the membrane potential and make sure it matches the manually defined initial value Perhaps the simplest approach would be to just add an ``assert vsec_data[0] == v` for one of the existing unit tests that records voltages? |
This is the first commit of many to come where I'm going to extract the parts of #1168 relevant to the new, proper voltage initialization.
The plan is:
master(this PR),master,master) back into the code at [WIP] Experimental duecker_ET model branch #1168 .For starters, this first commit consists of only the extracted changes to
cell.pyand nothing else. Fortunately, in this case, the tests seem to pass without having to change anything.