SimulationResult
SimulationResult
A class that stores the result of running a simulation.
Attributes
SimulationState
The state with which the simulation started.
Source code in pylattica/core/simulation_result.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
|
__init__(starting_state)
Initializes a SimulationResult with the specified starting_state.
Parameters
SimulationState
The state with which the simulation started.
Source code in pylattica/core/simulation_result.py
32 33 34 35 36 37 38 39 40 41 42 |
|
add_step(updates)
Takes a set of updates as a dictionary mapping site IDs to the new values for various state parameters. For instance, if at the new step, my_state_attribute at site 23 changed to 12, updates would look like this:
{ 23: { "my_state_attribute": 12 } }
Parameters
dict
The changes associated with a new simulation step.
Source code in pylattica/core/simulation_result.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
|
get_step(step_no)
Retrieves the step at the provided number.
Parameters
int
The number of the step to return.
Returns
SimulationState The simulation state at the requested step.
Source code in pylattica/core/simulation_result.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
|
last_step()
property
The last step of the simulation.
Returns
SimulationState The last step of the simulation
Source code in pylattica/core/simulation_result.py
79 80 81 82 83 84 85 86 87 88 |
|
steps()
Returns a list of all the steps from this simulation.
Returns
List[SimulationState] The list of steps
Source code in pylattica/core/simulation_result.py
66 67 68 69 70 71 72 73 74 75 76 77 |
|
to_file(fpath=None)
Serializes this result to the specified filepath.
Parameters
str
The filepath at which to save the serialized simulation result.
Source code in pylattica/core/simulation_result.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
|