In [1]:
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
# use seaborn for matplotlib settings
import seaborn; seaborn.set()
In [2]:
from astroML.datasets import fetch_LINEAR_sample
data = fetch_LINEAR_sample()
In [3]:
lcid = 10022663
t, y, dy = data[lcid].T
fig, ax = plt.subplots()
ax.errorbar(t, y, dy, fmt='o');
ax.invert_yaxis()
ax.set_xlabel('MJD')
ax.set_ylabel('magnitude')
ax.set_title('LINEAR object {0}'.format(lcid));
In [4]:
# add up-directory to Python path
import sys, os; sys.path.append(os.path.abspath('..'))
from periodogram.lomb_scargle import LombScargle
In [8]:
model = LombScargle(pmin=0.2,pmax=0.8, resolution=1e4).fit(t, y, dy)
periods = np.linspace(0.2, 0.8, 10000)
scores = model.score(periods)
plt.plot(periods, scores);
In [ ]: