snapshot#

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

Parameters:
  • timesteps (list) – list of timesteps on which to take the snapshot

  • args (list) – additional timestep(s)

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

  • kwargs (dict) – passed to Analyzer()

Example:

sim = fp.Sim(analyzers=fps.snapshot('2020-04-04', '2020-04-14'))
sim.run()
snapshot = sim.pars['analyzers'][0]
people = snapshot.snapshots[0]

Attributes

auto_state_list

List of "automatic" states with boolean type (ss.BoolState) that were added via define_states()

dt

Get the current module timestep

now

Shortcut to self.t.now()

state_dict

Return a flat dictionary (objdict) of all states

state_list

Return a flat list of all states (ss.Arr objects)

ti

Get the current module timestep

timevec

Shortcut to self.t.timevec

Methods

step()[source]#

Apply snapshot at each timestep listed in timesteps and save result at snapshot[str(timestep)]