SonoSK
SonoSK is a Python library for simulating medical ultrasound. A probe can be designed, placed in front of a numerical phantom and used to make a B-mode image, or to heat a target and map the temperature, the thermal dose and the lesion that remains. The same objects are used for imaging and therapy, in 1, 2 and 3 dimensions.
Documentation, tutorials and examples: https://sonosk.github.io/sonosk/
What it simulates
- Transducers: flat and focused single elements, annular arrays, linear and phased arrays with an elevation lens, convex and endocavity arrays, matrix arrays, cylindrical line-focus sources. Focusing, steering and apodization per element.
- Pressure fields: Rayleigh integral in an attenuating medium and angular spectrum propagation, on lines, planes or volumes.
- Phantoms: layered media, spheres, ellipsoids, vessels and boxes built from materials with acoustic and thermal properties; point scatterers with an echo level per material; wire targets.
- Imaging: plane-wave, diverging-wave and focused transmits, pulse-echo signals, delay-and-sum beamforming, coherent compounding, B-mode display.
- Therapy: heat source from the pressure field, Pennes bioheat equation with pulsed exposures, CEM43 thermal dose, lesion maps and a treatment report with ablated and residual target and damaged healthy tissue.
- Probe design: Mason model of a piezoelectric element with backing and matching layers; electrical impedance, transmit and pulse-echo responses.
- Acoustic output: derated pressure and intensity, ISPPA, ISPTA, mechanical index, FDA Track 3 limits.
- Image quality: resolution, contrast, CNR, gCNR and speckle SNR.
Each solver is checked against a closed-form result in the test suite (see the validation page of the documentation). The plan for the next releases, including the tissue property database and the breast, prostate and uterus phantoms, is on the roadmap page.
Installation
SonoSK needs Python 3.11 or newer and NumPy.
pip install sonosk
For the figures and example scripts:
pip install "sonosk[plot]"
Example
Focused field of a 128-element linear array and the mechanical index on the beam axis:
import numpy as np
import sonosk as sk
from sonosk import field, safety, transducer
probe = transducer.linear_array(128, pitch=0.3e-3, height=5e-3, elev_focus=20e-3)
probe.focus((0, 0, 20e-3), c=1540.0)
g = sk.Grid.centered((121, 151), 0.2e-3, depth_start=2e-3)
p = field.rayleigh_grid(probe, g, f=5e6, c=1540.0, alpha0=0.5) # p / (rho c u0)
x, z = g.axes()
axis = np.abs(p[60]) # on the beam axis, x = 0
pr = 2.0 * axis / axis.max() # scale to a 2 MPa peak
mi, z_mi = safety.mechanical_index(z * 100, pr, f_mhz=5.0)
print(f"MI = {mi:.2f} at {z_mi * 10:.1f} mm")
More scripts, from B-mode phantoms to HIFU ablation of a tumour, are in the examples folder.
Citing
If you use SonoSK in your work, please cite it with the metadata in CITATION.cff. Each release is archived on Zenodo with its own DOI.
Licence
SonoSK is free software under the GNU General Public License, version 3 or later. See LICENSE.
Disclaimer
SonoSK is research software. It is not a medical device, and its results must not be used for clinical decisions or for the safety assessment of a device on the market.
Author
Soheil Kooklan (ORCID 0009-0003-5035-7833)
Metadata
Release files for sonosk 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| sonosk-0.1.0.tar.gz | 50.4 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sonosk-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 94.0 kB
Release files / sonosk-0.1.0.tar.gz
| Download URL | sonosk-0.1.0.tar.gz |
|---|---|
| Size | 50.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ef3ae596c04a0ad28fd7529a8d5e90acc787c76f6e5dadec4f74b3374a17619c
|
|
BLAKE2b-256 checksum How to use checksums |
763381e951fcf419aade27fa2a074934cd7751cd09dc7762e7d9cf93d9b0e33f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.
Transparency logRelease files / sonosk-0.1.0-py3-none-any.whl
| Download URL | sonosk-0.1.0-py3-none-any.whl |
|---|---|
| Size | 43.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
65526857e853620ec43c61ce90cd36ab79dc3cb869a4ce544f9f43d3bac3d0c8
|
|
BLAKE2b-256 checksum How to use checksums |
33b309638b65223c662b5301d74802740ea02ccadf2801aaa9cacab38a8a276d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.
Transparency logSecurity for sonosk 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for sonosk-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.