realfast analysis


In [ ]:
import logging
logger = logging.getLogger()
for hdlr in logger.handlers:
    logger.removeHandler(hdlr)
logging.basicConfig()

from bokeh.plotting import output_notebook
from bokeh.resources import INLINE
from rtpipe import interactive, nbpipeline
from ipywidgets import Button, Output, VBox
from IPython.display import display

# following needed for classifier
import os
import numpy as np

In [ ]:
output_notebook(resources=INLINE)

In [ ]:
candsfile, noisefile, fileroot = interactive.initializenb()
statedir = fileroot+'.ipynb-state'
state = nbpipeline.state(statedir)

Prepare data and noise plot


In [ ]:
loc, prop, d = interactive.read_candidates(candsfile, returnstate=True)
data = interactive.readdata(d=d, cands=(loc, prop))

Calculate classifier score from latest training set


In [ ]:
try:
    agdir = os.environ['agdir']
except KeyError:
    home = os.environ['HOME']
    agdir = os.path.join(home, 'code', 'alnotebook')

if agdir:
    score = interactive.addclassifications(agdir, prop)
    if len(score):
        data['score'] = interactive.addclassifications(agdir, prop)
else:
    print('No agdir defined, so no score calculated.')

Remove bad times and cands, then calculate indices


In [ ]:
plinds = {'cir': [], 'cro': [], 'edg': []}  # initialize plot symbols
state.setFloat('threshold', default=15, min=5, max=20, description='Threshold to find bad times')
state.setText('ignorestr', default='', description='Times to ignore (comma-delimited)')

In [ ]:
interactive.filterdata(data=data, plinds=plinds, d=d, threshold=state.load('threshold'),
                       ignorestr=state.load('ignorestr'))

Generate candidate and noise plots


In [ ]:
state.setDropdown('scaling', default='snrs_3', options=['snrs_3', 'snrs_5', 'score_5', 'score_7'],
                        description='Symbol size scaling ("source_powerlaw")')
state.setDropdown('plottype', default='all', options=['all', 'dmt', 'norm', 'loc', 'stat'],
                       description='Type of plot to make')

In [ ]:
interactive.displayplot(data, plinds, state.load('plottype'), state.load('scaling'), fileroot,
                        url_path='http://www.aoc.nrao.edu/~claw/realfast/plots')

In [ ]:
noiseplot = interactive.plotnoise(noisefile, candsfile, plot_width=900, plot_height=450)

Comments


In [ ]:
state.setText('comments')

In [ ]:
state.objects

Optional refinement analysis

Requires download data from archive into working directory


In [ ]: