Skip to content

Commit

Permalink
Update sam.py
Browse files Browse the repository at this point in the history
Calculate redz in mass_stellar() rather than calling as argument
  • Loading branch information
CayenneMatt authored Feb 5, 2024
1 parent 119c7a6 commit 0e57482
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions holodeck/sams/sam.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def shape(self):
self._shape = tuple([len(ee) for ee in self.edges])
return self._shape

def mass_stellar(self, redz):
def mass_stellar(self):
"""Calculate stellar masses for each MBH based on the M-MBulge relation.
Returns
Expand All @@ -200,6 +200,7 @@ def mass_stellar(self, redz):
Galaxy total stellar masses for all MBH. [0, :] is primary, [1, :] is secondary [grams].
"""
redz = self.redz[np.newaxis, np.newaxis, :]
# total-mass, mass-ratio ==> (M1, M2)
masses = utils.m1m2_from_mtmr(self.mtot[:, np.newaxis], self.mrat[np.newaxis, :])
# BH-masses to stellar-masses
Expand Down Expand Up @@ -243,7 +244,7 @@ def static_binary_density(self):
# ---- convert from MBH ===> mstar

redz = self.redz[np.newaxis, np.newaxis, :]
mstar_pri, mstar_rat, mstar_tot, redz = self.mass_stellar(redz=redz)
mstar_pri, mstar_rat, mstar_tot, redz = self.mass_stellar()

# choose whether the primary mass, or total mass, is used in different calculations
mass_gsmf = mstar_tot if GSMF_USES_MTOT else mstar_pri
Expand Down Expand Up @@ -656,7 +657,7 @@ def gwb_ideal(self, fobs_gw, sum=True, redz_prime=None):
"""
redz = self.redz[np.newaxis, np.newaxis, :]
mstar_pri, mstar_rat, mstar_tot, redz = self.mass_stellar(redz=redz)
mstar_pri, mstar_rat, mstar_tot, redz = self.mass_stellar()

# default to using `redz_prime` values if a GMT instance is stored
if redz_prime is None:
Expand Down

0 comments on commit 0e57482

Please sign in to comment.