def currents(conn, start, end): '''Create specific plot and return plot object Parameters ---------- conn : DBobject Connection object that represents database start : time Startlimit for x-axis and query (typ. datetime.now()- 4Months) end : time Endlimit for x-axis and query (typ. datetime.now()) Return ------ p : Plot object Bokeh plot ''' # create a new plot with a title and axis labels p = figure(tools="pan,wheel_zoom,box_zoom,reset,save", toolbar_location="above", plot_width=1120, plot_height=500, y_range=[0, 1.1], x_axis_type='datetime', output_backend="webgl", x_axis_label='Date', y_axis_label='Current (A)') p.grid.visible = True p.title.text = "FPE & ICE Currents" pf.add_basic_layout(p) a = pf.add_to_plot(p, "ICE Current idle", "SE_ZIMIRICEA_IDLE", start, end, conn, color="red") b = pf.add_to_plot(p, "ICE Current HV on", "SE_ZIMIRICEA_HV_ON", start, end, conn, color="orange") c = pf.add_to_plot(p, "FPE Current", "SE_ZIMIRFPEA", start, end, conn, color="brown") pf.add_hover_tool(p, [a, b, c]) p.legend.location = "bottom_right" p.legend.click_policy = "hide" p.legend.orientation = "horizontal" return p
def det(conn, start, end): '''Create specific plot and return plot object Parameters ---------- conn : DBobject Connection object that represents database start : time Startlimit for x-axis and query (typ. datetime.now()- 4Months) end : time Endlimit for x-axis and query (typ. datetime.now()) Return ------ p : Plot object Bokeh plot ''' # create a new plot with a title and axis labels p = figure(tools="pan,wheel_zoom,box_zoom,reset,save", toolbar_location="above", plot_width=1120, plot_height=500, y_range=[6.395, 6.41], x_axis_type='datetime', output_backend="webgl", x_axis_label='Date', y_axis_label='Temperature (K)') p.grid.visible = True p.title.text = "Detector Temperature" pf.add_basic_layout(p) a = pf.add_to_plot(p, "Det. Temp. IC", "IGDP_MIR_IC_DET_TEMP", start, end, conn, color="red") b = pf.add_to_plot(p, "Det. Temp. LW", "IGDP_MIR_LW_DET_TEMP", start, end, conn, color="green") c = pf.add_to_plot(p, "Det. Temp. SW", "IGDP_MIR_SW_DET_TEMP", start, end, conn, color="blue") pf.add_hover_tool(p, [a, b, c]) p.legend.location = "bottom_right" p.legend.orientation = "horizontal" p.legend.click_policy = "hide" return p
def vdetcom(conn, start, end): '''Create specific plot and return plot object Parameters ---------- conn : DBobject Connection object that represents database start : time Startlimit for x-axis and query (typ. datetime.now()- 4Months) end : time Endlimit for x-axis and query (typ. datetime.now()) Return ------ p : Plot object Bokeh plot ''' # create a new plot with a title and axis labels p = figure( tools = "pan,wheel_zoom,box_zoom,reset,save", \ toolbar_location = "above", \ plot_width = 560, \ plot_height = 500, \ x_axis_type = 'datetime', \ output_backend="webgl", \ x_axis_label = 'Date', y_axis_label='Voltage (V)') p.grid.visible = True p.title.text = "VDETCOM" pf.add_basic_layout(p) a = pf.add_to_plot(p, "VDETCOM IC", "IGDP_MIR_IC_V_VDETCOM", start, end, conn, color="red") b = pf.add_to_plot(p, "VDETCOM SW", "IGDP_MIR_SW_V_VDETCOM", start, end, conn, color="orange") c = pf.add_to_plot(p, "VDETCOM LW", "IGDP_MIR_LW_V_VDETCOM", start, end, conn, color="green") pf.add_hover_tool(p, [a, b, c]) p.legend.location = "bottom_right" p.legend.click_policy = "hide" p.legend.orientation = "horizontal" return p
def dig5(conn, start, end): '''Create specific plot and return plot object Parameters ---------- conn : DBobject Connection object that represents database start : time Startlimit for x-axis and query (typ. datetime.now()- 4Months) end : time Endlimit for x-axis and query (typ. datetime.now()) Return ------ p : Plot object Bokeh plot ''' # create a new plot with a title and axis labels p = figure(tools="pan,wheel_zoom,box_zoom,reset,save", toolbar_location="above", plot_width=560, plot_height=500, y_range=[4.9, 5.1], x_axis_type='datetime', output_backend="webgl", x_axis_label='Date', y_axis_label='Voltage (V)') p.grid.visible = True p.title.text = "FPE Dig. 5V" pf.add_basic_layout(p) p.extra_y_ranges = {"current": Range1d(start=2100, end=2500)} a = pf.add_to_plot(p, "FPE Dig. 5V", "IMIR_PDU_V_DIG_5V", start, end, conn, color="red") b = pf.add_to_plot(p, "FPE Dig. 5V Current", "IMIR_PDU_I_DIG_5V", start, end, conn, y_axis="current", color="blue") p.add_layout( LinearAxis(y_range_name="current", axis_label="Current (mA)", axis_label_text_color="blue"), 'right') pf.add_hover_tool(p, [a, b]) p.legend.location = "bottom_right" p.legend.click_policy = "hide" return p
def volt4(conn, start, end): '''Create specific plot and return plot object Parameters ---------- conn : DBobject Connection object that represents database start : time Startlimit for x-axis and query (typ. datetime.now()- 4Months) end : time Endlimit for x-axis and query (typ. datetime.now()) Return ------ p : Plot object Bokeh plot ''' # create a new plot with a title and axis labels p = figure(tools="pan,wheel_zoom,box_zoom,reset,save", toolbar_location="above", plot_width=560, plot_height=500, y_range=[4.2, 5], x_axis_type='datetime', output_backend="webgl", x_axis_label='Date', y_axis_label='Voltage (V)') p.grid.visible = True p.title.text = "ICE_SEC_VOLT4" pf.add_basic_layout(p) # add a line renderer with legend and line thickness a = pf.add_to_plot(p, "Volt4 Idle", "IMIR_HK_ICE_SEC_VOLT4_IDLE", start, end, conn, color="orange") b = pf.add_to_plot(p, "Volt4 Hv on", "IMIR_HK_ICE_SEC_VOLT4_HV_ON", start, end, conn, color="red") pf.add_hover_tool(p, [a, b]) p.legend.location = "bottom_right" p.legend.click_policy = "hide" return p
def refdig(conn, start, end): '''Create specific plot and return plot object Parameters ---------- conn : DBobject Connection object that represents database start : time Startlimit for x-axis and query (typ. datetime.now()- 4Months) end : time Endlimit for x-axis and query (typ. datetime.now()) Return ------ p : Plot object Bokeh plot ''' # create a new plot with a title and axis labels p = figure(tools="pan,wheel_zoom,box_zoom,reset,save", toolbar_location="above", plot_width=560, plot_height=500, y_range=[2.45, 2.55], x_axis_type='datetime', output_backend="webgl", x_axis_label='Date', y_axis_label='Voltage (V)') p.grid.visible = True p.title.text = "2.5V Ref and FPE Dig." pf.add_basic_layout(p) a = pf.add_to_plot(p, "FPE Dig. 2.5V", "IMIR_SPW_V_DIG_2R5V", start, end, conn, color="orange") b = pf.add_to_plot(p, "FPE PDU 2.5V REF", "IMIR_PDU_V_REF_2R5V", start, end, conn, color="red") pf.add_hover_tool(p, [a, b]) p.legend.location = "bottom_right" p.legend.click_policy = "hide" return p
def pos_volt(conn, start, end): '''Create specific plot and return plot object Parameters ---------- conn : DBobject Connection object that represents database start : time Startlimit for x-axis and query (typ. datetime.now()- 4Months) end : time Endlimit for x-axis and query (typ. datetime.now()) Return ------ p : Plot object Bokeh plot ''' # create a new plot with a title and axis labels p = figure(tools="pan,wheel_zoom,box_zoom,reset,save", toolbar_location="above", plot_width=560, plot_height=500, y_range=[280, 300], x_axis_type='datetime', output_backend="webgl", x_axis_label='Date', y_axis_label='Voltage (mV)') p.grid.visible = True p.title.text = "Wheel Sensor Supply" pf.add_basic_layout(p) a = pf.add_to_plot(p, "FW", "IMIR_HK_FW_POS_VOLT", start, end, conn, color="red") b = pf.add_to_plot(p, "GW14", "IMIR_HK_GW14_POS_VOLT", start, end, conn, color="purple") c = pf.add_to_plot(p, "GW23", "IMIR_HK_GW23_POS_VOLT", start, end, conn, color="orange") d = pf.add_to_plot(p, "CCC", "IMIR_HK_CCC_POS_VOLT", start, end, conn, color="firebrick") pf.add_hover_tool(p, [a, b, c, d]) p.legend.location = "bottom_right" p.legend.click_policy = "hide" return p
def cryo(conn, start, end): '''Create specific plot and return plot object Parameters ---------- conn : DBobject Connection object that represents database start : time Startlimit for x-axis and query (typ. datetime.now()- 4Months) end : time Endlimit for x-axis and query (typ. datetime.now()) Return ------ p : Plot object Bokeh plot ''' # create a new plot with a title and axis labels p = figure( tools = "pan,wheel_zoom,box_zoom,reset,save", \ toolbar_location = "above", \ plot_width = 1120, \ plot_height = 700, \ y_range = [5.8,6.4], \ x_axis_type = 'datetime', \ output_backend="webgl", \ x_axis_label = 'Date', y_axis_label = 'Temperature (K)') p.grid.visible = True p.title.text = "Cryo Temperatures" pf.add_basic_layout(p) a = pf.add_to_plot(p, "T1P", "IGDP_MIR_ICE_T1P_CRYO", start, end, conn, color="brown") b = pf.add_to_plot(p, "T2R", "IGDP_MIR_ICE_T2R_CRYO", start, end, conn, color="burlywood") c = pf.add_to_plot(p, "T3LW", "IGDP_MIR_ICE_T3LW_CRYO", start, end, conn, color="cadetblue") d = pf.add_to_plot(p, "T4SW", "IGDP_MIR_ICE_T4SW_CRYO", start, end, conn, color="chartreuse") e = pf.add_to_plot(p, "T5IMG", "IGDP_MIR_ICE_T5IMG_CRYO", start, end, conn, color="chocolate") f = pf.add_to_plot(p, "T6DECK", "IGDP_MIR_ICE_T6DECKCRYO", start, end, conn, color="coral") g = pf.add_to_plot(p, "T7IOC", "IGDP_MIR_ICE_T7IOC_CRYO", start, end, conn, color="darkorange") h = pf.add_to_plot(p, "FW", "IGDP_MIR_ICE_FW_CRYO", start, end, conn, color="crimson") i = pf.add_to_plot(p, "CCC", "IGDP_MIR_ICE_CCC_CRYO", start, end, conn, color="cyan") j = pf.add_to_plot(p, "GW14", "IGDP_MIR_ICE_GW14_CRYO", start, end, conn, color="darkblue") k = pf.add_to_plot(p, "GW23", "IGDP_MIR_ICE_GW23_CRYO", start, end, conn, color="darkgreen") l = pf.add_to_plot(p, "POMP", "IGDP_MIR_ICE_POMP_CRYO", start, end, conn, color="darkmagenta") m = pf.add_to_plot(p, "POMR", "IGDP_MIR_ICE_POMR_CRYO", start, end, conn, color="darkcyan") n = pf.add_to_plot(p, "IFU", "IGDP_MIR_ICE_IFU_CRYO", start, end, conn, color="cornflowerblue") o = pf.add_to_plot(p, "IMG", "IGDP_MIR_ICE_IMG_CRYO", start, end, conn, color="orange") pf.add_hover_tool(p, [a, b, c, d, e, f, g, h, i, j, k, l, m, n, o]) p.legend.location = "bottom_right" p.legend.orientation = "horizontal" p.legend.click_policy = "hide" return p
def temp(conn, start, end): '''Create specific plot and return plot object Parameters ---------- conn : DBobject Connection object that represents database start : time Startlimit for x-axis and query (typ. datetime.now()- 4Months) end : time Endlimit for x-axis and query (typ. datetime.now()) Return ------ p : Plot object Bokeh plot ''' start_str = str(Time(start).mjd) end_str = str(Time(end).mjd) sql_c = "SELECT * FROM IGDP_MIR_ICE_INTER_TEMP WHERE start_time BETWEEN " + start_str + " AND " + end_str + " ORDER BY start_time" temp = pd.read_sql_query(sql_c, conn) temp['average'] += 273.15 reg = pd.DataFrame( {'reg': pf.pol_regression(temp['start_time'], temp['average'], 3)}) temp = pd.concat([temp, reg], axis=1) temp['start_time'] = pd.to_datetime( Time(temp['start_time'], format="mjd").datetime) plot_data = ColumnDataSource(temp) # create a new plot with a title and axis labels p = figure( tools = "pan,wheel_zoom,box_zoom,reset,save", \ toolbar_location = "above", \ plot_width = 1120, \ plot_height = 700, \ y_range = [275,295], \ x_axis_type = 'datetime', \ output_backend="webgl", \ x_axis_label = 'Date', y_axis_label = 'Temperature (K)') p.grid.visible = True p.title.text = "IEC Temperatures" pf.add_basic_layout(p) p.line(x="start_time", y="average", color="brown", legend="Internal Temp.", source=plot_data) p.scatter(x="start_time", y="average", color="brown", legend="Internal Temp.", source=plot_data) a = pf.add_to_plot(p, "ICE IEC A", "ST_ZTC1MIRIA", start, end, conn, color="burlywood") b = pf.add_to_plot(p, "FPE IEC A", "ST_ZTC2MIRIA", start, end, conn, color="cadetblue") j = pf.add_to_plot(p, "ICE IEC B", "ST_ZTC1MIRIB", start, end, conn, color="blue") k = pf.add_to_plot(p, "FPE IEC B.", "ST_ZTC2MIRIB", start, end, conn, color="brown") c = pf.add_to_plot(p, "FPE PDU", "IMIR_PDU_TEMP", start, end, conn, color="chartreuse") d = pf.add_to_plot(p, "ANA IC", "IMIR_IC_SCE_ANA_TEMP1", start, end, conn, color="chocolate") e = pf.add_to_plot(p, "ANA SW", "IMIR_SW_SCE_ANA_TEMP1", start, end, conn, color="coral") f = pf.add_to_plot(p, "ANA LW", "IMIR_LW_SCE_ANA_TEMP1", start, end, conn, color="darkorange") g = pf.add_to_plot(p, "DIG IC", "IMIR_IC_SCE_DIG_TEMP", start, end, conn, color="crimson") h = pf.add_to_plot(p, "DIG SW", "IMIR_SW_SCE_DIG_TEMP", start, end, conn, color="cyan") i = pf.add_to_plot(p, "DIG LW", "IMIR_LW_SCE_DIG_TEMP", start, end, conn, color="darkblue") pf.add_hover_tool(p, [a, b, c, d, e, f, g, h, i, j, k]) p.legend.location = "bottom_right" p.legend.orientation = "horizontal" p.legend.click_policy = "hide" return p