Skip to content

Commit

Permalink
revert change to remove O and D, we need those for computing the indi…
Browse files Browse the repository at this point in the history
…cator.
  • Loading branch information
Joshwani committed Feb 23, 2024
1 parent 91a74d3 commit c70f760
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
17 changes: 8 additions & 9 deletions lppls/lppls.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,9 @@ def fit(self, max_searches, minimizer="Nelder-Mead", obs=None):
# Increment search count on SVD convergence error, but raise all other exceptions.
try:
tc, m, w, a, b, c, c1, c2 = self.estimate_params(obs, seed, minimizer)
# O = self.get_oscillations(w, tc, t1, t2)
# D = self.get_damping(m, w, b, c)
return tc, m, w, a, b, c, c1, c2, #O, D
O = self.get_oscillations(w, tc, t1, t2)
D = self.get_damping(m, w, b, c)
return tc, m, w, a, b, c, c1, c2, O, D
except Exception as e:
# print(e)
search_count += 1
Expand Down Expand Up @@ -270,8 +270,8 @@ def compute_indicators(self, res, filter_conditions_config=None):
w = fits["w"]
b = fits["b"]
c = fits["c"]
# O = fits["O"]
# D = fits["D"]
O = fits["O"]
D = fits["D"]

# t_delta = t2 - t1
# pct_delta_min = t_delta * 0.5
Expand Down Expand Up @@ -581,8 +581,8 @@ def _func_compute_nested_fits(self, args):
# "t2_d": self.ordinal_to_date(nested_t2),
"t1": nested_t1,
"t2": nested_t2,
# "O": O,
# "D": D,
"O": O,
"D": D,
}
)

Expand Down Expand Up @@ -614,8 +614,7 @@ def _is_D_in_range(self, m, w, b, c, D_min):
return False if m <= 0 or w <= 0 else abs((m * b) / (w * c)) > D_min

def get_oscillations(self, w, tc, t1, t2):
dt = np.abs(tc - t2) + 1e-8
return (w / (2.0 * np.pi)) * np.log((tc - t1) / dt)
return (w / (2.0 * np.pi)) * np.log((tc - t1) / (tc - t2))

def get_damping(self, m, w, b, c):
return (m * np.abs(b)) / (w * np.abs(c))
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
long_description = fh.read()

setuptools.setup(name='lppls',
version='0.6.17',
version='0.6.18',
description='A Python module for fitting the LPPLS model to data.',
packages=['lppls'],
author='Josh Nielsen',
Expand Down

0 comments on commit c70f760

Please sign in to comment.