Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#156] Meaningful names for benchmark scenarios #190

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions docs/api/scenarios.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@
options:
show_root_heading: true

::: neurotechdevkit.scenarios.built_in.Scenario0
::: neurotechdevkit.scenarios.built_in.ScenarioSimple
options:
show_root_heading: true

::: neurotechdevkit.scenarios.built_in.Scenario1_2D
::: neurotechdevkit.scenarios.built_in.ScenarioFlatSkull_2D
options:
show_root_heading: true

::: neurotechdevkit.scenarios.built_in.Scenario1_3D
::: neurotechdevkit.scenarios.built_in.ScenarioFlatSkull_3D
options:
show_root_heading: true

::: neurotechdevkit.scenarios.built_in.Scenario2_2D
::: neurotechdevkit.scenarios.built_in.ScenarioRealisticSkull_2D
options:
show_root_heading: true

::: neurotechdevkit.scenarios.built_in.Scenario2_3D
::: neurotechdevkit.scenarios.built_in.ScenarioRealisticSkull_3D
options:
show_root_heading: true

Expand Down
2 changes: 1 addition & 1 deletion docs/examples/plot_adding_custom_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
num_points=1000,
)

scenario = ndk.built_in.Scenario0()
scenario = ndk.built_in.ScenarioSimple()
scenario.sources = [source]
scenario.make_grid()
scenario.compile_problem()
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/plot_customized_center_frequency.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

CENTER_FREQUENCY = 6e5

scenario = ndk.scenarios.built_in.Scenario0()
scenario = ndk.scenarios.built_in.ScenarioSimple()

# Customizing material properties
scenario.material_properties = {
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/plot_full_scenario.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
NDK and its examples are under constant development, more information
and content will be added to this example soon!

The following code is a simplified implementation of NDK's Scenario 1.
The following code is a simplified implementation of NDK's ScenarioFlatSkull.
"""
# %%
# Implementing a Scenario
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/plot_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# ## Rendering scenario
import neurotechdevkit as ndk

scenario = ndk.built_in.Scenario0()
scenario = ndk.built_in.ScenarioSimple()
scenario.make_grid()
scenario.compile_problem()
result = scenario.simulate_steady_state()
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/plot_multiple_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# %%
import neurotechdevkit as ndk

scenario = ndk.built_in.Scenario0()
scenario = ndk.built_in.ScenarioSimple()

s1 = ndk.sources.FocusedSource2D(
position=[0.01, 0.0],
Expand Down
8 changes: 4 additions & 4 deletions docs/examples/plot_phased_array_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
num_points=1000,
)

scenario = ndk.scenarios.built_in.Scenario1_2D()
scenario = ndk.scenarios.built_in.ScenarioFlatSkull_2D()
scenario.sources = [source]
scenario.make_grid()
scenario.compile_problem()
Expand All @@ -142,7 +142,7 @@
# delays are automatically computed when `focal_length` is defined. Let's explore how
# the API looks like:

scenario = ndk.scenarios.built_in.Scenario1_2D()
scenario = ndk.scenarios.built_in.ScenarioFlatSkull_2D()

phased_array = ndk.sources.PhasedArraySource2D(
position=[0.0, 0.0],
Expand Down Expand Up @@ -176,7 +176,7 @@
# In the example below we apply monotonically increasing delays to mimic a
# counter-clockwise angle.

scenario = ndk.scenarios.built_in.Scenario1_2D()
scenario = ndk.scenarios.built_in.ScenarioFlatSkull_2D()

phased_array = ndk.sources.PhasedArraySource2D(
position=[0.0, 0.0],
Expand Down Expand Up @@ -208,7 +208,7 @@
#
# The rest of the API is identical for both 2D and 3D scenarios.

scenario_3d = ndk.scenarios.built_in.Scenario1_3D()
scenario_3d = ndk.scenarios.built_in.ScenarioFlatSkull_3D()

phased_3d = ndk.sources.PhasedArraySource3D(
position=[0.0, 0.0, 0.0],
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/plot_pulsed_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# %%
import neurotechdevkit as ndk

scenario = ndk.built_in.Scenario0()
scenario = ndk.built_in.ScenarioSimple()
scenario.make_grid()
scenario.compile_problem()
result = scenario.simulate_pulse()
Expand Down
44 changes: 0 additions & 44 deletions docs/examples/plot_scenario2_predefined_target.py

This file was deleted.

56 changes: 56 additions & 0 deletions docs/examples/plot_scenario_predefined_target.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# -*- coding: utf-8 -*-
"""

ScenarioRealisticSkull predefined target
====================================

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

This example demonstrates how to use one of the predefined targets of
ScenarioRealisticSkull.
"""
# %%
# The list of supported targets is:
import neurotechdevkit as ndk

scenario_realistic_skull_2d_targets = (
ndk.scenarios.built_in.ScenarioRealisticSkull_2D.PREDEFINED_TARGET_OPTIONS.keys()
)
scenario_realistic_skull_3d_targets = (
ndk.scenarios.built_in.ScenarioRealisticSkull_3D.PREDEFINED_TARGET_OPTIONS.keys()
)
print(
"2D predefined targets: \n\t",
", ".join(scenario_realistic_skull_2d_targets),
"\n\n",
)
print(
"3D predefined targets: \n\t",
", ".join(scenario_realistic_skull_3d_targets),
"\n\n",
)

# %%
# Using one of the predefined targets is as simple as:
scenario = ndk.built_in.ScenarioRealisticSkull_2D()
target_options = (
ndk.scenarios.built_in.ScenarioRealisticSkull_2D.PREDEFINED_TARGET_OPTIONS
)
scenario.target = target_options["posterior-cingulate-cortex"]
scenario.make_grid()

scenario.render_layout()

# %%
# The same can be done for the 3D:
scenario_3d = ndk.built_in.ScenarioRealisticSkull_3D()
target_options = (
ndk.scenarios.built_in.ScenarioRealisticSkull_3D.PREDEFINED_TARGET_OPTIONS
)
scenario_3d.target = target_options["left-temporal-lobe"]
scenario_3d.make_grid()

scenario_3d.render_layout()
# %%
12 changes: 6 additions & 6 deletions docs/examples/plot_scenarios.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ def plot_scenario(chosen_scenario):


# %%
# Simulating scenario: scenario 0
# Simulating scenario: scenario-simple
# ===================================
plot_scenario(ndk.scenarios.built_in.Scenario0)
plot_scenario(ndk.scenarios.built_in.ScenarioSimple)

# %%
# Simulating scenario: scenario 1 2D
# Simulating scenario: scenario-flat-skull 2D
# ===================================
plot_scenario(ndk.scenarios.built_in.Scenario1_2D)
plot_scenario(ndk.scenarios.built_in.ScenarioFlatSkull_2D)

# %%
# Simulating scenario: scenario 2 2D
# Simulating scenario: scenario-realistic-skull 2D
# ===================================
plot_scenario(ndk.scenarios.built_in.Scenario2_2D)
plot_scenario(ndk.scenarios.built_in.ScenarioRealisticSkull_2D)

# %%
2 changes: 1 addition & 1 deletion docs/examples/plot_store_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# Execute the following code in a computer with ndk installed
import neurotechdevkit as ndk

scenario = ndk.built_in.Scenario0()
scenario = ndk.built_in.ScenarioSimple()
scenario.make_grid()
scenario.compile_problem()
result = scenario.simulate_steady_state()
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/plot_time_reverse.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
# %%
# Helper function to make the scenario with a PhasedArraySource
def make_scenario(element_delays=None):
true_scenario = ndk.scenarios.built_in.Scenario2_2D()
true_scenario = ndk.scenarios.built_in.ScenarioRealisticSkull_2D()

# define a phased-array source
default_source = true_scenario.sources[0]
Expand Down Expand Up @@ -68,7 +68,7 @@ def make_scenario(element_delays=None):
# The point source is visualized as a gray dot.

# Reinitialize the scenario
reversed_scenario = ndk.scenarios.built_in.Scenario2_2D()
reversed_scenario = ndk.scenarios.built_in.ScenarioRealisticSkull_2D()
# and reverse the source
point_source = ndk.sources.PointSource2D(
position=true_scenario.target.center,
Expand Down
8 changes: 4 additions & 4 deletions docs/examples/plot_ultrasound_imaging_multiplane.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
# Imaging modules
from neurotechdevkit.imaging import beamform, demodulate, util
from neurotechdevkit.results import PulsedResult2D, SteadyStateResult2D
from neurotechdevkit.scenarios.built_in import Scenario3
from neurotechdevkit.scenarios.built_in import ScenarioUltrasoundPhantom
from neurotechdevkit.sources import PhasedArraySource2D

# %%
Expand Down Expand Up @@ -93,9 +93,9 @@
# %%


def create_scenario(tilt_angle: float = 0.0) -> Scenario3:
def create_scenario(tilt_angle: float = 0.0) -> ScenarioUltrasoundPhantom:
"""Helper function to initialize scenario with different tilt angles."""
scenario = Scenario3()
scenario = ScenarioUltrasoundPhantom()
scenario.center_frequency = TONE_CENTER_FREQUENCY
source_position = [0.01, 0.0]
unit_direction = [1.0, 0.0]
Expand Down Expand Up @@ -172,7 +172,7 @@ def create_scenario(tilt_angle: float = 0.0) -> Scenario3:
# Helper functions: simulate long enough for ultrasound scattering reflection


def calc_simulation_time(scenario: Scenario3):
def calc_simulation_time(scenario: ScenarioUltrasoundPhantom):
simulation_time = ndk.scenarios._time.select_simulation_time_for_pulsed(
grid=scenario.grid,
materials=scenario.materials,
Expand Down
8 changes: 4 additions & 4 deletions docs/examples/plot_ultrasound_imaging_scanline.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
# Imaging modules
from neurotechdevkit.imaging import beamform, demodulate, util
from neurotechdevkit.results import PulsedResult2D, SteadyStateResult2D
from neurotechdevkit.scenarios.built_in import Scenario3
from neurotechdevkit.scenarios.built_in import ScenarioUltrasoundPhantom
from neurotechdevkit.sources import PhasedArraySource2D

# %%
Expand Down Expand Up @@ -91,9 +91,9 @@
# %%


def create_scenario(tilt_angle: float = 0.0) -> Scenario3:
def create_scenario(tilt_angle: float = 0.0) -> ScenarioUltrasoundPhantom:
"""Helper function to initialize scenario with different tilt angles."""
scenario = Scenario3()
scenario = ScenarioUltrasoundPhantom()
scenario.center_frequency = TONE_CENTER_FREQUENCY
source_position = [0.01, 0.0]
unit_direction = [1.0, 0.0]
Expand Down Expand Up @@ -171,7 +171,7 @@ def create_scenario(tilt_angle: float = 0.0) -> Scenario3:
scenario = create_scenario()


def calc_simulation_time(scenario: Scenario3):
def calc_simulation_time(scenario: ScenarioUltrasoundPhantom):
simulation_time = ndk.scenarios._time.select_simulation_time_for_pulsed(
grid=scenario.grid,
materials=scenario.materials,
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ To install and run **neurotechdevkit** locally check the [installation](http://n
```python
import neurotechdevkit as ndk

scenario = ndk.scenarios.built_in.Scenario0()
scenario = ndk.scenarios.built_in.ScenarioSimple()
scenario.make_grid()
scenario.compile_problem()
result = scenario.simulate_steady_state()
Expand Down
4 changes: 2 additions & 2 deletions docs/usage/defining_sources.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Users can specify the parameters and placement of sources, and add them to their
import neurotechdevkit as ndk
import numpy as np

scenario = ndk.scenarios.built_in.Scenario2_2D()
scenario = ndk.scenarios.built_in.ScenarioRealisticSkull_2D()

source = ndk.sources.FocusedSource2D(
position=np.array([0.19, 0.07]),
Expand Down Expand Up @@ -50,7 +50,7 @@ The 2D sources are for 2D scenarios and the 3D sources for 3D scenarios. The par
import neurotechdevkit as ndk
import numpy as np

scenario = ndk.scenarios.built_in.Scenario2_2D()
scenario = ndk.scenarios.built_in.ScenarioRealisticSkull_2D()

source_position = np.array([0.19, 0.07])
source = ndk.sources.PlanarSource2D(
Expand Down
2 changes: 1 addition & 1 deletion docs/usage/gpu.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Now when running NDK simulations you should be able to see `platform=nvidiaX` in
```py
import neurotechdevkit as ndk

scenario = ndk.scenarios.built_in.Scenario2_2D()
scenario = ndk.scenarios.built_in.ScenarioRealisticSkull_2D()
scenario.make_grid()
scenario.compile_problem()
result = scenario.simulate_steady_state()
Expand Down
14 changes: 7 additions & 7 deletions docs/usage/loading_scenarios.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ The following is all that's needed to load a pre-defined scenario:
```py
import neurotechdevkit as ndk

scenario = ndk.scenarios.built_in.Scenario2_2D()
scenario = ndk.scenarios.built_in.ScenarioRealisticSkull_2D()
scenario.make_grid()
```

The existing scenarios are:
The existing scenarios include:

- `SCENARIO_0` (2D) - a simple quickstart toy scenario that enables users to dive in and experiment with their first simulation immediately.
- `SCENARIO_1_3D` (3D) - a scenario containing a flat 3-layer bone covered by skin, with water above the skin and brain below the bone. This is based on benchmark 4 of [Jean-Francois Aubry, et al.](https://doi.org/10.1121/10.0013426).
- `SCENARIO_2_3D` (3D) - a scenario containing a full skull and brain mesh immersed in water. This is based on benchmark 8 of [Jean-Francois Aubry, et al.](https://doi.org/10.1121/10.0013426).
- `SCENARIO_1_2D` (2D) - a 2D version of scenario 1.
- `SCENARIO_2_2D` (2D) - a 2D version of scenario 2.
- `SCENARIO_SIMPLE` (2D) - a simple quick-start toy scenario that enables users to dive in and experiment with their first simulation immediately.
- `SCENARIO_FLAT_SKULL_3D` (3D) - a scenario containing a flat 3-layer bone covered by skin, with water above the skin and brain below the bone. This is based on benchmark 4 of [Jean-Francois Aubry, et al.](https://doi.org/10.1121/10.0013426).
- `SCENARIO_REALISTIC_SKULL_3D` (3D) - a scenario containing a full skull and brain mesh immersed in water. This is based on benchmark 8 of [Jean-Francois Aubry, et al.](https://doi.org/10.1121/10.0013426).
- `SCENARIO_FLAT_SKULL_2D` (2D) - a 2D version of `SCENARIO_FLAT_SKULL`.
- `SCENARIO_REALISTIC_SKULL_2D` (2D) - a 2D version of `SCENARIO_REALISTIC_SKULL`.

All of these scenarios are immediately ready for visualization and simulation, with appropriate default parameters used where needed.

Expand Down
Loading
Loading