from sfdata import SFDataFiles from sfdata import SFScanInfo import pandas as pd import glob import datetime import warnings import io import os import time import numpy as np ## You may need this !pip install lxml warnings.filterwarnings('ignore') def PVchs(): pv_name_dict={"SATUN:FELPHOTENE":'FEL_en (keV)', "SATUN13-UIND030:POL-SET": 'Polarisation', "SATOP11-OSGM087:exitslit": 'Exit_slit (um)', "SATOP11-OSGM087:photonenergy": "Mono_en (eV)", "SATFE10-OGAT053:transmission": "Gas_trans", "SATFE10-PEPG046:PHOTON-ENERGY-PER-PULSE-AVG": "FEL_pulse_en (uJ)", "SATES30-ARES:MOT_2TRY.RBV": "diode_otr_tth (deg)", "SATES30-ARES:MOT_DRY.RBV": "diode_inr_tth (deg)", "SATES30-ARES:MOT_SRZ.RBV": "sample_phi (deg)", "SATES30-ARES:MOT_SRY.RBV": "sample_th (deg)", "SATES30-ARES:MOT_SRX.RBV": "sample_chi (deg)", "SATES30-ARES:MOT_STX.RBV": "sample_x (mm)", "SATES30-ARES:MOT_STY.RBV": "sample_y (mm)", "SATES30-ARES:MOT_STZ.RBV": "sample_z (mm)", "SATES30-LS336:D_RBV": "sample_temp (K)", "SATES30-LS336:A_RBV": "cryo_temp (K)", "SATES30-LS336:C_RBV": "dummy_temp (K)", "SATES30-LS336:B_RBV": "dummy_temp (K)", "SLAAT-LGEN:DLY_OFFS1": "LXT_off1 (us)", "SLAAT01-LTIM-PDLY:DELAY": "LXT_delay (ps)", "SLAAT01-LTIM-PDLY:DELAY_Z_OFFS": "LXT_off1 (ps)", "SLAAT31-LMOT-M801:MOT.RBV": "800_WP (deg)", "SLAAT31-LMOT-M802:MOT.RBV": "comp1", "SLAAT31-LMOT-M803:MOT.RBV": "comp2", "SLAAT31-LMOT-M804:MOT.RBV": "comp3", "SLAAT31-LMOT-M805:MOT.RBV": "comp4", "SLAAT31-LMOT-M806:MOT.RBV": "THz_delay (mm)", "SLAAT31-LMOT-M807:MOT.RBV": "WL_delay (mm)", "SLAAT31-LMOT-M808:MOT.RBV": "800_delay (mm)", "SATOP21-PMOS127-2D:SPECTRUM_X":"PMOS127-2D:X", "SATOP21-PMOS127-2D:SPECTRUM_Y":"PMOS127-2D:Y", "SLAAT31-LCAM-C801:FIT-XPOS_EGU":"Cam_801_x", "SLAAT31-LCAM-C801:FIT-YPOS_EGU":"Cam_801_y", "SLAAT31-LCAM-C802:FIT-XPOS_EGU":"Cam_802_x", "SLAAT31-LCAM-C802:FIT-YPOS_EGU":"Cam_802_y", 'SLAAT31-LCAM-C801:FIT-XEGU-ARRAY':"Cam_801_xy", 'SLAAT31-LCAM-C802:FIT-XEGU-ARRAY':"Cam_802_xy", "SIN-LPOSIC1:POS1":"PICO X not sure", "SIN-LPOSIC1:POS2":"PICO Y not sure", "SATES30-CAMS182-GIGE2_sp1:x_center_of_mass":"", "SATES30-CAMS182-GIGE2_sp1:y_center_of_mass":"", } return pv_name_dict def colors(): dict_colors = { 'yellow_light' : ('#BF8F00', '2px solid #BF8F00', '#FFF2CC', '#FFFFFF'), 'grey_light' : ('#808080', '2px solid #808080', '#EDEDED', '#FFFFFF'), 'blue_light' : ('#305496', '2px solid #305496', '#D9E1F2', '#FFFFFF'), 'orange_light' : ('#C65911', '2px solid #C65911', '#FCE4D6', '#FFFFFF'), 'green_light' : ('#548235', '2px solid #548235', '#E2EFDA', '#FFFFFF'), 'red_light' : ('#823535', '2px solid #823535', '#efdada', '#FFFFFF'), 'yellow_dark' : ('#FFFFFF', '2px solid #BF8F00', '#FFF2CC', '#BF8F00'), 'grey_dark' : ('#FFFFFF', '2px solid #808080', '#EDEDED', '#808080'), 'blue_dark': ('#FFFFFF', '2px solid #305496', '#D9E1F2', '#305496'), 'blue_yellow': ('#FFFFFF', '2px solid #305496', '#ecedbe', '#305496'), 'orange_dark' : ('#FFFFFF', '2px solid #C65911', '#FCE4D6', '#C65911'), 'green_dark' : ('#FFFFFF', '2px solid #548235', '#E2EFDA', '#548235'), 'red_dark' : ('#FFFFFF', '2px solid #823535', '#efdada', '#823535') } return (dict_colors) def build_table_nocondition( df, color, font_size='12px', font_family='Century Gothic, sans-serif', text_align='center', width='600px', index=False, even_color='black', even_bg_color='white', odd_bg_color=None, border_bottom_color=None, escape=True, width_dict=[], padding="10px 10px 3px 3px", float_format=None): dict_colors = colors() if df.empty: return '' # Set color color, border_bottom, odd_background_color, header_background_color = dict_colors[color] if odd_bg_color: odd_background_color = odd_bg_color if border_bottom_color: border_bottom = border_bottom_color a = 0 while a != len(df): if a == 0: df_html_output = df.iloc[[a]].to_html( na_rep="", index=index, border=0, escape=escape, float_format=float_format, ) # change format of header if index: df_html_output = df_html_output.replace('
""" + format(df_html_output) a = 1 elif a % 2 == 0: df_html_output = df.iloc[[a]].to_html(na_rep = "", index = index, header = False, escape=escape) # change format of index df_html_output = df_html_output.replace('
' ,' | ', len(df.columns)+1) df_html_output = df_html_output.replace(' | ' ,' | ') else: df_html_output = df_html_output.replace(' | ' ,' | ') #change format of table df_html_output = df_html_output.replace(' | ' ,' | ')
body = """ """ + format(df_html_output) a = 1 elif a % 2 == 0: df_html_output = df.iloc[[a]].to_html(na_rep = "", index = index, header = False, escape=escape) # change format of index df_html_output = df_html_output.replace(' | ' ,' | ') #change format of table df_html_output = df_html_output.replace(' | ' ,' | ') body = body + format(df_html_output) a += 1 elif a % 2 != 0: df_html_output = df.iloc[[a]].to_html(na_rep = "", index = index, header = False, escape=escape) # change format of index df_html_output = df_html_output.replace(' | ' ,' | ') #change format of table df_html_output = df_html_output.replace(' | ' ,' | ') body = body + format(df_html_output) a += 1 body = body + """""" body = body.replace(""" |
---|