Skip to content

Commit

Permalink
Merge pull request #319 from GillesPy2/fix-pickle
Browse files Browse the repository at this point in the history
Changed 'is' to '==', 'is not' to '!=' when comparing to non-singletons
  • Loading branch information
briandrawert authored Apr 13, 2020
2 parents 2d0f265 + f332373 commit 6728d37
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion gillespy2/core/gillespy2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1241,7 +1241,7 @@ def to_model(self, name):
root = self.document

# Try to set name from document
if model.name is "":
if model.name == "":
name = root.find('Name')
if name.text is None:
raise NameError("The Name cannot be none")
Expand Down
16 changes: 8 additions & 8 deletions gillespy2/core/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def _plot_iterate(self, show_labels = True, included_species_list = []):
import matplotlib.pyplot as plt

for i,species in enumerate(self.data):
if species is not 'time':
if species != 'time':

if species not in included_species_list and included_species_list:
continue
Expand All @@ -43,7 +43,7 @@ def _plotplotly_iterate(result, show_labels = True, trace_list = None, line_dict
import plotly.graph_objs as go

for i,species in enumerate(result.data):
if species is not 'time':
if species != 'time':

if species not in included_species_list and included_species_list:
continue
Expand Down Expand Up @@ -480,13 +480,13 @@ def average_ensemble(self):
for i in range(0,number_of_trajectories): #Add every value of every Results Dict into one output Results
results_dict = results_list[i]
for species in results_dict:
if species is 'time':
if species == 'time':
continue
for k in range(0,len(output[species])):
output[species][k] += results_dict[species][k]

for species in output: #Divide for mean of every value in output Results
if species is 'time':
if species == 'time':
continue
for i in range(0,len(output[species])):
output[species][i] /= number_of_trajectories
Expand Down Expand Up @@ -529,14 +529,14 @@ def stddev_ensemble(self,ddof = 0):
for i in range(0,number_of_trajectories):
results_dict = results_list[i]
for species in results_dict:
if species is 'time':
if species == 'time':
continue
for k in range(0,len(output[species])):
output[species][k] += (results_dict[species][k] - average_list[species][k])\
*(results_dict[species][k] - average_list[species][k])

for species in output: #Divide for mean of every value in output Results
if species is 'time':
if species == 'time':
continue
for i in range(0,len(output[species])):
output[species][i] /= (number_of_trajectories - ddof)
Expand Down Expand Up @@ -584,7 +584,7 @@ def plotplotly_std_dev_range(self, xaxis_label = "Time (s)", yaxis_label="Specie

trace_list=[]
for species in average_result:
if species is not 'time':
if species != 'time':

if species not in included_species_list and included_species_list:
continue
Expand Down Expand Up @@ -691,7 +691,7 @@ def plot_std_dev_range(self, xaxis_label ="Time (s)", yaxis_label ="Species Popu
plt.figure(figsize=figsize)

for species in average_result:
if species is 'time':
if species == 'time':
continue

if species not in included_species_list and included_species_list:
Expand Down

0 comments on commit 6728d37

Please sign in to comment.