Skip to content
This is the development version of the documentation. It may change before the next release. See 0.14.x for the latest release.

gspat

src

gspat is an algorithm that speeds up gs. The algorithm is based on the paper by Plasencia et al. (Plasencia et al., 2020).

gspat(
&NalgebraBackend,
&geometry,
&foci,
wavelength,
&option,
&mut phases,
&mut intensities,
)?;
Parameter Type Description
geometry &Geometry Device layout
foci &[AmplitudeTarget] Sequence of focal points (position and target amplitude)
wavelength Length Wavelength
option &GspatOption Additional options (see below)
phases &mut [Vec<Phase>] Phase output buffer
intensities &mut [Vec<Intensity>] Intensity output buffer

The parameters are the same as gs.

GspatOption {
repeat,
constraint,
directivity,
mask,
}
Field Type Default
repeat NonZeroUsize 100
constraint IntensityConstraint Clamp(MIN, MAX)
directivity Directivity Sphere
mask TransducerMask AllEnabled

The options are the same as gs.

use std::num::NonZeroUsize;
use autd3_rs::geometry::{Autd3, Geometry, TransducerMask, offset};
use autd3_rs::units::{m, mm, s};
use autd3_rs::value::Intensity;
use autd3_rs_pattern::wavelength;
use autd3_rs_pattern_holo::{
AmplitudeTarget, Directivity, IntensityConstraint, GspatOption, NalgebraBackend, Pa, gspat,
};
let geometry = Geometry::new(vec![Autd3::default()]);
let mut phases = geometry.phase_buffer();
let mut intensities = geometry.intensity_buffer();
gspat(
&NalgebraBackend,
&geometry,
&[
AmplitudeTarget {
point: geometry.center() + offset(-30.0 * mm, 0.0 * mm, 150.0 * mm),
amplitude: 2.5e3 * Pa,
},
AmplitudeTarget {
point: geometry.center() + offset(30.0 * mm, 0.0 * mm, 150.0 * mm),
amplitude: 2.5e3 * Pa,
},
],
wavelength(340.0 * m / s),
&GspatOption {
repeat: NonZeroUsize::new(100).unwrap(),
constraint: IntensityConstraint::Clamp(Intensity::MIN, Intensity::MAX),
directivity: Directivity::Sphere,
mask: TransducerMask::AllEnabled,
},
&mut phases,
&mut intensities,
)?;