simulation.py¶
Simulation
¶
Simulation(
name: str | None,
path: list[str],
info: dict,
do_snapshot_grid: bool = False,
do_verbose: bool = True,
)
Class to manage a single DP Langevin field integration.
Parameters:
-
(name¶str | None) –of sim constructed from parameters etc
-
(path¶list[str]) –path to file
-
(info¶dict) –dictionary containing sim coefficients, model parameters, etc
-
(do_snapshot_grid¶bool, default:False) –flag whether to copy out final time-slice density grid into numpy array
-
(do_verbose¶bool, default:True) –flag whether to use tqdm progress bar, report from
dplvn.SimDP
-
Python modules
dp
Ensembleinitialize - Simulation tools Notebooks DPSimulation.ipynb
-
Python modules
dp
Ensemblesim_exec_wrapper
Methods:
-
exec–Carry out all simulation steps, including initialization & running.
-
initialize–Create and initialize a
dpvln.SimSPclass instance. -
plot–Plot everything
-
plot_graphs–Generate all the required graphs.
-
plot_images–Generate all the required images.
-
run–Execute a
dpvln.SimSPsimulation. -
run_wrapper–Wrapper around
dpvln.SimSPrun to provide timing. -
save–Export outfo JSON, graphs, and data files.
Source code in .venv/lib/python3.14/site-packages/langevin/dp/simulation.py
exec
¶
Carry out all simulation steps, including initialization & running.
Returns:
-
Sequence[tuple]–serialized versions of sim epoch times, mean grid densities, and
-
Sequence[tuple]–computation run time.
Source code in .venv/lib/python3.14/site-packages/langevin/dp/simulation.py
initialize
¶
Create and initialize a dpvln.SimSP class instance.
Source code in .venv/lib/python3.14/site-packages/langevin/dp/simulation.py
plot
¶
plot_graphs
¶
plot_graphs(do_profile: bool = False) -> None
Generate all the required graphs.
Source code in .venv/lib/python3.14/site-packages/langevin/dp/simulation.py
plot_images
¶
Generate all the required images.
Source code in .venv/lib/python3.14/site-packages/langevin/dp/simulation.py
run
¶
Execute a dpvln.SimSP simulation.
Source code in .venv/lib/python3.14/site-packages/langevin/dp/simulation.py
run_wrapper
¶
run_wrapper() -> str
Wrapper around dpvln.SimSP run to provide timing.
Returns:
-
str–printable string describing computation (sim run) time
Source code in .venv/lib/python3.14/site-packages/langevin/dp/simulation.py
save
¶
save(
module: Any,
do_dummy: bool = False,
do_verbose: bool = False,
do_export_images: bool = True,
) -> str | None
Export outfo JSON, graphs, and data files.
Parameters:
-
(module¶Any) –dplvn or other class module
-
(do_dummy¶bool, default:False) –just print (possibly create) the output folders
-
(do_verbose¶bool, default:False) –report how the exporting is going
Source code in .venv/lib/python3.14/site-packages/langevin/dp/simulation.py
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 | |