Skip to content

Commit

Permalink
A few check_units
Browse files Browse the repository at this point in the history
  • Loading branch information
paranoya committed Oct 7, 2024
1 parent 6a64e99 commit 35fb6a2
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/pst/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,16 +216,10 @@ class SingleBurstCEM(ChemicalEvolutionModel):
Metallicity of the burst.
"""
def __init__(self, **kwargs):
self.mass_burst = kwargs['mass_burst']
if not isinstance(self.mass_burst, u.Quantity):
self.mass_burst *= u.Msun
self.time_burst = kwargs['time_burst']
if not isinstance(self.time_burst, u.Quantity):
self.time_burst *= u.Gyr

self.mass_burst = check_units(kwargs['mass_burst'], u.Msun)
self.time_burst = check_units(kwargs['time_burst'], u.Gyr)
self.burst_metallicity = kwargs.get("burst_metallicity",
0.02 * u.dimensionless_unscaled)

ChemicalEvolutionModel.__init__(self, **kwargs)

@u.quantity_input
Expand Down Expand Up @@ -434,7 +428,7 @@ class LogNormalQuenchedCEM(LogNormalZPowerLawCEM):
"""
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.quenching_time = kwargs["quenching_time"]
self.quenching_time = check_unit(kwargs["quenching_time"], u.Gyr)
mtoday = self.stellar_mass_formed(self.today)
self.mass_norm *= self.mass_today / mtoday

Expand Down

0 comments on commit 35fb6a2

Please sign in to comment.