In [ ]:
import tkp.db
import logging
import tkp.db.alchemy
from pandas import DataFrame
from bokeh.plotting import figure, output_notebook, show
from bokeh.models import DatetimeTickFormatter
logging.basicConfig(level=logging.INFO)
output_notebook()
In [ ]:
engine = 'postgresql'
host = 'localhost'
port = 5432
user = 'gijs'
password = 'gijs'
database = 'gijs'
query_loglevel = logging.WARNING # Set to INFO to see queries, otherwise WARNING
# the running catalog ID for the lightcurve to plot
runcat_id = 10
In [ ]:
logging.getLogger('sqlalchemy.engine').setLevel(query_loglevel)
db = tkp.db.Database(engine=engine, host=host, port=port,
user=user, password=password, database=database)
db.connect()
session = db.Session()
In [ ]:
runcat = session.query(tkp.db.model.Runningcatalog).filter(tkp.db.model.Runningcatalog.id==runcat_id).one()
sources = runcat.extractedsources
x = [s.image.taustart_ts for s in sources]
y = [s.f_int for s in sources]
In [ ]:
p = figure(title="ligthcurve for runcat %s" % runcat.id, x_axis_label='timestamp', y_axis_label='flux')
p.line(x, y, line_width=1)
p.xaxis.formatter = DatetimeTickFormatter()
show(p)