Skip to content

Commit

Permalink
Update units for NEURON
Browse files Browse the repository at this point in the history
  • Loading branch information
Hjorthmedh committed Aug 21, 2024
1 parent 0b24fce commit 36bf912
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 8 deletions.
35 changes: 30 additions & 5 deletions examples/notebooks/neuromodulation/neuromodulation_bath.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,18 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"id": "d84ee6f3-4193-4509-ad4a-0d93dff5e3d9",
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Loading networks/neuromodulation_bath/simulation/output.hdf5\n"
]
}
],
"source": [
"from snudda.utils import SnuddaLoadSimulation\n",
"\n",
Expand All @@ -232,7 +240,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"id": "bd0f4edf-a622-490b-b39f-18f516975737",
"metadata": {},
"outputs": [],
Expand All @@ -244,10 +252,27 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 8,
"id": "a63a7152-730e-4868-a81a-cc87fccaf9f4",
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/html": [
"<iframe\n",
" scrolling=\"no\"\n",
" width=\"1020px\"\n",
" height=\"820\"\n",
" src=\"iframe_figures/figure_8.html\"\n",
" frameborder=\"0\"\n",
" allowfullscreen\n",
"></iframe>\n"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import plotly.graph_objects as go\n",
"import plotly.io as pio\n",
Expand Down
6 changes: 3 additions & 3 deletions snudda/simulate/simulate.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ def setup_parse_sim_info(self):
for species_name, bath_info in self.sim_info["bath_application"].items():

bath_time = np.array(bath_info["time"])
bath_conc = np.array(bath_info["concentration"]) * 1e6 # convert from SI to micromolar
bath_conc = np.array(bath_info["concentration"])
neuron_id = bath_info.get("neuron_id", None)

self.add_bath_application(species_name=species_name,
Expand Down Expand Up @@ -2020,8 +2020,8 @@ def add_bath_application(self, species_name, concentration, time, neuron_id=None
if neuron_id is None:
neuron_id = self.snudda_loader.get_neuron_id(include_virtual=False)

conc_vect = self.sim.neuron.h.Vector(concentration)
t_vect = self.sim.neuron.h.Vector(time)
conc_vect = self.sim.neuron.h.Vector(concentration * 1e6) # SI to micromolar
t_vect = self.sim.neuron.h.Vector(time * 1e3) # s -> ms

if species_name is self.bath_application:
raise KeyError(f"Bath application already applied for {species_name}")
Expand Down

0 comments on commit 36bf912

Please sign in to comment.