Skip to content

Commit 9d79b9d

Browse files
committed
enforce right units
1 parent 6c578e1 commit 9d79b9d

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/pst/models.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ def interpolate_ssp_masses(self, ssp: SSPBase, t_obs: u.Gyr,
130130
Stellar masses corresponding to each SSP age and metallicity, in units
131131
of solar masses.
132132
"""
133-
134133
# define age bins from 0 to t_obs
135134
age_bins = np.hstack(
136135
[0 << u.yr, np.sqrt(ssp.ages[1:] * ssp.ages[:-1]), 1e12 << u.yr])
@@ -645,11 +644,12 @@ def stellar_mass_formed(self, times: u.Gyr):
645644
"""
646645
interpolator = interpolate.PchipInterpolator(
647646
self.table_t, self.table_mass)
648-
integral = interpolator(times) << self.table_mass.unit
647+
integral = interpolator(times.to_value(self.table_t.unit)
648+
) << self.table_mass.unit
649649
integral[times > self.table_t[-1]] = self.table_mass[-1]
650650
integral[times < self.table_t[0]] = 0
651651
return integral
652-
652+
653653
@u.quantity_input
654654
def ism_metallicity(self, times: u.Gyr):
655655
"""Evaluate the integral of the SFR over a given set of times.

0 commit comments

Comments
 (0)