Skip to content

Note

Click here to download the full example code

Plot pulsed simulation

This example demonstrates how to execute a pulsed simulation using ndk

import neurotechdevkit as ndk

scenario = ndk.built_in.Scenario0()
scenario.make_grid()
scenario.compile_problem()
result = scenario.simulate_pulse()
assert isinstance(result, ndk.results.PulsedResult2D)
result.render_pulsed_simulation_animation()

Out:

/home/circleci/.cache/pypoetry/virtualenvs/neurotechdevkit-3aSsmiER-py3.10/lib/python3.10/site-packages/devito/types/basic.py:613: DeprecationWarning: invalid escape sequence '\-'
  """
/home/circleci/.cache/pypoetry/virtualenvs/neurotechdevkit-3aSsmiER-py3.10/lib/python3.10/site-packages/hdf5storage/utilities.py:44: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
  from pkg_resources import parse_version
/home/circleci/.cache/pypoetry/virtualenvs/neurotechdevkit-3aSsmiER-py3.10/lib/python3.10/site-packages/pkg_resources/__init__.py:2871: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('mpl_toolkits')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
  declare_namespace(pkg)
/home/circleci/.cache/pypoetry/virtualenvs/neurotechdevkit-3aSsmiER-py3.10/lib/python3.10/site-packages/pkg_resources/__init__.py:2871: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('sphinxcontrib')`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
  declare_namespace(pkg)
WARNING: DEVITO_ARCH environment variable not set and might cause compilation errors. See NDK documentation for help.
Estimated time to complete simulation: 2 minutes. Memory required is 28.92546936289519 GB (available 73.624408064 GB). These values are approximated.
Default Devito configuration:
         * autotuning=off
         * develop-mode=False
         * mpi=False
         * log-level=DEBUG
         * language=openmp
(ShotID 0) Preparing to run state for shot
(ShotID 0) Estimated bandwidth for the propagated wavelet 0.257-0.724 MHz
(ShotID 0) Spatial grid spacing (0.500 mm | 4.145 PPW) is higher than dispersion limit (0.415 mm | 5.000 PPW)
(ShotID 0) Time grid spacing (0.083 μs | 46%) is above OT2 limit (0.080 μs) and below OT4 limit (0.145 μs)
(ShotID 0) Selected undersampling level 4
(ShotID 0) Selected time stepping scheme OT4
/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\
Operator `acoustic_iso_state` instance configuration:
         * subs={h_x: 0.0005, h_y: 0.0005}
         * opt=advanced
         * platform=None
/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\
Operator `acoustic_iso_state` generated in 9.82 s
  * lowering.Clusters: 4.35 s (44.4 %)
     * specializing.Clusters: 2.92 s (29.8 %)
  * lowering.Expressions: 3.03 s (30.9 %)
Flops reduction after symbolic optimization: [3457 --> 892]
recompiling for non-existent cache dir (/tmp/devito-codepy-uid1001/300b924/ae802b3a0a758d83087b6d6dfec378ed).
gcc -O3 -g -fPIC -Wall -std=c99 -march=native -Wno-unused-result -Wno-unused-variable -Wno-unused-but-set-variable -ffast-math -shared -fopenmp /tmp/devito-jitcache-uid1001/300b924d7d2dce0732c3931f2d6f9c3293d56c3f.c -lm -o /tmp/devito-jitcache-uid1001/300b924d7d2dce0732c3931f2d6f9c3293d56c3f.so
Operator `acoustic_iso_state` jit-compiled `/tmp/devito-jitcache-uid1001/300b924d7d2dce0732c3931f2d6f9c3293d56c3f.c` in 3.96 s with `GNUCompiler`
(ShotID 0) Using inhomogeneous density
(ShotID 0) Using attenuation with power 0
(ShotID 0) Running state equation for shot
Operator `acoustic_iso_state` ran in 0.20 s
Global performance: [OI=0.01, 22.86 GFlops/s, 0.10 GPts/s]
Local performance:
  * section0<201> ran in 0.01 s [OI=0.25, 0.01 GFlops/s]
  * section1<181> ran in 0.01 s [OI=0.25, 0.09 GFlops/s]
  * section2<<513,40,181>,<513,40,181>,<513,40,181>,<513,40,181>,<513,40,181>,<513,40,181>,<513,201,40>,<513,201,40>,<513,201,40>,<513,201,40>,<513,201,40>,<513,201,40>,<513,210,190>,<513,201,181>,<513,130,110>,<513,121,101>,<513,49,110>,<513,40,101>,<513,49,110>,<513,40,101>,<513,210,49>,<513,201,40>,<513,210,49>,<513,201,40>> ran in 0.13 s [OI=0.01, 34.99 GFlops/s, 0.28 GPts/s]
  * section4<<513,1000>,<513,1000>,<513,1000>,<513,1000>,<513,1000>> ran in 0.07 s [OI=14.38, 1.77 GFlops/s, 0.01 GPts/s]
Performance[mode=advanced] arguments: {'nthreads': 18, 'nthreads_nonaffine': 18}
(ShotID 0) Completed state equation run for shot
/home/circleci/project/src/neurotechdevkit/rendering/_animations.py:118: UserWarning: You passed in an explicit save_count=127 which is being ignored in favor of frames=127.
  anim = FuncAnimation(
Animation.save using <class 'matplotlib.animation.HTMLWriter'>