Skip to content

Commit

Permalink
plot only neurons in lims, fix figargs bug, v0.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
kjohnsen committed Jul 25, 2022
1 parent 0be88fa commit c7d4f6d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions cleosim/visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -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})")
Expand Down Expand Up @@ -269,5 +277,4 @@ def plot(
devices,
invert_z,
scatterargs,
**figargs,
)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>",
Expand Down

0 comments on commit c7d4f6d

Please sign in to comment.