1
0
Fork 0
mirror of https://github.com/Findus23/halo_comparison.git synced 2024-09-19 16:03:50 +02:00
halo_comparison/nfw_velo.py

30 lines
741 B
Python

import random
from pathlib import Path
from sys import argv
from time import sleep
import matplotlib.pyplot as plt
from nfw import fit_nfw
from read_vr_files import read_velo_profiles
bin_edges, mass_profiles, density_profiles = read_velo_profiles(Path(argv[1]))
with open("ids.txt") as f:
text = f.read()
ids = {int(id) for id in text.split(",")}
# print(ids)
for i, profile in enumerate(density_profiles):
is_odd_halo = i in ids
if not is_odd_halo:
if random.random() > 0.1:
continue
else:
popt = fit_nfw(bin_edges, profile)
print(popt)
sleep(1)
color = "red" if is_odd_halo else "lightgray"
plt.loglog(bin_edges, profile, color=color, alpha=.1)
plt.show()