Update Code/Hosei.py

This commit is contained in:
xans 2024-09-28 00:51:18 +02:00
parent 951f8df5cf
commit f2d92bd6ae

View File

@ -109,7 +109,7 @@ d = datetime.datetime.now()
dlast = datetime.datetime.now() dlast = datetime.datetime.now()
## Collect data ## Collect data
time.sleep(3) time.sleep(3)
for n in range(1): for n in range(5):
time.sleep(10) time.sleep(10)
for x in sweep: for x in sweep:
cntr = cntr + 1 cntr = cntr + 1
@ -185,28 +185,27 @@ if minMaxEqual:
# not implemented as of yet # not implemented as of yet
print("not implemented") print("not implemented")
else: else:
# compensate negative 1st order correction
correctionfactors[15] = 1 #df.loc[df['SetVolts'] == -10]["DutVolts"].iloc[0]/df.loc[df['SetVolts'] == 10]["DutVolts"].iloc[0]
#rslt_df = dataframe[dataframe['Percentage'] > 80]
# postive part of INL # postive part of INL
correctionfactors[0] = (df.loc[df['SetVolts'] == 0]["DutToRefVolts"].iloc[0] - df.loc[df['SetVolts'] == 2]["DutToRefVolts"].iloc[0])/2 correctionfactors[0] = (df.loc[df['SetVolts'] == 0]["DutToRefVolts"].iloc[0] - df.loc[df['SetVolts'] == 2]["DutToRefVolts"].iloc[0])/2
correctionfactors[1] = (df.loc[df['SetVolts'] == 2]["DutToRefVolts"].iloc[0] - df.loc[df['SetVolts'] == 4]["DutToRefVolts"].iloc[0])/2 correctionfactors[1] = (df.loc[df['SetVolts'] == 2]["DutToRefVolts"].iloc[0] - df.loc[df['SetVolts'] == 4]["DutToRefVolts"].iloc[0])/2
correctionfactors[2] = (df.loc[df['SetVolts'] == 4]["DutToRefVolts"].iloc[0] - df.loc[df['SetVolts'] == 6]["DutToRefVolts"].iloc[0])/2 correctionfactors[2] = (df.loc[df['SetVolts'] == 4]["DutToRefVolts"].iloc[0] - df.loc[df['SetVolts'] == 6]["DutToRefVolts"].iloc[0])/2
correctionfactors[3] = (df.loc[df['SetVolts'] == 6]["DutToRefVolts"].iloc[0] - df.loc[df['SetVolts'] == 8]["DutToRefVolts"].iloc[0])/2 correctionfactors[3] = (df.loc[df['SetVolts'] == 6]["DutToRefVolts"].iloc[0] - df.loc[df['SetVolts'] == 8]["DutToRefVolts"].iloc[0])/2
correctionfactors[4] = (df.loc[df['SetVolts'] == 8]["DutToRefVolts"].iloc[0] - df.loc[df['SetVolts'] == 10]["DutToRefVolts"].iloc[0])/2 correctionfactors[4] = (df.loc[df['SetVolts'] == 8]["DutToRefVolts"].iloc[0] - df.loc[df['SetVolts'] == 10]["DutToRefVolts"].iloc[0])/2
# negative part of INL # negative part of INL
correctionfactors[15] = 1 #df.loc[df['SetVolts'] == -10]["DutVolts"].iloc[0]/df.loc[df['SetVolts'] == 10]["DutVolts"].iloc[0] minusRangeScaling = df.loc[df['SetVolts'] == -10]["DutToRefVolts"].iloc[0]/10
correctionfactors[5] = (df.loc[df['SetVolts'] == -0.02]["DutToRefVolts"].iloc[0] - df.loc[df['SetVolts'] == -0.00]["DutToRefVolts"].iloc[0])/0.02 df["DutToRefVolts"] = df["DutToRefVolts"]-minusRangeScaling*-df["SetVolts"]
correctionfactors[6] = (df.loc[df['SetVolts'] == -0.04]["DutToRefVolts"].iloc[0] - df.loc[df['SetVolts'] == -0.02]["DutToRefVolts"].iloc[0])/0.02 correctionfactors[5] = (df.loc[df['SetVolts'] == -0.02]["DutToRefVolts"].iloc[0] - df.loc[df['SetVolts'] == 0]["DutToRefVolts"].iloc[0])/0.02
correctionfactors[7] = (df.loc[df['SetVolts'] == -0.06]["DutToRefVolts"].iloc[0] - df.loc[df['SetVolts'] == -0.04]["DutToRefVolts"].iloc[0])/0.02 correctionfactors[6] = (df.loc[df['SetVolts'] == -0.04]["DutToRefVolts"].iloc[0] - df.loc[df['SetVolts'] == -0.02]["DutToRefVolts"].iloc[0])/0.02
correctionfactors[8] = (df.loc[df['SetVolts'] == -0.08]["DutToRefVolts"].iloc[0] - df.loc[df['SetVolts'] == -0.06]["DutToRefVolts"].iloc[0])/0.02 correctionfactors[7] = (df.loc[df['SetVolts'] == -0.06]["DutToRefVolts"].iloc[0] - df.loc[df['SetVolts'] == -0.04]["DutToRefVolts"].iloc[0])/0.02
correctionfactors[9] = (df.loc[df['SetVolts'] == -0.1]["DutToRefVolts"].iloc[0] - df.loc[df['SetVolts'] == -0.08]["DutToRefVolts"].iloc[0])/0.02 correctionfactors[8] = (df.loc[df['SetVolts'] == -0.08]["DutToRefVolts"].iloc[0] - df.loc[df['SetVolts'] == -0.06]["DutToRefVolts"].iloc[0])/0.02
correctionfactors[10] = (df.loc[df['SetVolts'] == -2]["DutToRefVolts"].iloc[0] - df.loc[df['SetVolts'] == -0.1]["DutToRefVolts"].iloc[0])/1.9 correctionfactors[9] = (df.loc[df['SetVolts'] == -0.1]["DutToRefVolts"].iloc[0] - df.loc[df['SetVolts'] == -0.08]["DutToRefVolts"].iloc[0])/0.02
correctionfactors[11] = (df.loc[df['SetVolts'] == -4]["DutToRefVolts"].iloc[0] - df.loc[df['SetVolts'] == -2]["DutToRefVolts"].iloc[0])/2 correctionfactors[10] = (df.loc[df['SetVolts'] == -2]["DutToRefVolts"].iloc[0] - df.loc[df['SetVolts'] == -0.1]["DutToRefVolts"].iloc[0])/1.9
correctionfactors[12] = (df.loc[df['SetVolts'] == -6]["DutToRefVolts"].iloc[0] - df.loc[df['SetVolts'] == -4]["DutToRefVolts"].iloc[0])/2 correctionfactors[11] = (df.loc[df['SetVolts'] == -4]["DutToRefVolts"].iloc[0] - df.loc[df['SetVolts'] == -2]["DutToRefVolts"].iloc[0])/2
correctionfactors[13] = (df.loc[df['SetVolts'] == -8]["DutToRefVolts"].iloc[0] - df.loc[df['SetVolts'] == -6]["DutToRefVolts"].iloc[0])/2 correctionfactors[12] = (df.loc[df['SetVolts'] == -6]["DutToRefVolts"].iloc[0] - df.loc[df['SetVolts'] == -4]["DutToRefVolts"].iloc[0])/2
correctionfactors[14] = (df.loc[df['SetVolts'] == -10]["DutToRefVolts"].iloc[0] - df.loc[df['SetVolts'] == -8]["DutToRefVolts"].iloc[0])/2 correctionfactors[13] = (df.loc[df['SetVolts'] == -8]["DutToRefVolts"].iloc[0] - df.loc[df['SetVolts'] == -6]["DutToRefVolts"].iloc[0])/2
print(correctionfactors) correctionfactors[14] = (df.loc[df['SetVolts'] == -10]["DutToRefVolts"].iloc[0] - df.loc[df['SetVolts'] == -8]["DutToRefVolts"].iloc[0])/2
# negative 10v voltage reversal alpha error for faster measurements
correctionfactors[15] = 1+minusRangeScaling
## Read the HOSEI parameters and save the original constants ## Read the HOSEI parameters and save the original constants
inst4.write("CAL:EXT:EEPROM:PROTECTION 1") inst4.write("CAL:EXT:EEPROM:PROTECTION 1")
@ -240,7 +239,7 @@ d = datetime.datetime.now()
dlast = datetime.datetime.now() dlast = datetime.datetime.now()
## Collect data ## Collect data
time.sleep(3) time.sleep(3)
for n in range(1): for n in range(5):
for x in sweep: for x in sweep:
cntr = cntr + 1 cntr = cntr + 1
try: try: