laser.measles.compartmental.snapshot
laser.measles.compartmental.snapshot
Snapshot save/load for the laser-measles compartmental model.
Snapshots capture the full patch SEIR state at a given point in time and allow the simulation to be resumed exactly from that point.
Typical usage::
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | |
Notes
- Do not include
InfectionSeedingProcessin thecomponentslist for a resumed run — infections are already encoded in the restored patch states. - Snapshots persist
SIACalendarProcess'simplemented_siasstate. When resumed withSIACalendarProcessin thecomponentslist, campaigns already applied before the snapshot will not fire again; only campaigns not yet implemented in the schedule remain eligible.
laser.measles.compartmental.snapshot.load_snapshot(path, params, components=None, verbose=True)
Load a compartmental model from an HDF5 snapshot file and return it ready to run.
Restores the patch SEIR state, scenario, and metadata saved by
save_snapshot.
Set params.start_time to the snapshot date printed by
save_snapshot. Do not include InfectionSeedingProcess in the
components list — infections are already encoded in the restored
patch states.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Path to the HDF5 snapshot file written by
|
required |
params
|
CompartmentalParams
|
|
required |
components
|
list | None
|
Ordered list of component classes to attach — same list
as used when building the original model, minus
|
None
|
verbose
|
bool
|
Print a loading summary. |
True
|
Returns:
| Type | Description |
|---|---|
CompartmentalModel
|
A configured
|
Example:
1 2 3 4 5 6 7 8 9 10 11 | |
laser.measles.compartmental.snapshot.save_snapshot(model, path, verbose=True)
Save compartmental model patch state to an HDF5 snapshot file.
Call this after
CompartmentalModel.run()
to persist the full patch SEIR state. The resulting HDF5 file can be
resumed with
load_snapshot to
continue the simulation from exactly where it left off.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
CompartmentalModel
|
A fully-run (or mid-run)
|
required |
path
|
str | Path
|
Destination HDF5 file path (created or overwritten). |
required |
verbose
|
bool
|
Print a progress summary. |
True
|
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | |