File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -459,6 +459,17 @@ def get_metallicity(self):
459
459
return np .repeat (self .Z_all , self .size ) * u .dimensionless_unscaled
460
460
461
461
462
+ class ConstantUniformDisc (BurstUniformDisc ):
463
+ """A simple star formation history, with all stars formed at a constant rate between ``t_burst``
464
+ and the present day in a uniform disc with height ``z_max`` and radius ``R_max`` disc, all with
465
+ metallicity ``Z``.
466
+
467
+ Based on :class:`BurstUniformDisc`.
468
+ """
469
+ def draw_lookback_times (self , size = None , component = None ):
470
+ return np .random .uniform (0 , self .t_burst .value , size ) * self .t_burst .unit
471
+
472
+
462
473
class Wagg2022 (StarFormationHistory ):
463
474
"""A semi-empirical model defined in
464
475
`Wagg+2022 <https://ui.adsabs.harvard.edu/abs/2021arXiv211113704W/abstract>`_
Original file line number Diff line number Diff line change @@ -58,6 +58,18 @@ def test_burst_uniform_disc(self):
58
58
self .assertTrue (np .all (g .rho <= 20 * u .kpc ))
59
59
self .assertTrue (np .all (g .Z == 0.02 ))
60
60
61
+ def test_constant_uniform_disc (self ):
62
+ """Ensure the constant uniform disc class works"""
63
+ g = sfh .ConstantUniformDisc (size = 10000 ,
64
+ t_burst = 5 * u .Gyr ,
65
+ R_max = 20 * u .kpc ,
66
+ z_max = 1 * u .kpc ,
67
+ Z = 0.02 )
68
+ self .assertTrue (np .all (g .tau <= 5 * u .Gyr ))
69
+ self .assertTrue (np .all (g .z <= 1 * u .kpc ))
70
+ self .assertTrue (np .all (g .rho <= 20 * u .kpc ))
71
+ self .assertTrue (np .all (g .Z == 0.02 ))
72
+
61
73
def test_bad_inputs (self ):
62
74
"""Ensure the classes fail with bad input"""
63
75
g = sfh .Wagg2022 (size = None , immediately_sample = False )
You can’t perform that action at this time.
0 commit comments