kWaveMedium

For conceptual background and examples, see Medium: Material Properties.

class kWaveMedium[source]

Bases: object

Medium properties for k-Wave simulations.

Note: For heterogeneous medium parameters, medium.sound_speed and medium.density must be given in matrix form with the same dimensions as kgrid. For homogeneous medium parameters, these can be given as single numeric values. If the medium is homogeneous and velocity inputs or outputs are not required, it is not necessary to specify medium.density.

BonA: float | int | ndarray | None = None
__init__(sound_speed, sound_speed_ref=None, density=None, alpha_coeff=None, alpha_power=None, alpha_mode=None, alpha_filter=None, alpha_sign=None, BonA=None, absorbing=False, stokes=False)
Parameters:
  • sound_speed (float | int | ndarray)

  • sound_speed_ref (float | int | ndarray | None)

  • density (float | int | ndarray | None)

  • alpha_coeff (float | int | ndarray | None)

  • alpha_power (float | int | ndarray | None)

  • alpha_mode (AlphaMode | str | None)

  • alpha_filter (ndarray | None)

  • alpha_sign (ndarray | None)

  • BonA (float | int | ndarray | None)

  • absorbing (bool)

  • stokes (bool)

Return type:

None

absorbing: bool = False
alpha_coeff: float | int | ndarray | None = None
property alpha_coeff_compression

Compression alpha coefficient (used in elastic simulations | not supported currently!)

property alpha_coeff_shear

Shear alpha coefficient (used in elastic simulations | not supported currently!)

alpha_filter: ndarray | None = None
alpha_mode: AlphaMode | str | None = None
alpha_power: float | int | ndarray | None = None
alpha_sign: ndarray | None = None
check_fields(kgrid_shape)[source]

Check whether the given properties are valid

Parameters:

kgrid_shape (Sequence[int]) – Shape of the kWaveGrid

Returns:

None

Return type:

None

density: float | int | ndarray | None = None
ensure_defined(*fields)[source]

Assert that the field(s) are defined (not None)

Parameters:

*fields – String list of the fields

Returns:

None

Return type:

None

is_defined(*fields)[source]

Check if the field(s) are defined or None

Parameters:

*fields – String list of the fields

Returns:

Boolean list

Return type:

List[bool]

is_nonlinear()[source]

Check if the medium is nonlinear

Returns:

whether the fluid simulation is nonlinear

Return type:

bool

set_absorbing(is_absorbing, is_stokes=False)[source]

Change medium’s absorbing and stokes properties

Parameters:
  • is_absorbing – Is the medium absorbing

  • is_stokes – Is the medium stokes

Returns:

None

Return type:

None

sound_speed: float | int | ndarray
property sound_speed_compression

Compression sound speed (used in elastic simulations | not supported currently!)

sound_speed_ref: float | int | ndarray | None = None
property sound_speed_ref_compression

Compression sound speed reference (used in elastic simulations | not supported currently!)

property sound_speed_ref_shear

Shear sound speed reference (used in elastic simulations | not supported currently!)

property sound_speed_shear

Shear sound speed (used in elastic simulations | not supported currently!)

stokes: bool = False