Skip to content

Commit

Permalink
minor bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
noahfranz13 committed Jul 16, 2024
1 parent 02b8eb9 commit c1a1771
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
1 change: 1 addition & 0 deletions src/syncfit/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
from syncfit.models.b5b3_model import B5B3
from syncfit.models.mq_model import MQModel
from syncfit.models.syncfit_model import SyncfitModel
from syncfit.models import thermal_util
26 changes: 14 additions & 12 deletions src/syncfit/models/mq_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@

import numpy as np
from .syncfit_model import SyncfitModel
from .thermalsyn_v2 import Lnu_of_nu
from .thermal_util import Lnu_of_nu
from astropy import units as u
from astropy import constants as c

class MQModel(SyncfitModel):

def get_labels(p=None):
if p is None:
return ['p', 'bG_sh', 'log Mdot', 'log_epsilon_T', 'log_epsilon_e', 'log_epsilon_B']
return ['p', 'log_bG_sh', 'log_Mdot', 'log_epsilon_T', 'log_epsilon_e', 'log_epsilon_B']
else:
return ['bG_sh', 'log Mdot', 'log_epsilon_T', 'log_epsilon_e', 'log_epsilon_B']
return ['log_bG_sh', 'log_Mdot', 'log_epsilon_T', 'log_epsilon_e', 'log_epsilon_B']

def SED(nu, p, log_bG_sh, logMdot, log_epsilon_T, log_epsilon_e, log_epsilon_B,
lum_dist, t, **kwargs):
Expand All @@ -42,20 +42,22 @@ def SED(nu, p, log_bG_sh, logMdot, log_epsilon_T, log_epsilon_e, log_epsilon_B,

return Fnu.value

def lnprior(theta, nu, F, p=None, **kwargs):
def lnprior(theta, nu, F, upperlimit, p=None, **kwargs):
'''
The prior
'''

uppertest = SyncfitModel._is_below_upperlimits(
nu, F, upperlimit, theta, MQModel.SED, p=p
)

if p is None:
p, bG_sh, logMdot, epsilon_T, epsilon_e, log_epsilon_B = theta
p, log_bG_sh, logMdot, epsilon_T, epsilon_e, log_epsilon_B = theta
else:
bG_sh, logMdot, epsilon_T, epsilon_e, log_epsilon_B = theta

epsilon_B = epsilon_e # assume equipartition
log_bG_sh, logMdot, epsilon_T, epsilon_e, log_epsilon_B = theta

if (2 < p < 4 and
0.01 < bG_sh < 100 and
if (uppertest and
2 < p < 4 and
-3 < log_bG_sh < 3 and
-10 < logMdot < 0 and
-6 < epsilon_e < 0 and
-6 < epsilon_T < 0 and
Expand All @@ -82,7 +84,7 @@ def dynesty_transform(theta, nu, F, upperlimit, p=None, **kwargs):
log_bG_sh, logMdot, epsilon_T, epsilon_e, epsilon_B = theta

# log_bG_sh should be between -2 and 2
log_bG_sh = log_bG_sh*4 - 2
log_bG_sh = log_bG_sh*6 - 3

# -10 < logMdot < 0
logMdot*=-10
Expand Down
File renamed without changes.

0 comments on commit c1a1771

Please sign in to comment.