Skip to content

Commit 3e8dbd6

Browse files
authored
Merge pull request creatis-ULTIM#39 from dribalta/feature/PyMUST3D
Fixed comments and structure
2 parents 357e208 + 2a46953 commit 3e8dbd6

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

src/pymust/dasmtx3.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,12 +305,12 @@ def dasmtx3(SIG: np.ndarray, x: np.ndarray, y: np.ndarray, z: np.ndarray, *varar
305305
# zTi =np.zeros_like(idx)
306306
# delaysTXi = delaysTX[idx]
307307

308-
# DR : The current MUST (and PyMUST) implementation doesn't calculate the f-number (f-number is converted to [0,0] if None)
308+
309309
#-- f-number (determined automatically if not given)
310310
# The f-number is determined from the element directivity
311311
# See the paper "So you think you can DAS?"
312312
if param.get('fnumber', None) is None:
313-
param.fnumber = np.array([0, 0]) # Initialize f-number
313+
param.fnumber = np.array([0, 0], dtype=np.float32) # Initialize f-number
314314
lambdaMIN = c/(param.fc*(1+param.bandwidth/200))
315315
RXa = abs(param.RXangle)
316316
# Note: in Matlab, sinc(x) = sin(pi*x)/(pi*x)
@@ -406,7 +406,7 @@ def dasmtx3(SIG: np.ndarray, x: np.ndarray, y: np.ndarray, z: np.ndarray, *varar
406406
#-- Aperture (using the f-number):
407407
if (fNum != 0).any():
408408
#-- for a planar array
409-
Iaperture = np.logical_and(np.abs(dxT)<=(np.abs(dzT)*fNum[0]),np.abs(dyT)<=(np.abs(dzT)*fNum[1]))
409+
Iaperture = np.logical_and(np.abs(dxT)<=(np.abs(dzT)/2/fNum[0]),np.abs(dyT)<=(np.abs(dzT)/2/fNum[1]))
410410
I = np.logical_and(I,Iaperture)
411411

412412
dxT, dyT, dzT = None, None, None # clear dxT dyT dzT

src/pymust/pfield3.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ def pfield3(x: np.ndarray, y: np.ndarray, z: np.ndarray, delaysTX: np.ndarray, p
8989
and 2nd rows containing the x and y coordinates, respectively.
9090
3) PARAM.width: element width, in the x-direction (in m, REQUIRED)
9191
4) PARAM.height: element height, in the y-direction (in m, REQUIRED)
92-
5) PARAM.bandwidth: pulse-echo 6dB fractional bandwidth (in #)
93-
The default is 75#.
92+
5) PARAM.bandwidth: pulse-echo 6dB fractional bandwidth (in %)
93+
The default is 75%.
9494
6) PARAM.baffle: property of the baffle:
9595
'soft' (default), 'rigid', or a scalar > 0.
9696
See "Note on BAFFLE properties" below for details
@@ -282,7 +282,7 @@ def pfield3(x: np.ndarray, y: np.ndarray, z: np.ndarray, delaysTX: np.ndarray, p
282282
#-- 5) Fractional bandwidth at -6dB (in %)
283283
if 'bandwidth' not in param:
284284
param.bandwidth = 75
285-
assert param.bandwidth>0 and param.bandwidth<200, 'The fractional bandwidth at -6 dB (PARAM.bandwidth, in %) must be in ]0,200[' #DR : is this a typo ]0,200[ or [0,200] ?
285+
assert param.bandwidth>0 and param.bandwidth<200, 'The fractional bandwidth at -6 dB (PARAM.bandwidth, in %) must be in ]0,200['
286286

287287
#-- 6) Baffle
288288
# An obliquity factor will be used if the baffle is not rigid
@@ -342,6 +342,10 @@ def pfield3(x: np.ndarray, y: np.ndarray, z: np.ndarray, delaysTX: np.ndarray, p
342342
FreqSweep = param.TXfreqsweep
343343
assert FreqSweep is None or (np.isscalar(FreqSweep) and utils.isnumeric(FreqSweep) and FreqSweep>0), 'PARAM.TXfreqsweep must be empty (windowed sine) or a positive scalar (linear chirp).'
344344

345+
# DR: Possibly add explanation of casting RC to single precision
346+
if options.RC is not None and len(options.RC):
347+
options.RC = options.RC.astype(np.float32)
348+
345349
#%----------------------------------%
346350
#% END of Check the PARAM structure %
347351
#%----------------------------------%
@@ -594,9 +598,6 @@ def pfield3(x: np.ndarray, y: np.ndarray, z: np.ndarray, delaysTX: np.ndarray, p
594598
#-- We replace EXP by EXP*ObliFac/r
595599
EXP = EXP*ObliFac/r
596600

597-
if options.RC is not None and len(options.RC): #DR : shouldn't this be checked at the "Check the OPTIONS structure"
598-
options.RC = options.RC.astype(np.float32)
599-
600601
#-- TX apodization
601602
APOD = param.TXapodization.flatten(order='F')
602603

@@ -641,9 +642,9 @@ def pfield3(x: np.ndarray, y: np.ndarray, z: np.ndarray, delaysTX: np.ndarray, p
641642
DIR = DIRx*DIRy
642643

643644
#-- Radiation patterns of the single elements
644-
# They are the combination of the far-field patterns of the M small
645+
# They are the combination of the far-field patterns of the M*N small
645646
# segments that make up the single elements
646-
#-- DR : combine M*N small segments?
647+
#--
647648
if isFFD: # isFFD = true -> frequency-dependent directivity
648649
#TODO: CHECK THIS IS CORRECT
649650
RPmono = average_over_last_axis(DIR*EXP) # summation over the M*N small segments

0 commit comments

Comments
 (0)