Skip to content

Commit

Permalink
Faster SimulationResult loading: use slices (#491)
Browse files Browse the repository at this point in the history
  • Loading branch information
ortega2247 committed Feb 4, 2020
1 parent efa3db4 commit 918e86e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pysb/simulator/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1267,10 +1267,10 @@ def load(cls, filename, dataset_name=None, group_name=None):
obs_and_exprs = None

if 'observables' in dset.keys():
obs_and_exprs = list(dset['observables'])
obs_and_exprs = list(dset['observables'][:])

if 'expressions' in dset.keys():
exprs = dset['expressions']
exprs = dset['expressions'][:]
if obs_and_exprs is None:
obs_and_exprs = list(exprs)
else:
Expand All @@ -1282,12 +1282,12 @@ def load(cls, filename, dataset_name=None, group_name=None):

trajectories = None
try:
trajectories = dset['trajectories']
trajectories = dset['trajectories'][:]
except KeyError:
pass

try:
initials = np.array(dset['initials'])
initials = dset['initials'][:]
except KeyError:
initials = pickle.loads(dset['initials_dict'][()])

Expand All @@ -1304,8 +1304,8 @@ def load(cls, filename, dataset_name=None, group_name=None):
simulator=None,
model=model,
initials=initials,
param_values=np.array(dset['param_values']),
tout=np.array(dset['tout']),
param_values=dset['param_values'][:],
tout=dset['tout'][:],
trajectories=trajectories,
observables_and_expressions=obs_and_exprs,
squeeze=dset.attrs['squeeze'],
Expand Down

0 comments on commit 918e86e

Please sign in to comment.