Skip to content

Commit

Permalink
Update HostGalaxyModel for lbol to be non-zero and length 1
Browse files Browse the repository at this point in the history
  • Loading branch information
mcoughlin committed Aug 26, 2023
1 parent 7ba9db8 commit 95d911e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
22 changes: 13 additions & 9 deletions nmma/em/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,10 +368,14 @@ def generate_lightcurve(self, sample_times, parameters):
try:
parameters_list.append(new_parameters[parameter_name])
except KeyError:
if 'log10' in parameter_name:
parameters_list.append(np.log10(new_parameters[parameter_name.replace('log10_', '')]))
if "log10" in parameter_name:
parameters_list.append(
np.log10(new_parameters[parameter_name.replace("log10_", "")])
)
else:
parameters_list.append(10**new_parameters[f'log10_{parameter_name}'])
parameters_list.append(
10 ** new_parameters[f"log10_{parameter_name}"]
)

z = utils.getRedShift(new_parameters)

Expand Down Expand Up @@ -405,7 +409,7 @@ def generate_spectra(self, sample_times, wavelengths, parameters):
try:
parameters_list.append(new_parameters[parameter_name])
except KeyError:
parameters_list.append(10**new_parameters[f'log10_{parameter_name}'])
parameters_list.append(10 ** new_parameters[f"log10_{parameter_name}"])

z = utils.getRedShift(new_parameters)

Expand Down Expand Up @@ -653,12 +657,12 @@ def generate_lightcurve(self, sample_times, parameters):
new_parameters = parameters.copy()

mag = {}
lbol = 0. # just a random number
alpha = new_parameters['alpha_AG']
lbol = [1e33] # just a random number
alpha = new_parameters["alpha_AG"]
for filt in self.filters:
# assumed to be in unit of muJy
a_AG = new_parameters[f'a_AG_{filt}']
f_nu_filt = new_parameters[f'f_nu_{filt}']
a_AG = new_parameters[f"a_AG_{filt}"]
f_nu_filt = new_parameters[f"f_nu_{filt}"]
flux_per_filt = a_AG * np.power(sample_times, -alpha) + f_nu_filt

mag[filt] = -2.5 * np.log10(flux_per_filt) + 23.9
Expand Down Expand Up @@ -1046,7 +1050,7 @@ def parameter_conversion(converted_parameters, added_keys):
filters=filters,
)

elif model_name == 'Sr2023':
elif model_name == "Sr2023":
lc_model = HostGalaxyLightCurveModel(
sample_times=sample_times,
parameter_conversion=parameter_conversion,
Expand Down
6 changes: 5 additions & 1 deletion priors/Sr2023.prior
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
luminosity_distance = Uniform(minimum=1, maximum=500, name='luminosity_distance',latex_label='$D_L$')
a_AG_ztfi = Uniform(name='a_AG_ztfi', minimum=250, maximum=450)
a_AG_ztfr = Uniform(name='a_AG_ztfr', minimum=100, maximum=200)
alpha = Uniform(name='alpha', minimum=1.01, maximum=2)
a_AG_ztfg = Uniform(name='a_AG_g', minimum=100, maximum=200)
alpha_AG = Uniform(name='alpha', minimum=1.01, maximum=2)
f_nu_ztfi = Uniform(name='f_nu_ztfi', minimum=1, maximum=2)
f_nu_ztfr = Uniform(name='f_nu_ztfr', minimum=0, maximum=1)
f_nu_ztfg = Uniform(name='f_nu_ztfg', minimum=0, maximum=1)
supernova_mag_boost = Gaussian(mu=-0.14, sigma=0.58)
supernova_mag_stretch = TruncatedNormal(mu=0.9, sigma=0.3, minimum=0., maximum=10.)
timeshift = Uniform(minimum=-2.0, maximum=1.0, name='trigger_time',latex_label='$t_0$')

0 comments on commit 95d911e

Please sign in to comment.