-
Notifications
You must be signed in to change notification settings - Fork 0
/
plot_kicks.py
48 lines (39 loc) · 1.21 KB
/
plot_kicks.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# -*- coding: utf-8 -*-
"""plot kicks from differnt samples
"""
import matplotlib.pyplot as plt
import pandas as pd
from matplotlib import rcParams
rcParams["font.size"] = 20
rcParams["font.family"] = "serif"
rcParams["font.sans-serif"] = ["Computer Modern Sans"]
rcParams["text.usetex"] = True
rcParams['axes.labelsize'] = 30
rcParams['axes.titlesize'] = 30
rcParams['axes.labelpad'] = 20
SAMPLES = "datafiles/{}_population.csv"
DATA = dict(
# agn=dict(bins=100, label="AGN"),
aligned_spin=dict(bins=12, label="Aligned Spin"),
precessing_spin=dict(bins=100, label="Precessing Spin"),
)
LABELS = list(DATA.keys())
def plot():
"""Plots a corner plot from some samples."""
fig, ax = plt.subplots()
for key, data in DATA.items():
samples = pd.read_csv(SAMPLES.format(key))
ax.hist(
samples['remnant_kick'],
bins=data['bins'], density=True, alpha=0.5,
label=data['label']
)
ax.legend(frameon=False)
ax.set_ylabel("Density")
ax.set_xlabel("Kick Magnitude (km/s)")
plt.tight_layout()
fig.savefig("kick_magnitudes_for_different_populations.png")
def main():
plot()
if __name__ == "__main__":
main()