Skip to content
Discussion options

You must be logged in to vote

Hi @lampk , thanks for your inquiry! The issue is that Sim.load is a static method, which means that it creates a new Sim instance rather than modifying the existing one. If you assign Sim.load() to a new variable, then it works, e.g.:

import starsim as ss

# Run and save the sim
sim = ss.Sim(diseases='sir', networks='random')
sim.run()
sim.save('sim.obj')

# Load and plot the sim
sim2 = ss.Sim.load('sim.obj')
sim2.plot()

(Note that by default this saves a "shrunken" version of the sim, which includes the results but not all the details of all the agents. To save the complete sim exactly as-is, for example if you want to save partway through a run and then restart the run, use sim.save(sh…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@lampk
Comment options

@cliffckerr
Comment options

Answer selected by cliffckerr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants