Skip to content

Commit 051458d

Browse files
authored
Merge pull request creatis-ULTIM#43 from creatis-ULTIM/gbernardino-devel
Allow 1D arrays as input to dasmtx
2 parents 3e8dbd6 + df63e11 commit 051458d

File tree

11 files changed

+328
-259
lines changed

11 files changed

+328
-259
lines changed

examples/DW_echo_demo.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@
509509
"metadata": {},
510510
"outputs": [],
511511
"source": [
512-
"xi,zi = pymust.impolgrid(np.array([256, 128]),15e-2,np.deg2rad(80), param)"
512+
"xi,zi = pymust.impolgrid(np.array([256, 128]),15e-2,np.deg2rad(80), param)\n"
513513
]
514514
},
515515
{

src/pymust/dasmtx.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,9 @@ def dasmtx(SIG: np.ndarray, x: np.ndarray, z: np.ndarray, *varargin) -> scipy.sp
332332

333333

334334
#%-- Number of elements
335+
assert isinstance(delaysTX,np.ndarray), 'delaysTX must be a numpy array.'
336+
if len(delaysTX.shape) == 1:
337+
delaysTX = delaysTX.reshape((1, -1))
335338
if delaysTX.shape[0] == nc and delaysTX.shape[1] != nc:
336339
delaysTX = delaysTX.T
337340

src/pymust/dasmtx3.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from __future__ import annotations
12
import numpy as np
23
import scipy, scipy.interpolate
34
from . import utils

src/pymust/pfield.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ def pfield(x: np.ndarray, y: np.ndarray, z: np.ndarray, delaysTX: np.ndarray, pa
256256
isMKMOVIE = options.CallFun == 'mkmovie'
257257

258258
#GB: TODO: do parallelism
259-
#GB TODO: For txhe moment no statistics.
259+
#GB TODO: For the moment no statistics of usage.
260260

261261

262262
#%---------------------------%

tutorials/Figures/s1_ex1.png

7.81 KB
Loading

tutorials/P1_radiofrequency.ipynb

Lines changed: 35 additions & 12 deletions
Large diffs are not rendered by default.

tutorials/P2_several_elements_new.ipynb

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
},
3737
{
3838
"cell_type": "code",
39-
"execution_count": 9,
39+
"execution_count": 13,
4040
"metadata": {},
4141
"outputs": [],
4242
"source": [
@@ -56,13 +56,22 @@
5656
"\n",
5757
"### Execise 2.1: Pressure field\n",
5858
"\n",
59-
"1. Execute the code to generate the pressure field for a linear wave without a tilt. Place two points at regions which are at the same distance but the center of the probe, but recieve different energy.\n",
59+
"1. Execute the code to generate the pressure field for a linear wave without a tilt. Place two points at regions which are at the same distance to the center of the probe, but receive different energy.\n",
6060
"\n",
6161
"1. Use two times simus in order to get the RF associated to each point chosen in the previous exercise. What do you observe? [Note: now the probe involves many piezoelectrical elements, and as such the RF signal will have a channel for each. Now you can use the center element (channel #31)]\n",
6262
"\n",
6363
"1. Add attenuation of 0.5dB/cm. What do you observe in the pressure field and why?"
6464
]
6565
},
66+
{
67+
"cell_type": "code",
68+
"execution_count": null,
69+
"metadata": {},
70+
"outputs": [],
71+
"source": [
72+
"!pip install pymust --upgrade"
73+
]
74+
},
6675
{
6776
"cell_type": "code",
6877
"execution_count": null,
@@ -99,7 +108,7 @@
99108
},
100109
{
101110
"cell_type": "code",
102-
"execution_count": 11,
111+
"execution_count": null,
103112
"metadata": {},
104113
"outputs": [
105114
{
@@ -131,7 +140,7 @@
131140
}
132141
],
133142
"source": [
134-
"plt.imshow(20*np.log10(P.T/np.max(P)),\n",
143+
"plt.imshow(20*np.log10(P/np.max(P)),\n",
135144
" cmap='hot',\n",
136145
" extent=[xGrid[0,0]*1e2,xGrid[0,-1]*1e2,zGrid[-1,0]*1e2,zGrid[0,0]*1e2],aspect='auto')\n",
137146
"plt.colorbar()\n",
@@ -279,13 +288,18 @@
279288
" param.width *= factor\n",
280289
" param.pitch *= factor\n",
281290
" param.kerf *= factor\n",
291+
" if 'TXapodization' in param:\n",
292+
" del param['TXapodization']\n",
282293
" return param\n",
283294
"\n",
284295
"def changeNumberOfElements(param, factor):\n",
285296
" \"\"\"\n",
286297
" Scale the number of piezoelectrical elements to 1\n",
287298
" \"\"\"\n",
288-
" param.Nelements *= int(factor)\n",
299+
" param.Nelements = int(param.Nelements*factor)\n",
300+
" if 'TXapodization' in param:\n",
301+
" del param['TXapodization']\n",
302+
"\n",
289303
" return param\n",
290304
"\n",
291305
"\n",
@@ -350,7 +364,7 @@
350364
],
351365
"metadata": {
352366
"kernelspec": {
353-
"display_name": "pymust",
367+
"display_name": "pymust-test",
354368
"language": "python",
355369
"name": "python3"
356370
},
@@ -364,7 +378,7 @@
364378
"name": "python",
365379
"nbconvert_exporter": "python",
366380
"pygments_lexer": "ipython3",
367-
"version": "3.11.4"
381+
"version": "3.12.3"
368382
},
369383
"orig_nbformat": 4
370384
},

tutorials/P3_bmode.ipynb

Lines changed: 65 additions & 112 deletions
Large diffs are not rendered by default.

tutorials/P4_different_probes.ipynb

Lines changed: 129 additions & 77 deletions
Large diffs are not rendered by default.

tutorials/P5_Doppler.ipynb

Lines changed: 53 additions & 23 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)