Update U180-ToolKit.py
This commit is contained in:
parent
32b3aefe1f
commit
5eb9569afe
@ -3,8 +3,12 @@ import os
|
|||||||
import json
|
import json
|
||||||
import time
|
import time
|
||||||
import csv
|
import csv
|
||||||
|
import pandas as pd
|
||||||
|
from plotly.subplots import make_subplots
|
||||||
|
import plotly.graph_objects as go
|
||||||
|
from datetime import datetime
|
||||||
|
import numpy
|
||||||
import GPIBPrologix
|
import GPIBPrologix
|
||||||
import datetime
|
|
||||||
|
|
||||||
GPIB = GPIBPrologix.ResourceManager("/dev/ttyACM0")
|
GPIB = GPIBPrologix.ResourceManager("/dev/ttyACM0")
|
||||||
instObj = GPIB.open_resource(22)
|
instObj = GPIB.open_resource(22)
|
||||||
@ -81,3 +85,20 @@ for file in readRunningConfigs():
|
|||||||
writer = csv.writer(f)
|
writer = csv.writer(f)
|
||||||
writer.writerow((interrogate3458A(instObj)))
|
writer.writerow((interrogate3458A(instObj)))
|
||||||
writeFunc(instObj,"DISP OFF,''")
|
writeFunc(instObj,"DISP OFF,''")
|
||||||
|
|
||||||
|
## do the plotting
|
||||||
|
for file in readRunningConfigs():
|
||||||
|
dataPath = os.path.realpath(os.path.dirname(__file__))+'/RunningConfigs/'+file
|
||||||
|
with open(dataPath, "r") as read_file:
|
||||||
|
configData = json.load(read_file)
|
||||||
|
serialPath = os.path.realpath(os.path.dirname(__file__))+'/data/'+configData['serial']+'/'
|
||||||
|
df = pd.read_csv(serialPath+configData['serial']+'.csv')
|
||||||
|
|
||||||
|
time_x = pd.to_datetime(df['DateTime'],format='%d-%m-%y %H:%M:%S')
|
||||||
|
coefficients = numpy.polyfit(df['TEMP'], df['G10V'], 1, rcond=None, full=False, w=None, cov=False)
|
||||||
|
polynomial = numpy.poly1d(coefficients)
|
||||||
|
|
||||||
|
fig = make_subplots(rows=1, cols=2)
|
||||||
|
fig.add_trace(go.Scatter(x=time_x, y=df['G10V']-polynomial(df['TEMP']),mode='lines+markers',name='time vs cal72 w tempcomp'),row=1, col=1)
|
||||||
|
fig.add_trace(go.Scatter(x=df['TEMP'], y=df['G10V'],mode='lines+markers',name='temp vs cal72'),row=1, col=2)
|
||||||
|
fig.write_html(serialPath+configData['serial']+'.html')
|
||||||
Loading…
x
Reference in New Issue
Block a user