@@ -104,18 +104,53 @@ def crlb_finitediff_cost(flip, ESP, T1, T2):
104104tcost = t1 - t0
105105
106106# plot derivative
107+ #%%
108+ fsz = 20
107109plt .figure ()
108- plt .rcParams .update ({'font.size' : 22 })
110+ plt .subplot (2 ,2 ,1 )
111+ plt .rcParams .update ({'font.size' : 0.5 * fsz })
112+ plt .plot (angles , '.' )
113+ plt .xlabel ("Echo #" , fontsize = fsz )
114+ plt .xlim ([- 1 , 51 ])
115+ plt .ylabel ("Flip Angle [deg]" , fontsize = fsz )
116+
117+ plt .subplot (2 ,2 ,2 )
118+ plt .rcParams .update ({'font.size' : 0.5 * fsz })
109119plt .plot (abs (grad ), '-k' ), plt .plot (abs (grad0 ), '*r' )
110- plt .xlabel ("Echo #" , fontsize = 40 )
120+ plt .xlabel ("Echo #" , fontsize = fsz )
111121plt .xlim ([- 1 , 51 ])
112- plt .ylabel (r"$\frac{\partial signal}{\partial T2}$ [a.u.]" , fontsize = 40 )
122+ plt .ylabel (r"$\frac{\partial signal}{\partial T2}$ [a.u.]" , fontsize = fsz )
113123plt .legend (["Finite Diff" , "Auto Diff" ])
114124
115- plt .figure ()
116- plt .rcParams .update ({'font.size' : 22 })
125+
126+ plt .subplot (2 ,2 ,3 )
127+ plt .rcParams .update ({'font.size' : 0.5 * fsz })
117128plt .plot (abs (dcost ), '-k' ), plt .plot (abs (dcost0 ), '*r' )
118- plt .xlabel ("Echo #" , fontsize = 40 )
129+ plt .xlabel ("Echo #" , fontsize = fsz )
119130plt .xlim ([- 1 , 51 ])
120- plt .ylabel (r"$\frac{\partial CRLB}{\partial FA}$ [a.u.]" , fontsize = 40 )
121- plt .legend (["Finite Diff" , "Auto Diff" ])
131+ plt .ylabel (r"$\frac{\partial CRLB}{\partial FA}$ [a.u.]" , fontsize = fsz )
132+ plt .legend (["Finite Diff" , "Auto Diff" ])
133+
134+ plt .subplot (2 ,2 ,4 )
135+
136+ # define labels
137+ # plot results
138+ labels = ['derivative of signal' , 'CRLB objective gradient' ]
139+ time_finite = [round (tgrad0 , 2 ), round (tcost0 , 2 )]
140+ time_auto = [round (tgrad , 2 ), round (tcost , 2 )]
141+
142+
143+ x = np .arange (len (labels )) # the label locations
144+ width = 0.35 # the width of the bars
145+ rects1 = plt .bar (x + width / 2 , time_finite , width , label = 'Finite Diff' )
146+ rects2 = plt .bar (x - width / 2 , time_auto , width , label = 'Auto Diff' )
147+
148+ # Add some text for labels, title and custom x-axis tick labels, etc.
149+ plt .ylabel ('Execution Time [s]' , fontsize = fsz )
150+ plt .xticks (x , labels , fontsize = fsz )
151+ plt .ylim ([0 , 25 ])
152+ plt .legend ()
153+
154+ plt .bar_label (rects1 , padding = 3 , fontsize = fsz )
155+ plt .bar_label (rects2 , padding = 3 , fontsize = fsz )
156+
0 commit comments