MRArbGrad 4.4.0__tar.gz → 4.4.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. {mrarbgrad-4.4.0 → mrarbgrad-4.4.1}/LICENSE +1 -1
  2. mrarbgrad-4.4.1/MANIFEST.in +1 -0
  3. {mrarbgrad-4.4.0 → mrarbgrad-4.4.1/MRArbGrad.egg-info}/PKG-INFO +1 -1
  4. {mrarbgrad-4.4.0 → mrarbgrad-4.4.1}/MRArbGrad.egg-info/SOURCES.txt +4 -4
  5. {mrarbgrad-4.4.0/MRArbGrad.egg-info → mrarbgrad-4.4.1}/PKG-INFO +1 -1
  6. {mrarbgrad-4.4.0 → mrarbgrad-4.4.1}/mrarbgrad_src/__init__.py +1 -1
  7. mrarbgrad-4.4.1/mrarbgrad_src/__pycache__/Function.cpython-312.pyc +0 -0
  8. mrarbgrad-4.4.1/mrarbgrad_src/__pycache__/Utility.cpython-312.pyc +0 -0
  9. mrarbgrad-4.4.1/mrarbgrad_src/__pycache__/__init__.cpython-312.pyc +0 -0
  10. mrarbgrad-4.4.1/mrarbgrad_src/ext.cpython-312-x86_64-linux-gnu.so +0 -0
  11. {mrarbgrad-4.4.0 → mrarbgrad-4.4.1}/pyproject.toml +1 -1
  12. mrarbgrad-4.4.0/MANIFEST.in +0 -1
  13. mrarbgrad-4.4.0/example/example_BuiltInTraj.py +0 -105
  14. mrarbgrad-4.4.0/example/example_ExternalFunction2D.py +0 -80
  15. mrarbgrad-4.4.0/example/example_ExternalSamples2D.py +0 -84
  16. mrarbgrad-4.4.0/example/example_ExternalSamples3D.py +0 -72
  17. {mrarbgrad-4.4.0 → mrarbgrad-4.4.1}/MRArbGrad.egg-info/dependency_links.txt +0 -0
  18. {mrarbgrad-4.4.0 → mrarbgrad-4.4.1}/MRArbGrad.egg-info/requires.txt +0 -0
  19. {mrarbgrad-4.4.0 → mrarbgrad-4.4.1}/MRArbGrad.egg-info/top_level.txt +0 -0
  20. {mrarbgrad-4.4.0 → mrarbgrad-4.4.1}/README.md +0 -0
  21. {mrarbgrad-4.4.0 → mrarbgrad-4.4.1}/mrarbgrad_src/Function.py +0 -0
  22. {mrarbgrad-4.4.0 → mrarbgrad-4.4.1}/mrarbgrad_src/Utility.py +0 -0
  23. {mrarbgrad-4.4.0 → mrarbgrad-4.4.1}/mrarbgrad_src/ext/mag/Mag.cpp +0 -0
  24. {mrarbgrad-4.4.0 → mrarbgrad-4.4.1}/mrarbgrad_src/ext/mag/Mag.h +0 -0
  25. {mrarbgrad-4.4.0 → mrarbgrad-4.4.1}/mrarbgrad_src/ext/main.cpp +0 -0
  26. {mrarbgrad-4.4.0 → mrarbgrad-4.4.1}/mrarbgrad_src/ext/traj/Cones.h +0 -0
  27. {mrarbgrad-4.4.0 → mrarbgrad-4.4.1}/mrarbgrad_src/ext/traj/MrTraj.h +0 -0
  28. {mrarbgrad-4.4.0 → mrarbgrad-4.4.1}/mrarbgrad_src/ext/traj/MrTraj_2D.h +0 -0
  29. {mrarbgrad-4.4.0 → mrarbgrad-4.4.1}/mrarbgrad_src/ext/traj/Rosette.h +0 -0
  30. {mrarbgrad-4.4.0 → mrarbgrad-4.4.1}/mrarbgrad_src/ext/traj/Seiffert.h +0 -0
  31. {mrarbgrad-4.4.0 → mrarbgrad-4.4.1}/mrarbgrad_src/ext/traj/Shell3d.h +0 -0
  32. {mrarbgrad-4.4.0 → mrarbgrad-4.4.1}/mrarbgrad_src/ext/traj/Spiral.h +0 -0
  33. {mrarbgrad-4.4.0 → mrarbgrad-4.4.1}/mrarbgrad_src/ext/traj/TrajFunc.h +0 -0
  34. {mrarbgrad-4.4.0 → mrarbgrad-4.4.1}/mrarbgrad_src/ext/traj/VDSpiral.h +0 -0
  35. {mrarbgrad-4.4.0 → mrarbgrad-4.4.1}/mrarbgrad_src/ext/traj/Yarnball.h +0 -0
  36. {mrarbgrad-4.4.0 → mrarbgrad-4.4.1}/mrarbgrad_src/ext/utility/Intp.h +0 -0
  37. {mrarbgrad-4.4.0 → mrarbgrad-4.4.1}/mrarbgrad_src/ext/utility/LinIntp.h +0 -0
  38. {mrarbgrad-4.4.0 → mrarbgrad-4.4.1}/mrarbgrad_src/ext/utility/SplineIntp.h +0 -0
  39. {mrarbgrad-4.4.0 → mrarbgrad-4.4.1}/mrarbgrad_src/ext/utility/global.cpp +0 -0
  40. {mrarbgrad-4.4.0 → mrarbgrad-4.4.1}/mrarbgrad_src/ext/utility/global.h +0 -0
  41. {mrarbgrad-4.4.0 → mrarbgrad-4.4.1}/mrarbgrad_src/ext/utility/v3.cpp +0 -0
  42. {mrarbgrad-4.4.0 → mrarbgrad-4.4.1}/mrarbgrad_src/ext/utility/v3.h +0 -0
  43. {mrarbgrad-4.4.0 → mrarbgrad-4.4.1}/mrarbgrad_src/trajfunc/__init__.py +0 -0
  44. {mrarbgrad-4.4.0 → mrarbgrad-4.4.1}/mrarbgrad_src/trajfunc/main.py +0 -0
  45. {mrarbgrad-4.4.0 → mrarbgrad-4.4.1}/setup.cfg +0 -0
  46. {mrarbgrad-4.4.0 → mrarbgrad-4.4.1}/setup.py +0 -0
@@ -1,4 +1,4 @@
1
- Copyright 2025 Rui Luo
1
+ Copyright 2026 Rui Luo
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
4
 
@@ -0,0 +1 @@
1
+ graft mrarbgrad_src
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: MRArbGrad
3
- Version: 4.4.0
3
+ Version: 4.4.1
4
4
  Summary: Gradient waveform design tool for arbitrary k-space trajectories.
5
5
  Author-email: Ryan <ryan_shanghaitech@proton.me>
6
6
  License-Expression: MIT
@@ -12,13 +12,13 @@ MRArbGrad.egg-info/SOURCES.txt
12
12
  MRArbGrad.egg-info/dependency_links.txt
13
13
  MRArbGrad.egg-info/requires.txt
14
14
  MRArbGrad.egg-info/top_level.txt
15
- example/example_BuiltInTraj.py
16
- example/example_ExternalFunction2D.py
17
- example/example_ExternalSamples2D.py
18
- example/example_ExternalSamples3D.py
19
15
  mrarbgrad_src/Function.py
20
16
  mrarbgrad_src/Utility.py
21
17
  mrarbgrad_src/__init__.py
18
+ mrarbgrad_src/ext.cpython-312-x86_64-linux-gnu.so
19
+ mrarbgrad_src/__pycache__/Function.cpython-312.pyc
20
+ mrarbgrad_src/__pycache__/Utility.cpython-312.pyc
21
+ mrarbgrad_src/__pycache__/__init__.cpython-312.pyc
22
22
  mrarbgrad_src/ext/main.cpp
23
23
  mrarbgrad_src/ext/mag/Mag.cpp
24
24
  mrarbgrad_src/ext/mag/Mag.h
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: MRArbGrad
3
- Version: 4.4.0
3
+ Version: 4.4.1
4
4
  Summary: Gradient waveform design tool for arbitrary k-space trajectories.
5
5
  Author-email: Ryan <ryan_shanghaitech@proton.me>
6
6
  License-Expression: MIT
@@ -1,6 +1,6 @@
1
1
  from .Function import calGrad4ExFunc, calGrad4ExSamp
2
2
  from .Function import getG_Cones, getG_Rosette, getG_Rosette_Trad, getG_Seiffert, getG_Shell3d, getG_Spiral, getG_VDSpiral, getG_VDSpiral_RT, getG_Yarnball, getG_Yarnball_RT
3
3
  from .Function import setSolverMtg, setTrajRev, setGoldAng, setShuf, setMaxG0, setMaxG1, setMagGradSamp, setMagTrajSamp, setMagOverSamp, setMagSFS, setMagGradRep, setMagTrajRep, setDbgPrint, saveF64, loadF64, saveF32, loadF32
4
- from .Utility import _calDiaphony, rotate, _calJacElip, _calCompElipInt, _calSphFibPt, cvtGrad2Traj, getGoldang, getGoldrat, rand3d, gradClip, genPermTab
4
+ from .Utility import _calDiaphony, rotate, _calJacElip, _calCompElipInt, _calSphFibPt, cvtGrad2Traj, getGoldang, getGoldrat, rand3d, gradClip, genPermTab, unitcvt, getK_Cartesian, getK_Radial
5
5
 
6
6
  from . import trajfunc
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "MRArbGrad"
7
- version = "4.4.0"
7
+ version = "4.4.1"
8
8
  dependencies = ["numpy"]
9
9
 
10
10
  description = "Gradient waveform design tool for arbitrary k-space trajectories."
@@ -1 +0,0 @@
1
- global-include *.py *.c *.cpp *.h
@@ -1,105 +0,0 @@
1
- import mrarbgrad as mag
2
- from numpy import *
3
- from matplotlib.pyplot import *
4
- from numpy.linalg import norm
5
-
6
- gamma = 42.5756e6
7
- fov = 0.256
8
- nPix = 256
9
- dtGrad = 10e-6
10
- dtADC = 2.5e-6
11
- sLim = 50 * gamma * fov/nPix
12
- gLim = 20e-3 * gamma * fov/nPix
13
- # gLim = 1/nPix/dtADC
14
- argCom = dict(fov=fov, nPix=nPix, sLim=sLim, gLim=gLim, dt=dtGrad)
15
-
16
- mag.setSolverMtg(0) # set solver, 0 for proposed method, 1 for baseline method, baseline method may be removed due to copyright reason
17
- mag.setTrajRev(0) # reverse the trajectory
18
- mag.setGoldAng(1) # enable golden-angle interleaving (only for 2D)
19
- mag.setShuf(0) # enable TR-shuffling
20
- mag.setMaxG0(0) # use maximum possible initial gradient amplitude
21
- mag.setMaxG1(0) # use maximum possible final gradient amplitude
22
- mag.setMagOverSamp(8) # set oversampling ratio (default: 8, reduce only if hardware performance is too low to support real-time)
23
- mag.setMagSFS(0) # disable DTFBS (experimental)
24
- mag.setMagGradRep(1) # enable gradient reparameterization (experimental)
25
- mag.setMagTrajRep(1) # enable trajectory reparameterization (experimental)
26
- mag.setDbgPrint(1) # enable debug info (for benchmark purpose)
27
-
28
- # calculate gradient
29
- # lstArrK0, lstArrGrad = mag.getG_Spiral(**argCom); nAx = 2
30
- # lstArrK0, lstArrGrad = mag.getG_VDSpiral(**argCom); nAx = 2
31
- # lstArrK0, lstArrGrad = mag.getG_VDSpiral_RT(**argCom); nAx = 2
32
- # lstArrK0, lstArrGrad = mag.getG_Rosette(**argCom); nAx = 2
33
- # lstArrK0, lstArrGrad = mag.getG_Rosette_Trad(**argCom); nAx = 2
34
- # lstArrK0, lstArrGrad = mag.getG_Shell3d(**argCom); nAx = 3
35
- lstArrK0, lstArrGrad = mag.getG_Yarnball(**argCom); nAx = 3
36
- # lstArrK0, lstArrGrad = mag.getG_Seiffert(**argCom); nAx = 3
37
- # lstArrK0, lstArrGrad = mag.getG_Cones(**argCom); nAx = 3
38
-
39
- # lstArrGrad = mag.gradClip(lstArrGrad, dtGrad, sLim, gLim) # clip slew/grad amp with hardware constraint
40
-
41
- print("")
42
- print(f"Intlea Num.: {len(lstArrGrad)}")
43
- nRO_Max = amax([arrG.shape[0] for arrG in lstArrGrad])
44
- print(f"Tacq: {nRO_Max*dtGrad*1e3:.3f} ms")
45
- tTR = (nRO_Max*dtGrad + 2e-3)
46
- print(f"TR: {tTR*1e3:.3f} ms")
47
- tScan = tTR*len(lstArrGrad)
48
- print(f"Tscan: {tScan:.3e} s")
49
-
50
- # derive shape parameter
51
- if nAx==2:
52
- lstArrK0 = [arrK0[:2] for arrK0 in lstArrK0]
53
- lstArrGrad = [arrG[:,:2] for arrG in lstArrGrad]
54
- nRO, nAx = lstArrGrad[0].shape
55
-
56
- # derive slewrate
57
- lstArrSlew = [diff(arrG, axis=0)/dtGrad for arrG in lstArrGrad]
58
- sMax = max(norm(concatenate(lstArrSlew)/gamma*nPix/fov, axis=-1))
59
- gMax = max(norm(concatenate(lstArrGrad)/gamma*nPix/fov, axis=-1))
60
-
61
- # derive trajectory
62
- lstArrK = []
63
- for arrK0, arrGrad in zip(lstArrK0, lstArrGrad):
64
- arrK, _ = mag.cvtGrad2Traj(arrGrad, dtGrad, dtADC)
65
- arrK += arrK0
66
- lstArrK.append(arrK)
67
-
68
- iArrK = len(lstArrK)*2//3
69
-
70
- # k-space and g-space
71
- figure(figsize=(18,9), dpi=120)
72
-
73
- subplot(221, projection="3d" if nAx==3 else None)
74
- plot(*lstArrK[iArrK].T, ".-")
75
- axis("equal")
76
- grid("on")
77
- title(f"kspace {1}/{len(lstArrGrad)}")
78
-
79
- subplot(223, projection="3d" if nAx==3 else None)
80
- plot(*lstArrGrad[iArrK].T, ".-")
81
- axis("equal")
82
- grid("on")
83
- title("gspace")
84
-
85
- # gradient and slewrate
86
- subplot(222)
87
- for iAx in range(nAx):
88
- plot(lstArrGrad[iArrK][:,iAx]/gamma*nPix/fov, ".-")
89
- grid("on")
90
- title(f"Gradient")
91
-
92
- subplot(224)
93
- plot(norm(lstArrSlew[iArrK],axis=-1)/gamma*nPix/fov, ".-", c="tab:blue")
94
- ylim(sLim/gamma*nPix/fov*0.9, sLim/gamma*nPix/fov*1.1)
95
- grid("on")
96
-
97
- twinx()
98
- plot(norm(lstArrGrad[iArrK],axis=-1)/gamma*nPix/fov*1e3, ".-", c="tab:orange")
99
- ylim(gLim/gamma*nPix/fov*0.9*1e3, gLim/gamma*nPix/fov*1.1*1e3)
100
- grid("on")
101
- title(f"Grad & Slew amp., max grad:{gMax*1e3:.3f}, max slew:{sMax:.3f}")
102
-
103
- subplots_adjust(0.05,0.1,0.95,0.9, 0.2, 0.2)
104
-
105
- show()
@@ -1,80 +0,0 @@
1
- from numpy import *
2
- from numpy.linalg import norm
3
- from matplotlib.pyplot import *
4
- import mrarbgrad as mag
5
-
6
- gamma = 42.5756e6
7
- fov = 0.256
8
- nPix = 256
9
- dtGrad = 10e-6
10
- dtADC = 1e-6
11
- sLim = 50 * gamma * fov/nPix
12
- gLim = 20e-3 * gamma * fov/nPix
13
- # gLim = 1/nPix/dtADC
14
-
15
- # Rosette
16
- nAx = 2
17
- om1 = 19*pi
18
- om2 = 17*pi
19
- def Rosette(t):
20
- rho = 0.5*sin(om1*t)
21
- return array\
22
- ([
23
- rho*cos(om2*t),
24
- rho*sin(om2*t),
25
- 0*t
26
- ])
27
-
28
- pLim = [0,1]
29
-
30
- # derive slew-rate constrained trajectory
31
- mag.setMaxG0(0)
32
- mag.setMaxG1(0)
33
- arrGrad = mag.calGrad4ExFunc(fov, nPix, sLim, gLim, dtGrad, Rosette, None, None, pLim[0], pLim[1])[0]
34
- # arrGrad = mag.gradClip(arrGrad, dtGrad, sLim, gLim) # clip slew/grad amp with hardware constraint
35
- nRO = arrGrad.shape[0]
36
-
37
- arrSlew = diff(arrGrad, axis=0)/dtGrad
38
- print(f"sMax: {max(norm(arrSlew,axis=-1))/(42.58e6)*(nPix/fov)}")
39
-
40
- arrK = mag.cvtGrad2Traj(arrGrad, dtGrad, dtADC, 0.5)[0]
41
-
42
- # derive reference trajectory
43
- arrP_Ref = linspace(pLim[0], pLim[1], int(1e4))
44
- arrK_Ref = Rosette(arrP_Ref).T
45
-
46
- # plot
47
- figure(figsize=(20,10), dpi=120)
48
-
49
- subplot(221, projection=None if nAx==2 else "3d")
50
- if nAx==2: plot(arrK_Ref[:,0], arrK_Ref[:,1], "--", label="K_Ref")
51
- if nAx==3: plot(arrK_Ref[:,0], arrK_Ref[:,1], arrK_Ref[:,2], "--", label="K_Ref")
52
- if nAx==2: plot(arrK[:,0], arrK[:,1], ".-", label="K_Imp")
53
- if nAx==3: plot(arrK[:,0], arrK[:,1], arrK[:,2], ".-", label="K_Imp")
54
- xlim(-0.5,0.5)
55
- ylim(-0.5,0.5)
56
- axis("equal")
57
- grid("on")
58
- legend()
59
- title("k-Space")
60
-
61
- subplot(222)
62
- for iAx in range(nAx):
63
- plot(arrGrad[:,iAx]/(42.58e6)*(nPix/fov), ".-")
64
- grid("on")
65
- title("Gradient")
66
-
67
- subplot(223, projection=None if nAx==2 else "3d")
68
- if nAx==2: plot(arrGrad[:,0], arrGrad[:,1], ".-")
69
- if nAx==3: plot(arrGrad[:,0], arrGrad[:,1], arrGrad[:,2], ".-")
70
- axis("equal")
71
- grid("on")
72
- title("g-Space")
73
-
74
- subplot(224)
75
- plot(norm(arrSlew,axis=-1)/(42.58e6)*(nPix/fov), ".-")
76
- ylim(sLim/(42.58e6)*(nPix/fov)*0.9, sLim/(42.58e6)*(nPix/fov)*1.1)
77
- grid("on")
78
- title(f"Slewrate, max:{max(norm(arrSlew,axis=-1))/(42.58e6)*(nPix/fov):.3f}")
79
-
80
- show()
@@ -1,84 +0,0 @@
1
- from numpy import *
2
- from numpy.linalg import norm
3
- from matplotlib.pyplot import *
4
- import mrarbgrad as mag
5
-
6
- gamma = 42.5756e6
7
- fov = 0.256
8
- nPix = 256
9
- dtGrad = 10e-6
10
- dtADC = 2.5e-6
11
- sLim = 50 * gamma * fov/nPix
12
- gLim = 20e-3 * gamma * fov/nPix
13
- # gLim = 1/nPix/dtADC
14
-
15
- # Rosette
16
- om1 = 5*pi
17
- om2 = 3*pi
18
- pLim = [0,1]
19
- def TrajFunc(t):
20
- rho = 0.5*sin(om1*t)
21
- return array\
22
- ([
23
- rho*cos(om2*t),
24
- rho*sin(om2*t),
25
- zeros_like(t)
26
- ])
27
-
28
- # sample
29
- arrP = linspace(pLim[0], pLim[1], 1000)
30
- arrK = TrajFunc(arrP).T
31
- nAx = 2
32
-
33
- # derive slew-rate constrained trajectory
34
- for i in range(1):
35
- arrGrad = mag.calGrad4ExSamp(fov, nPix, sLim, gLim, dtGrad, arrK)[0]
36
- # arrGrad = mag.gradClip(arrGrad, dtGrad, sLim, gLim) # clip slew/grad amp with hardware constraint
37
- nRO = arrGrad.shape[0]
38
-
39
- arrSlew = diff(arrGrad, axis=0)/dtGrad
40
- print(f"sMax: {max(norm(arrSlew,axis=-1))/(42.58e6)*(nPix/fov)}")
41
-
42
- arrK, _ = mag.cvtGrad2Traj(arrGrad, dtGrad, dtADC, 0.5)
43
- arrK += TrajFunc(pLim[0])
44
- print(f"Err: {norm(arrK[-1,:]-TrajFunc(pLim[1])):.1e}")
45
-
46
- # derive reference trajectory
47
- arrP_Ref = linspace(pLim[0], pLim[1], int(1e4))
48
- arrK_Ref = TrajFunc(arrP_Ref).T
49
-
50
- # plot
51
- figure(figsize=(20,10), dpi=120)
52
-
53
- subplot(221, projection=None if nAx==2 else "3d")
54
- if nAx==2: plot(arrK_Ref[:,0], arrK_Ref[:,1], "--", label="K_Ref")
55
- if nAx==3: plot(arrK_Ref[:,0], arrK_Ref[:,1], arrK_Ref[:,2], "--", label="K_Ref")
56
- if nAx==2: plot(arrK[:,0], arrK[:,1], ".-", label="K_Imp")
57
- if nAx==3: plot(arrK[:,0], arrK[:,1], arrK[:,2], ".-", label="K_Imp")
58
- xlim(-0.5,0.5)
59
- ylim(-0.5,0.5)
60
- axis("equal")
61
- grid("on")
62
- legend()
63
- title("k-Space")
64
-
65
- subplot(222)
66
- for iAx in range(nAx):
67
- plot(arrGrad[:,iAx]/(42.58e6)*(nPix/fov), ".-")
68
- grid("on")
69
- title("Gradient")
70
-
71
- subplot(223, projection=None if nAx==2 else "3d")
72
- if nAx==2: plot(arrGrad[:,0], arrGrad[:,1], ".-")
73
- if nAx==3: plot(arrGrad[:,0], arrGrad[:,1], arrGrad[:,2], ".-")
74
- axis("equal")
75
- grid("on")
76
- title("g-Space")
77
-
78
- subplot(224)
79
- plot(norm(arrSlew,axis=-1)/(42.58e6)*(nPix/fov), ".-")
80
- ylim(sLim/(42.58e6)*(nPix/fov)*0.9, sLim/(42.58e6)*(nPix/fov)*1.1)
81
- grid("on")
82
- title(f"Slewrate, max:{max(norm(arrSlew,axis=-1))/(42.58e6)*(nPix/fov):.3f}")
83
-
84
- show()
@@ -1,72 +0,0 @@
1
- from numpy import *
2
- from numpy.linalg import norm
3
- from matplotlib.pyplot import *
4
- import mrarbgrad as mag
5
-
6
- gamma = 42.5756e6
7
- fov = 0.256
8
- nPix = 256
9
- dtGrad = 10e-6
10
- dtADC = 2.5e-6
11
- sLim = 50 * gamma * fov/nPix
12
- gLim = 20e-3 * gamma * fov/nPix
13
- # gLim = 1/nPix/dtADC
14
-
15
- # Yarnball
16
- nAx = 3
17
-
18
- kRhoPhi = 0.5/(2*pi)
19
- Yarnball = lambda sqrtTht: mag.trajfunc.Yarnball(sqrtTht, kRhoPhi)
20
- pLim = mag.trajfunc.prange_Yarnball(kRhoPhi)
21
-
22
- arrP = linspace(pLim[0], pLim[1], 1000)
23
- arrK = Yarnball(arrP)
24
-
25
- # derive slew-rate constrained trajectory
26
- mag.setDbgPrint(1)
27
- arrGrad = mag.calGrad4ExSamp(fov, nPix, sLim, gLim, dtGrad, arrK)[0]
28
- # arrGrad = mag.gradClip(arrGrad, dtGrad, sLim, gLim) # clip slew/grad amp with hardware constraint
29
- nRO = arrGrad.shape[0]
30
-
31
- arrSlew = diff(arrGrad, axis=0)/dtGrad
32
- print(f"sMax: {max(norm(arrSlew,axis=-1))/(42.58e6)*(nPix/fov)}")
33
-
34
- arrK, _ = mag.cvtGrad2Traj(arrGrad, dtGrad, dtADC, 0.5)
35
-
36
- # derive reference trajectory
37
- arrP_Ref = linspace(pLim[0], pLim[1], int(1e4))
38
- arrK_Ref = Yarnball(arrP_Ref)
39
-
40
- # plot
41
- figure(figsize=(20,10), dpi=120)
42
-
43
- subplot(221, projection="3d")
44
- plot(arrK_Ref[:,0], arrK_Ref[:,1], arrK_Ref[:,2], "--", label="K_Ref")
45
- plot(arrK[:,0], arrK[:,1], arrK[:,2], ".-", label="K_Imp")
46
- xlim(-0.5,0.5)
47
- ylim(-0.5,0.5)
48
- axis("equal")
49
- grid("on")
50
- legend()
51
- title("k-Space")
52
-
53
- subplot(222)
54
- for iAx in range(nAx):
55
- plot(arrGrad[:,iAx]/(42.58e6)*(nPix/fov), ".-")
56
- grid("on")
57
- title("Gradient")
58
-
59
- subplot(223, projection=None if nAx==2 else "3d")
60
- if nAx==2: plot(arrGrad[:,0], arrGrad[:,1], ".-")
61
- if nAx==3: plot(arrGrad[:,0], arrGrad[:,1], arrGrad[:,2], ".-")
62
- axis("equal")
63
- grid("on")
64
- title("g-Space")
65
-
66
- subplot(224)
67
- plot(norm(arrSlew,axis=-1)/(42.58e6)*(nPix/fov), ".-")
68
- ylim(sLim/(42.58e6)*(nPix/fov)*0.9, sLim/(42.58e6)*(nPix/fov)*1.1)
69
- grid("on")
70
- title(f"Slewrate, max:{max(norm(arrSlew,axis=-1))/(42.58e6)*(nPix/fov):.3f}")
71
-
72
- show()
File without changes
File without changes
File without changes