Skip to content

Note

Click here to download the full example code

Save and load results

Note

NDK and its examples are under constant development, more information and content will be added to this example soon!

This example demonstrates how a simulation can be executed and stored in one computer and the results can be loaded and rendered later in the same computer or another one.

Execute the following code in a computer with ndk installed

import neurotechdevkit as ndk

scenario = ndk.built_in.Scenario0()
scenario.make_grid()
scenario.compile_problem()
result = scenario.simulate_steady_state()
result.save_to_disk("scenario-0-results.tar.gz")

Out:

Estimated time to complete simulation: 44 seconds. Memory required is 8.09906664298232 GB (available 73.624408064 GB). These values are approximated.
/home/circleci/.cache/pypoetry/virtualenvs/neurotechdevkit-3aSsmiER-py3.10/lib/python3.10/site-packages/devito/finite_differences/differentiable.py:224: DeprecationWarning: NotImplemented should not be used in a boolean context
  return super(Differentiable, self).__eq__(other) and\
/home/circleci/.cache/pypoetry/virtualenvs/neurotechdevkit-3aSsmiER-py3.10/lib/python3.10/site-packages/devito/finite_differences/differentiable.py:224: DeprecationWarning: NotImplemented should not be used in a boolean context
  return super(Differentiable, self).__eq__(other) and\
A result artifact has been saved to scenario-0-results.tar.gz.

The output file from the previous step could be copied to another computer with ndk installed or stored for future use. The results can be loaded running the following code:

import neurotechdevkit as ndk  # noqa: E402

result2 = ndk.load_result_from_disk("scenario-0-results.tar.gz")
assert isinstance(result2, ndk.results.SteadyStateResult2D)
result2.render_steady_state_amplitudes(show_material_outlines=False)

Steady-State Wave Amplitude

Out:

Recreating the scenario for the result from saved metadata...

Total running time of the script: ( 0 minutes 12.848 seconds)

Download Python source code: plot_store_results.py

Download Jupyter notebook: plot_store_results.ipynb

Gallery generated by mkdocs-gallery