예제 #1
0
 def init(self):
     self.pattern_result_display = PreText(text='No Matches to show.',
                                           width=600,
                                           height=200)
     self.pattern_selector = TextInput(value="",
                                       title="Search Pattern:",
                                       width=600,
                                       height=60)
     dataframe_names = self.shared_state.get("dataframe_names")
     self.dataframe_selector = Select(title="Dataframe",
                                      value="",
                                      options=dataframe_names)
     self.df_title = PreText(text="", width=600, height=20)
     df_column_names = [
         "Field name",
         "Data type",
         "Comment",
     ]
     self.df_source = ColumnDataSource(
         {name: []
          for name in df_column_names})
     columns = [
         TableColumn(field=name, title=name) for name in df_column_names
     ]
     self.df_table = DataTable(source=self.df_source,
                               columns=columns,
                               width=600,
                               height=300,
                               editable=False)
예제 #2
0
def stock(ticker1, ticker2):
    pretext = PreText(text="", width=500)
    df = get_data(ticker1, ticker2)
    source = ColumnDataSource(data=df)
    source.tags = ['main_source']
    p = figure(
        title="%s vs %s" % (ticker1, ticker2),
        plot_width=400,
        plot_height=400,
        tools="pan,wheel_zoom,box_select,reset",
        title_text_font_size="10pt",
    )
    p.circle(ticker1 + "_returns",
             ticker2 + "_returns",
             size=2,
             nonselection_alpha=0.02,
             source=source)
    stats = df.describe()
    pretext.text = str(stats)
    row1 = HBox(children=[p, pretext])
    hist1 = hist_plot(df, ticker1)
    hist2 = hist_plot(df, ticker2)
    row2 = HBox(children=[hist1, hist2])
    line1 = line_plot(ticker1, source)
    line2 = line_plot(ticker2, source, line1.x_range)
    output = VBox(children=[row1, row2, line1, line2])
    return output
예제 #3
0
def stock2(ticker1, ticker2):
    pretext = PreText(text="", width=500)
    df = get_data(ticker1, ticker2)
    source = ColumnDataSource(data=df)
    source.tags = ['main_source']
    p = figure(
        title="%s vs %s" % (ticker1, ticker2),
        plot_width=400,
        plot_height=400,
        tools="pan,wheel_zoom,box_select,reset",
        title_text_font_size="10pt",
    )
    p.circle(ticker1 + "_returns",
             ticker2 + "_returns",
             size=2,
             nonselection_alpha=0.02,
             source=source)
    stats = df.describe()
    pretext.text = str(stats)
    hist1 = hist_plot(df, ticker1)
    hist2 = hist_plot(df, ticker2)
    line1 = line_plot(ticker1, source)
    line2 = line_plot(ticker2, source, line1.x_range)
    return dict(scatterplot=p,
                statstext=pretext,
                hist1=hist1,
                hist2=hist2,
                line1=line1,
                line2=line2)
예제 #4
0
def stock2(ticker1, ticker2):
    pretext = PreText(text="", width=500)
    df = get_data(ticker1, ticker2)
    source = ColumnDataSource(data=df)
    source.tags = ['main_source']
    p = figure(
        title="%s vs %s" % (ticker1, ticker2),
        plot_width=400, plot_height=400,
        tools="pan,wheel_zoom,box_select,reset",
        title_text_font_size="10pt",
    )
    p.circle(ticker1 + "_returns", ticker2 + "_returns",
             size=2,
             nonselection_alpha=0.02,
             source=source
    )
    stats = df.describe()
    pretext.text = str(stats)
    hist1 = hist_plot(df, ticker1)
    hist2 = hist_plot(df, ticker2)
    line1 = line_plot(ticker1, source)
    line2 = line_plot(ticker2, source, line1.x_range)
    return dict(scatterplot=p,
                statstext=pretext,
                hist1=hist1,
                hist2=hist2,
                line1=line1,
                line2=line2)
예제 #5
0
def stock(ticker1, ticker2):
    pretext = PreText(text="", width=500)
    df = get_data(ticker1, ticker2)
    source = ColumnDataSource(data=df)
    source.tags = ['main_source']
    p = figure(
        title="%s vs %s" % (ticker1, ticker2),
        plot_width=400, plot_height=400,
        tools="pan,wheel_zoom,box_select,reset",
        title_text_font_size="10pt",
    )
    p.circle(ticker1 + "_returns", ticker2 + "_returns",
             size=2,
             nonselection_alpha=0.02,
             source=source
    )
    stats = df.describe()
    pretext.text = str(stats)
    row1 = HBox(children=[p, pretext])
    hist1 = hist_plot(df, ticker1)
    hist2 = hist_plot(df, ticker2)
    row2 = HBox(children=[hist1, hist2])
    line1 = line_plot(ticker1, source)
    line2 = line_plot(ticker2, source, line1.x_range)
    output =  VBox(children=[row1, row2, line1, line2])
    return output
예제 #6
0
파일: tools.py 프로젝트: grasshoff/tools
def makeTable(df, width, ID1, ID2):
    '''
    df: DataFrame, which contain the cartographical information
    width: float/int, giving the width of the table
    ID1: str, str provides the the ID of the first dataset
    ID2: str or None, use None if no second ID is provided, str provides the the ID of the second dataset
    '''

    table = PreText(text="", width=width)
    if not ID2:
        table.text = str(df.loc[[ID1]].T)
    else:
        table.text = str(df.loc[ID1:ID2].T)
    return table
예제 #7
0
def update_annotation_exact(attr, old, new):
    # This function probablby needs a rewrite if too slow. if not new is an empty search box, else has input text
    if not new:
        # Display table header as PreText
        information_1 = "Showing {} of {} annotated genes total".format(maxindeces-1, totalrows)
        annotation_information_1 = PreText(text=information_1)
        funclayout.children[1] = annotation_information_1
        # Reset table to original
        annotation = ColumnDataSource(data=df.head(n=maxindeces))
        csv_download = ColumnDataSource(data=df)
        columns = [TableColumn(field=str(key), title=str(key)) for key in list(df)]
        annotation_table = DataTable(source=annotation, columns=columns, width=1800)
        funclayout.children[2] = annotation_table
        # Redo buttons to original
        funcbutton1 = Button(label="Download annotation (tsv)", button_type="primary")
        funcbutton1.callback = CustomJS(args=dict(source=csv_download.data),code=open(join(dirname(__file__), "download_tsv.js")).read())
        funcbutton2 = Button(label="Download sequences (Nuc, fasta)", button_type="success", disabled=True)
        funcbutton3 = Button(label="Download sequences (Prot, fasta)", button_type="success")
        funcbutton3.callback = CustomJS(args=dict(source=csv_download.data, seqs=seqs),code=open(join(dirname(__file__), "download_protseq.js")).read())
        funcbuttons = row(funcbutton1, funcbutton2, funcbutton3)
        funclayout.children[3] = funcbuttons

    else:
        # Display "Searching while searching"
        annotation_information_1 = PreText(text="Searching...(expect atleast 5 second search time pr. 10000 annotated genes)")
        funclayout.children[1] = annotation_information_1
        # Use template df pandas to search and create new pandas with search results
        current = df.where(df.apply(lambda row: row.astype(str).str.contains(new, case=False).any(), axis=1, result_type='broadcast')).dropna(how='all')
        hitcount= len(current)
        annotation = ColumnDataSource(data=current.head(n=maxindeces))
        csv_download = ColumnDataSource(data=current)
        columns = [TableColumn(field=str(key), title=str(key)) for key in list(current)]
        annotation_table = DataTable(source=annotation, columns=columns, width=1800)
        funclayout.children[2] = annotation_table
        # Display hit information
        tablecount = len(current.head(n=maxindeces))
        information_1 = "Showing {} of {} hits of {} annotated genes total".format(tablecount, hitcount,totalrows)
        annotation_information_1 = PreText(text=information_1)
        funclayout.children[1] = annotation_information_1
        # Change buttons
        funcbutton1 = Button(label="Download annotation of current hits (tsv)", button_type="primary")
        funcbutton1.callback = CustomJS(args=dict(source=csv_download.data),code=open(join(dirname(__file__), "download_tsv.js")).read())
        funcbutton2 = Button(label="Download sequences of current hits (Nuc, fasta)", button_type="success", disabled=True)
        funcbutton3 = Button(label="Download sequences of current hits (Prot, fasta)", button_type="success")
        funcbutton3.callback = CustomJS(args=dict(source=csv_download.data, seqs=seqs),code=open(join(dirname(__file__), "download_protseq.js")).read())
        funcbuttons = row(funcbutton1, funcbutton2, funcbutton3)
        funclayout.children[3] = funcbuttons
예제 #8
0
def draw(validy, predy, smiles, T, P):
    error_y = abs(predy - validy)
    RE = error_y / validy * 100
    data_svg = [DrawMol(i) for i in smiles]
    colors = [mapcolor(c) for c in RE]
    TOOLS = "pan,wheel_zoom,reset, save, lasso_select"
    # TOOLTIPS = [ ("Smiles:", "@smiles"), ("T:", "@T"), ("P:", "@P"), ("log MSE:", "@error"), ("pic", "@svgs{safe}") ]
    TOOLTIPS = """
        <div>
            <div>@svgs{safe}</div>
            <div>Smiles: @smiles</div>
            <div>T: @T</div>
            <div>P: @P</div>
            <div>predy(g/cm^3): @y</div>
            <div>calc(g/cm^3): @x</div>
            <div>RelativeErr: @error %</div>
        </div>
        """
    data = ColumnDataSource({
        'x': validy,
        'y': predy,
        'smiles': smiles,
        'T': T,
        'P': P,
        'error': RE,
        'fill_color': colors,
        'svgs': data_svg
    })
    miny = float(min(validy))
    maxy = float(max(validy))
    p = figure(title="result",
               tools=TOOLS,
               x_range=Range1d(0.9 * miny, 1.1 * maxy),
               y_range=Range1d(0.9 * miny, 1.1 * maxy))
    p.select(LassoSelectTool).select_every_mousemove = False
    hover = HoverTool()
    hover.tooltips = TOOLTIPS
    p.tools.append(hover)
    stats = PreText(text='a', width=500)

    def selection_change(attrname, old, new):
        selected_idx = data.selected.indices
        selected_smiles = list(data.data['smiles'][idx])
        stats.text = smiles_str

    data.selected.on_change('indices', selection_change)

    p.line([miny, maxy], [miny, maxy], line_width=1)
    p.scatter('x',
              'y',
              radius=0.002,
              source=data,
              fill_color='fill_color',
              fill_alpha=1,
              line_color=None)
    layout = row(p, stats)
    curdoc().add_root(layout)

    show(layout)
예제 #9
0
    def __init__ (self, size=400):
        self.size = size
        self.min_percentile= Slider(title="Lower Bound of Historical Team", value=.9, start=0, end=1, step=.01)
        self.max_percentile= Slider(title="Upper Bound of Historical Team", value=1, start=0, end=1, step=.01)
        self.game_equivalent= Slider(title="Number of Games to weight prior", value=10, start=1, end=200, step=1)
        self.select_team = Select(title="Current_Team:", value="GSW", options=my_predicter.get_teams_list())

# Create Column Data Source that will be used by the plot
        self.hist_source = ColumnDataSource(data=dict(
                    top =[],
                    left = [],
                    right = []
                    ))
                    
        self.pdf_source = ColumnDataSource( data = dict(
                    pdf_x=[], 
                    prior_y = [],
                    rescaled_y = [],
                    post_y = []
                    ))
        self.cdf_source =ColumnDataSource(data = dict(
                    cdf_x = [],
                    cdf_y =[]
                    ))



        self.p1 = figure(title="Density Fuctions", tools="save",
                   background_fill_color="#E8DDCB", width= self.size, plot_height=self.size)
        self.p1.legend.location = "top_right"
        self.p1.xaxis.axis_label = 'Winning Percentage'
        self.p1.yaxis.axis_label = 'Likelihod of prior'
        self.p1.quad(top="top", bottom=0, left="left", right="right", source= self.hist_source, line_color="#033649")
        self.p1.line(x = "pdf_x", y = "prior_y", source= self.pdf_source, line_color="#D95B43", line_width=8, alpha=0.7, legend="prior PDF")
        self.p1.line(x = "pdf_x", y = "rescaled_y", source= self.pdf_source, line_color="red", line_width=8, alpha=0.7, legend="rescaled PDF")
        self.p1.line(x = "pdf_x", y= "post_y", source= self.pdf_source, line_color="green", line_width=8, alpha=0.7, legend="posterior PDF")


        self.p2_hover = HoverTool(
            tooltips=[
                ("wins", "@cdf_x"),
                ("prob", "@cdf_y"),
            ]
        )

        self.p2 = figure(title="Cumulative Wins", tools=[self.p2_hover,"save"],
                   background_fill_color="#E8DDCB",  width= self.size, plot_height=self.size)
        self.p2.xaxis.axis_label = 'Number of Wins in 82 game seasons'
        self.p2.yaxis.axis_label = 'Probabily of Wins'
        self.p2.circle(x='cdf_x', y='cdf_y', source = self.cdf_source, size = 20)
        self.p2.x_range=Range1d(-2, 84)
        self.p2.y_range=Range1d(-3, 103)

        self.textbox = PreText(text='', width=self.size)
예제 #10
0
def dom_widget_for_thing(thing):
    if isinstance(thing, Model):
        print("is model")
        dom_widget = thing
    elif hasattr(thing, '__html__'):
        print("is html")
        dom_widget = Div(text=thing.__html__())
    else:
        print("is text")
        dom_widget = PreText(text=str(thing))

    return dom_widget
예제 #11
0
 def __init__(self):
     self.session_selector = None
     self.stats = PreText(text='Run Stats', width=500, height=150)
     self.details = PreText(text='Run Details', width=300, height=100)
     self.speed_source = ColumnDataSource(
         data=dict(timestamp=[], distance=[], speed=[], lat=[], lon=[]))
     self.accel_source = ColumnDataSource(
         data=dict(timestamp=[], distance=[], x_accel=[], y_accel=[]))
     self.tps_source = ColumnDataSource(
         data=dict(timestamp=[], distance=[], result=[]))
     self.bps_source = ColumnDataSource(
         data=dict(timestamp=[], distance=[], result=[]))
     self.rpm_source = ColumnDataSource(
         data=dict(timestamp=[], distance=[], result=[]))
     self.wheelspeed1_source = ColumnDataSource(
         data=dict(timestamp=[], distance=[], result=[]))
     self.wheelspeed2_source = ColumnDataSource(
         data=dict(timestamp=[], distance=[], result=[]))
     self.wheelspeed3_source = ColumnDataSource(
         data=dict(timestamp=[], distance=[], result=[]))
     self.wheelspeed4_source = ColumnDataSource(
         data=dict(timestamp=[], distance=[], result=[]))
예제 #12
0
    def make_plot():
        p = PreText(text="""
        We are group 10 in Visualization JBI100.
        
        The group members are:
        
        Kaloyan Videlov
        
        Mohamed Jahouh
        
        Fadi Shallah
        
        Stefan Stoev
        
        Jelle van Hees""",
                    width=500,
                    height=100)

        p1 = PreText(text="""
        Our visualization project is part of the Brabant's Historical Information Center located
        in Den Bosch. The data we use is about people having lived in the Netherlands from at least 200 years, 
        resulting several million people.
        
        In the project we have included timelines, for marriages, births and deaths per year, word clouds for name  
        frequency for every 26 years and a male to female bar charts about people who were born and who died for 
        different time periods.
        
        This project is inspired by the work of Will Koehrsen.""",
                     width=700,
                     height=100)

        # Creating a tab for each visualization
        tab = Panel(child=p, title="About Us")
        tab1 = Panel(child=p1, title="About the project")

        tabs = Tabs(tabs=[tab, tab1])

        return tabs
예제 #13
0
    def create_fig(self, sources):
        """


        """

        if self._type == 'PreText':
            fig = PreText(text=self._text,  **self._args)
        elif self._type == 'Div':
            fig = Div(text=self._text, **self._args)
        elif self._type == 'Paragraph':
            fig = Paragraph(text=self._text, **self._args)

        return fig
예제 #14
0
	def __init__(self, X, Y, patch_xs, patch_ys):
		self.workspace = figure(x_range=[x_low-2,x_high+2], y_range=[0,.6], toolbar_location=None)
		self.plot = self.workspace.line(x=X, y=Y, line_width=4)
		
		self.point = self.workspace.circle(x=[0], y=[-1], size=10, color="red")
		self.fx = self.workspace.circle(x=[0], y=[-1], size=10, color="red")
		self.sample_y = self.workspace.circle(x=[0], y=[-1], size=10, color="black")
		self.vertical = self.workspace.line(x=[0,0], y=[0,0], color="red", line_width=2)
		self.horizontal = self.workspace.line(x=[0,0], y=[0,0], color="red", line_width=2)
		self.slice = self.workspace.line(x=[0,0], y=[0,0], color="black", line_width=4)
		self.patches = self.workspace.patches(patch_xs, patch_ys, alpha=.3, line_width=2)
		self.filler1 = PreText(text='', width=200, height=250)
		self.filler2 = PreText(text='', width=200, height=250)

		## for choosing update function
		self.radio = RadioButtonGroup(
		    labels=['Stepping out', 'Doubling'], active=0)
		self.radio.on_click(self.radio_handler)

		## for progressing demo
		self.button = Button(label="Next")
		self.button.on_click(self.callback)

		curdoc().add_root(row(column(self.filler1, self.button), self.workspace, column(self.filler2, self.radio)))
예제 #15
0
def generic_tab(db, mode):
    cur = db.cursor()
    cur.execute("SELECT name FROM sqlite_master WHERE type='table' AND name=?",
                [mode])
    if len(cur.fetchall()) == 0:
        return None
    cur.execute('select * from "' + mode + '"')
    text = ""
    for r in cur:
        l = r[0]
        text += l
    content = PreText(text=text)
    layout = WidgetBox(content, sizing_mode="scale_both")
    tab = Panel(child=layout, title=mode)
    return tab
예제 #16
0
    def __init__(self, logdata: DataFrame):
        self.line_dataset = None
        self.scatter_dataset = None
        self.logdata = logdata

        # Partition markers, filter out span data from full log
        self.span_locations = logdata[logdata.Name.isin(conf.sections)]
        self.logdata = self.logdata[~self.logdata.Name.isin(conf.sections)]

        # Convert to datetime format
        self.logdata.Timestamp = to_datetime(self.logdata.Timestamp, unit='ms')

        # Scatter data
        self.scatter_data = self.logdata

        # Multi line data prep
        self.line_data = self.logdata.groupby('Channel').aggregate({
            'Timestamp':
            list,
            'Value':
            list
        })

        self.id_list = list(self.line_data.index)
        self.id_list.sort()
        self.line_checkbox = CheckboxGroup(labels=self.id_list)
        self.line_checkbox.on_change('active', self.lineplot_handler)
        self.scatter_checkbox = CheckboxGroup(labels=self.id_list)
        self.scatter_checkbox.on_change('active', self.scatterplot_handler)

        #self.duration = self.logdata.Timestamp.max() -
        self.reaction_times = [1, 2, 3, 4, 5]
        self.extra_data_text = PreText(text='')

        try:
            self.sections = generate_sections(logdata)
            radio_labels = [
                'Section %s' % i for i in range(len(self.sections))
            ]
            radio_labels.append('All')
            self.radio_buttons = RadioButtonGroup(labels=radio_labels,
                                                  active=len(radio_labels) - 1)
            self.radio_buttons.on_change('active', self.radio_button_handler)
        except IndexError:
            print('Missing Slide values. Skipping section generation')
            self.radio_buttons = RadioButtonGroup(labels=['Fix your data'])
예제 #17
0
def create_updates_tab():
    """
    Creates updates tab

    """

    file_path = os.path.join(os.path.join(GLOBAL_PWD, "..", ".."),
                             UPDATES_FILE)

    updates_text = ""
    with open(file_path, "r", encoding=CONST_ENCODING) as myfile:
        updates_text = myfile.read()

    widget_updates = PreText(text="""%s""" % (updates_text))

    updates_widgets = column(children=[row(children=[widget_updates])])

    return Panel(child=updates_widgets, title="Release notes")
예제 #18
0
 def init(self):
     self.plot_templates = self.shared_state["plot_templates"]
     # self.json_viewer = TextInput(value=self.text, title="Templates", width=1000, height=600)
     self.template_selector = Select(
         title=None,
         value="",
         options=[t for t in self.plot_templates],
         height=60,
         width=200)
     self.build_plot_button = Button(label="Build plot",
                                     button_type="primary",
                                     disabled=True,
                                     height=60,
                                     width=180)
     self.json_viewer = PreText(text="Template values: \n",
                                width=700,
                                height=500)
     # self.json_viewer.js_on_change("value", cb)
     self.json_viewer.disabled = False
예제 #19
0
    def create(self, ped, stddev=None):
        self.log.info("Creating {}".format(self.name))
        self._ped = ped
        self._stddev = stddev

        n_tm = ped.shape[0]
        self.n_tmpix = ped.shape[1]
        n_pixels = n_tm * self.n_tmpix

        self._update_cdsource()

        fig = self._get_figure()

        # Widgets
        tm_str = ['{:.0f}'.format(x) for x in range(n_tm)]
        tmpix_str = ['{:.0f}'.format(x) for x in range(self.n_tmpix)]
        pixel_str = ['{:.0f}'.format(x) for x in range(n_pixels)]

        self.tm_select = Select(title="TM:", value='0', options=tm_str)
        self.tmpix_select = Select(title="TMPIX:",
                                   value='0',
                                   options=tmpix_str)
        self.pixel_select = Select(title="PIXEL:",
                                   value='0',
                                   options=pixel_str)

        text = PreText(text="""
        Changing of TM and TMPIX only works when plot_pedestal
        is ran from inside a Bokeh server.
        e.g.
        bokeh serve --show plot_pedestal.py --args -P pedestal.fits
        """,
                       width=500,
                       height=100)

        self.tm_select.on_change('value', self._on_tm_select)
        self.tmpix_select.on_change('value', self._on_tmpix_select)
        self.pixel_select.on_change('value', self._on_pixel_select)

        self.layout = layout(
            [[self.tm_select, self.tmpix_select, self.pixel_select, text],
             [fig]])
def rdf_plot(name):
    from bokeh.plotting import figure

    if name != "PAU":
        df_rdf = get_rdf_df(name)
        p = figure(
            width=800,
            height=int(800 / 1.61803),
            x_axis_label="r / A",
            y_axis_label="g(r)",
            title="methane-framework radial distribution function",
            active_drag="box_zoom",
            output_backend="webgl",
        )
        p.line(df_rdf.distance, df_rdf.histogram, color="#d62728")

    else:
        p = PreText(text="No RDF available.", width=800, height=100)

    return p
예제 #21
0
def build_cam_view(source, imdata):
    label = PreText(text='Camera', width=300)

    fig = figure(plot_width=300,
                plot_height=300,
                x_range=(0, 100), y_range=(0, 100),
                responsive=True)

    fig.toolbar.logo = None
    fig.toolbar_location = None
    fig.xaxis.major_tick_line_color = None  # turn off x-axis major ticks
    fig.xaxis.minor_tick_line_color = None  # turn off x-axis minor ticks
    fig.yaxis.major_tick_line_color = None  # turn off y-axis major ticks
    fig.yaxis.minor_tick_line_color = None  # turn off y-axis minor ticks
    fig.xaxis.major_label_text_font_size = '0pt'  # preferred method for removing tick labels
    fig.yaxis.major_label_text_font_size = '0pt'  # preferred method for removing tick labels

    im = fig.image(image='image',x=0,y=0,dw=100,dh=100, source=source)
    #log.info(str(im))
    col = column(widgetbox(label), fig)
    return fig
    def __init__ (self, size=500):
        self.size = size
        self.game_thresh= Slider(title="Probability of Winning at Least Games", value=50, start=0, end=82, step=1)
        self.select_team = Select(title="Current_Team:", value="GSW", options=my_predicter.get_teams_list())

# Create Column Data Source that will be used by the plot
        self.scatter_source = ColumnDataSource(data=dict(
                    pct =[],
                    we = [],
                    prob = []))
                    

        self.p2_hover = HoverTool(
            tooltips=[
                ("win percentage", "@pct"),
                ("game equivalent", "@we"),
                ("probability of winnin N games", "@prob"),
            ]
        )

        palette_r = palette[::-1]
        color_mapper = LinearColorMapper(palette=palette_r, low = 0.0, high = 100.0)
        self.p2 = figure(title="Probability of winning at least n games", tools=[self.p2_hover,"save"],
                   background_fill_color="#E8DDCB",  width= self.size, plot_height=self.size, toolbar_location="below")
        self.p2.xaxis.axis_label = 'Prior Expected Win Pct'
        self.p2.yaxis.axis_label = 'Prior Game Equivalent'

        #self.scatter_course.data['c' = "red"
        self.p2.circle(x='pct', y='we', color= {'field': 'prob', 'transform': color_mapper}, line_color="black", source = self.scatter_source, size = 12)
        color_bar = ColorBar(color_mapper=color_mapper, ticker=BasicTicker(),
                     label_standoff=12, border_line_color=None, location=(0,0))
        self.p2.add_layout(color_bar, 'right')
        text_string = """
        From the previous tab, it is clear your prior beliefs should strongly influence
        your future projections. This tab lets you explore different beliefs based on your
        prior. Choose a team, and a number of wins you wish to project them achieving. This plot
        tells you the probability they achieve those wins (color), conditional on a prior expected
        winning percentage (x-axis) and a strength of that prior (y-axis)
        """
        self.sample_text = PreText (text = text_string, height = 50, width =800)
예제 #23
0
def modify_doc(doc):

    explorer = QAExplorer(rootdir='.')
    explorer.output = explorer.view()

    doc = parambokeh.Widgets(explorer,
                             continuous_update=False,
                             callback=explorer.event,
                             view_position='right',
                             mode='server')

    name_input = TextInput(value='selected', title="Save IDs as")
    save_button = Button(label='Save IDs', width=100)
    clear_button = Button(label='Clear saved IDs', width=100)
    saved_ids = PreText(text=','.join(explorer.saved_ids))

    def save_selected():
        explorer.save_selected(name_input.value)
        saved_ids.text = ','.join(explorer.saved_ids)

    def clear_ids():
        for f in [
                os.path.join(explorer.id_path, '{}.h5'.format(i))
                for i in explorer.saved_ids
        ]:
            os.remove(f)
        saved_ids.txt = ''

    save_button.on_click(save_selected)
    clear_button.on_click(clear_ids)

    doc.add_root(name_input)
    doc.add_root(save_button)
    doc.add_root(saved_ids)
    doc.add_root(clear_button)

    return doc
예제 #24
0
    def create(cls):
        """
        This function is called once, and is responsible for
        creating all objects (plots, datasources, etc)
        """
        # create layout widgets
        obj = cls()
        obj.mainrow = HBox()
        obj.histrow = HBox()
        obj.statsbox = VBox()
        obj.input_box = VBoxForm()

        # create input widgets
        obj.make_inputs()

        # outputs
        obj.pretext = PreText(text="", width=500)
        obj.make_source()
        obj.make_plots()
        obj.make_stats()

        # layout
        obj.set_children()
        return obj
예제 #25
0
dataset.columns = ['asin', 'reviewerID', 'overall', 'unixReviewTime']
metadata = pd.read_csv('myapp/dataset/Music_Instruments_meta_5.csv',
                       skipinitialspace=True)
metadata.columns = ['Product ID', 'Description', 'price', 'Category']


def upload_dataset(attr, old, new):
    global dataset
    dataset = pd.read_csv(io.BytesIO(base64.b64decode(
        dataset_file_input.value)),
                          skipinitialspace=True)
    dataset.columns = ['asin', 'reviewerID', 'overall', 'unixReviewTime']


pre_dataset = PreText(text="""Reviews Dataset CSV File""",
                      width=200,
                      height=10)
dataset_file_input = FileInput(accept=".csv")
dataset_file_input.on_change('value', upload_dataset)


def upload_metadata(attr, old, new):
    global metadata
    metadata = pd.read_csv(io.BytesIO(
        base64.b64decode(metadata_file_input.value)),
                           skipinitialspace=True)
    metadata.columns = ['Product ID', 'Description', 'price', 'Category']


pre_metadata = PreText(text="""Metadata CSV File""", width=150, height=10)
metadata_file_input = FileInput(accept=".csv")
예제 #26
0
    def control(self):
        personId = Select(
            value='all',
            title="Person ID",
            options=['all', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'])
        room = Select(title="Room",
                      value="all",
                      options=[
                          "all", "bath", "bed1", "bed2", "hall", "kitchen",
                          "living", "stairs", "study", "toilet"
                      ])
        slider = Slider(start=0, end=1800, value=1, step=1, title="Time")
        annotationText = PreText(text='Annotation: ')
        locationText = PreText(text='Location: ')

        controls = widgetbox(
            [personId, room, slider, annotationText, locationText], width=300)

        stackBar = self.annotationStackBar('all')
        p = layout([[
            controls,
            layout([[self.firstMap(), self.groundMap()],
                    [
                        self.annotationDistribution('all'),
                        self.locationDistribution('all')
                    ], [self.annotationBar('all', 'all')], [stackBar[0]],
                    [stackBar[1]], [self.ganttChart(0)]])
        ]])

        def update(_, __, ___):
            try:
                pid = personId.value
                roomValue = room.value

                sb = self.annotationStackBar(pid)
                p.children[0].children[1] = layout(
                    [[self.firstMap(), self.groundMap()],
                     [
                         self.annotationDistribution(pid),
                         self.locationDistribution(pid)
                     ], [self.annotationBar(pid, roomValue)], [sb[0]], [sb[1]],
                     [self.ganttChart(pid)]])
            except:
                pass

        def updateTime(_, __, value):
            try:
                location = self.db.timeBased.find({
                    't': int(value),
                    'pid': int(personId.value)
                })
                annotation = self.db.timeBased.find({
                    't': int(value),
                    'pid': int(personId.value)
                })

                locationText.text = 'Location: %s' % location[0]['locationName']
                annotationText.text = 'Annotation: %s' % annotation[0][
                    'annotationsName']
            except:
                locationText.text = 'Location: Unknown'
                annotationText.text = 'Annotation: Unknown'

        personId.on_change('value', update)
        room.on_change('value', update)
        slider.on_change('value', updateTime)

        # toggle = Toggle(label="Refresh", button_type="success")

        curdoc().add_root(p)
예제 #27
0
    for cc in c_controls:
        cc.on_change("value", lambda attr, old, new: change_values())
    preview_clust_button.on_click(preview)
    reset_button.on_click(reset_values)

    ### Page layout
    top_title = Div( text="<h3></h3>", name='top_title')
    if trimmed:
        top_title.text = "<h3>Caution: some regions had >50 hits, and have been truncated.</h3>"
    cl_title = Div( text="<h3>Clustering parameters:</h3>" )
    empty_vert = Div( text="<br><br>" )
    goto_summary_button = Div(text='''<form name="Goto_summary" action="/'''+orf+'''" method="get">
    <input type="hidden" name="prob" id="prob" value="'''+str(prob_def)+'''"/>
    <input type="hidden" name="ovm" id="ovm" value="'''+str(om_def)+'''" />
    <input type="hidden" name="ovm1" id="ovm1" value="'''+str(om_def1)+'''" />
    <button type="submit">Go to summary view</button>
    </form>''', name='goto_summary_button')
    page = layout( [widgetbox(top_title)],
                   [widgetbox(threshold_text),
                    widgetbox(cl_title, ov_min_text, ov_min1_text),
                    widgetbox(empty_vert, preview_clust_button, reset_button),
                    widgetbox(goto_summary_button)],
                   [p],
                   sizing_mode='scale_width' )
    curdoc().add_root(page)

except Exception as e:
    curdoc().clear()
    mess = PreText( text=str(e) )
    curdoc().add_root( mess )
예제 #28
0
def ticker1_change(attrname, old, new):
    ticker1.options = DEFAULT_TICKERS
    update()


def selection_change(attrname, old, new):
    t1 = ticker1.value
    data = get_data(t1)
    selected = source.selected.indices
    if selected:
        data = data.iloc[selected, :]


# set up widgets
stats = PreText(text="", width=100)
ticker1 = Select(value="ts", options=DEFAULT_TICKERS)

# set up plot

source = ColumnDataSource(
    data=dict(
        step=[],
        t1=[],
        t1_e=[],
        t1_e_=[],
        t1_e_TF=[],
        t1_c_max=[],
        t1_c_max_=[],
        t1_gm_TF=[],
        t1_c_rms=[],
예제 #29
0
파일: main.py 프로젝트: ltalirz/CCGenome
        desc = "{} [{}]".format(v['label'], v['unit'])

    if 'default' not in v.keys():
        v['default'] = None

    if v['type'] == 'float':
        filters_dict[k] = get_slider(desc, v['range'], v['default'])
    elif v['type'] == 'list':
        if 'labels' not in v.keys():
            v['labels'] = None
        filters_dict[k] = get_select(desc, v['values'], v['default'],
                                     v['labels'])

# plot button, output, graph
btn_plot = Button(label='Plot', button_type='primary')
info_block = PreText(text='', width=500, height=100)
plot_info = PreText(text='', width=300, height=100)

load_preset(None, None, get_preset_label_from_url())

source = bmd.ColumnDataSource(data=data_empty)
hover = bmd.HoverTool(tooltips=[])
tap = bmd.TapTool()

colorscale = [
    '#CCFFCC', '#CCFFCC', '#CCFFCC', '#CCFFCC', '#CCFFCC', '#CCFFCC',
    '#CCFFCC', '#CCFFCC', '#CCFFCC', '#CCFFCC', '#CCFFCC', '#CCFFCC',
    '#CCFFCC', '#CCFFCC', '#CCFFCC', '#80FF66', '#80FF66', '#80FF66',
    '#80FF66', '#80FF66', '#80FF66', '#80FF66', '#80FF66', '#80FF66',
    '#80FF66', '#80FF66', '#80FF66', '#80FF66', '#80FF66', '#80FF66',
    '#80FF66', '#80FF66', '#80FF66', '#80FF66', '#80FF66', '#80FF66',
예제 #30
0
    data = pd.concat([df1, df2, df3], axis=1)
    data = data.dropna()
    data['t1'] = df1[t1]
    data['t2'] = df2[t2]
    data['t3'] = df3[t3]
    data['module'] = df1[t1+'_module']
    #data['t2_module'] = data[t2+'_module']
    #print data
    #data['t1_returns'] = data[t1+'_returns']
    #data['t2_returns'] = data[t2+'_returns']
    #print data
    return data

# set up widgets

stats = PreText(text='', width=300)
ticker1 = Select(title = "X-axis",value='%s' % DEFAULT_TICKERS[5], options= DEFAULT_TICKERS )
ticker2 = Select(title = "Y-axis",value='%s' % DEFAULT_TICKERS[4], options= DEFAULT_TICKERS )
ticker3 = Select(title = "Size"  ,value='%s' % DEFAULT_TICKERS[3], options= DEFAULT_TICKERS )
#size   = Select(title =' Size', value='None', options=['None'] + columns)

# set up plots

#source = ColumnDataSource(data=dict(date=[], t1=[], t2=[], t1_returns=[], t2_returns=[]))
source        = ColumnDataSource(data=dict(number=[], t1=[], t2=[], t3=[], module=[] ))
#source_static = ColumnDataSource(data=dict(date=[], t1=[], t2=[], t1_returns=[], t2_returns=[]))
source_static = ColumnDataSource(data=dict(number=[], t1=[], t2=[], t3=[], module=[] ))

hover = HoverTool(tooltips=[("module, %s, %s" % (ticker1.value.title(), ticker2.value.title()),"@module, @t1, @t2")])

hover2 = HoverTool(tooltips=[("module","@module")])
예제 #31
0
    def write_run_plot(self, run=None, site_type=None, raft=None):

        print('Operating on run ', run)

        g = get_EO_analysis_results(db=self.db, server=self.server)

        raft_list, data = g.get_tests(site_type=site_type,
                                      test_type="gain",
                                      run=run)
        res = g.get_results(test_type="gain", data=data, device=raft)

        raft_list_ptc, data_ptc = g.get_tests(site_type=site_type,
                                              test_type="ptc_gain",
                                              run=run)
        res_ptc_gain = g.get_results(test_type='ptc_gain',
                                     data=data_ptc,
                                     device=raft)

        raft_list_psf, data_psf = g.get_tests(site_type=site_type,
                                              test_type="psf_sigma",
                                              run=run)
        res_psf = g.get_results(test_type='psf_sigma',
                                data=data_psf,
                                device=raft)

        raft_list_rn, data_rn = g.get_tests(site_type=site_type,
                                            test_type="read_noise",
                                            run=run)
        res_rn = g.get_results(test_type='read_noise',
                               data=data_rn,
                               device=raft)

        raft_list_cti_low_serial, data_cls = g.get_tests(
            site_type=site_type, test_type="cti_low_serial", run=run)
        res_cls = g.get_results(test_type='cti_low_serial',
                                data=data_cls,
                                device=raft)
        raft_list_cti_high_serial, data_chs = g.get_tests(
            site_type=site_type, test_type="cti_high_serial", run=run)
        res_chs = g.get_results(test_type='cti_high_serial',
                                data=data_chs,
                                device=raft)

        raft_list_cti_low_parallel, data_clp = g.get_tests(
            site_type=site_type, test_type="cti_low_parallel", run=run)
        res_clp = g.get_results(test_type='cti_low_parallel',
                                data=data_clp,
                                device=raft)

        raft_list_cti_high_parallel, data_chp = g.get_tests(
            site_type=site_type, test_type="cti_high_parallel", run=run)
        res_chp = g.get_results(test_type='cti_high_parallel',
                                data=data_chp,
                                device=raft)

        raft_list_dark_pixels, data_dp = g.get_tests(site_type=site_type,
                                                     test_type="dark_pixels",
                                                     run=run)
        res_dp = g.get_results(test_type='dark_pixels',
                               data=data_dp,
                               device=raft)

        raft_list_dark_columns, data_dc = g.get_tests(site_type=site_type,
                                                      test_type="dark_columns",
                                                      run=run)
        res_dc = g.get_results(test_type='dark_columns',
                               data=data_dc,
                               device=raft)

        raft_list_bright_pixels, data_bp = g.get_tests(
            site_type=site_type, test_type="bright_pixels", run=run)
        res_bp = g.get_results(test_type='bright_pixels',
                               data=data_bp,
                               device=raft)

        raft_list_bright_columns, data_bc = g.get_tests(
            site_type=site_type, test_type="bright_columns", run=run)
        res_bc = g.get_results(test_type='bright_columns',
                               data=data_bc,
                               device=raft)

        raft_list_traps, data_tp = g.get_tests(site_type=site_type,
                                               test_type="num_traps",
                                               run=run)
        res_tp = g.get_results(test_type='num_traps',
                               data=data_tp,
                               device=raft)

        raft_list_qe, data_qe = g.get_tests(site_type=site_type,
                                            test_type="QE",
                                            run=run)
        res_qe = g.get_results(test_type='QE', data=data_qe, device=raft)

        raft_list_drkC, data_drkC = g.get_tests(site_type=site_type,
                                                test_type="dark_current_95CL",
                                                run=run)
        res_drkC = g.get_results(test_type='dark_current_95CL',
                                 data=data_drkC,
                                 device=raft)

        raft_list_fw, data_fw = g.get_tests(site_type=site_type,
                                            test_type="full_well",
                                            run=run)
        res_fw = g.get_results(test_type='full_well',
                               data=data_fw,
                               device=raft)

        raft_list_nonl, data_nonl = g.get_tests(site_type=site_type,
                                                test_type="max_frac_dev",
                                                run=run)
        res_nonl = g.get_results(test_type='max_frac_dev',
                                 data=data_nonl,
                                 device=raft)

        test_list = []
        test_list_ptc = []
        test_list_psf = []
        test_list_rn = []

        test_list_cls = []
        test_list_chs = []
        test_list_clp = []
        test_list_chp = []

        test_list_dp = []
        test_list_dc = []
        test_list_bp = []
        test_list_bc = []
        test_list_tp = []

        test_list_drkC = []
        test_list_fw = []
        test_list_nonl = []

        # treat qe specially since all filters are in the same list

        test_list_qe_u = []
        test_list_qe_g = []
        test_list_qe_r = []
        test_list_qe_i = []
        test_list_qe_z = []
        test_list_qe_y = []

        for ccd in res:
            test_list.extend(res[ccd])
            test_list_ptc.extend(res_ptc_gain[ccd])
            test_list_psf.extend(res_psf[ccd])
            test_list_rn.extend(res_rn[ccd])

            test_list_cls.extend(res_cls[ccd])
            test_list_chs.extend(res_chs[ccd])
            test_list_clp.extend(res_clp[ccd])
            test_list_chp.extend(res_chp[ccd])

            test_list_bp.extend(res_bp[ccd])
            test_list_bc.extend(res_bc[ccd])
            test_list_dp.extend(res_dp[ccd])
            test_list_dc.extend(res_dc[ccd])
            test_list_tp.extend(res_tp[ccd])

            test_list_drkC.extend(res_drkC[ccd])
            test_list_fw.extend(res_fw[ccd])
            test_list_nonl.extend(res_nonl[ccd])

            test_list_qe_u.append(res_qe[ccd][0])
            test_list_qe_g.append(res_qe[ccd][1])
            test_list_qe_r.append(res_qe[ccd][2])
            test_list_qe_i.append(res_qe[ccd][3])
            test_list_qe_z.append(res_qe[ccd][4])
            test_list_qe_y.append(res_qe[ccd][5])

        # NEW: create a column data source for the plots to share
        source = ColumnDataSource(data=dict(x=range(0, len(test_list)),
                                            gain=test_list,
                                            ptc=test_list_ptc,
                                            psf=test_list_psf,
                                            rn=test_list_rn,
                                            cls=test_list_cls,
                                            chs=test_list_chs,
                                            clp=test_list_clp,
                                            chp=test_list_chp,
                                            bp=test_list_bp,
                                            bc=test_list_bc,
                                            dp=test_list_dp,
                                            dc=test_list_dc,
                                            tp=test_list_tp,
                                            drkC=test_list_drkC,
                                            fw=test_list_fw,
                                            nonl=test_list_nonl))

        source_qe = ColumnDataSource(data=dict(x=range(0, len(test_list_qe_u)),
                                               u=test_list_qe_u,
                                               g=test_list_qe_g,
                                               r=test_list_qe_r,
                                               i=test_list_qe_i,
                                               z=test_list_qe_z,
                                               y=test_list_qe_y))

        TOOLS = "pan,wheel_zoom,box_zoom,reset,save,box_select,lasso_select"

        # create a new plot with a title and axis labels
        p = figure(tools=TOOLS,
                   title="gains",
                   x_axis_label='amp',
                   y_axis_label='gain')
        ptc = figure(tools=TOOLS,
                     title="ptc gains",
                     x_axis_label='amp',
                     y_axis_label='gain')
        psf = figure(tools=TOOLS,
                     title="psf",
                     x_axis_label='amp',
                     y_axis_label='psf')
        rn = figure(tools=TOOLS,
                    title="Read noise",
                    x_axis_label='amp',
                    y_axis_label='Noise')

        cls = figure(tools=TOOLS,
                     title="CTI low serial",
                     x_axis_label='amp',
                     y_axis_label='CTI')
        chs = figure(tools=TOOLS,
                     title="CTI high serial",
                     x_axis_label='amp',
                     y_axis_label='CTI')
        clp = figure(tools=TOOLS,
                     title="CTI low parallel",
                     x_axis_label='amp',
                     y_axis_label='CTI')
        chp = figure(tools=TOOLS,
                     title="CTI high parallel",
                     x_axis_label='amp',
                     y_axis_label='CTI')

        bp = figure(tools=TOOLS,
                    title="Bright Pixels",
                    x_axis_label='amp',
                    y_axis_label='Bright Pixels')
        bc = figure(tools=TOOLS,
                    title="Bright Columns",
                    x_axis_label='amp',
                    y_axis_label='Bright Columns')
        dp = figure(tools=TOOLS,
                    title="Dark Pixels",
                    x_axis_label='amp',
                    y_axis_label='Dark Pixels')
        dc = figure(tools=TOOLS,
                    title="Dark Columns",
                    x_axis_label='amp',
                    y_axis_label='Dark Columns')
        tp = figure(tools=TOOLS,
                    title="Traps",
                    x_axis_label='amp',
                    y_axis_label='Traps')

        drkC = figure(tools=TOOLS,
                      title="Dark Current",
                      x_axis_label='amp',
                      y_axis_label='Current')
        fw = figure(tools=TOOLS,
                    title="Full Well",
                    x_axis_label='amp',
                    y_axis_label='Full Well')
        nonl = figure(tools=TOOLS,
                      title="Non-linearity",
                      x_axis_label='amp',
                      y_axis_label='Max dev')

        qe_u = figure(tools=TOOLS,
                      title="QE: u band",
                      x_axis_label='sensor',
                      y_axis_label='QE')
        qe_g = figure(tools=TOOLS,
                      title="QE: g band",
                      x_axis_label='sensor',
                      y_axis_label='QE')
        qe_r = figure(tools=TOOLS,
                      title="QE: r band",
                      x_axis_label='sensor',
                      y_axis_label='QE')
        qe_i = figure(tools=TOOLS,
                      title="QE: i band",
                      x_axis_label='sensor',
                      y_axis_label='QE')
        qe_z = figure(tools=TOOLS,
                      title="QE: z band",
                      x_axis_label='sensor',
                      y_axis_label='QE')
        qe_y = figure(tools=TOOLS,
                      title="QE: y band",
                      x_axis_label='sensor',
                      y_axis_label='QE')

        # add a line renderer with legend and line thickness
        #sensor_lines = [sensor_start, sensor_end, sensor_third]
        sensor_lines = []
        for i in range(0, 160, 16):
            sensor_lines.append(
                Span(location=i,
                     dimension='height',
                     line_color='grey',
                     line_dash='dashed',
                     line_width=3))
        p.circle('x',
                 'gain',
                 source=source,
                 legend="Gain: Run " + str(run),
                 line_width=2)
        for sensor_line in sensor_lines:
            p.add_layout(sensor_line)

        my_label = Label(x=0, y=10, text='S00')
        p.add_layout(my_label)

        sensor_lines = []
        for i in range(0, 160, 16):
            sensor_lines.append(
                Span(location=i,
                     dimension='height',
                     line_color='grey',
                     line_dash='dashed',
                     line_width=3))
        ptc.circle('x',
                   'ptc',
                   source=source,
                   legend="ptc Gain: Run " + str(run),
                   line_width=2)
        for sensor_line in sensor_lines:
            ptc.add_layout(sensor_line)

        sensor_lines = []
        for i in range(0, 160, 16):
            sensor_lines.append(
                Span(location=i,
                     dimension='height',
                     line_color='grey',
                     line_dash='dashed',
                     line_width=3))
        psf.circle('x',
                   'psf',
                   source=source,
                   legend="PSF: Run " + str(run),
                   line_width=2)
        for sensor_line in sensor_lines:
            psf.add_layout(sensor_line)

        sensor_lines = []
        for i in range(0, 160, 16):
            sensor_lines.append(
                Span(location=i,
                     dimension='height',
                     line_color='grey',
                     line_dash='dashed',
                     line_width=3))
        rn.circle('x',
                  'rn',
                  source=source,
                  legend="Read Noise: Run " + str(run),
                  line_width=2)
        for sensor_line in sensor_lines:
            rn.add_layout(sensor_line)

        sensor_lines = []
        for i in range(0, 160, 16):
            sensor_lines.append(
                Span(location=i,
                     dimension='height',
                     line_color='grey',
                     line_dash='dashed',
                     line_width=3))
        cls.circle('x',
                   'cls',
                   source=source,
                   legend="CTI low serial: Run " + str(run),
                   line_width=2)
        for sensor_line in sensor_lines:
            cls.add_layout(sensor_line)

        sensor_lines = []
        for i in range(0, 160, 16):
            sensor_lines.append(
                Span(location=i,
                     dimension='height',
                     line_color='grey',
                     line_dash='dashed',
                     line_width=3))
        chs.circle('x',
                   'chs',
                   source=source,
                   legend="CTI high serial: Run " + str(run),
                   line_width=2)
        for sensor_line in sensor_lines:
            chs.add_layout(sensor_line)

        sensor_lines = []
        for i in range(0, 160, 16):
            sensor_lines.append(
                Span(location=i,
                     dimension='height',
                     line_color='grey',
                     line_dash='dashed',
                     line_width=3))
        clp.circle('x',
                   'clp',
                   source=source,
                   legend="CTI low parallel: Run " + str(run),
                   line_width=2)
        for sensor_line in sensor_lines:
            clp.add_layout(sensor_line)

        sensor_lines = []
        for i in range(0, 160, 16):
            sensor_lines.append(
                Span(location=i,
                     dimension='height',
                     line_color='grey',
                     line_dash='dashed',
                     line_width=3))
        chp.circle('x',
                   'chp',
                   source=source,
                   legend="CTI high parallel: Run " + str(run),
                   line_width=2)
        for sensor_line in sensor_lines:
            chp.add_layout(sensor_line)

        sensor_lines = []
        for i in range(0, 160, 16):
            sensor_lines.append(
                Span(location=i,
                     dimension='height',
                     line_color='grey',
                     line_dash='dashed',
                     line_width=3))
        bp.circle('x',
                  'bp',
                  source=source,
                  legend="Bright Pixels: Run " + str(run),
                  line_width=2)
        for sensor_line in sensor_lines:
            bp.add_layout(sensor_line)

        sensor_lines = []
        for i in range(0, 160, 16):
            sensor_lines.append(
                Span(location=i,
                     dimension='height',
                     line_color='grey',
                     line_dash='dashed',
                     line_width=3))
        bc.circle('x',
                  'bc',
                  source=source,
                  legend="Bright Columns: Run " + str(run),
                  line_width=2)
        for sensor_line in sensor_lines:
            bc.add_layout(sensor_line)

        sensor_lines = []
        for i in range(0, 160, 16):
            sensor_lines.append(
                Span(location=i,
                     dimension='height',
                     line_color='grey',
                     line_dash='dashed',
                     line_width=3))
        dp.circle('x',
                  'dp',
                  source=source,
                  legend="Dark Pixels: Run " + str(run),
                  line_width=2)
        for sensor_line in sensor_lines:
            dp.add_layout(sensor_line)

        sensor_lines = []
        for i in range(0, 160, 16):
            sensor_lines.append(
                Span(location=i,
                     dimension='height',
                     line_color='grey',
                     line_dash='dashed',
                     line_width=3))
        dc.circle('x',
                  'dc',
                  source=source,
                  legend="Dark Columns: Run " + str(run),
                  line_width=2)

        for sensor_line in sensor_lines:
            dc.add_layout(sensor_line)

        sensor_lines = []
        for i in range(0, 160, 16):
            sensor_lines.append(
                Span(location=i,
                     dimension='height',
                     line_color='grey',
                     line_dash='dashed',
                     line_width=3))
        tp.circle('x',
                  'tp',
                  source=source,
                  legend="Traps: Run " + str(run),
                  line_width=2)
        for sensor_line in sensor_lines:
            tp.add_layout(sensor_line)

        sensor_lines = []
        for i in range(0, 160, 16):
            sensor_lines.append(
                Span(location=i,
                     dimension='height',
                     line_color='grey',
                     line_dash='dashed',
                     line_width=3))

        drkC.circle('x',
                    'drkC',
                    source=source,
                    legend="Dark Current: Run " + str(run),
                    line_width=2)
        for sensor_line in sensor_lines:
            drkC.add_layout(sensor_line)

        sensor_lines = []
        for i in range(0, 160, 16):
            sensor_lines.append(
                Span(location=i,
                     dimension='height',
                     line_color='grey',
                     line_dash='dashed',
                     line_width=3))
        fw.circle('x',
                  'fw',
                  source=source,
                  legend="Full Well: Run " + str(run),
                  line_width=2)
        for sensor_line in sensor_lines:
            fw.add_layout(sensor_line)

        sensor_lines = []
        for i in range(0, 160, 16):
            sensor_lines.append(
                Span(location=i,
                     dimension='height',
                     line_color='grey',
                     line_dash='dashed',
                     line_width=3))
        nonl.circle('x',
                    'nonl',
                    source=source,
                    legend="Non-linearity: Run " + str(run),
                    line_width=2)
        for sensor_line in sensor_lines:
            nonl.add_layout(sensor_line)

        raft_lines = []
        for i in range(0, 9, 1):
            raft_lines.append(
                Span(location=i,
                     dimension='height',
                     line_color='grey',
                     line_dash='dashed',
                     line_width=3))

        qe_u.circle('x',
                    'u',
                    source=source_qe,
                    legend="QE u band: Run " + str(run),
                    line_width=2)
        for raft_line in raft_lines:
            qe_u.add_layout(raft_line)

        raft_lines = []
        for i in range(0, 9, 1):
            raft_lines.append(
                Span(location=i,
                     dimension='height',
                     line_color='grey',
                     line_dash='dashed',
                     line_width=3))
        qe_g.circle('x',
                    'g',
                    source=source_qe,
                    legend="QE g band: Run " + str(run),
                    line_width=2)
        for raft_line in raft_lines:
            qe_g.add_layout(raft_line)

        raft_lines = []
        for i in range(0, 9, 1):
            raft_lines.append(
                Span(location=i,
                     dimension='height',
                     line_color='grey',
                     line_dash='dashed',
                     line_width=3))
        qe_r.circle('x',
                    'r',
                    source=source_qe,
                    legend="QE r band: Run " + str(run),
                    line_width=2)
        for raft_line in raft_lines:
            qe_r.add_layout(raft_line)

        raft_lines = []
        for i in range(0, 9, 1):
            raft_lines.append(
                Span(location=i,
                     dimension='height',
                     line_color='grey',
                     line_dash='dashed',
                     line_width=3))
        qe_i.circle('x',
                    'i',
                    source=source_qe,
                    legend="QE i band: Run " + str(run),
                    line_width=2)
        for raft_line in raft_lines:
            qe_i.add_layout(raft_line)

        raft_lines = []
        for i in range(0, 9, 1):
            raft_lines.append(
                Span(location=i,
                     dimension='height',
                     line_color='grey',
                     line_dash='dashed',
                     line_width=3))
        qe_z.circle('x',
                    'z',
                    source=source_qe,
                    legend="QE z band: Run " + str(run),
                    line_width=2)
        for raft_line in raft_lines:
            qe_z.add_layout(raft_line)

        raft_lines = []
        for i in range(0, 9, 1):
            raft_lines.append(
                Span(location=i,
                     dimension='height',
                     line_color='grey',
                     line_dash='dashed',
                     line_width=3))
        qe_y.circle('x',
                    'y',
                    source=source_qe,
                    legend="QE y band: Run " + str(run),
                    line_width=2)
        for raft_line in raft_lines:
            qe_y.add_layout(raft_line)

        # NEW: put the subplots in a gridplot
        grid = gridplot([[p, ptc], [psf, rn]])
        grid_cti = gridplot([[cls, chs], [clp, chp]])
        grid_def = gridplot([[bp, bc, None], [dp, dc, tp]])
        grid_qe = gridplot([[qe_u, qe_g, qe_r], [qe_i, qe_z, qe_y]])
        grid_misc = gridplot([[fw, drkC], [nonl, None]])

        raft_text = "Plots for I&T Raft run " + str(run) + " " + raft

        pre = PreText(text=raft_text, width=1000, height=100)

        tab1 = Panel(child=grid, title="Gains, PSF, Noise")
        tab2 = Panel(child=grid_cti, title="CTI")
        tab3 = Panel(child=grid_def, title="Defects")
        tab4 = Panel(child=grid_qe, title="QE 6-band")
        tab5 = Panel(child=grid_misc, title="Dark C, Full well, Non-lin")

        tabs = Tabs(tabs=[tab1, tab2, tab3, tab4, tab5])

        l = layout([widgetbox(pre), tabs], sizing_mode='scale_both')

        o_file = self.base_dir + raft + "-" + str(run) + ".html"
        output_file(o_file)
        save(l)
예제 #32
0
    runs_int_dev = [5708, 5715, 5867, 5899, 5923, 5941, 5943, 6006, 6106]
    run_list, raft_list = pG_dev.make_run_pages(site_type="I&T-Raft",
                                                runs=runs_int_dev)

    type_list = [eR_dev.raft_type(raft=raft) for raft in raft_list]

    data_table_int_dev = pG_dev.write_table(run_list=run_list,
                                            raft_list=raft_list,
                                            type_list=type_list)

    dash_file = args.output + 'bokehDashboard.html'
    output_file(dash_file)

    intro_text = "EO Test Results for Good Raft Runs (scroll if more than 10 entries)"
    pre_intro = PreText(text=intro_text, width=550, height=10)

    type_text = "BNL-Raft"
    pre = PreText(text=type_text, width=500, height=10)
    l = layout(pre_intro, pre, data_table_bnl)

    type_int = "I&T-Raft (Prod)"
    pre_int = PreText(text=type_int, width=500, height=10)
    l_int = layout(pre_int, data_table_int)

    type_int_dev = "I&T-Raft (Dev)"
    pre_int_dev = PreText(text=type_int_dev, width=500, height=10)
    l_int_dev = layout(pre_int_dev, data_table_int_dev)

    p = layout(l, [l_int, l_int_dev])