class snapshot(days, *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.

  • days (list) – list of ints/strings/date objects, the days on which to take the snapshot

  • args (list) – additional day(s)

  • die (bool) – whether or not to raise an exception if a date is not found (default true)

  • kwargs (dict) – passed to Analyzer()


sim = cv.Sim(analyzers=cv.snapshot('2020-04-04', '2020-04-14'))
snapshot = sim['analyzers'][0]
people = snapshot.snapshots[0]            # Option 1
people = snapshot.snapshots['2020-04-04'] # Option 2
people = snapshot.get('2020-04-14')       # Option 3
people = snapshot.get(34)                 # Option 4
people = snapshot.get()                   # Option 5



Retrieve a snapshot from the given key (int, str, or date)