Compare commits

...

2 commits

Author SHA1 Message Date
fc6979ecb2 add fix for invalid temperatures 2024-03-28 14:54:40 +01:00
34d82f8069 spelling of commandline corrected 2024-03-28 11:09:49 +01:00
2 changed files with 7 additions and 7 deletions

View file

@ -81,7 +81,7 @@ def main():
nameadd = nameadd + '_mV' nameadd = nameadd + '_mV'
u = [1.0]*18 u = [1.0]*18
if len(args.nameadd)>0: if args.nameadd:
nameadd = args.nameadd[0] nameadd = args.nameadd[0]
global trigchan global trigchan
@ -97,7 +97,7 @@ def main():
hist[i][0]=minV + resV*i hist[i][0]=minV + resV*i
with fileinput.input(files=(file), encoding="utf-8") as f: with fileinput.input(files=(file), encoding="utf-8") as f:
T='unknown' T = None
B1 = [] B1 = []
B2 = [] B2 = []
for line in f: for line in f:
@ -105,7 +105,7 @@ def main():
if not 'EOF' in l: if not 'EOF' in l:
if l[0] == 'H': if l[0] == 'H':
T = adc_to_T(int(l[8])) T = adc_to_T(int(l[8]))
elif l[0] == 'EI' and not T=='unknown': elif l[0] == 'EI' and T is not None:
if conditions(l,args): if conditions(l,args):
if args.tdhist: if args.tdhist:
B1.append(CmV(l,ch[0])*u[0]) B1.append(CmV(l,ch[0])*u[0])
@ -187,10 +187,10 @@ def adc_to_T(adc):
R1 = 10000 R1 = 10000
b = 3940 b = 3940
dac = 62690 dac = 62690
T = 0 if adc/(dac-adc)-1 <= 0:
return
alpha = np.log(R1/R25 *(dac/(dac-adc)-1)) alpha = np.log(R1/R25 *(dac/(dac-adc)-1))
T = 1/(alpha/b+1/298.15) -273.15 return 1/(alpha/b+1/298.15) -273.15
return T
def conditions(l,args): def conditions(l,args):

View file

@ -7,7 +7,7 @@ import argparse
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import numpy as np import numpy as np
###the comandline interface ###the commandline interface
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
prog='plot_hist.py', prog='plot_hist.py',
description='takes a .hist file as input and creates a plot') description='takes a .hist file as input and creates a plot')