Skip to content

Commit

Permalink
Compare with astropy also with log model
Browse files Browse the repository at this point in the history
The test previously failed just because the approximate Lomb-Scargle
periodogram had values slightly above 1 (both in LombScargle.jl and in
Astropy), so log(1 - p) gave a DomainError.  Change the frequency grid
and increase the number of input points in order to fix this issue.
  • Loading branch information
giordano committed Aug 19, 2016
1 parent 77f78d3 commit 5679206
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions test/astropy.jl
Expand Up @@ -3,7 +3,7 @@
using LombScargle, Base.Test, PyCall
PyCall.@pyimport astropy.stats as ast

ntimes = 201
ntimes = 401
t = linspace(0.01, 10pi, ntimes)
t += step(t)*rand(ntimes)
for f in (x -> sinpi(x), x -> sin(x) + 1.5*cospi(4*x) + 3)
Expand All @@ -30,15 +30,17 @@ for f in (x -> sinpi(x), x -> sin(x) + 1.5*cospi(4*x) + 3)
s = f(t)
# "psd" normalization in LombScargle slightly differ from that of
# Astropy and the test would fail if we includ it.
for fitmean in (true, false), nrm in ("standard", "model")
for fitmean in (true, false), nrm in ("standard", "model", "log")
f_jl, p_jl = freqpower(lombscargle(t, s, fit_mean = fitmean,
normalization=nrm,
maximum_frequency=20))
maximum_frequency=10,
samples_per_peak=10))
f_py, p_py =
ast.LombScargle(t, s,
fit_mean = fitmean)[:autopower](method="fast",
normalization=nrm,
maximum_frequency=20)
maximum_frequency=10,
samples_per_peak=10)
@test_approx_eq f_jl f_py
@test_approx_eq p_jl p_py
end
Expand Down

0 comments on commit 5679206

Please sign in to comment.