Skip to content

Commit 5de4bf3

Browse files
committed
Better looking derivative figure
1 parent cd4edfd commit 5de4bf3

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

examples/scripts/02-derivatives.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def crlb_finitediff_cost(flip, ESP, T1, T2):
7777
t1 = 1000.0
7878
t2 = 100.0
7979

80-
angles = np.ones(60, dtype=np.float32) * 120.0
80+
angles = np.concatenate((np.linspace(0, 180.0, 36), np.ones(60, dtype=np.float32) * 180.0))
8181
esp = 5.0
8282

8383
# run
@@ -104,21 +104,21 @@ def crlb_finitediff_cost(flip, ESP, T1, T2):
104104
tcost = t1 - t0
105105

106106
# plot derivative
107-
#%%
107+
#%%plots
108108
fsz = 20
109109
plt.figure()
110110
plt.subplot(2,2,1)
111111
plt.rcParams.update({'font.size': 0.5 * fsz})
112112
plt.plot(angles, '.')
113113
plt.xlabel("Echo #", fontsize=fsz)
114-
plt.xlim([-1, 51])
114+
plt.xlim([-1, 97])
115115
plt.ylabel("Flip Angle [deg]", fontsize=fsz)
116116

117117
plt.subplot(2,2,2)
118118
plt.rcParams.update({'font.size': 0.5 * fsz})
119119
plt.plot(abs(grad), '-k'), plt.plot(abs(grad0), '*r')
120120
plt.xlabel("Echo #", fontsize=fsz)
121-
plt.xlim([-1, 51])
121+
plt.xlim([-1, 97])
122122
plt.ylabel(r"$\frac{\partial signal}{\partial T2}$ [a.u.]", fontsize=fsz)
123123
plt.legend(["Finite Diff", "Auto Diff"])
124124

@@ -127,7 +127,7 @@ def crlb_finitediff_cost(flip, ESP, T1, T2):
127127
plt.rcParams.update({'font.size': 0.5 * fsz})
128128
plt.plot(abs(dcost), '-k'), plt.plot(abs(dcost0), '*r')
129129
plt.xlabel("Echo #", fontsize=fsz)
130-
plt.xlim([-1, 51])
130+
plt.xlim([-1, 97])
131131
plt.ylabel(r"$\frac{\partial CRLB}{\partial FA}$ [a.u.]", fontsize=fsz)
132132
plt.legend(["Finite Diff", "Auto Diff"])
133133

@@ -148,7 +148,7 @@ def crlb_finitediff_cost(flip, ESP, T1, T2):
148148
# Add some text for labels, title and custom x-axis tick labels, etc.
149149
plt.ylabel('Execution Time [s]', fontsize=fsz)
150150
plt.xticks(x, labels, fontsize=fsz)
151-
plt.ylim([0, 25])
151+
# plt.ylim([0, 25])
152152
plt.legend()
153153

154154
plt.bar_label(rects1, padding=3, fontsize=fsz)

0 commit comments

Comments
 (0)