diff --git a/.gitignore b/.gitignore index c97fedad..9bc1df73 100644 --- a/.gitignore +++ b/.gitignore @@ -136,3 +136,5 @@ examples/results/*.dat /examples/NET_NML2_Ex5_DetCell.net.nml .mypy_cache/ +/examples/test_data/TwoCell.net.png +/examples/test_data/Purk2M9s.png diff --git a/examples/test_data/TwoCell.net.nml b/examples/test_data/TwoCell.net.nml new file mode 100644 index 00000000..5b597dfc --- /dev/null +++ b/examples/test_data/TwoCell.net.nml @@ -0,0 +1,78 @@ + + + + + +Network structure (NeuroML 2beta4) for project: ACnet2 saved with neuroConstruct v1.7.1 on: 15:53:21, 02-Oct-14 + +Cell Group: pyramidals contains 1 cells +Cell Group: baskets contains 1 cells + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pyneuroml/plot/Plot.py b/pyneuroml/plot/Plot.py index 45620b41..1097e2ee 100644 --- a/pyneuroml/plot/Plot.py +++ b/pyneuroml/plot/Plot.py @@ -374,7 +374,7 @@ def generate_interactive_plot( for i in range(len(xvalues)): fig.add_trace( - go.Scatter( + go.Scattergl( x=xvalues[i], y=yvalues[i], name=labels[i], diff --git a/pyneuroml/plot/PlotMorphology.py b/pyneuroml/plot/PlotMorphology.py index 121f0cf9..fa997d6e 100644 --- a/pyneuroml/plot/PlotMorphology.py +++ b/pyneuroml/plot/PlotMorphology.py @@ -22,6 +22,8 @@ from pyneuroml.pynml import read_neuroml2_file from pyneuroml.utils.cli import build_namespace +import neuroml + logger = logging.getLogger(__name__) logger.setLevel(logging.INFO) @@ -33,7 +35,8 @@ "saveToFile": None, "interactive3d": False, "plane2d": "xy", - "minwidth": 0.8, + "minwidth": 0, + "square": False, } @@ -65,7 +68,8 @@ def process_args(): parser.add_argument( "-plane2d", - action="store_true", + type=str, + metavar="", default=DEFAULTS["plane2d"], help="Plane to plot on for 2D plot", ) @@ -92,6 +96,14 @@ def process_args(): help="Name of the image file", ) + + parser.add_argument( + "-square", + action="store_true", + default=DEFAULTS["square"], + help="Scale axes so that image is approximately square", + ) + return parser.parse_args() @@ -114,16 +126,41 @@ def plot_from_console(a: typing.Optional[typing.Any] = None, **kwargs: str): if a.interactive3d: plot_interactive_3D(a.nml_file, a.minwidth, a.v, a.nogui, a.save_to_file) else: - plot_2D(a.nml_file, a.plane2d, a.minwidth, a.v, a.nogui, a.save_to_file) + plot_2D(a.nml_file, a.plane2d, a.minwidth, a.v, a.nogui, a.save_to_file, a.square) + +########################################################################################## +# Taken from https://stackoverflow.com/questions/19394505/expand-the-line-with-specified-width-in-data-unit +from matplotlib.lines import Line2D + +class LineDataUnits(Line2D): + def __init__(self, *args, **kwargs): + _lw_data = kwargs.pop("linewidth", 1) + super().__init__(*args, **kwargs) + self._lw_data = _lw_data + + def _get_lw(self): + if self.axes is not None: + ppd = 72./self.axes.figure.dpi + trans = self.axes.transData.transform + return ((trans((1, self._lw_data))-trans((0, 0)))*ppd)[1] + else: + return 1 + def _set_lw(self, lw): + self._lw_data = lw + + _linewidth = property(_get_lw, _set_lw) + +########################################################################################## def plot_2D( nml_file: str, plane2d: str = "xy", - min_width: float = 0.8, + min_width: float = DEFAULTS["minwidth"], verbose: bool = False, nogui: bool = False, - save_to_file: typing.Optional[str] = None + save_to_file: typing.Optional[str] = None, + square: bool = False ): """Plot cell morphology in 2D. @@ -142,71 +179,220 @@ def plot_2D( :type nogui: bool :param save_to_file: optional filename to save generated morphology to :type save_to_file: str + :param square: scale axes so that image is approximately square + :type square: bool """ if verbose: print("Plotting %s" % nml_file) - nml_model = read_neuroml2_file(nml_file) + nml_model = read_neuroml2_file(nml_file, + include_includes=True, + check_validity_pre_include=False, + verbose=False, + optimized=True,) - for cell in nml_model.cells: - title = "2D plot of %s from %s" % (cell.id, nml_file) + from pyneuroml.utils import extract_position_info + + cell_id_vs_cell, pop_id_vs_cell, positions, pop_id_vs_color, pop_id_vs_radii = extract_position_info(nml_model, verbose) + + title = "2D plot of %s from %s" % (nml_model.networks[0].id, nml_file) - fig, ax = plt.subplots(1, 1) # noqa - plt.get_current_fig_manager().set_window_title(title) + if verbose: + print("positions: %s"%positions) + print("pop_id_vs_cell: %s"%pop_id_vs_cell) + print("cell_id_vs_cell: %s"%cell_id_vs_cell) + print("pop_id_vs_color: %s"%pop_id_vs_color) + print("pop_id_vs_radii: %s"%pop_id_vs_radii) + + fig, ax = plt.subplots(1, 1) # noqa + plt.get_current_fig_manager().set_window_title(title) + + ax.set_aspect("equal") + + ax.spines["right"].set_visible(False) + ax.spines["top"].set_visible(False) + ax.yaxis.set_ticks_position("left") + ax.xaxis.set_ticks_position("bottom") + + if plane2d == "xy": + ax.set_xlabel("x (μm)") + ax.set_ylabel("y (μm)") + elif plane2d == "yx": + ax.set_xlabel("y (μm)") + ax.set_ylabel("x (μm)") + elif plane2d == "xz": + ax.set_xlabel("x (μm)") + ax.set_ylabel("z (μm)") + elif plane2d == "zx": + ax.set_xlabel("z (μm)") + ax.set_ylabel("x (μm)") + elif plane2d == "yz": + ax.set_xlabel("y (μm)") + ax.set_ylabel("z (μm)") + elif plane2d == "zy": + ax.set_xlabel("z (μm)") + ax.set_ylabel("y (μm)") + else: + logger.error(f"Invalid value for plane: {plane2d}") + sys.exit(-1) + + max_xaxis = -1*float('inf') + min_xaxis = float('inf') + + for pop_id in pop_id_vs_cell: + cell = pop_id_vs_cell[pop_id] + pos_pop = positions[pop_id] + + for cell_index in pos_pop: + pos = pos_pop[cell_index] + + try: + soma_segs = cell.get_all_segments_in_group('soma_group') + except: + soma_segs = [] + try: + dend_segs = cell.get_all_segments_in_group('dendrite_group') + except: + dend_segs = [] + try: + axon_segs = cell.get_all_segments_in_group('axon_group') + except: + axon_segs = [] + + if cell is None: + + radius = pop_id_vs_radii[pop_id] if pop_id in pop_id_vs_radii else 10 + color = 'b' + if pop_id in pop_id_vs_color: + color = pop_id_vs_color[pop_id] + + if plane2d == "xy": + min_xaxis, max_xaxis = add_line(ax, [pos[0], pos[0]], [pos[1], pos[1]], radius, color, min_xaxis, max_xaxis) + elif plane2d == "yx": + min_xaxis, max_xaxis = add_line(ax, [pos[1], pos[1]], [pos[0], pos[0]], radius, color, min_xaxis, max_xaxis) + elif plane2d == "xz": + min_xaxis, max_xaxis = add_line(ax, [pos[0], pos[0]], [pos[2], pos[2]], radius, color, min_xaxis, max_xaxis) + elif plane2d == "zx": + min_xaxis, max_xaxis = add_line(ax, [pos[2], pos[2]], [pos[0], pos[0]], radius, color, min_xaxis, max_xaxis) + elif plane2d == "yz": + min_xaxis, max_xaxis = add_line(ax, [pos[1], pos[1]], [pos[2], pos[2]], radius, color, min_xaxis, max_xaxis) + elif plane2d == "zy": + min_xaxis, max_xaxis = add_line(ax, [pos[2], pos[2]], [pos[1], pos[1]], radius, color, min_xaxis, max_xaxis) + else: + raise Exception(f"Invalid value for plane: {plane2d}") - ax.set_aspect("equal") - ax.set_xlabel("extent (um)") - ax.set_ylabel("extent (um)") + else: - ax.spines["right"].set_visible(False) - ax.spines["top"].set_visible(False) - ax.yaxis.set_ticks_position("left") - ax.xaxis.set_ticks_position("bottom") + for seg in cell.morphology.segments: + p = cell.get_actual_proximal(seg.id) + d = seg.distal + width = (p.diameter + d.diameter)/2 + + if width < min_width: + width = min_width + + color = 'b' + if pop_id in pop_id_vs_color: + color = pop_id_vs_color[pop_id] + else: + if seg.id in soma_segs: color = 'g' + if seg.id in axon_segs: color = 'r' + + spherical = p.x == d.x and p.y == d.y and p.z == d.z and p.diameter == d.diameter + + if verbose: + print( + "\nSeg %s, id: %s%s has proximal: %s, distal: %s (width: %s, min_width: %s), color: %s" + % (seg.name, seg.id, ' (spherical)' if spherical else '', p, d, width, min_width, str(color)) + ) + + + if plane2d == "xy": + min_xaxis, max_xaxis = add_line(ax, [pos[0]+p.x, pos[0]+d.x], [pos[1]+p.y, pos[1]+d.y], width, color, min_xaxis, max_xaxis) + elif plane2d == "yx": + min_xaxis, max_xaxis = add_line(ax, [pos[1]+p.y, pos[1]+d.y], [pos[0]+p.x, pos[0]+d.x], width, color, min_xaxis, max_xaxis) + elif plane2d == "xz": + min_xaxis, max_xaxis = add_line(ax, [pos[0]+p.x, pos[0]+d.x], [pos[2]+p.z, pos[2]+d.z], width, color, min_xaxis, max_xaxis) + elif plane2d == "zx": + min_xaxis, max_xaxis = add_line(ax, [pos[2]+p.z, pos[2]+d.z], [pos[0]+p.x, pos[0]+d.x], width, color, min_xaxis, max_xaxis) + elif plane2d == "yz": + min_xaxis, max_xaxis = add_line(ax, [pos[1]+p.y, pos[1]+d.y], [pos[2]+p.z, pos[2]+d.z], width, color, min_xaxis, max_xaxis) + elif plane2d == "zy": + min_xaxis, max_xaxis = add_line(ax, [pos[2]+p.z, pos[2]+d.z], [pos[1]+p.y, pos[1]+d.y], width, color, min_xaxis, max_xaxis) + else: + raise Exception(f"Invalid value for plane: {plane2d}") + + if verbose: print('Extent x: %s -> %s'%(min_xaxis, max_xaxis)) # add a scalebar # ax = fig.add_axes([0, 0, 1, 1]) + sc_val = 50 + if max_xaxis-min_xaxis<100: + sc_val = 5 + if max_xaxis-min_xaxis<10: + sc_val = 1 scalebar1 = ScaleBar(0.001, units="mm", dimension="si-length", scale_loc="top", location="lower right", - fixed_value=50, fixed_units="um") + fixed_value=sc_val, fixed_units="um", box_alpha=.8) ax.add_artist(scalebar1) - for seg in cell.morphology.segments: - p = cell.get_actual_proximal(seg.id) - d = seg.distal - if verbose: - print( - "\nSegment %s, id: %s has proximal point: %s, distal: %s" - % (seg.name, seg.id, p, d) - ) - width = max(p.diameter, d.diameter) - if width < min_width: - width = min_width - if plane2d == "xy": - plt.plot([p.x, d.x], [p.y, d.y], linewidth=width, color="b") - elif plane2d == "yx": - plt.plot([p.y, d.y], [p.x, d.x], linewidth=width, color="b") - elif plane2d == "xz": - plt.plot([p.x, d.x], [p.z, d.z], linewidth=width, color="b") - elif plane2d == "zx": - plt.plot([p.z, d.z], [p.x, d.x], linewidth=width, color="b") - elif plane2d == "yz": - plt.plot([p.y, d.y], [p.z, d.z], linewidth=width, color="b") - elif plane2d == "zy": - plt.plot([p.z, d.z], [p.y, d.y], linewidth=width, color="b") - else: - logger.error(f"Invalid value for plane: {plane2d}") - sys.exit(-1) + plt.autoscale() + xl = plt.xlim() + yl = plt.ylim() + if verbose: print('Auto limits - x: %s , y: %s'%(xl, yl)) + + small = 0.1 + if xl[1]-xl[0]yl[1]-yl[0]: + d2 = (xl[1]-xl[0])/2 + m = yl[0] + (yl[1]-yl[0])/2. + plt.ylim([m-d2,m+d2]) + + if xl[1]-xl[0]0: + popElements = nml_model.networks[0].populations + else: + popElements = [] + net = neuroml.Network(id='x') + nml_model.networks.append(net) + cell_str = '' + for cell in cell_elements: + pop = neuroml.Population(id='dummy_population_%s'%cell.id, size=1, component=cell.id) + net.populations.append(pop) + cell_str+=cell.id+'__' + net.id=cell_str[:-2] + + popElements = nml_model.networks[0].populations + + + for pop in popElements: + name = pop.id + celltype = pop.component + instances = pop.instances + + if pop.component in cell_id_vs_cell.keys(): + pop_id_vs_cell[pop.id] = cell_id_vs_cell[pop.component] + else: + pop_id_vs_cell[pop.id] = None + + info = "Population: %s has %i positioned cells of type: %s" % ( + name, + len(instances), + celltype, + ) + if verbose: print(info) + + colour = "b" + substitute_radius = None + + props = [] + props.extend(pop.properties) + ''' TODO + if pop.annotation: + props.extend(pop.annotation.properties)''' + + for prop in props: + #print(prop) + if prop.tag == "color": + color = prop.value + color = (float(color.split(' ')[0]), + float(color.split(' ')[1]), + float(color.split(' ')[2])) + + pop_id_vs_color[pop.id]=color + #print("Colour determined to be: %s"%str(color)) + if prop.tag == "radius": + substitute_radius = float(prop.value) + pop_id_vs_radii[pop.id]=substitute_radius + + pop_positions = {} + + if len(instances)>0: + for instance in instances: + location = instance.location + id = int(instance.id) + + x = float(location.x) + y = float(location.y) + z = float(location.z) + pop_positions[id] = (x, y, z) + else: + for id in range(pop.size): + pop_positions[id] = (0,0,0) + + positions[name] = pop_positions + + return cell_id_vs_cell, pop_id_vs_cell, positions, pop_id_vs_color, pop_id_vs_radii diff --git a/tests/plot/CaDynamics.nml b/tests/plot/CaDynamics.nml new file mode 100644 index 00000000..56f4242a --- /dev/null +++ b/tests/plot/CaDynamics.nml @@ -0,0 +1,70 @@ + + + + NeuroML 2 implementation of the Ca Pool mechanism + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/plot/CaDynamics_all.nml b/tests/plot/CaDynamics_all.nml new file mode 100644 index 00000000..dd338295 --- /dev/null +++ b/tests/plot/CaDynamics_all.nml @@ -0,0 +1,23 @@ + + + + A set of concentration models for various cells exported to NeuroML, with specific values for gamma and delay + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/plot/Ca_HVA.channel.nml b/tests/plot/Ca_HVA.channel.nml new file mode 100644 index 00000000..acacf383 --- /dev/null +++ b/tests/plot/Ca_HVA.channel.nml @@ -0,0 +1,51 @@ + + + + NeuroML file containing a single Channel description + + + + High voltage activated Ca2+ current. +NOTE: Most Allen Institute channel models from Hay et al. 2011 use Q10 scaling. This one doesn't... +See https://github.com/OpenSourceBrain/AllenInstituteNeuroML/issues/2 + +Comment from original mod file: +Reuveni, Friedman, Amitai, and Gutnick, J.Neurosci. 1993 + + + + + + + + Models of Neocortical Layer 5b Pyramidal Cells Capturing a Wide Range of Dendritic and Perisomatic Active Properties, + Etay Hay, Sean Hill, Felix Schürmann, Henry Markram and Idan Segev, PLoS Comp Biol 2011 + + + + + + + + Calcium channels + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/plot/Ca_LVA.channel.nml b/tests/plot/Ca_LVA.channel.nml new file mode 100644 index 00000000..db2ee055 --- /dev/null +++ b/tests/plot/Ca_LVA.channel.nml @@ -0,0 +1,78 @@ + + + + NeuroML file containing a single Channel description + + + + Low voltage activated Ca2+ current +Modified slightly for Allen Institute cell models from Hay et al. 2011 version: + - Added Q10 scaling to rate variables + +Comment from original mod file: +Note: mtau is an approximation from the plots +:Reference : : Avery and Johnston 1996, tau from Randall 1997 +:Comment: shifted by -10 mv to correct for junction potential +:Comment: corrected rates using q10 = 2.3, target temperature 34, orginal 21 + + + + + + + + Models of Neocortical Layer 5b Pyramidal Cells Capturing a Wide Range of Dendritic and Perisomatic Active Properties, + Etay Hay, Sean Hill, Felix Schürmann, Henry Markram and Idan Segev, PLoS Comp Biol 2011 + + + + + + + + Ca channels + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/plot/Ih.channel.nml b/tests/plot/Ih.channel.nml new file mode 100644 index 00000000..5b980df2 --- /dev/null +++ b/tests/plot/Ih.channel.nml @@ -0,0 +1,36 @@ + + + + NeuroML file containing a single Channel description + + + + Non-specific cation current + +Comment from original mod file: +Reference : : Kole,Hallermann,and Stuart, J. Neurosci. 2006 + + + + + + + + Models of Neocortical Layer 5b Pyramidal Cells Capturing a Wide Range of Dendritic and Perisomatic Active Properties, + Etay Hay, Sean Hill, Felix Schürmann, Henry Markram and Idan Segev, PLoS Comp Biol 2011 + + + + + + + + + + + + + + + + diff --git a/tests/plot/Im.channel.nml b/tests/plot/Im.channel.nml new file mode 100644 index 00000000..1a4a9d1d --- /dev/null +++ b/tests/plot/Im.channel.nml @@ -0,0 +1,48 @@ + + + + NeuroML file containing a single Channel description + + + + Muscarinic K+ current +Modified slightly for Allen Institute cell models from Hay et al. 2011 version: + - Added Q10 scaling to rate variables + +Comment from original mod file: +:Reference : : Adams et al. 1982 - M-currents and other potassium currents in bullfrog sympathetic neurones +:Comment: corrected rates using q10 = 2.3, target temperature 34, orginal 21 + + + + + + + + Models of Neocortical Layer 5b Pyramidal Cells Capturing a Wide Range of Dendritic and Perisomatic Active Properties, + Etay Hay, Sean Hill, Felix Schürmann, Henry Markram and Idan Segev, PLoS Comp Biol 2011 + + + + + + + + K channels + + + + + + + + + + + + + + + + + diff --git a/tests/plot/Im_v2.channel.nml b/tests/plot/Im_v2.channel.nml new file mode 100644 index 00000000..14bcf88f --- /dev/null +++ b/tests/plot/Im_v2.channel.nml @@ -0,0 +1,67 @@ + + + + NeuroML file containing a single Channel description + + + + Im current + +Comment from original mod file: +Based on Im model of Vervaeke et al. (2006) + + + + + + + + Kv7/KCNQ/M-channels in rat glutamatergic hippocampal axons and their role in regulation of excitability and transmitter release, + Vervaeke K, Gu N, Agdestein C, Hu H, Storm JF. J Physiol. 2006 Oct 1;576(Pt 1):235-56. + + + + + + + + K channels + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/plot/K_P.channel.nml b/tests/plot/K_P.channel.nml new file mode 100644 index 00000000..45415ab1 --- /dev/null +++ b/tests/plot/K_P.channel.nml @@ -0,0 +1,85 @@ + + + + NeuroML file containing a single Channel description + + + + Slow inactivating K+ current +Modified slightly for Allen Institute cell models from Hay et al. 2011 version: + - Added Q10 scaling to rate variables + - Equations for tau/inf updated to match mod + +Comment from original mod file: +:Comment : The persistent component of the K current +:Reference : : Voltage-gated K+ channels in layer 5 neocortical pyramidal neurones from young rats:subtypes and gradients,Korngreen and Sakmann, J. Physiology, 2000 +:Comment : shifted -10 mv to correct for junction potential +:Comment: corrected rates using q10 = 2.3, target temperature 34, orginal 21 + + + + + + + + Models of Neocortical Layer 5b Pyramidal Cells Capturing a Wide Range of Dendritic and Perisomatic Active Properties, + Etay Hay, Sean Hill, Felix Schürmann, Henry Markram and Idan Segev, PLoS Comp Biol 2011 + + + + + + + + K channels + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/plot/K_T.channel.nml b/tests/plot/K_T.channel.nml new file mode 100644 index 00000000..24c3c24d --- /dev/null +++ b/tests/plot/K_T.channel.nml @@ -0,0 +1,82 @@ + + + + NeuroML file containing a single Channel description + + + + Fast inactivating K+ current +Modified slightly for Allen Institute cell models from Hay et al. 2011 version: + - Added Q10 scaling to rate variables + - Equations for tau/inf updated to match mod + +Comment from original mod file: +:Comment : The transient component of the K current +:Reference : : Voltage-gated K+ channels in layer 5 neocortical pyramidal neurones from young rats:subtypes and gradients,Korngreen and Sakmann, J. Physiology, 2000 +:Comment : shifted -10 mv to correct for junction potential +:Comment: corrected rates using q10 = 2.3, target temperature 34, orginal 21 + + + + + + + + Models of Neocortical Layer 5b Pyramidal Cells Capturing a Wide Range of Dendritic and Perisomatic Active Properties, + Etay Hay, Sean Hill, Felix Schürmann, Henry Markram and Idan Segev, PLoS Comp Biol 2011 + + + + + + + + K channels + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/plot/Kd.channel.nml b/tests/plot/Kd.channel.nml new file mode 100644 index 00000000..f8801aa2 --- /dev/null +++ b/tests/plot/Kd.channel.nml @@ -0,0 +1,53 @@ + + + + NeuroML file containing a single Channel description + + + + Kd current + +Comment from original mod file: +Based on Kd model of Foust et al. (2011) + + + + + + + + Somatic membrane potential and Kv1 channels control spike repolarization in cortical axon collaterals and presynaptic boutons + Foust AJ, Yu Y, Popovic M, Zecevic D, McCormick DA (2011), The Journal of Neuroscience 31(43):15490-15498 + + + + + + + + K channels + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/plot/Kv2like.channel.nml b/tests/plot/Kv2like.channel.nml new file mode 100644 index 00000000..6e6a4c8a --- /dev/null +++ b/tests/plot/Kv2like.channel.nml @@ -0,0 +1,110 @@ + + + + NeuroML file containing a single Channel description + + + + Kv2-like channel + +Comment from original mod file: +: Kv2-like channel +: Adapted from model implemented in Keren et al. 2005 +: Adjusted parameters to be similar to guangxitoxin-sensitive current in mouse CA1 pyramids from Liu and Bean 2014 + + + + + + + + Constraining compartmental models using multiple voltage recordings and genetic algorithms. + Keren N, Peled N, Korngreen A, J Neurophysiol. 2005 Dec;94(6):3730-42. + + + + + + Kv2 channel regulation of action potential repolarization and firing patterns + in superior cervical ganglion neurons and hippocampal CA1 pyramidal neurons. + Liu PW, Bean BP. J Neurosci. 2014 Apr 2;34(14):4991-5002. + + + + + + + + K channels + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/plot/Kv3_1.channel.nml b/tests/plot/Kv3_1.channel.nml new file mode 100644 index 00000000..c32df899 --- /dev/null +++ b/tests/plot/Kv3_1.channel.nml @@ -0,0 +1,55 @@ + + + + NeuroML file containing a single Channel description + + + + Fast, non inactivating K+ current (Kv3-like) + +Comment from original mod file: +:Reference : : Characterization of a Shaw-related potassium channel family in rat brain, The EMBO Journal, vol.11, no.7,2473-2486 (1992) + + + + + + + + Models of Neocortical Layer 5b Pyramidal Cells Capturing a Wide Range of Dendritic and Perisomatic Active Properties, + Etay Hay, Sean Hill, Felix Schürmann, Henry Markram and Idan Segev, PLoS Comp Biol 2011 + + + + + + + + K channels + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/plot/NaTa.channel.nml b/tests/plot/NaTa.channel.nml new file mode 100644 index 00000000..9c85eda1 --- /dev/null +++ b/tests/plot/NaTa.channel.nml @@ -0,0 +1,57 @@ + + + + NeuroML file containing a single Channel description + + + + Fast inactivating Na+ current +Modified slightly for Allen Institute cell models from Hay et al. 2011 version: + - Added Q10 scaling to rate variables + - Values for midpoint changed to match mod + +Comment from original mod file: +:Reference :Colbert and Pan 2002 + + + + + + + + Models of Neocortical Layer 5b Pyramidal Cells Capturing a Wide Range of Dendritic and Perisomatic Active Properties, + Etay Hay, Sean Hill, Felix Schürmann, Henry Markram and Idan Segev, PLoS Comp Biol 2011 + + + + + + + + Na channels + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/plot/NaTs.channel.nml b/tests/plot/NaTs.channel.nml new file mode 100644 index 00000000..5db143cb --- /dev/null +++ b/tests/plot/NaTs.channel.nml @@ -0,0 +1,57 @@ + + + + + NeuroML file containing a single Channel description + + + + Fast inactivating Na+ current. +Modified slightly for Allen Institute cell models from Hay et al. 2011 version: + - Added Q10 scaling to rate variables + - Values for midpoint changed to match mod + +Comment from mod file (NaTs2_t.mod): took the NaTa and shifted both activation/inactivation by 6 mv + + + + + + + + Models of Neocortical Layer 5b Pyramidal Cells Capturing a Wide Range of Dendritic and Perisomatic Active Properties, + Etay Hay, Sean Hill, Felix Schürmann, Henry Markram and Idan Segev, PLoS Comp Biol 2011 + + + + + + + + Na channels + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/plot/NaV.channel.nml b/tests/plot/NaV.channel.nml new file mode 100644 index 00000000..09780202 --- /dev/null +++ b/tests/plot/NaV.channel.nml @@ -0,0 +1,211 @@ + + + + + + + Mouse sodium current +: Kinetics of Carter et al. (2012) +: Based on 37 degC recordings from mouse hippocampal CA1 pyramids + + + + + + + + Na channels + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/plot/Nap.channel.nml b/tests/plot/Nap.channel.nml new file mode 100644 index 00000000..5b22b261 --- /dev/null +++ b/tests/plot/Nap.channel.nml @@ -0,0 +1,57 @@ + + + + NeuroML file containing a single Channel description + + + + Persistent Na+ current +Modified for Allen Institute cell models from Hay et al. 2011 version: +- Form of conductance expression changed from: g = gbar * m^3 * h to: g = gbar * minf * h (comment in mod: assuming instantaneous activation as modeled by Magistretti and Alonso) +- Added Q10 scaling to rate variables + +Comment from original mod file: +:Comment : mtau deduced from text (said to be 6 times faster than for NaTa) +:Comment : so I used the equations from NaT and multiplied by 6 +:Reference : Modeled according to kinetics derived from Magistretti and Alonso 1999 +:Comment: corrected rates using q10 = 2.3, target temperature 34, orginal 21 + + + + + + + + Models of Neocortical Layer 5b Pyramidal Cells Capturing a Wide Range of Dendritic and Perisomatic Active Properties, + Etay Hay, Sean Hill, Felix Schürmann, Henry Markram and Idan Segev, PLoS Comp Biol 2011 + + + + + + + + Na channels + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/plot/SK.channel.nml b/tests/plot/SK.channel.nml new file mode 100644 index 00000000..5d940d61 --- /dev/null +++ b/tests/plot/SK.channel.nml @@ -0,0 +1,71 @@ + + + + NeuroML file containing a single Channel description + + + + Small-conductance, Ca2+ activated K+ current + +Comment from original mod file: +: SK-type calcium-activated potassium current +: Reference : Kohler et al. 1996 + + + + + + + + Models of Neocortical Layer 5b Pyramidal Cells Capturing a Wide Range of Dendritic and Perisomatic Active Properties, + Etay Hay, Sean Hill, Felix Schürmann, Henry Markram and Idan Segev, PLoS Comp Biol 2011 + + + + + + + + K channels + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/plot/olm-example/HCNolm.channel.nml b/tests/plot/olm-example/HCNolm.channel.nml new file mode 100755 index 00000000..084aa197 --- /dev/null +++ b/tests/plot/olm-example/HCNolm.channel.nml @@ -0,0 +1,32 @@ + + + + NeuroML file containing a single ion channel + + + + Hyperpolarization-activated, CN-gated h channel description (from Lawrence 2006) + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/plot/olm-example/Kdrfast.channel.nml b/tests/plot/olm-example/Kdrfast.channel.nml new file mode 100755 index 00000000..ba2eeecb --- /dev/null +++ b/tests/plot/olm-example/Kdrfast.channel.nml @@ -0,0 +1,33 @@ + + + + NeuroML file containing a single ion channel + + + + Fast delayed rectifier K+ channel description (from Yuen and Durand 1991, modeled by Marianne Bezaire) + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/plot/olm-example/KvAolm.channel.nml b/tests/plot/olm-example/KvAolm.channel.nml new file mode 100755 index 00000000..416972bb --- /dev/null +++ b/tests/plot/olm-example/KvAolm.channel.nml @@ -0,0 +1,42 @@ + + + + NeuroML file containing a single ion channel + + + + A-type K+ channel description (from Zhang and McBain 1995, Martina 1998, Warman 1994 - modeled by Marianne Bezaire) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/plot/olm-example/Nav.channel.nml b/tests/plot/olm-example/Nav.channel.nml new file mode 100755 index 00000000..c4e056b4 --- /dev/null +++ b/tests/plot/olm-example/Nav.channel.nml @@ -0,0 +1,40 @@ + + + + NeuroML file containing a single ion channel + + + + Na+ channel description (modeled by Marianne Bezaire) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/plot/olm-example/leak_chan.channel.nml b/tests/plot/olm-example/leak_chan.channel.nml new file mode 100755 index 00000000..5a430360 --- /dev/null +++ b/tests/plot/olm-example/leak_chan.channel.nml @@ -0,0 +1,8 @@ + + + + NeuroML file containing a single passive Channel description + + + + diff --git a/tests/plot/pas.channel.nml b/tests/plot/pas.channel.nml new file mode 100644 index 00000000..881a1cca --- /dev/null +++ b/tests/plot/pas.channel.nml @@ -0,0 +1,12 @@ + + + + NeuroML file containing a single Channel description + + + + Simple example of a leak/passive conductance. + + + + diff --git a/tests/plot/test_plot.py b/tests/plot/test_plot.py index 0763b616..f51bb184 100644 --- a/tests/plot/test_plot.py +++ b/tests/plot/test_plot.py @@ -64,21 +64,21 @@ def test_generate_interactive_plot(self): except FileNotFoundError: pass - xs = [*range(5, 15)] - ys = [*range(5, 15)] - xs1 = [*range(5, 15)] - ys1 = [*range(14, 4, -1)] + xs = [*range(5, 15000)] + ys = [*range(5, 15000)] + xs1 = [*range(5, 15000)] + ys1 = [*range(14999, 4, -1)] labels = ["up", "down"] generate_interactive_plot( xvalues=[xs, xs1], yvalues=[ys, ys1], labels=labels, modes=["lines+markers", "markers"], - title="test interactive plot", + title=f"test interactive plot with {len(xs) * 2} points", plot_bgcolor="white", xaxis="x axis", yaxis="y axis", - show_interactive=False, + show_interactive=True, xaxis_spikelines=True, yaxis_spikelines=False, save_figure_to=filename,