In [12]:
import os
import numpy as np
import feets
%matplotlib inline
import matplotlib.pyplot as plt
In [2]:
fs = feets.FeatureSpace()
data_path = os.path.join(os.path.abspath(os.path.dirname(feets.tests.__file__)), "data")
lc_path = os.path.join(data_path, "lc_1.3444.614.B_R.npz")
# recreate the lightcurve
with np.load(lc_path) as npz:
magnitude = npz['mag']
time = npz['time']
magnitude, time
Out[2]:
In [3]:
from ext_lomb_scargle_orig import LombScargle as FATSLombScargle
lscargle = FATSLombScargle(fs)
%time fats_ls = lscargle.fit(magnitude, time, 6.)
fats_ls
Out[3]:
In [4]:
from ext_fourier_components_orig import FourierComponents as FATSFourierComponents
fc = FATSFourierComponents(fs)
%time fats_fc = fc.fit(magnitude, time, 6.)
fats_fc
Out[4]:
In [5]:
from feets.extractors.ext_lomb_scargle import LombScargle as FeetsLombScargle, lscargle as ls
lscargle = FeetsLombScargle(fs)
fasper_kwds = {"autopower_kwds": {"samples_per_peak": 6., "nyquist_factor": 10}}
params = {
"lscargle_kwds": {
"autopower_kwds": {
"normalization": "standard",
"samples_per_peak": 6., "nyquist_factor": 10
}
},
"fap_kwds": {
"normalization": "standard",
"method": "simple"}
}
%time feets_ls = lscargle.fit(magnitude, time, **params)
feets_ls
Out[5]:
In [6]:
from feets.extractors.ext_fourier_components import FourierComponents as FeetsFourierComponents
fc = FeetsFourierComponents(fs)
fasper_kwds = {"autopower_kwds": {"samples_per_peak": 6., "nyquist_factor": 100}}
%time feets_fc = fc.fit(magnitude, time, lscargle_kwds=fasper_kwds)
feets_fc
Out[6]:
In [7]:
%%timeit -n 10
lscargle = FATSLombScargle(fs)
fats_ls = lscargle.fit(magnitude, time, 6.)
In [8]:
%%timeit -n 10
feets_ls = FeetsLombScargle
feets_ls = lscargle.fit(magnitude, time, **params)
In [9]:
# Create a normal distributed light curve
mag_normal = np.random.normal(size=10000)
time_normal = np.arange(10000)
lscargle.fit(mag_normal, time_normal, **params)
Out[9]:
In [10]:
# Create uniform light-curve
mag_uniform = np.random.uniform(size=10000)
time_uniform = np.arange(10000)
lscargle.fit(mag_uniform, time_uniform, **params)
Out[10]:
In [11]:
# periodic light-curve
N = 100
time_periodic = np.arange(N)
Period = 10
cov = np.zeros([N, N])
mean = np.zeros(N)
for i in np.arange(N):
for j in np.arange(N):
cov[i, j] = np.exp(-(np.sin((np.pi / Period) * (i - j)) ** 2))
mag_periodic = np.random.multivariate_normal(mean, cov)
fasper_kwds = {"autopower_kwds": {"samples_per_peak": 20., "nyquist_factor": 6}}
lscargle.fit(mag_periodic, time_periodic, **params)
Out[11]: