recompute data from device log
This commit is contained in:
27
scripts/recompute.py
Normal file
27
scripts/recompute.py
Normal file
@@ -0,0 +1,27 @@
|
||||
import pandas as pd
|
||||
import os
|
||||
import numpy as np
|
||||
import re
|
||||
import math
|
||||
|
||||
curdir = os.getcwd()
|
||||
path_delim = '/'
|
||||
df = pd.read_excel(curdir + path_delim + "data/data_22_09_2023_05_29.xlsx", sheet_name="data")
|
||||
|
||||
def parse(resultData, idx):
|
||||
result = [line.strip() for line in resultData.split("\n") if "RESULT" in line and "REND" in line]
|
||||
# print(result[-1].split(' '))
|
||||
return result[-1].split(' ')[idx]
|
||||
|
||||
df["led1BufferRc"] = df.apply(lambda x: parse(x['resultData'], 3), axis=1)
|
||||
df["led1SampleRc"] = df.apply(lambda x: parse(x['resultData'], 5), axis=1)
|
||||
df["led2BufferRc"] = df.apply(lambda x: parse(x['resultData'], 4), axis=1)
|
||||
df["led2SampleRc"] = df.apply(lambda x: parse(x['resultData'], 6), axis=1)
|
||||
|
||||
print(df)
|
||||
# df["absorbance"] = df.apply(lambda x: float(x["led1BufferRc"])/float(x["led1SampleRc"]))
|
||||
|
||||
|
||||
writer = pd.ExcelWriter(curdir + path_delim + "data/recompute2.xlsx", engine = 'openpyxl')
|
||||
df.to_excel(writer, sheet_name = 'op', index=False)
|
||||
writer.close()
|
||||
Reference in New Issue
Block a user