Skip to content

Commit

Permalink
can't supply galaxy as length could be wrong
Browse files Browse the repository at this point in the history
  • Loading branch information
TomWagg committed Nov 6, 2023
1 parent 52e9612 commit 43f4f8f
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions cogsworth/pop.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ def sample_initial_galaxy(self):
self.__citations__.extend([c for c in self._initial_galaxy.__citations__ if c != "cogsworth"])

# if velocities are already set then just immediately return
if all(hasattr(self._initial_galaxy, attr) for attr in ["_v_R", "_v_T", "_v_z"]):
if all(hasattr(self._initial_galaxy, attr) for attr in ["_v_R", "_v_T", "_v_z"]): # pragma: no cover
return

# work out the initial velocities of each binary
Expand All @@ -555,8 +555,7 @@ def sample_initial_galaxy(self):
self._initial_galaxy._v_T = v_T
self._initial_galaxy._v_z = v_z

def sample_initial_binaries(self, initC=None, overwrite_initC_settings=True, reset_sampled_kicks=True,
initial_galaxy=None):
def sample_initial_binaries(self, initC=None, overwrite_initC_settings=True, reset_sampled_kicks=True):
"""Sample the initial binary parameters for the population.
Alternatively, copy initial conditions from another population
Expand All @@ -570,8 +569,6 @@ def sample_initial_binaries(self, initC=None, overwrite_initC_settings=True, res
`BSE_settings`, by default True
reset_sampled_kicks : `bool`, optional
Whether to reset any sampled kicks in the population to ensure new ones are drawn, by default True
initial_galaxy : :class:`~cogsworth.galaxy.Galaxy`, optional
The initial galaxy to use to avoid sampling a new one, by default None (new sampling performed)
"""
self._bin_nums = None

Expand Down Expand Up @@ -614,10 +611,7 @@ def sample_initial_binaries(self, initC=None, overwrite_initC_settings=True, res
raise ValueError(("Your choice of `m1_cutoff` resulted in all samples being thrown out. Consider"
" a larger sample size or a less stringent mass cut"))

if initial_galaxy is not None:
self._initial_galaxy = copy(initial_galaxy)
else:
self.sample_initial_galaxy()
self.sample_initial_galaxy()

# update the metallicity and birth times of the binaries to match the galaxy
self._initial_binaries["metallicity"] = self._initial_galaxy.Z
Expand Down

0 comments on commit 43f4f8f

Please sign in to comment.