diff --git a/src/syncfit/_version.py b/src/syncfit/_version.py index 493f741..260c070 100644 --- a/src/syncfit/_version.py +++ b/src/syncfit/_version.py @@ -1 +1 @@ -__version__ = "0.3.0" +__version__ = "0.3.1" diff --git a/src/syncfit/models/b1b2_b3b4_weighted_model.py b/src/syncfit/models/b1b2_b3b4_weighted_model.py index fe5d309..d8e0850 100644 --- a/src/syncfit/models/b1b2_b3b4_weighted_model.py +++ b/src/syncfit/models/b1b2_b3b4_weighted_model.py @@ -11,8 +11,6 @@ class B1B2_B3B4_Weighted(SyncfitModel): ''' def __init__(self, p=None): - super().__init__(p=p) - # then set the default prior for this model if p is None: self.prior = dict( @@ -28,13 +26,8 @@ def __init__(self, p=None): log_nu_m=[6,12] ) - - def get_labels(self, p=None): - if p is None: - return ['p','log_F_nu', 'log_nu_a','log_nu_m'] - else: - return ['log_F_nu', 'log_nu_a','log_nu_m'] - + super().__init__(self.prior, p=p) + # the model, must be named SED!!! def SED(self, nu, p, log_F_nu, log_nu_a, log_nu_m, **kwargs): ### Spectrum 1 diff --git a/src/syncfit/models/b1b2_model.py b/src/syncfit/models/b1b2_model.py index 55a32bd..2c3430f 100644 --- a/src/syncfit/models/b1b2_model.py +++ b/src/syncfit/models/b1b2_model.py @@ -11,8 +11,6 @@ class B1B2(SyncfitModel): ''' def __init__(self, p=None): - super().__init__(p=p) - # then set the default prior for this model if p is None: self.prior = dict( @@ -28,12 +26,7 @@ def __init__(self, p=None): log_nu_m=[7,15] ) - - def get_labels(self, p=None): - if p is None: - return ['p','log_F_nu', 'log_nu_a','log_nu_m'] - else: - return ['log_F_nu', 'log_nu_a','log_nu_m'] + super().__init__(p=p) # the model, must be named SED!!! def SED(self, nu, p, log_F_nu, log_nu_a, log_nu_m, **kwargs): diff --git a/src/syncfit/models/b4b5_model.py b/src/syncfit/models/b4b5_model.py index 626fd9d..3f1ca97 100644 --- a/src/syncfit/models/b4b5_model.py +++ b/src/syncfit/models/b4b5_model.py @@ -12,8 +12,6 @@ class B4B5(SyncfitModel): ''' def __init__(self, p=None): - super().__init__(p=p) - # then set the default prior for this model if p is None: self.prior = dict( @@ -29,13 +27,9 @@ def __init__(self, p=None): log_nu_m=[-np.inf,6] ) - - def get_labels(self, p=None): - if p is None: - return ['p','log_F_nu', 'log_nu_a','log_nu_m'] - else: - return ['log_F_nu', 'log_nu_a','log_nu_m'] + super().__init__(p=p) + # the model, must be named SED!!! def SED(self, nu, p, log_F_nu, log_nu_a, log_nu_m, **kwargs): b1 = 2 diff --git a/src/syncfit/models/b4b5b3_model.py b/src/syncfit/models/b4b5b3_model.py index 62846a4..30f98ab 100644 --- a/src/syncfit/models/b4b5b3_model.py +++ b/src/syncfit/models/b4b5b3_model.py @@ -11,8 +11,6 @@ class B4B5B3(SyncfitModel): ''' def __init__(self, p=None): - super().__init__(p=p) - # then set the default prior for this model if p is None: self.prior = dict( @@ -29,13 +27,9 @@ def __init__(self, p=None): log_nu_m=[0, 6], log_nu_c=[7,15] ) - - def get_labels(self, p=None): - if p is None: - return ['p','log_F_nu', 'log_nu_a','log_nu_m', 'log_nu_c'] - else: - return ['log_F_nu', 'log_nu_a','log_nu_m', 'log_nu_c'] + super().__init__(self.prior, p=p) + # the model, must be named SED!!! def SED(self, nu, p, log_F_nu, log_nu_a, log_nu_m, log_nu_c, **kwargs): b1 = 2 diff --git a/src/syncfit/models/b5_model.py b/src/syncfit/models/b5_model.py index 3da8577..8c64aec 100644 --- a/src/syncfit/models/b5_model.py +++ b/src/syncfit/models/b5_model.py @@ -10,8 +10,6 @@ class B5(SyncfitModel): ''' def __init__(self, p=None): - super().__init__(p=p) - # then set the default prior for this model if p is None: self.prior = dict( @@ -24,13 +22,9 @@ def __init__(self, p=None): log_F_nu=[-4,2], log_nu_a=[6,11] ) - - def get_labels(self, p=None): - if p is None: - return ['p','log_F_nu', 'log_nu_a'] - else: - return ['log_F_nu', 'log_nu_a'] + super().__init__(self.prior, p=p) + # the model, must be named SED!!! def SED(self, nu, p, log_F_nu, log_nu_a, **kwargs): b1 = 5/2 diff --git a/src/syncfit/models/b5b3_model.py b/src/syncfit/models/b5b3_model.py index 68a2c15..44ddf18 100644 --- a/src/syncfit/models/b5b3_model.py +++ b/src/syncfit/models/b5b3_model.py @@ -12,8 +12,6 @@ class B5B3(SyncfitModel): ''' def __init__(self, p=None): - super().__init__(p=p) - # then set the default prior for this model if p is None: self.prior = dict( @@ -28,14 +26,9 @@ def __init__(self, p=None): log_nu_a=[6,11], log_nu_c=[7,15] ) - - # Write some getters for things that are model specific - def get_labels(self, p=None): - if p is None: - return ['p','log_F_nu', 'log_nu_a','log_nu_c'] - else: - return ['log_F_nu', 'log_nu_a','log_nu_c'] + super().__init__(self.prior, p=p) + # the model, must be named SED!!! def SED(self, nu, p, log_F_nu, log_nu_a, log_nu_c, **kwargs): b1 = 5/2 diff --git a/src/syncfit/models/mq_model.py b/src/syncfit/models/mq_model.py index 4a8986d..c19f9b8 100644 --- a/src/syncfit/models/mq_model.py +++ b/src/syncfit/models/mq_model.py @@ -14,12 +14,7 @@ class MQModel(SyncfitModel): def __init__(self, p=None, t=None): - super().__init__(p=p) - self.t = t - self.labels = self.get_labels(p=p, t=t) - self.ndim = len(self.labels) - - # then set the default prior for this model + # set the default prior for this model self.prior = dict( log_bG_sh=[-3,3], log_Mdot=[-10,0], @@ -33,15 +28,11 @@ def __init__(self, p=None, t=None): if t is None: self.prior['t'] = [0.1, 1_000] # super wide prior as default - - def get_labels(self, p=None, t=None): - base_labels = ['log_bG_sh', 'log_Mdot', 'log_epsilon_T', 'log_epsilon_e', 'log_epsilon_B'] - if p is None: - base_labels = ['p'] + base_labels - if t is None: - base_labels.append('t') - return base_labels - + + # then initiate the superclass + super().__init__(self.prior, p=p) + self.t = t + def SED(self, nu, p, log_bG_sh, logMdot, log_epsilon_T, log_epsilon_e, log_epsilon_B, t, lum_dist, **kwargs): diff --git a/src/syncfit/models/syncfit_model.py b/src/syncfit/models/syncfit_model.py index 14a6cac..d939dea 100644 --- a/src/syncfit/models/syncfit_model.py +++ b/src/syncfit/models/syncfit_model.py @@ -26,10 +26,10 @@ class SyncfitModel(object, metaclass=_SyncfitModelMeta): while also allowing users to customize their own. ''' - def __init__(self, p=None): + def __init__(self, prior, p=None): + self.prior = prior self.labels = self.get_labels(p=p) self.ndim = len(self.labels) - self.prior = None self.p = p # Write some getters for things that are model specific @@ -175,7 +175,7 @@ def get_labels(self, *args, **kwargs): Describes a list of labels used in the return values of the mcmc chain. This varies depending on the inputs to the MCMC. ''' - pass + return list(self.prior.keys()) @abstractmethod def SED(self, *args, **kwargs):