示例#1
0
 def update_graph(variable_name):
     dftemp = df.loc[(df['variable_name'] == variable_name)
                     & (df['strax_version'] == default_strax) &
                     (df['straxen_version'] == default_straxen)]
     dfvartemp = dfvar.loc[(dfvar['variable_name'] == variable_name)]
     print('dfvartemp = ', dfvartemp)
     #        return create_plot_with_runid(
     return create_plot(
         #            x=dftemp["timestamp"],
         x=dftemp["run_id"],
         #            xrunid=dftemp["run_id"],
         xlabel='Time Stamp',
         y=dftemp["value"],
         ylabel=process_dict[variable_name],
         #            yunit = unit_dict[variable_name],
         error=dftemp["error"],
         figname=dftemp["figname"])
示例#2
0
    def picture_on_hover(hoverData, variable_name):
        """
        params hoverData: data on graph hover, and dropdowns
        update the graph as the users passes the mouse on a point or the user changes the drop down values.
        """
        print('tata')

        if hoverData is None:
            raise PreventUpdate
        try:
            dftemp = df.loc[(df['variable_name'] == variable_name)
                            & (df['strax_version'] == default_strax) &
                            (df['straxen_version'] == default_straxen)]
            dfvartemp = dfvar.loc[(dfvar['variable_name'] == variable_name)]
            print('dfvartemp = ', dfvartemp)
            #            figtemp = create_plot_with_runid(
            figtemp = create_plot(
                #                x=dftemp["timestamp"],
                #                xrunid=dftemp["run_id"],
                x=dftemp["run_id"],
                xlabel='Time Stamp',
                y=dftemp["value"],
                ylabel=process_dict[variable_name],
                #                yunit = unit_dict[variable_name],
                error=dftemp["error"],
                figname=dftemp["figname"])

            # gets the index the point on which the mouse is on
            point_number = hoverData["points"][0]["pointNumber"]
            # gets the corresponding figure name
            print('figtemp["data"] = ', figtemp["data"])
            figname = str(
                figtemp["data"][0]["text"].values[point_number]).strip()
            image_path = image_folder + figname
            print('image+path = ', image_path)
            encoded_image = b64_image(image_path)
            # the way I found to print out the figure...
            #            return 'data:image/png;base64,{}'.format(encoded_image.decode())
            return encoded_image

        except Exception as error:
            print(error)
            raise PreventUpdate
示例#3
0
文件: layout.py 项目: XENONnT/xom
dftemp = df.loc[(df['variable_name'] == initvar)
                & (df['strax_version'] == default_strax)]
dfvar = getvariables()
dfvartemp = dfvar.loc[(dfvar['variable_name'] == initvar)]
process_dict = {
    var: leg
    for (var, leg) in (zip(dfvar['variable_name'], dfvar['legend_name']))
}
unit_dict = {
    var: unit
    for (var, unit) in (zip(dfvar['variable_name'], dfvar['unit']))
}

FIGURE = create_plot(x=dftemp["timestamp"].astype('int'),
                     xlabel='time',
                     y=dftemp["value"],
                     ylabel=dfvartemp['legend_name'][0],
                     error=dftemp["error"],
                     figname=df["figname"])

FIGURE_WITH_RUNID = create_plot_with_runid(x=dftemp["timestamp"],
                                           xrunid=dftemp["run_id"],
                                           xlabel='Time Stamp',
                                           y=dftemp["value"],
                                           ylabel=dfvartemp['legend_name'][0],
                                           yunit=dfvartemp['unit'][0],
                                           error=dftemp["error"],
                                           figname=df["figname"])

df = getalldata()

示例#4
0
print('tes ======== ', dfvartemp)
process_dict = {
    var: leg
    for (var, leg) in (zip(dfvar['variable_name'], dfvar['legend_name']))
}
unit_dict = {
    var: unit
    for (var, unit) in (zip(dfvar['variable_name'], dfvar['unit']))
}
print('process_dict = ', process_dict)

image_folder = '/xom/images/'

FIGURE = create_plot(x=dftemp["timestamp"].astype('int'),
                     xlabel='time',
                     y=dftemp["value"],
                     ylabel=dfvartemp['legend_name'][0],
                     error=dftemp["error"],
                     figname=dftemp["figname"])

FIGURE_WITH_RUNID = create_plot(
    #FIGURE_WITH_RUNID = create_plot_with_runid(
    #    x=dftemp["timestamp"],
    #    xrunid=dftemp["run_id"],
    x=dftemp["run_id"],
    xlabel='Time Stamp',
    y=dftemp["value"],
    ylabel=dfvartemp['legend_name'][0],
    #    yunit=dfvartemp['unit'][0],
    error=dftemp["error"],
    figname=df["figname"])
示例#5
0
from dash.dependencies import Output
from app.utils import getdata, getalldata
from app.utils import make_dash_table, create_plot, create_plot_errorx
import os
import base64
df = getalldata()

dftemp = df.sort_values(by=['time'])
dftemp = dftemp[(dftemp['process'] == 'el_lifetime')
                & (dftemp['version'] == 'v4.0')]
print('times = ', df['time'], flush=True)
print('times sorted ? = ', dftemp['time'], flush=True)
sel = ''
FIGURE = create_plot(x=dftemp["time"],
                     xlabel='time',
                     y=dftemp["value"],
                     ylabel='temp',
                     error=dftemp["error"],
                     figname=dftemp["figure"])

layout = html.Div([
    html.Div([
        html.Div([
            html.A(
                html.H2("Back to home page"),
                id="home_page",
                href="https://xe1t-offlinemon.lngs.infn.it/dash/",
            ),
        ],
                 style={
                     'width': '30%',
                     'float': 'left'