Skip to content

Commit

Permalink
Change location of channel density plots
Browse files Browse the repository at this point in the history
  • Loading branch information
pgleeson committed Sep 19, 2023
1 parent e4c7963 commit c90cd3a
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 17 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,4 @@ arm64
/tests/plot/test_schematic_plot_2d_test_cell_nml_xy.png
/tests/plot/test_schematic_plot_2d_test_cell_nml_xz.png
/tests/plot/test_schematic_plot_2d_test_cell_nml_yz.png
/tests/analysis/*png
18 changes: 7 additions & 11 deletions examples/LeakConductance.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ NEURON {
RANGE i__LeakConductance : a copy of the variable for current which makes it easier to access from outside the mod file
RANGE gmax : Will be changed when ion channel mechanism placed on cell!
RANGE conductance : parameter

RANGE g : exposure

RANGE fopen : exposure
RANGE conductanceScale : derived variable
RANGE fopen0 : derived variable
Expand All @@ -36,11 +34,13 @@ UNITS {
(mV) = (millivolt)
(mS) = (millisiemens)
(uS) = (microsiemens)
(nF) = (nanofarad)
(molar) = (1/liter)
(kHz) = (kilohertz)
(mM) = (millimolar)
(um) = (micrometer)
(umol) = (micromole)
(pC) = (picocoulomb)
(S) = (siemens)

}
Expand All @@ -49,7 +49,7 @@ PARAMETER {

gmax = 0 (S/cm2) : Will be changed when ion channel mechanism placed on cell!

conductance = 1.0E-5 (uS)
conductance = 1.0E-5 (uS) : was: 1.0E-11 (conductance)
}

ASSIGNED {
Expand All @@ -62,14 +62,10 @@ ASSIGNED {
i (mA/cm2)
i__LeakConductance (mA/cm2)


conductanceScale : derived variable

fopen0 : derived variable

fopen : derived variable

g (uS) : derived variable
conductanceScale : derived variable
fopen0 : derived variable
fopen : derived variable
g (uS) : derived variable

}

Expand Down
11 changes: 7 additions & 4 deletions pyneuroml/analysis/ChannelDensityPlot.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,7 @@ def plot_channel_densities(
show_plots_already: bool = True,
morph_plot_type: str = "constant",
morph_min_width: float = 2.0,
target_directory=None
):
"""Plot channel densities on a Cell on morphology plots.
Expand Down Expand Up @@ -603,6 +604,8 @@ def plot_channel_densities(
:type colormap_name: str
:returns: None
"""
tgt_dir = target_directory+'/' if target_directory else './'

if channel_density_ids is not None and ion_channels is not None:
raise ValueError(
"Only one of channel_density_ids or ions channels may be provided"
Expand Down Expand Up @@ -685,7 +688,7 @@ def plot_channel_densities(
min_width=morph_min_width,
overlay_data=data,
overlay_data_label="(S/m2)",
save_to_file=f"{cell.id}_{cd.id}.cd.png",
save_to_file=f"{tgt_dir}{cell.id}_{cd.id}.cd.png",
datamin=ymin,
plane2d=plane2d,
nogui=not show_plots_already,
Expand All @@ -710,7 +713,7 @@ def plot_channel_densities(
title_above_plot=True,
xaxis="Distance from soma (um)",
yaxis="g density (S/m2)",
save_figure_to=f"{cell.id}_{cd.id}_cd_vs_dist.png",
save_figure_to=f"{tgt_dir}{cell.id}_{cd.id}_cd_vs_dist.png",
show_plot_already=show_plots_already,
linestyles=[" "],
linewidths=["0"],
Expand Down Expand Up @@ -786,7 +789,7 @@ def plot_channel_densities(
min_width=morph_min_width,
overlay_data=data,
overlay_data_label="(S/m2)",
save_to_file=f"{cell.id}_{ion_channel}.ion.png",
save_to_file=f"{tgt_dir}{cell.id}_{ion_channel}.ion.png",
datamin=ymin,
plane2d=plane2d,
nogui=not show_plots_already,
Expand All @@ -811,7 +814,7 @@ def plot_channel_densities(
title_above_plot=True,
xaxis="Distance from soma (um)",
yaxis="g density (S/m2)",
save_figure_to=f"{cell.id}_{ion_channel}_ion_vs_dist.png",
save_figure_to=f"{tgt_dir}{cell.id}_{ion_channel}_ion_vs_dist.png",
show_plot_already=show_plots_already,
linestyles=[" "],
linewidths=["0"],
Expand Down
7 changes: 5 additions & 2 deletions tests/analysis/test_channel_density_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,13 @@ def test_plot_channel_densities(self):
channel_density_ids=["Ih_apical", "Ih_somatic", "Ih_basal", "Ih"],
distance_plots=True,
show_plots_already=False,
target_directory='tests/analysis'
)
plot_channel_densities(
cell, ion_channels=["Ih"], distance_plots=True, show_plots_already=False
cell, ion_channels=["Ih"], distance_plots=True, show_plots_already=False,
target_directory='tests/analysis'
)
# no channel densities or ion channels, so generate for all ion
# channels
plot_channel_densities(cell, distance_plots=True, show_plots_already=False)
plot_channel_densities(cell, distance_plots=True, show_plots_already=False,
target_directory='tests/analysis')

0 comments on commit c90cd3a

Please sign in to comment.