resistance_to_temp
unknown
plain_text
a year ago
395 B
6
Indexable
def resistance_to_temp(resistance):
"""Convert resistance to temperature using the Steinhart-Hart equation."""
# Steinhart-Hart coefficients
A = 1.129241e-3
B = 2.341077e-4
C = 8.775468e-8
log_r = np.log(resistance)
temp_kelvin = 1 / (A + B * log_r + C * log_r**3)
# Convert from Kelvin to Celsius
temp_celsius = temp_kelvin - 273.15
return temp_celsiusEditor is loading...
Leave a Comment