From c7d4f6d28f4a1ed12aaa36e47128befaa1fd8a15 Mon Sep 17 00:00:00 2001 From: Kyle Johnsen Date: Mon, 25 Jul 2022 16:35:26 -0400 Subject: [PATCH] plot only neurons in lims, fix figargs bug, v0.5.1 --- cleosim/visualization.py | 13 ++++++++++--- pyproject.toml | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/cleosim/visualization.py b/cleosim/visualization.py index 2f62e16..cc1edc7 100644 --- a/cleosim/visualization.py +++ b/cleosim/visualization.py @@ -177,12 +177,20 @@ def _plot( neuron_artists = [] for i in range(len(neuron_groups)): ng = neuron_groups[i] - args = [ng.x / axis_scale_unit, ng.y / axis_scale_unit, ng.z / axis_scale_unit] + xyz = [ng.x / axis_scale_unit, ng.y / axis_scale_unit, ng.z / axis_scale_unit] + # mask neurons outside desired lims: + for i_dim, lim in enumerate([xlim, ylim, zlim]): + if lim is not None: + xyz[i_dim] = np.ma.masked_array( + xyz[i_dim], + np.logical_or(xyz[i_dim] < lim[0], xyz[i_dim] > lim[1]), + dtype=float, + ) kwargs = {"label": ng.name, "alpha": _neuron_alpha} if colors is not None: kwargs["color"] = colors[i] kwargs.update(scatterargs) - neuron_artists.append(ax.scatter(*args, **kwargs)) + neuron_artists.append(ax.scatter(*xyz, **kwargs)) ax.set_xlabel(f"x ({axis_scale_unit._dispname})") ax.set_ylabel(f"y ({axis_scale_unit._dispname})") ax.set_zlabel(f"z ({axis_scale_unit._dispname})") @@ -269,5 +277,4 @@ def plot( devices, invert_z, scatterargs, - **figargs, ) diff --git a/pyproject.toml b/pyproject.toml index a0579ca..66b3fad 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "cleosim" -version = "0.5.0" +version = "0.5.1" description = "Closed Loop, Electrophysiology, and Optogenetics Simulator: testbed and prototyping kit" authors = [ "Kyle Johnsen ",