
198 # (a) Ener gy densit y
199 ax = axes [0 , 0]
200 vp = valid & ( rho > 0)
201 ax . l og log ( r_c [ vp ] , rho [ vp ], ’o ’ , col or = c_data , ms =4.5 , mew =0 ,
202 alpha =0.85 , la be l = ’ FCC la tt ice ( m eas ured ) ’)
203 if n_rho is not None :
204 ax . loglog ( r_th , np . exp ( A_rho ) * r_th ** n_rho , ’ - ’ , c olor = c_fit ,
205 lw =2 , label =r ’ Best fit : $ \ rho \ propto r ^{%. 2 f}$ ’ % n_rho )
206 C_ ref = rho [ vp ][ len ( rho [ vp ]) // 3] * r_c [ vp ][ len ( r_c [ vp ]) // 3 ]* *2
207 ax . loglog ( r_th , C _ref / r_th **2 , ’ -- ’ , col or = c_theory , lw =1.5 ,
208 alpha =0.6 , label =r ’ A nal y ti c al : $\ rho \ pro pto r ^{ -2} $ ’)
209 ax . set_ x lab el (r ’ Dist anc e from d islo cat ion core $r / a$ ’)
210 ax . set_ y lab el (r ’ Strain e ne rg y d en sity $ \ rho (r ) $ ’)
211 ax . set_ tit le (r ’(a) Energy Den sity : $\ rho \ pro pt o r ^{%.2 f}$ ’ % n_rho , fon tsi ze =12)
212 ax . l eg end ( fonts ize =9 , f ram eal p ha =0.9)
213 ax . grid ( True , alp ha =0.2 , wh ich = ’ both ’)
214 ax . text (0.03 , 0.03 , r ’ T heory : $ \ rho = \ frac {\ mu b ^2}{8\ pi ^2 r ^2} $ ’ ,
215 tra nsf orm = ax . trans Axes , f ont size =10 , va = ’ bot to m ’ ,
216 bbox = dict ( box sty le = ’ round , pad =0.3 ’, f ace col or = ’ whe at ’, alpha =0 .5 ) )
217
218 # (b) En clo sed mass
219 ax = axes [0 , 1]
220 fit_M = v al id & ( M_enc > 0)
221 ax . l og log ( r_c [ f it_M ] , M_en c [ fit _M ] , ’o ’, color = c_data , ms =4.5 ,
222 mew =0 , alph a =0.85 , l ab el = r ’$M_ {\ m at hr m { halo }}( r ) $ ’)
223 if n_M is not None :
224 ax . loglog ( r_th , np . exp ( A_M ) * r_th ** n_M , ’- ’ , co lor = c_fit ,
225 lw =2 , label =r ’ Best fit : $M \ prop to r ^{%.2 f } $ ’ % n_M )
226 M_ lin = np . exp ( A_M ) * r_th [ len ( r_th ) // 2] ** n_M * ( r_th / r_ th [ len ( r_th ) //2])
227 ax . loglog ( r_th , M_lin , ’ -- ’ , color = c_theory , lw =1.5 , alpha =0.6 ,
228 label = r ’ Theo ry : $M \ propt o r$ ’)
229 ax . set_ x lab el (r ’ Radius $r / a$ ’)
230 ax . set_ y lab el (r ’ Encl ose d dark mass $M_ {\ math rm { halo }}( r) $ ’)
231 ax . set_ tit le (r ’(b) En clo se d Mass : $M \ pr op to r ^{%.2 f } $ ’ % n_M , fon tsi ze =12)
232 ax . l eg end ( fonts ize =9 , f ram eal p ha =0.9)
233 ax . grid ( True , alp ha =0.2 , wh ich = ’ both ’)
234
235 # (c) Ro tat ion c ur ve
236 ax = axes [1 , 0]
237 v_max = np . max ( v_rot [ valid ])
238 v_norm = v _r ot / v _max
239 vv = valid & ( v_n orm > 0)
240 ax . plot ( r_c [ vv ] , v _norm [ vv ], ’o - ’ , col or = c_data , ms =4 , lw =1.5 ,
241 label =r ’$v ( r ) $ from t ors ion al halo ’)
242 v_ ou ter = v_norm [ vv ][ len ( v_ no rm [ vv ]) // 3:]
243 v_fl = np . mean ( v_ outer )
244 fl atn ess = np . std ( v_ outer ) / v_fl * 100
245 ax . a xhlin e ( v_fl , c ol or = c_fit , ls = ’ -- ’, lw =1.5 , a lpha =0.7 ,
246 label = r ’ Flat : $v / v_ {\ mathrm { max }} = %.2 f$ ’ % v_fl )
247 r_kep = r_c [ vv ]
248 v_kep = v_norm [ vv ][0] * np . sqrt ( r_c [ vv ][0] / r_kep )
249 ax . plot ( r_kep , v_kep , ’ : ’ , color = c_kep , lw =2 , alpha =0.6 ,
250 label = ’ Kepl eri an ( no dark halo ) ’)
251 ax . set_ x lab el (r ’ Radius $r / a$ ’)
252 ax . set_ y lab el (r ’ $v ( r ) / v_ {\ mathrm { max }} $ ’)
253 ax . set_ tit le (r ’(c) Ro tat io n Curve ( $ \ si gma /\ mu = %.1 f \%% $) ’ % flatness , f ont siz e =12 )
254 ax . set_ yl im (0 , 1.4)
255 ax . l eg end ( fonts ize =9 , f ram eal p ha =0.9)
256 ax . grid ( True , alp ha =0.2)
257
258 # (d) Per - node s catte r
259 ax = axes [1 , 1]
260 sca tter _ma s k = (( r _pe rp_ int > 2 * b ) & ( r_pe rp_ int < N_eff ) & ( E _ nod e_i nt > 0) )
261 ax . s catte r ( r_p erp _in t [ s cat t er_ m ask ] , E_ nod e_i n t [ sca t ter _mas k ] ,
262 s =0.5 , alpha =0.08 , color = c_data , ras ter i zed = True )
263 r_sort = np . l ins pa ce (2 * b, N_eff , 300)
264 me d_ val = np . media n ( E_ n ode _in t [ scat ter _ mas k ] * r_ per p_i nt [ sca t ter _ma s k ]**2 )
265 ax . plot ( r_sort , me d_ val / r _sort **2 , ’ - ’ , color = c_fit , lw =2 ,
12