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

[MRG] Record calcium concentration #792

Closed
wants to merge 3 commits into from

Conversation

katduecker
Copy link
Collaborator

Recording calcium concentration in all sections of the L5 pyramidal neurons

hnn_core/cell.py Outdated
if 'ca' in self.sections[sec_name].mechs:
self.ca[sec_name] = h.Vector()
self.ca[sec_name].record(
self._nrn_sections[sec_name](0.5)._ref_cai) # there may be an issue here with referencing mod file
Copy link
Contributor

Choose a reason for hiding this comment

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

keep or remove?

@@ -348,6 +348,11 @@ class Cell:
by synapse type (keys can be soma_gabaa, soma_gabab etc.).
Must be enabled by running simulate_dipole(net, record_isec=True)
or simulate_dipole(net, record_isoma=True)
ca : dict
Contains recording of section speicifc calcium concentration.
Must be enabled by running simulate_dipole(...) with record_ca
Copy link
Collaborator

@jasmainak jasmainak Jun 13, 2024

Choose a reason for hiding this comment

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

Suggested change
Must be enabled by running simulate_dipole(...) with record_ca
Must be enabled by running simulate_dipole(net, record_ca)

Copy link
Collaborator Author

@katduecker katduecker Jun 13, 2024

Choose a reason for hiding this comment

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

Shouldn't we tell the user what to do? Because "True" won't work

Copy link
Contributor

Choose a reason for hiding this comment

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

I think @jasmainak is copying that from the docstring above for record_isoma, which is out of date.

But yes the docstring should read Must be enabled by running simulate_dipole(..., record_ca='all')

Copy link
Collaborator

Choose a reason for hiding this comment

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

I just wanted to say that use the function signature rather than using words to explain it.

assert len(mpi_net.cell_response.vsec) == n_trials
assert len(mpi_net.cell_response.isec) == n_trials
assert len(mpi_net.cell_response.vsec[trial_idx][gid]) == 8 # num sec
assert len(mpi_net.cell_response.isec[trial_idx][gid]) == 1
assert len(mpi_net.cell_response.isec[trial_idx][gid]) == 1
Copy link
Collaborator

Choose a reason for hiding this comment

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

this must be a pep8 issue

@jasmainak
Copy link
Collaborator

@ntolley monthly issue metrics fails !

@ntolley
Copy link
Contributor

ntolley commented Jun 13, 2024

@ntolley monthly issue metrics fails !

Fixed!

@@ -37,6 +37,9 @@ def simulate_dipole(net, tstop, dt=0.025, n_trials=None, record_vsec=False,
record_isec : 'all' | 'soma' | False
Option to record voltages from all sections ('all'), or just
the soma ('soma'). Default: False.
record_ca : 'all' | 'soma' | False
Copy link
Contributor

Choose a reason for hiding this comment

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

You can actually just copy the docstring here to the one in cell.py

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you also replace the incorrect record isoma/vsoma docstrings in cell.py with the isec/vsec docstrings here?


if record_ca:
for sec_name in self.ca:
if 'ca' in self.sections[sec_name].mechs:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if 'ca' in self.sections[sec_name].mechs:
if hasattr(self._nrn_sections[sec_name](0.5), '_ref_cai)::

Your suggestion! Just making sure we don't forget

Copy link
Collaborator

@jasmainak jasmainak left a comment

Choose a reason for hiding this comment

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

PR looks clean to me. I leave it to @ntolley to check and merge :) Don't forget to update whats_new !

@ntolley ntolley changed the title Record calcium concentration [MRG] Record calcium concentration Jun 14, 2024
@ntolley
Copy link
Contributor

ntolley commented Jun 14, 2024

Here's the plot with the spikes/Ca overlaid. At first I thought something was wrong but realized I hadn't set the times correctly.

Very nice work @katduecker! This definitely looks good

from hnn_core import simulate_dipole, jones_2009_model
import numpy as np
import matplotlib.pyplot as plt

net = jones_2009_model()
net.add_evoked_drive('evprox', mu=20.0, sigma=2.0, numspikes=1,
                     location='proximal', weights_ampa={'L5_pyramidal': 0.1})

plt.figure()
fig, ax = plt.subplots(2, 1, figsize=(5, 4), sharex=True, tight_layout=True)
plot_data = np.array([net.cell_response.ca[0][gid]['soma'] for gid in net.gid_ranges['L5_pyramidal']]).T
ax[0].plot(dpl[0].times, plot_data)
ax[0].set_title('Somatic Ca$^{2+}$')
ax[1].set_title('Spike Raster')
net.cell_response.plot_spikes_raster(ax=ax[1])

image

@katduecker
Copy link
Collaborator Author

Thanks both! I haven't managed to look at the rest of this yet, as I have been busy with the NEURON workshop. One thing I learned today at the workshop is that calcium concentration should be at the order a few hundred nM, but our calcium concentration is at the order of 0.1 mM (mod file of ca shows that cai is in mM). This is 1000 times too high... Am I missing something obvious with a conversion of the units?

@jasmainak
Copy link
Collaborator

jasmainak commented Jun 19, 2024 via email

@katduecker
Copy link
Collaborator Author

katduecker commented Jun 19, 2024

I asked Stephanie about this and she said that it may be possible that the conductance had to be scaled up to get the desired dynamics. To confirm this, I will read out the concentration for sodium and potassium as well, to see if they are in a similar regime. I remember @ntolley saying that an option to read out concentrations for all ions may not be a useful functionality in general, but if it allows sanity checks of the scale of the conductance, couldn't it be helpful for users to have access to this? I'd be happy to write a tutorial on this if we decide to integrate.

@katduecker katduecker closed this Jun 25, 2024
@katduecker katduecker deleted the record_calc branch June 25, 2024 17:02
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.

3 participants