From f2d92bd6ae652adf0e11997733c4d576b7e3fb75 Mon Sep 17 00:00:00 2001 From: xans Date: Sat, 28 Sep 2024 00:51:18 +0200 Subject: [PATCH] Update Code/Hosei.py --- Code/Hosei.py | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/Code/Hosei.py b/Code/Hosei.py index 80fce3b..cebedda 100644 --- a/Code/Hosei.py +++ b/Code/Hosei.py @@ -109,7 +109,7 @@ d = datetime.datetime.now() dlast = datetime.datetime.now() ## Collect data time.sleep(3) -for n in range(1): +for n in range(5): time.sleep(10) for x in sweep: cntr = cntr + 1 @@ -185,28 +185,27 @@ if minMaxEqual: # not implemented as of yet print("not implemented") 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 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[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[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 - correctionfactors[15] = 1 #df.loc[df['SetVolts'] == -10]["DutVolts"].iloc[0]/df.loc[df['SetVolts'] == 10]["DutVolts"].iloc[0] - correctionfactors[5] = (df.loc[df['SetVolts'] == -0.02]["DutToRefVolts"].iloc[0] - df.loc[df['SetVolts'] == -0.00]["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[7] = (df.loc[df['SetVolts'] == -0.06]["DutToRefVolts"].iloc[0] - df.loc[df['SetVolts'] == -0.04]["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[9] = (df.loc[df['SetVolts'] == -0.1]["DutToRefVolts"].iloc[0] - df.loc[df['SetVolts'] == -0.08]["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[11] = (df.loc[df['SetVolts'] == -4]["DutToRefVolts"].iloc[0] - df.loc[df['SetVolts'] == -2]["DutToRefVolts"].iloc[0])/2 - correctionfactors[12] = (df.loc[df['SetVolts'] == -6]["DutToRefVolts"].iloc[0] - df.loc[df['SetVolts'] == -4]["DutToRefVolts"].iloc[0])/2 - correctionfactors[13] = (df.loc[df['SetVolts'] == -8]["DutToRefVolts"].iloc[0] - df.loc[df['SetVolts'] == -6]["DutToRefVolts"].iloc[0])/2 - correctionfactors[14] = (df.loc[df['SetVolts'] == -10]["DutToRefVolts"].iloc[0] - df.loc[df['SetVolts'] == -8]["DutToRefVolts"].iloc[0])/2 - print(correctionfactors) + minusRangeScaling = df.loc[df['SetVolts'] == -10]["DutToRefVolts"].iloc[0]/10 + df["DutToRefVolts"] = df["DutToRefVolts"]-minusRangeScaling*-df["SetVolts"] + correctionfactors[5] = (df.loc[df['SetVolts'] == -0.02]["DutToRefVolts"].iloc[0] - df.loc[df['SetVolts'] == 0]["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[7] = (df.loc[df['SetVolts'] == -0.06]["DutToRefVolts"].iloc[0] - df.loc[df['SetVolts'] == -0.04]["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[9] = (df.loc[df['SetVolts'] == -0.1]["DutToRefVolts"].iloc[0] - df.loc[df['SetVolts'] == -0.08]["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[11] = (df.loc[df['SetVolts'] == -4]["DutToRefVolts"].iloc[0] - df.loc[df['SetVolts'] == -2]["DutToRefVolts"].iloc[0])/2 + correctionfactors[12] = (df.loc[df['SetVolts'] == -6]["DutToRefVolts"].iloc[0] - df.loc[df['SetVolts'] == -4]["DutToRefVolts"].iloc[0])/2 + correctionfactors[13] = (df.loc[df['SetVolts'] == -8]["DutToRefVolts"].iloc[0] - df.loc[df['SetVolts'] == -6]["DutToRefVolts"].iloc[0])/2 + 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 inst4.write("CAL:EXT:EEPROM:PROTECTION 1") @@ -240,7 +239,7 @@ d = datetime.datetime.now() dlast = datetime.datetime.now() ## Collect data time.sleep(3) -for n in range(1): +for n in range(5): for x in sweep: cntr = cntr + 1 try: