greedy
srcgreedy is a combinatorial optimization that greedily selects the phase of each transducer one at a time from a set of discrete candidates. The algorithm is based on the paper by Suzuki et al. (Suzuki et al., 2021).
greedy(&geometry, &foci, wavelength, &option, &mut dst)?;greedy(geometry, foci, wavelength, option, dst)Holo.Greedy(geometry, foci, wavelength, option, dst);| Parameter | Type | Description |
|---|---|---|
geometry |
&Geometry |
Device layout |
foci |
&[AmplitudeTarget] |
Sequence of focal points (position and target amplitude) |
wavelength |
Length |
Wavelength |
option |
&GreedyOption |
Additional options (see below) |
dst |
&mut [[Emission; _]] |
Output buffer |
For the common elements (AmplitudeTarget / TransducerMask, etc.), see the Holo overview.
GreedyOption
Section titled “GreedyOption”GreedyOption { phase_quantization_levels, constraint, directivity, objective_func, mask,}GreedyOption( phase_quantization_levels, constraint, directivity, mask,)new GreedyOption( phaseQuantizationLevels, constraint, directivity, mask)| Field | Type | Default |
|---|---|---|
phase_quantization_levels |
NonZeroU8 |
16 |
constraint |
EmissionConstraint |
Uniform(MAX) |
directivity |
Directivity |
Sphere |
objective_func |
fn(Complex<f32>, Amplitude) -> f32 |
abs_objective_func |
mask |
TransducerMask |
AllEnabled |
phase_quantization_levels— the number of divisions of the phase candidates. The larger it is, the higher the phase resolution.objective_func— the objective function that evaluates each candidate. The defaultabs_objective_funcreturns the absolute value of the difference between the magnitude of the synthesized sound pressure and the target amplitude.- Configurable only in the Rust version. In other languages, the default objective function is used.
- For the meaning of
constraint/directivity/mask, see the Holo overview.
Example
Section titled “Example”use std::num::NonZeroU8;
use autd3_rs::geometry::{Autd3, Geometry, 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, EmissionConstraint, GreedyOption, Pa, TransducerMask, abs_objective_func, greedy,};
let geometry = Geometry::new(vec![Autd3::default()]);
let mut dst = geometry.pattern_buffer();
greedy( &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), &GreedyOption { phase_quantization_levels: NonZeroU8::new(16).unwrap(), constraint: EmissionConstraint::Uniform(Intensity::MAX), directivity: Directivity::Sphere, objective_func: abs_objective_func, mask: TransducerMask::AllEnabled, }, &mut dst,)?;import numpy as npfrom autd3.geometry import Autd3, Geometryfrom autd3.units import m, sfrom autd3_pattern import wavelengthfrom autd3_pattern_holo import ( AmplitudeTarget, Directivity, EmissionConstraint, GreedyOption, Pa, TransducerMask, greedy,)
geometry = Geometry([Autd3([0.0, 0.0, 0.0], [1.0, 0.0, 0.0, 0.0])])
dst = geometry.pattern_buffer()
greedy( geometry, [ AmplitudeTarget( point=geometry.center() + np.array([-30.0, 0.0, 150.0]), amplitude=2.5e3 * Pa, ), AmplitudeTarget( point=geometry.center() + np.array([30.0, 0.0, 150.0]), amplitude=2.5e3 * Pa, ), ], wavelength(340 * m / s), GreedyOption( phase_quantization_levels=16, constraint=EmissionConstraint.Uniform(0xFF), directivity=Directivity.Sphere, mask=TransducerMask.AllEnabled, ), dst,)using System.Numerics;using AUTD3;using AUTD3.Holo;using static AUTD3.Units;using static AUTD3.Holo.HoloUnits;
var geometry = new Geometry(new[] { new Autd3(Vector3.Zero) });
var dst = geometry.PatternBuffer();
Holo.Greedy( geometry, new[] { new AmplitudeTarget(geometry.Center + new Vector3(-30.0f, 0.0f, 150.0f), 2.5e3f * Pa), new AmplitudeTarget(geometry.Center + new Vector3(30.0f, 0.0f, 150.0f), 2.5e3f * Pa), }, Pattern.Wavelength(340.0f * m / s), new GreedyOption( phaseQuantizationLevels: 16, constraint: EmissionConstraint.Uniform(Intensity.Max), directivity: Directivity.Sphere, mask: TransducerMask.AllEnabled ), dst);