Note
Go to the end to download the full example code.
Galactic plane distances#
Plot the distance from the galactic plane for each binary in the population, separating by whether a binary experienced a kick from a supernova or not.
As one would expect, kicked systems are more likely to be found further from the galactic plane.

import cogsworth
import matplotlib.pyplot as plt
import numpy as np
p = cogsworth.pop.Population(500, final_kstar1=[13, 14], processes=1, BSE_settings={"binfrac": 1.0})
p.create_population(with_timing=False)
# find any binary that experienced a kick from a supernova
kicked = np.isin(p.bin_nums, p.bpp[(p.bpp["evol_type"] == 15) | (p.bpp["evol_type"] == 16)]["bin_num"])
# split the population
p_kicked = p[kicked]
p_unkicked = p[~kicked]
fig, ax = plt.subplots()
for pop, label, colour in zip([p_unkicked, p_kicked], ["Unkicked", "Kicked"], ["grey", "C2"]):
ax.hist(abs(pop.final_pos[:, 2].value), bins=np.geomspace(1e-3, 1e3, 20),
histtype="step", linewidth=3, color=colour)
ax.hist(abs(pop.final_pos[:, 2].value), bins=np.geomspace(1e-3, 1e3, 20),
alpha=0.5, color=colour, label=label)
ax.set(xscale="log", xlabel="Distance from Galactic Plane [kpc]", ylabel="Number of systems")
ax.legend()
plt.show()
Total running time of the script: (0 minutes 23.494 seconds)