Closed pllim closed 3 years ago
I've tested this code against simple sine waves at the transit period and half the transit period. I get back the amplitudes I input, so that is a reasonable test.
I'd say that we should comment out the warnings that this test throws and just leave them to be returned in the dictionary.
Here is the code for the two tests I wrote if you want to add them to test_sweet.py
def test_doublesine():
Period = 0.61
A = 1000/1e6
epoch = 0.2
time = np.arange(0,3,2/24.)
flux = A * np.sin(2*np.pi*(time+epoch)/Period*2)
tce = TCE(period =Period*u.day, tzero=epoch, duration=.1*u.day)
lc = lightcurve.LightCurve(time,flux, time_format="btjd", label="Sin-wave")
sweet_vetter = Sweet()
sweet_vetter.run(tce, lc)
res = sweet_vetter.result
print(res)
assert 'WARN' in res['msg']
assert_allclose(
res['amp'], [[1.00007544e-03, 1.58445948e-06, 6.31177669e+02],
[3.95471263e-04, 1.73162859e-04, 2.28381112e+00],
[1.37722120e-04, 1.85663338e-04, 7.41784145e-01]])
def test_sinewave():
Period = 0.61
A = 1000/1e6
epoch = 0.2
time = np.arange(0,3,2/24.)
flux = A * np.sin(2*np.pi*(time+epoch)/Period)
tce = TCE(period =Period*u.day, tzero=epoch, duration=.1*u.day)
lc = lightcurve.LightCurve(time,flux, time_format="btjd", label="Sin-wave")
sweet_vetter = Sweet()
sweet_vetter.run(tce, lc)
res = sweet_vetter.result
print(res)
assert 'WARN' in res['msg']
assert_allclose(
res['amp'], [[2.55025899e-04, 1.73406992e-04, 1.47067829e+00],
[9.63733192e-04, 2.95202543e-05, 3.26465071e+01],
[6.67236445e-05, 1.79074673e-04, 3.72602354e-01]])
This conflicts a lot with #26 . I might have to open a new PR and re-implement some parts of this.
That's fair, I probably wrote those tests before we re-worked the new TCE class. Feel free to reimplement the above test with the same values using the new TCE class if that is possible.
See #36
Fix #21
TODO
Screenshot
Using the
plot
method for the test case for SWEET vetter (updated).