Reconstruction API
SnapshotCollector
numen.reconstruction.collector.SnapshotCollector
Reconstructs GenericWorld snapshots from solver output at arbitrary times.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
world
|
any
|
The original |
required |
spec
|
CompiledSpec
|
The |
required |
result
|
SolveResult
|
The |
required |
Source code in src/numen/reconstruction/collector.py
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 | |
at(t)
Reconstruct a full world snapshot at simulation time t.
Uses binary search on result.t to find the nearest saved time point,
then rebuilds the world with all compiled state fields updated.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
t
|
float
|
Simulation time in seconds. |
required |
Returns:
| Type | Description |
|---|---|
any
|
A deep copy of the original world with state fields updated to |
any
|
their values at time |
Source code in src/numen/reconstruction/collector.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 | |
at_times(times)
Reconstruct world snapshots at a list of times.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
times
|
list[float]
|
List of simulation times in seconds. |
required |
Returns:
| Type | Description |
|---|---|
list[tuple[float, any]]
|
List of |
Source code in src/numen/reconstruction/collector.py
63 64 65 66 67 68 69 70 71 72 | |
field_series(entity_id, component_kind, field_name)
Extract a single field's time series directly from the result arrays.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entity_id
|
str
|
Entity key (e.g. "osc"). |
required |
component_kind
|
str
|
Component kind string (e.g. "nl_oscillator"). |
required |
field_name
|
str
|
Field name on the component (e.g. "position"). |
required |
Returns:
| Type | Description |
|---|---|
tuple[ndarray, ndarray]
|
(t, values) — faster than reconstructing full snapshots. |
Source code in src/numen/reconstruction/collector.py
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 | |
uniform(n=100)
Reconstruct world snapshots at n uniformly-spaced times.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n
|
int
|
Number of snapshots. Default 100. |
100
|
Returns:
| Type | Description |
|---|---|
list[tuple[float, any]]
|
List of |
Source code in src/numen/reconstruction/collector.py
74 75 76 77 78 79 80 81 82 83 84 | |
reconstruct_snapshot
numen.reconstruction.snapshot.reconstruct_snapshot(world, spec, result, t)
Rebuild a GenericWorld snapshot from solver output at time t.
Returns a deep copy of world with all compiled fields updated to their values at t.
State keys use the full path entity_id.component_kind.field_name.
Source code in src/numen/reconstruction/snapshot.py
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 | |