Open 1ozturkbe opened 8 years ago
Never mind, figured it out. Made the mistake of leaving a 1/log(1) in the data, giving inf... Problem resolved.
It is odd that this gives an indexError though.
Thanks @1ozturkbe. Agreed that this should fail more gracefully. I reduced your code and data to a MWE:
import numpy as np
from gpfit.fit import fit
logL = np.array([
float("-inf"),
-2.083896,
-1.390749,
-1.021651,
-0.762140,
-0.579818,
-0.432494,
-0.316234])
logh = np.array([
float("-inf"),
8.095855,
8.789002,
9.194467,
9.482149,
9.705293,
9.887614,
10.041765])
cstrt, rms_error = fit(logh,logL, 2, "SMA")
This gives an IndexError
; it should fail more gracefully, probably by raising a ValueError
for the -inf
.
Let's leave this open to make sure we fix it.
I have been trying to fit a SMA function with two terms to the data attached, but been getting the index error above. Don't exactly know what I am doing wrong. The data, code, and specific error are attached.
issue.zip