Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions spatialpy/core/domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,9 @@ def plot_types(self, width=None, height=None, colormap=None, size=None, title=No
:returns: Plotly figure of domain types if, use_matplotlib=False and return_plotly_figure=True
:rtype: None or dict
'''
if len(self.vertices) == 0:
raise DomainError("The domain does not contain particles.")

from spatialpy.core.result import _plotly_iterate # pylint: disable=import-outside-toplevel

if not use_matplotlib:
Expand Down Expand Up @@ -906,7 +909,7 @@ def create_3D_domain(cls, xlim, ylim, zlim, nx, ny, nz, type_id=1, mass=1.0,
x_list = numpy.linspace(xlim[0], xlim[1], nx)
y_list = numpy.linspace(ylim[0], ylim[1], ny)
z_list = numpy.linspace(zlim[0], zlim[1], nz)
totalvolume = (xlim[1] - xlim[0]) * (ylim[1] - ylim[0]) * (zlim[1] - zlim[0])
totalvolume = abs(xlim[1] - xlim[0]) * abs(ylim[1] - ylim[0]) * abs(zlim[1] - zlim[0])
vol = totalvolume / numberparticles
if vol < 0:
raise DomainError("Paritcles cannot have 0 volume")
Expand Down Expand Up @@ -964,7 +967,7 @@ def create_2D_domain(cls, xlim, ylim, nx, ny, type_id=1, mass=1.0,
# Vertices
x_list = numpy.linspace(xlim[0], xlim[1], nx)
y_list = numpy.linspace(ylim[0], ylim[1], ny)
totalvolume = (xlim[1] - xlim[0]) * (ylim[1] - ylim[0])
totalvolume = abs(xlim[1] - xlim[0]) * abs(ylim[1] - ylim[0])
vol = totalvolume / numberparticles
if vol < 0:
raise DomainError("Paritcles cannot have 0 volume")
Expand Down