Skip to content
Snippets Groups Projects
Commit 16ce6cb9 authored by Armin Damon Riess's avatar Armin Damon Riess
Browse files

implemented calculation of half mass radius

parent 4998df4e
No related branches found
No related tags found
No related merge requests found
plots/densityprofile.png

72.6 KiB | W: | H:

plots/densityprofile.png

69.8 KiB | W: | H:

plots/densityprofile.png
plots/densityprofile.png
plots/densityprofile.png
plots/densityprofile.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -29,9 +29,19 @@ rhoHernquist = M / (2*np.pi) * a / (bins[1:]-dr/2) / (bins[1:]-dr/2 + a)**3 ...@@ -29,9 +29,19 @@ rhoHernquist = M / (2*np.pi) * a / (bins[1:]-dr/2) / (bins[1:]-dr/2 + a)**3
print("Number of bins:",nbins) print("Number of bins:",nbins)
print("Bin size:",dr) print("Bin size:",dr)
for i in range(len(hist)): # for i in range(len(hist)):
if hist[i] == 0: # if hist[i] == 0:
hist[i] = np.nan # hist[i] = np.nan
halfmassradius = 0
tmpmass = 0
rsorted = np.sort(r)
for i in range(len(rsorted)):
tmpmass += m[i]
if tmpmass > M/2:
halfmassradius = rsorted[i]
break
print("Half mass radius:",halfmassradius)
# plot poissonian error bars # plot poissonian error bars
plt.errorbar(bins[1:], rhoHernquist, yerr=np.sqrt(rhoHernquist), color='grey', fmt='.', label='Hernquist with Poisson error', markersize=0) plt.errorbar(bins[1:], rhoHernquist, yerr=np.sqrt(rhoHernquist), color='grey', fmt='.', label='Hernquist with Poisson error', markersize=0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment