Replicate Network¶
replicate_network
¶
Structural op_system adapter preserving a local stochastic network per bank.
No compiler/framework import is required. Time tables are resolved once per callback using diagonal (time, replicate) gathers rather than a Cartesian batch.
ReplicateReactionNetwork(stoichiometry, channel_names, channel_reactions, n_replicates, forcing_breakpoints, _batch_axis, _states, _reactions, _params, _time_axis, _time_coordinates, _table_axes, _axis_sizes)
dataclass
¶
One local stoichiometry plus a vectorized, independent propensity bank.
Local state/channel ordering follows the existing flat adapter after removing the declared replicate axis. Full input parameter arrays retain declared axis order. Parameters are read on every call; changing their values is allowed between runs and no interpolation result is cached.
flatten_history(history)
¶
Restore compiler flat cell order from a local bank history.
Returns:
| Type | Description |
|---|---|
FloatBank
|
History shaped (output time, full compiler state). |
Raises:
| Type | Description |
|---|---|
ValueError
|
The bank history has an incompatible layout. |
Source code in src/op_engine/replicate_network.py
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 | |
pack_state(flat_state)
¶
Convert compiler flat state order into (local species, replicate).
Returns:
| Type | Description |
|---|---|
FloatBank
|
A local state bank preserving each template's declared axis order. |
Raises:
| Type | Description |
|---|---|
ValueError
|
The flat state has an incompatible size. |
Source code in src/op_engine/replicate_network.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | |
propensity(times, state)
¶
Evaluate one hazard bank with every table resolved at local clocks.
Returns:
| Type | Description |
|---|---|
FloatBank
|
NumPy propensities shaped (local channel, replicate). |
Raises:
| Type | Description |
|---|---|
ValueError
|
State, clocks, parameter tables or reaction outputs have incompatible shapes. |
Source code in src/op_engine/replicate_network.py
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 | |
from_compiled_replicates(compiled, params, *, batch_axis)
¶
Build a local network from compiler-certified independent reactions.
Requires the independent-reaction contract from op_system 0.8.0+. Every evolving state must carry the batch axis. Operators, gaps, explicit-time hazards and nonconstant linear tables are rejected. Time-varying parameters must explicitly carry the batch axis to represent asynchronous current values.
Returns:
| Type | Description |
|---|---|
ReplicateReactionNetwork
|
Local network for BatchedDirectSSASolver. |
Raises:
| Type | Description |
|---|---|
ValueError
|
Independence, completeness or time assumptions are unmet. |
TypeError
|
Required compiler artifacts are unavailable. |
Source code in src/op_engine/replicate_network.py
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 | |