def read_fgga_txt(ifile) :
fgga_dateparse = lambda x: pd.datetime.utcfromtimestamp(int(x))
fgga_names = ['identifier', 'packet_length', 'timestamp', 'ptp_sync',
'MFM', 'flight_num', 'CPU_Load', 'USB_disk_space', 'ch4',
'co2', 'h2o', 'press_torr', 'temp_c', 'fit_flag',
'rda_usec', 'rdb_usec', 'ch4_ppb', 'co2_ppm',
'MFC_1_absolute_pressure', 'MFC_1_temperature',
'MFC_1volumetic_flow', 'MFC_1mass_flow', 'MFC_1set_point',
'V1', 'V2', 'V3', 'V4', 'restart_FGGA', 'FGGA_Pump',
'CAL_MFC_1Set_Value']
df_fgga = pd.read_csv(ifile,
names=fgga_names,
delimiter=',',
parse_dates=[2],
date_parser=fgga_dateparse,
skiprows=100) # To be sure to skip the header
# Using the Valve states for flagging out calibration periods
# TODO: add time buffer around calibration periods
df_fgga.loc[df_fgga['V1'] != 0, 'ch4_ppb'] = np.nan
df_fgga.loc[df_fgga['V2'] != 0, 'co2_ppm'] = np.nan
df_fgga.loc[df_fgga['V2'] != 0, 'ch4_ppb'] = np.nan
return df_fgga
评论列表
文章目录