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
20 changes: 11 additions & 9 deletions spatialpy/Result.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,10 +354,10 @@ def plot_species(self, species, t_ndx=0, concentration=False, deterministic=Fals
for i in range(1, len(t_ndx_list), speed):
_, _data = self.read_step(t_ndx_list[i])
_data = _data[spec_name] if deterministic or not concentration else _data[spec_name] / (_data['mass'] / _data['rho'])
if min(_data) < cmin:
cmin = min(_data)
if max(_data) > cmax:
cmax = max(_data)
if min(_data) - 0.1 < cmin:
cmin = min(_data) - 0.1
if max(_data) + 0.1 > cmax:
cmax = max(_data) + 0.1

frames = []
for index in range(0, len(t_ndx_list), speed):
Expand All @@ -366,7 +366,7 @@ def plot_species(self, species, t_ndx=0, concentration=False, deterministic=Fals
# map data to types
types = {}
for i, val in enumerate(data['type']):
name = "sub {}".format(val)
name = species
if deterministic or not concentration:
spec_data = data[spec_name][i]
else:
Expand Down Expand Up @@ -399,6 +399,7 @@ def plot_species(self, species, t_ndx=0, concentration=False, deterministic=Fals
if return_plotly_figure:
return fig
else:
init_notebook_mode(connected=True)
iplot(fig)

def get_property(self, property_name, timepoints=None):
Expand Down Expand Up @@ -603,11 +604,11 @@ def plot_property(self, property_name, t_ndx=0, p_ndx=0, width=500, height=500,
for i in range(1, len(t_ndx_list), speed):
_, _data = self.read_step(t_ndx_list[i])
_cmin = min(_data[property_name]) if property_name != "v" else min(_data[property_name], key=lambda val: val[p_ndx])[p_ndx]
if _cmin < cmin:
cmin = _cmin
if _cmin - 0.1 < cmin:
cmin = _cmin - 0.1
_cmax = max(_data[property_name]) if property_name != "v" else max(_data[property_name], key=lambda val: val[p_ndx])[p_ndx]
if _cmax > cmax:
cmax = _cmax
if _cmax + 0.1 > cmax:
cmax = _cmax + 0.1

frames = []
for index in range(0, len(t_ndx_list), speed):
Expand Down Expand Up @@ -657,6 +658,7 @@ def plot_property(self, property_name, t_ndx=0, p_ndx=0, width=500, height=500,
if return_plotly_figure:
return fig
else:
init_notebook_mode(connected=True)
iplot(fig)

# def __setattr__(self, k, v):
Expand Down