snapshot#
- class snapshot(timepoints=None, *args, die=True, **kwargs)[source]#
Bases:
Analyzer
Analyzer that takes a “snapshot” of the sim.people array at specified points in time, and saves them to itself. To retrieve them, you can either access the dictionary directly, or use the
get()
method.- Parameters:
timepoints (list) – list of ints/strings/date objects, the days on which to take the snapshot
die (bool) – whether or not to raise an exception if a date is not found (default true)
kwargs (dict) – passed to
Analyzer
Example:
sim = hpv.Sim(analyzers=hpv.snapshot('2015.4', '2020')) sim.run() snapshot = sim['analyzers'][0] people = snapshot.snapshots[0] # Option 1 people = snapshot.snapshots['2020'] # Option 2 people = snapshot.get('2020') # Option 3 people = snapshot.get(34) # Option 4 people = snapshot.get() # Option 5
Methods