Post by kosi on May 30, 2023 15:02:42 GMT -5
Hello!
I am currently trying to implement the DT-670 diode for a colleague. I am using the Keithley 2636A device to source and measure the diode.
Software is written in python.
I have trouble with the chebyshev polynomials. I must be missing something obvious but I can't see what.
output of the code given is:
The temperature(1) is 6.309166842047422 K.
1.2618333684094845
It should result in 5.0 K (the x was chosen from the curves points data)
Do I have to add all ranges or something of the sort? There is no additional information on the curves sheet.
Thanks in advance!
I am currently trying to implement the DT-670 diode for a colleague. I am using the Keithley 2636A device to source and measure the diode.
Software is written in python.
I have trouble with the chebyshev polynomials. I must be missing something obvious but I can't see what.
output of the code given is:
The temperature(1) is 6.309166842047422 K.
1.2618333684094845
It should result in 5.0 K (the x was chosen from the curves points data)
import numpy as np
def chebyshev(x, ZL, ZU, coeffs):
"""
Calculate the temperature using Chebychev polynomials.
"""
# Define the normalized variable x
z = (((x - ZL) * (ZU - x)) / (ZU - ZL)) #(x - ZL) / (ZU - ZL)
if z < 0:
return 0
# Calculate the Chebychev polynomials
T = np.zeros(len(coeffs))
T[0] = 1
T[1] = z
for i in range(2, len(coeffs)):
T[i] = 2 * z * T[i-1] - T[i-2]
# Calculate the temperature
temperature = 0
for i in range(len(coeffs)):
temperature += coeffs[i] * T[i]
return temperature
#table 1
ZL_1 = 1.294390
ZU_1 = 1.680000
coeffs_1 = [6.429274,-7.514262,-0.725882,-1.117846,-0.562041,
-0.360239,-0.229751,-0.135713,-0.068203,-0.029755]
#table 2
ZL_2 = 1.11230
ZU_2 = 1.38373
coeffs_2 = [17.244846,-7.964373,0.625343,-0.105068,0.292196,
-0.344492,0.271670,-0.151722,0.121320,-0.035566,0.045966]
#table 3
ZL_3 = 0.909416
ZU_3 = 1.122751
coeffs_3 = [82.017868,-59.064244,-1.356615,1.055396,0.837341,0.431875,
0.440840,-0.061588,0.209414,-0.120882,0.055734,-0.035974]
#table 4
ZL_4 = 0.07
ZU_4 = 0.99799
coeffs_4 = [306.592351, -205.393808, -4.695680, -2.031603, -0.071792,
-0.437682, 0.176352, -0.182516, 0.064687, -0.027019, 0.010019]
#x = 0.783720 # Voltage, represents exactly 200K
x = 1.551450 # Voltage, represents exactly 5.0 K
temperature1 = chebyshev(x, ZL_1, ZU_1, coeffs_1)
#temperature2 = chebyshev(x, ZL_2, ZU_2, coeffs_2)
#temperature3 = chebyshev(x, ZL_3, ZU_3, coeffs_3)
#temperature4 = chebyshev(x, ZL_4, ZU_4, coeffs_4)
print(f"The temperature(1) is {temperature1} K.")
print(temperature1/5)
#print(f"The temperature(2) is {temperature2} K.")
#print(f"The temperature(3) is {temperature3} K.")
#print(f"The temperature(4) is {temperature4} K.")
#print(temperature4/200)
Do I have to add all ranges or something of the sort? There is no additional information on the curves sheet.
Thanks in advance!