Skip to content

Commit

Permalink
Merge pull request #5 from alexander-group/dev
Browse files Browse the repository at this point in the history
fix major plot labeling bug
  • Loading branch information
noahfranz13 authored Jul 19, 2024
2 parents 8b5332f + 30f9296 commit 8a6c409
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 69 deletions.
2 changes: 1 addition & 1 deletion src/syncfit/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.3.0"
__version__ = "0.3.1"
11 changes: 2 additions & 9 deletions src/syncfit/models/b1b2_b3b4_weighted_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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
Expand Down
9 changes: 1 addition & 8 deletions src/syncfit/models/b1b2_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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):
Expand Down
10 changes: 2 additions & 8 deletions src/syncfit/models/b4b5_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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
Expand Down
10 changes: 2 additions & 8 deletions src/syncfit/models/b4b5b3_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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
Expand Down
10 changes: 2 additions & 8 deletions src/syncfit/models/b5_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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
Expand Down
11 changes: 2 additions & 9 deletions src/syncfit/models/b5b3_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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
Expand Down
21 changes: 6 additions & 15 deletions src/syncfit/models/mq_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand All @@ -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):

Expand Down
6 changes: 3 additions & 3 deletions src/syncfit/models/syncfit_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 8a6c409

Please sign in to comment.