Skip to content

Commit

Permalink
option to remove sbpy model bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
jrob93 committed May 16, 2024
1 parent 6e5bafd commit 98ef9dc
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/adler/science/PhaseCurve.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class PhaseCurve:
Units - by default no units are set but astropy units can be passed.
It is up to the user to ensure that units are correct for the relevant phasecurve model.
Attibutes
Attributes
-----------
abs_mag : float
Absolute magnitude, H, of the phasecurve model (often units of mag).
Expand All @@ -24,9 +24,12 @@ class PhaseCurve:
Label for the phasecurve model to be used.
Choice of: "HG", "HG1G2", "HG12", "HG12_Pen16", "LinearPhaseFunc"
bounds: bool
Flag for using the default bounds on the sbpy model (True) or ignoring bounds (False).
"""

def __init__(self, abs_mag=18, phase_param=0.2, phase_param2=None, model_name="HG"):
def __init__(self, abs_mag=18, phase_param=0.2, phase_param2=None, model_name="HG", bounds=False):
self.abs_mag = abs_mag
self.phase_param = phase_param
self.phase_param2 = phase_param2
Expand All @@ -45,6 +48,14 @@ def __init__(self, abs_mag=18, phase_param=0.2, phase_param2=None, model_name="H
else:
print("no model selected")

# by default sbpy sets bounds
if not bounds:
model_sbpy = self.model_function
param_names = model_sbpy.param_names
for p in param_names:
x = getattr(model_sbpy, p)
setattr(x, "bounds", (None, None))

def ReturnModelDict(self):
"""Return the values for the PhaseCurve class as a dict
Expand Down

0 comments on commit 98ef9dc

Please sign in to comment.