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

remove simple normalization, take other parameters (mass, etc.) into account

parent 1fb66fa5
No related branches found
No related tags found
No related merge requests found
plots/densityprofile.png

28.5 KiB | W: | H:

plots/densityprofile.png

65.9 KiB | W: | H:

plots/densityprofile.png
plots/densityprofile.png
plots/densityprofile.png
plots/densityprofile.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -7,32 +7,41 @@ x = data[:,2]
y = data[:,3]
z = data[:,4]
m = data[:,1]
M = np.sum(m)
print(x)
maxr = 256
dr = 8
dr = 4
a = dr
r = np.arange(0, maxr, dr)
rhoHernquist = 1.0 / (r + 1.0)**4
rhoHernquist /= np.sum(rhoHernquist)
r = np.arange(dr, maxr, dr)
rhoHernquist = M / (2*np.pi) * a / r / (r + a)**4
rho = np.zeros(len(r))
for i in range(len(x)):
ri2 = x[i]**2 + y[i]**2 + z[i]**2
for j in range(len(r)):
if (ri2 > r[j]**2 and ri2 < (r[j] + dr)**2):
rho[j] += 1
rho[j] += m[i]
break
rho /= np.sum(rho)
rho /= 4*np.pi*r**2*dr
# Normalize
# rhoHernquist /= np.sum(rhoHernquist)
# rho /= np.sum(rho)
print(rho.shape)
plt.plot(np.log(r), np.log(rhoHernquist), 'r-', label='Hernquist Density Profile')
plt.plot(np.log(r), np.log(rho), 'b-', label='Density Profile')
plt.plot(np.log(r), np.log(rhoHernquist), 'r-', label='Hernquist Density Profile')
plt.xlabel('log(r)')
plt.ylabel('log(rho)')
plt.legend()
plt.savefig('densityprofile.png', dpi=200)
plt.show()
\ No newline at end of file
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