* Make it work in bookworm, redid some of the changes from last commit
* Changed default number types to int16 for ADC_Result and float32 for Accumulations
This commit is contained in:
+13
-14
@@ -73,9 +73,9 @@ class ADC_Result(Resultable, Drawable, DamarisFFT, Signalpath):
|
|||||||
if samples <= 0: raise ValueError("ValueError: You cant create an ADC-Result with less than 1 sample!")
|
if samples <= 0: raise ValueError("ValueError: You cant create an ADC-Result with less than 1 sample!")
|
||||||
|
|
||||||
for i in range(channels):
|
for i in range(channels):
|
||||||
self.y.append(numpy.zeros((samples,), dtype="Int16"))
|
self.y.append(numpy.zeros((samples,), dtype="int16"))
|
||||||
|
|
||||||
self.x = numpy.zeros((samples,), dtype="float64")
|
self.x = numpy.zeros((samples,), dtype="float32")
|
||||||
|
|
||||||
self.index.append((0, samples-1))
|
self.index.append((0, samples-1))
|
||||||
self.cont_data = True
|
self.cont_data = True
|
||||||
@@ -231,8 +231,7 @@ class ADC_Result(Resultable, Drawable, DamarisFFT, Signalpath):
|
|||||||
|
|
||||||
if self.description is not None:
|
if self.description is not None:
|
||||||
for (key,value) in self.description.items():
|
for (key,value) in self.description.items():
|
||||||
if key != None:
|
accu_group._v_attrs.__setattr__("description_"+key,str(value))
|
||||||
accu_group._v_attrs.__setattr__("description_"+key, str(value))
|
|
||||||
accu_group._v_attrs.__setattr__("sampling_rate",self.sampling_rate)
|
accu_group._v_attrs.__setattr__("sampling_rate",self.sampling_rate)
|
||||||
|
|
||||||
# save interval information
|
# save interval information
|
||||||
@@ -246,8 +245,8 @@ class ADC_Result(Resultable, Drawable, DamarisFFT, Signalpath):
|
|||||||
name="indices",
|
name="indices",
|
||||||
description={"start": tables.UInt64Col(),
|
description={"start": tables.UInt64Col(),
|
||||||
"length": tables.UInt64Col(),
|
"length": tables.UInt64Col(),
|
||||||
"start_time": tables.Float64Col(),
|
"start_time": tables.Float32Col(),
|
||||||
"dwelltime": tables.Float64Col()},
|
"dwelltime": tables.Float32Col()},
|
||||||
title="indices of adc data intervals",
|
title="indices of adc data intervals",
|
||||||
filters=filter,
|
filters=filter,
|
||||||
expectedrows=len(self.index))
|
expectedrows=len(self.index))
|
||||||
@@ -341,7 +340,7 @@ class ADC_Result(Resultable, Drawable, DamarisFFT, Signalpath):
|
|||||||
tmp_y = []
|
tmp_y = []
|
||||||
|
|
||||||
for i in range(self.get_number_of_channels()):
|
for i in range(self.get_number_of_channels()):
|
||||||
tmp_y.append(numpy.array(self.y[i], dtype="float64") + other)
|
tmp_y.append(numpy.array(self.y[i], dtype="float32") + other)
|
||||||
|
|
||||||
r = ADC_Result(x = self.x[:], y = tmp_y, index = self.index[:], sampl_freq = self.sampling_rate, desc = self.description, job_id = self.job_id, job_date = self.job_date)
|
r = ADC_Result(x = self.x[:], y = tmp_y, index = self.index[:], sampl_freq = self.sampling_rate, desc = self.description, job_id = self.job_id, job_date = self.job_date)
|
||||||
self.lock.release()
|
self.lock.release()
|
||||||
@@ -362,7 +361,7 @@ class ADC_Result(Resultable, Drawable, DamarisFFT, Signalpath):
|
|||||||
tmp_y = []
|
tmp_y = []
|
||||||
|
|
||||||
for i in range(self.get_number_of_channels()):
|
for i in range(self.get_number_of_channels()):
|
||||||
tmp_y.append(numpy.array(self.y[i], dtype="float64") - other)
|
tmp_y.append(numpy.array(self.y[i], dtype="float32") - other)
|
||||||
|
|
||||||
r = ADC_Result(x = self.x[:], y = tmp_y, index = self.index[:], sampl_freq = self.sampling_rate, desc = self.description, job_id = self.job_id, job_date = self.job_date)
|
r = ADC_Result(x = self.x[:], y = tmp_y, index = self.index[:], sampl_freq = self.sampling_rate, desc = self.description, job_id = self.job_id, job_date = self.job_date)
|
||||||
self.lock.release()
|
self.lock.release()
|
||||||
@@ -378,7 +377,7 @@ class ADC_Result(Resultable, Drawable, DamarisFFT, Signalpath):
|
|||||||
tmp_y = []
|
tmp_y = []
|
||||||
|
|
||||||
for i in range(self.get_number_of_channels()):
|
for i in range(self.get_number_of_channels()):
|
||||||
tmp_y.append(other - numpy.array(self.y[i], dtype="float64"))
|
tmp_y.append(other - numpy.array(self.y[i], dtype="float32"))
|
||||||
|
|
||||||
r = ADC_Result(x = self.x[:], y = tmp_y, index = self.index[:], sampl_freq = self.sampling_rate, desc = self.description, job_id = self.job_id, job_date = self.job_date)
|
r = ADC_Result(x = self.x[:], y = tmp_y, index = self.index[:], sampl_freq = self.sampling_rate, desc = self.description, job_id = self.job_id, job_date = self.job_date)
|
||||||
self.lock.release()
|
self.lock.release()
|
||||||
@@ -395,7 +394,7 @@ class ADC_Result(Resultable, Drawable, DamarisFFT, Signalpath):
|
|||||||
tmp_y = []
|
tmp_y = []
|
||||||
|
|
||||||
for i in range(self.get_number_of_channels()):
|
for i in range(self.get_number_of_channels()):
|
||||||
tmp_y.append(numpy.array(self.y[i], dtype="float64") * other)
|
tmp_y.append(numpy.array(self.y[i], dtype="float32") * other)
|
||||||
|
|
||||||
r = ADC_Result(x = self.x[:], y = tmp_y, index = self.index[:], sampl_freq = self.sampling_rate, desc = self.description, job_id = self.job_id, job_date = self.job_date)
|
r = ADC_Result(x = self.x[:], y = tmp_y, index = self.index[:], sampl_freq = self.sampling_rate, desc = self.description, job_id = self.job_id, job_date = self.job_date)
|
||||||
self.lock.release()
|
self.lock.release()
|
||||||
@@ -415,7 +414,7 @@ class ADC_Result(Resultable, Drawable, DamarisFFT, Signalpath):
|
|||||||
tmp_y = []
|
tmp_y = []
|
||||||
|
|
||||||
for i in range(self.get_number_of_channels()):
|
for i in range(self.get_number_of_channels()):
|
||||||
tmp_y.append(numpy.array(self.y[i], dtype="float64") ** other)
|
tmp_y.append(numpy.array(self.y[i], dtype="float32") ** other)
|
||||||
|
|
||||||
r = ADC_Result(x = self.x[:], y = tmp_y, index = self.index[:], sampl_freq = self.sampling_rate, desc = self.description, job_id = self.job_id, job_date = self.job_date)
|
r = ADC_Result(x = self.x[:], y = tmp_y, index = self.index[:], sampl_freq = self.sampling_rate, desc = self.description, job_id = self.job_id, job_date = self.job_date)
|
||||||
self.lock.release()
|
self.lock.release()
|
||||||
@@ -431,7 +430,7 @@ class ADC_Result(Resultable, Drawable, DamarisFFT, Signalpath):
|
|||||||
tmp_y = []
|
tmp_y = []
|
||||||
|
|
||||||
for i in range(self.get_number_of_channels()):
|
for i in range(self.get_number_of_channels()):
|
||||||
tmp_y.append(numpy.array(self.y[i], dtype="float64") / other)
|
tmp_y.append(numpy.array(self.y[i], dtype="float32") / other)
|
||||||
|
|
||||||
r = ADC_Result(x = self.x[:], y = tmp_y, index = self.index[:], sampl_freq = self.sampling_rate, desc = self.description, job_id = self.job_id, job_date = self.job_date)
|
r = ADC_Result(x = self.x[:], y = tmp_y, index = self.index[:], sampl_freq = self.sampling_rate, desc = self.description, job_id = self.job_id, job_date = self.job_date)
|
||||||
self.lock.release()
|
self.lock.release()
|
||||||
@@ -447,7 +446,7 @@ class ADC_Result(Resultable, Drawable, DamarisFFT, Signalpath):
|
|||||||
tmp_y = []
|
tmp_y = []
|
||||||
|
|
||||||
for i in range(self.get_number_of_channels()):
|
for i in range(self.get_number_of_channels()):
|
||||||
tmp_y.append(other / numpy.array(self.y[i], dtype="float64"))
|
tmp_y.append(other / numpy.array(self.y[i], dtype="float32"))
|
||||||
|
|
||||||
r = ADC_Result(x = self.x[:], y = tmp_y, index = self.index[:], sampl_freq = self.sampling_rate, desc = self.description, job_id = self.job_id, job_date = self.job_date)
|
r = ADC_Result(x = self.x[:], y = tmp_y, index = self.index[:], sampl_freq = self.sampling_rate, desc = self.description, job_id = self.job_id, job_date = self.job_date)
|
||||||
self.lock.release()
|
self.lock.release()
|
||||||
@@ -517,7 +516,7 @@ def read_from_hdf(hdf_node):
|
|||||||
# now do the real data
|
# now do the real data
|
||||||
adc_data=hdf_node.adc_data.read()
|
adc_data=hdf_node.adc_data.read()
|
||||||
|
|
||||||
adc.x=numpy.arange(adc_data.shape[0], dtype="float64")/adc.sampling_rate
|
adc.x=numpy.arange(adc_data.shape[0], dtype="float32")/adc.sampling_rate
|
||||||
|
|
||||||
for ch in range(adc_data.shape[1]):
|
for ch in range(adc_data.shape[1]):
|
||||||
adc.y.append(adc_data[:,ch])
|
adc.y.append(adc_data[:,ch])
|
||||||
|
|||||||
+30
-30
@@ -131,19 +131,19 @@ class Accumulation(Errorable, Drawable, DamarisFFT, Signalpath):
|
|||||||
return error (std.dev/sqrt(n)) of mean
|
return error (std.dev/sqrt(n)) of mean
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if not self.uses_statistics(): return numpy.zeros((len(self.y[0]),),dtype="float64")
|
if not self.uses_statistics(): return numpy.zeros((len(self.y[0]),),dtype="float32")
|
||||||
if not self.contains_data(): return []
|
if not self.contains_data(): return []
|
||||||
|
|
||||||
self.lock.acquire()
|
self.lock.acquire()
|
||||||
if self.n < 2:
|
if self.n < 2:
|
||||||
retval=numpy.zeros((len(self.y[0]),),dtype="float64")
|
retval=numpy.zeros((len(self.y[0]),),dtype="float32")
|
||||||
self.lock.release()
|
self.lock.release()
|
||||||
return retval
|
return retval
|
||||||
try:
|
try:
|
||||||
variance_over_n = (self.y_square[channel] - (self.y[channel]**2 / float(self.n)))/float((self.n-1)*self.n)
|
variance_over_n = (self.y_square[channel] - (self.y[channel]**2 / float(self.n)))/float((self.n-1)*self.n)
|
||||||
except IndexError:
|
except IndexError:
|
||||||
print("Warning Accumulation.get_ydata(channel): Channel index does not exist.")
|
print("Warning Accumulation.get_ydata(channel): Channel index does not exist.")
|
||||||
variance_over_n = numpy.zeros((len(self.y[0]),), dtype="float64")
|
variance_over_n = numpy.zeros((len(self.y[0]),), dtype="float32")
|
||||||
self.lock.release()
|
self.lock.release()
|
||||||
# sample standard deviation / sqrt(n)
|
# sample standard deviation / sqrt(n)
|
||||||
return numpy.nan_to_num(numpy.sqrt(variance_over_n))
|
return numpy.nan_to_num(numpy.sqrt(variance_over_n))
|
||||||
@@ -160,7 +160,7 @@ class Accumulation(Errorable, Drawable, DamarisFFT, Signalpath):
|
|||||||
tmp_y = self.y[channel] / self.n
|
tmp_y = self.y[channel] / self.n
|
||||||
except IndexError:
|
except IndexError:
|
||||||
print("Warning Accumulation.get_ydata(channel): Channel index does not exist.")
|
print("Warning Accumulation.get_ydata(channel): Channel index does not exist.")
|
||||||
tmp_y = numpy.zeros((len(self.y[0]),), dtype="float64")
|
tmp_y = numpy.zeros((len(self.y[0]),), dtype="float32")
|
||||||
|
|
||||||
self.lock.release()
|
self.lock.release()
|
||||||
return tmp_y
|
return tmp_y
|
||||||
@@ -466,13 +466,13 @@ class Accumulation(Errorable, Drawable, DamarisFFT, Signalpath):
|
|||||||
|
|
||||||
# prepare saving data
|
# prepare saving data
|
||||||
channel_no=len(self.y)
|
channel_no=len(self.y)
|
||||||
timedata=numpy.empty((len(self.y[0]),channel_no*2), dtype = "float64")
|
timedata=numpy.empty((len(self.y[0]),channel_no*2), dtype = "float32")
|
||||||
for ch in range(channel_no):
|
for ch in range(channel_no):
|
||||||
timedata[:,ch*2]=self.get_ydata(ch)
|
timedata[:,ch*2]=self.get_ydata(ch)
|
||||||
if self.uses_statistics():
|
if self.uses_statistics():
|
||||||
timedata[:,ch*2+1]=self.get_yerr(ch)
|
timedata[:,ch*2+1]=self.get_yerr(ch)
|
||||||
else:
|
else:
|
||||||
timedata[:,ch*2+1]=numpy.zeros((len(self.y[0]),),dtype = "float64")
|
timedata[:,ch*2+1]=numpy.zeros((len(self.y[0]),),dtype = "float32")
|
||||||
|
|
||||||
# save data
|
# save data
|
||||||
time_slice_data=None
|
time_slice_data=None
|
||||||
@@ -486,7 +486,7 @@ class Accumulation(Errorable, Drawable, DamarisFFT, Signalpath):
|
|||||||
time_slice_data=hdffile.create_carray(accu_group,
|
time_slice_data=hdffile.create_carray(accu_group,
|
||||||
name="accu_data",
|
name="accu_data",
|
||||||
shape=timedata.shape,
|
shape=timedata.shape,
|
||||||
atom=tables.Float64Atom(shape=chunkshape,
|
atom=tables.Float32Atom(shape=chunkshape,
|
||||||
flavor="numpy"),
|
flavor="numpy"),
|
||||||
filters=filter,
|
filters=filter,
|
||||||
title="accu data")
|
title="accu data")
|
||||||
@@ -495,7 +495,7 @@ class Accumulation(Errorable, Drawable, DamarisFFT, Signalpath):
|
|||||||
name="accu_data",
|
name="accu_data",
|
||||||
shape=timedata.shape,
|
shape=timedata.shape,
|
||||||
chunkshape=chunkshape,
|
chunkshape=chunkshape,
|
||||||
atom=tables.Float64Atom(),
|
atom=tables.Float32Atom(),
|
||||||
filters=filter,
|
filters=filter,
|
||||||
title="accu data")
|
title="accu data")
|
||||||
|
|
||||||
@@ -564,9 +564,9 @@ class Accumulation(Errorable, Drawable, DamarisFFT, Signalpath):
|
|||||||
tmp_y.append(self.y[i] + (other*self.n))
|
tmp_y.append(self.y[i] + (other*self.n))
|
||||||
|
|
||||||
if self.uses_statistics():
|
if self.uses_statistics():
|
||||||
r = Accumulation(x = numpy.array(self.x, dtype="float64"), y = tmp_y, y_2 = tmp_ysquare, n = self.n, index = self.index, sampl_freq = self.sampling_rate, error = self.use_error)
|
r = Accumulation(x = numpy.array(self.x, dtype="float32"), y = tmp_y, y_2 = tmp_ysquare, n = self.n, index = self.index, sampl_freq = self.sampling_rate, error = self.use_error)
|
||||||
else:
|
else:
|
||||||
r = Accumulation(x = numpy.array(self.x, dtype="float64"), y = tmp_y, n = self.n, index = self.index, sampl_freq = self.sampling_rate, error = self.use_error)
|
r = Accumulation(x = numpy.array(self.x, dtype="float32"), y = tmp_y, n = self.n, index = self.index, sampl_freq = self.sampling_rate, error = self.use_error)
|
||||||
r.job_id = self.job_id # added by Oleg Petrov
|
r.job_id = self.job_id # added by Oleg Petrov
|
||||||
self.lock.release()
|
self.lock.release()
|
||||||
return r
|
return r
|
||||||
@@ -587,14 +587,14 @@ class Accumulation(Errorable, Drawable, DamarisFFT, Signalpath):
|
|||||||
self.lock.acquire()
|
self.lock.acquire()
|
||||||
|
|
||||||
for i in range(other.get_number_of_channels()):
|
for i in range(other.get_number_of_channels()):
|
||||||
tmp_y.append(numpy.array(other.y[i], dtype="float64"))
|
tmp_y.append(numpy.array(other.y[i], dtype="float32"))
|
||||||
if self.uses_statistics(): tmp_ysquare.append(tmp_y[i] ** 2)
|
if self.uses_statistics(): tmp_ysquare.append(tmp_y[i] ** 2)
|
||||||
|
|
||||||
|
|
||||||
if self.uses_statistics():
|
if self.uses_statistics():
|
||||||
r = Accumulation(x = numpy.array(other.x, dtype="float64"), y = tmp_y, y_2 = tmp_ysquare, n = 1, index = other.index, sampl_freq = other.sampling_rate, error = True)
|
r = Accumulation(x = numpy.array(other.x, dtype="float32"), y = tmp_y, y_2 = tmp_ysquare, n = 1, index = other.index, sampl_freq = other.sampling_rate, error = True)
|
||||||
else:
|
else:
|
||||||
r = Accumulation(x = numpy.array(other.x, dtype="float64"), y = tmp_y, index = other.index, sampl_freq = other.sampling_rate, n = 1, error = False)
|
r = Accumulation(x = numpy.array(other.x, dtype="float32"), y = tmp_y, index = other.index, sampl_freq = other.sampling_rate, n = 1, error = False)
|
||||||
r.time_period=[other.job_date,other.job_date]
|
r.time_period=[other.job_date,other.job_date]
|
||||||
r.job_id = other.job_id # added by Oleg Petrov
|
r.job_id = other.job_id # added by Oleg Petrov
|
||||||
r.common_descriptions=other.description.copy()
|
r.common_descriptions=other.description.copy()
|
||||||
@@ -616,12 +616,12 @@ class Accumulation(Errorable, Drawable, DamarisFFT, Signalpath):
|
|||||||
|
|
||||||
for i in range(self.get_number_of_channels()):
|
for i in range(self.get_number_of_channels()):
|
||||||
tmp_y.append(self.y[i] + other.y[i])
|
tmp_y.append(self.y[i] + other.y[i])
|
||||||
if self.uses_statistics(): tmp_ysquare.append(self.y_square[i] + (numpy.array(other.y[i], dtype="float64") ** 2))
|
if self.uses_statistics(): tmp_ysquare.append(self.y_square[i] + (numpy.array(other.y[i], dtype="float32") ** 2))
|
||||||
|
|
||||||
if self.uses_statistics():
|
if self.uses_statistics():
|
||||||
r = Accumulation(x = numpy.array(self.x, dtype="float64"), y = tmp_y, y_2 = tmp_ysquare, n = self.n + 1, index = self.index, sampl_freq = self.sampling_rate, error = True)
|
r = Accumulation(x = numpy.array(self.x, dtype="float32"), y = tmp_y, y_2 = tmp_ysquare, n = self.n + 1, index = self.index, sampl_freq = self.sampling_rate, error = True)
|
||||||
else:
|
else:
|
||||||
r = Accumulation(x = numpy.array(self.x, dtype="float64"), y = tmp_y, n = self.n + 1, index = self.index, sampl_freq = self.sampling_rate, error = False)
|
r = Accumulation(x = numpy.array(self.x, dtype="float32"), y = tmp_y, n = self.n + 1, index = self.index, sampl_freq = self.sampling_rate, error = False)
|
||||||
r.time_period=[min(self.time_period[0],other.job_date),
|
r.time_period=[min(self.time_period[0],other.job_date),
|
||||||
max(self.time_period[1],other.job_date)]
|
max(self.time_period[1],other.job_date)]
|
||||||
r.job_id = other.job_id # added by Oleg Petrov
|
r.job_id = other.job_id # added by Oleg Petrov
|
||||||
@@ -649,9 +649,9 @@ class Accumulation(Errorable, Drawable, DamarisFFT, Signalpath):
|
|||||||
self.lock.acquire()
|
self.lock.acquire()
|
||||||
|
|
||||||
if self.uses_statistics():
|
if self.uses_statistics():
|
||||||
r = Accumulation(x = numpy.array(other.x, dtype="float64"), y = tmp_y, y_2 = tmp_ysquare, n = other.n, index = other.index, sampl_freq = other.sampling_rate, error = True)
|
r = Accumulation(x = numpy.array(other.x, dtype="float32"), y = tmp_y, y_2 = tmp_ysquare, n = other.n, index = other.index, sampl_freq = other.sampling_rate, error = True)
|
||||||
else:
|
else:
|
||||||
r = Accumulation(x = numpy.array(other.x, dtype="float64"), y = tmp_y, n = other.n, index = other.index, sampl_freq = other.sampling_rate, error = False)
|
r = Accumulation(x = numpy.array(other.x, dtype="float32"), y = tmp_y, n = other.n, index = other.index, sampl_freq = other.sampling_rate, error = False)
|
||||||
for i in range(other.get_number_of_channels()):
|
for i in range(other.get_number_of_channels()):
|
||||||
tmp_y.append(other.y[i])
|
tmp_y.append(other.y[i])
|
||||||
tmp_ysquare.append(other.y_square[i])
|
tmp_ysquare.append(other.y_square[i])
|
||||||
@@ -684,9 +684,9 @@ class Accumulation(Errorable, Drawable, DamarisFFT, Signalpath):
|
|||||||
tmp_ysquare.append(self.y_square[i] + other.y_square[i])
|
tmp_ysquare.append(self.y_square[i] + other.y_square[i])
|
||||||
|
|
||||||
if self.uses_statistics():
|
if self.uses_statistics():
|
||||||
r = Accumulation(x = numpy.array(self.x, dtype="float64"), y = tmp_y, y_2 = tmp_ysquare, n = other.n + self.n, index = self.index, sampl_freq = self.sampling_rate, error = True)
|
r = Accumulation(x = numpy.array(self.x, dtype="float32"), y = tmp_y, y_2 = tmp_ysquare, n = other.n + self.n, index = self.index, sampl_freq = self.sampling_rate, error = True)
|
||||||
else:
|
else:
|
||||||
r = Accumulation(x = numpy.array(self.x, dtype="float64"), y = tmp_y, n = other.n + self.n, index = self.index, sampl_freq = self.sampling_rate, error = False)
|
r = Accumulation(x = numpy.array(self.x, dtype="float32"), y = tmp_y, n = other.n + self.n, index = self.index, sampl_freq = self.sampling_rate, error = False)
|
||||||
|
|
||||||
r.time_period=[min(self.time_period[0],other.time_period[0]),
|
r.time_period=[min(self.time_period[0],other.time_period[0]),
|
||||||
max(self.time_period[1],other.time_period[1])]
|
max(self.time_period[1],other.time_period[1])]
|
||||||
@@ -745,11 +745,11 @@ class Accumulation(Errorable, Drawable, DamarisFFT, Signalpath):
|
|||||||
self.n += 1
|
self.n += 1
|
||||||
self.index = other.index[0:]
|
self.index = other.index[0:]
|
||||||
self.sampling_rate = other.sampling_rate
|
self.sampling_rate = other.sampling_rate
|
||||||
self.x = numpy.array(other.x, dtype="float64")
|
self.x = numpy.array(other.x, dtype="float32")
|
||||||
self.cont_data = True
|
self.cont_data = True
|
||||||
|
|
||||||
for i in range(other.get_number_of_channels()):
|
for i in range(other.get_number_of_channels()):
|
||||||
self.y.append(numpy.array(other.y[i], dtype="float64"))
|
self.y.append(numpy.array(other.y[i], dtype="float32"))
|
||||||
if self.uses_statistics(): self.y_square.append(self.y[i] ** 2)
|
if self.uses_statistics(): self.y_square.append(self.y[i] ** 2)
|
||||||
|
|
||||||
self.set_title(self.__title_pattern % self.n)
|
self.set_title(self.__title_pattern % self.n)
|
||||||
@@ -774,7 +774,7 @@ class Accumulation(Errorable, Drawable, DamarisFFT, Signalpath):
|
|||||||
|
|
||||||
for i in range(self.get_number_of_channels()):
|
for i in range(self.get_number_of_channels()):
|
||||||
self.y[i] += other.y[i]
|
self.y[i] += other.y[i]
|
||||||
if self.uses_statistics(): self.y_square[i] += numpy.array(other.y[i], dtype="float64") ** 2
|
if self.uses_statistics(): self.y_square[i] += numpy.array(other.y[i], dtype="float32") ** 2
|
||||||
|
|
||||||
self.n += 1
|
self.n += 1
|
||||||
self.time_period=[min(self.time_period[0],other.job_date),
|
self.time_period=[min(self.time_period[0],other.job_date),
|
||||||
@@ -804,11 +804,11 @@ class Accumulation(Errorable, Drawable, DamarisFFT, Signalpath):
|
|||||||
self.n += other.n
|
self.n += other.n
|
||||||
self.index = other.index[0:]
|
self.index = other.index[0:]
|
||||||
self.sampling_rate = other.sampling_rate
|
self.sampling_rate = other.sampling_rate
|
||||||
self.x = numpy.array(other.x, dtype="float64")
|
self.x = numpy.array(other.x, dtype="float32")
|
||||||
self.cont_data = True
|
self.cont_data = True
|
||||||
|
|
||||||
for i in range(other.get_number_of_channels()):
|
for i in range(other.get_number_of_channels()):
|
||||||
self.y.append(numpy.array(other.y[i], dtype="float64"))
|
self.y.append(numpy.array(other.y[i], dtype="float32"))
|
||||||
if self.uses_statistics(): self.y_square.append(self.y[i] ** 2)
|
if self.uses_statistics(): self.y_square.append(self.y[i] ** 2)
|
||||||
|
|
||||||
self.set_title(self.__title_pattern % self.n)
|
self.set_title(self.__title_pattern % self.n)
|
||||||
@@ -869,12 +869,12 @@ class Accumulation(Errorable, Drawable, DamarisFFT, Signalpath):
|
|||||||
|
|
||||||
self.lock.acquire()
|
self.lock.acquire()
|
||||||
for i in range(self.get_number_of_channels()):
|
for i in range(self.get_number_of_channels()):
|
||||||
tmp_y.append(numpy.array(-self.y[i], dtype="float64"))
|
tmp_y.append(numpy.array(-self.y[i], dtype="float32"))
|
||||||
|
|
||||||
if self.uses_statistics():
|
if self.uses_statistics():
|
||||||
r = Accumulation(x = numpy.array(self.x, dtype="float64"), y = tmp_y, y_2 = numpy.array(self.y_square), n = self.n, index = self.index, sampl_freq = self.sampling_rate, error = True)
|
r = Accumulation(x = numpy.array(self.x, dtype="float32"), y = tmp_y, y_2 = numpy.array(self.y_square), n = self.n, index = self.index, sampl_freq = self.sampling_rate, error = True)
|
||||||
else:
|
else:
|
||||||
r = Accumulation(x = numpy.array(self.x, dtype="float64"), y = tmp_y, n = self.n, index = self.index, sampl_freq = self.sampling_rate, error = False)
|
r = Accumulation(x = numpy.array(self.x, dtype="float32"), y = tmp_y, n = self.n, index = self.index, sampl_freq = self.sampling_rate, error = False)
|
||||||
self.lock.release()
|
self.lock.release()
|
||||||
return r
|
return r
|
||||||
|
|
||||||
@@ -951,7 +951,7 @@ def read_from_hdf(hdf_node):
|
|||||||
# now do the real data
|
# now do the real data
|
||||||
accu_data=hdf_node.accu_data.read()
|
accu_data=hdf_node.accu_data.read()
|
||||||
|
|
||||||
accu.x=numpy.arange(accu_data.shape[0], dtype="float64")/accu.sampling_rate
|
accu.x=numpy.arange(accu_data.shape[0], dtype="float32")/accu.sampling_rate
|
||||||
# assume error information, todo: save this information explicitly
|
# assume error information, todo: save this information explicitly
|
||||||
accu.y_square=[]
|
accu.y_square=[]
|
||||||
accu.use_error=False
|
accu.use_error=False
|
||||||
@@ -959,7 +959,7 @@ def read_from_hdf(hdf_node):
|
|||||||
for ch in range(accu_data.shape[1]/2):
|
for ch in range(accu_data.shape[1]/2):
|
||||||
accu.y.append(accu_data[:,ch*2]*accu.n)
|
accu.y.append(accu_data[:,ch*2]*accu.n)
|
||||||
if accu.n<2 or numpy.all(accu_data[:,ch*2+1]==0.0):
|
if accu.n<2 or numpy.all(accu_data[:,ch*2+1]==0.0):
|
||||||
accu.y_square.append(numpy.zeros((accu_data.shape[0]) ,dtype="float64"))
|
accu.y_square.append(numpy.zeros((accu_data.shape[0]) ,dtype="float32"))
|
||||||
else:
|
else:
|
||||||
accu.use_error=True
|
accu.use_error=True
|
||||||
accu.y_square.append((accu_data[:,ch*2+1]**2)*float((accu.n-1.0)*accu.n)+(accu_data[:,ch*2]**2)*accu.n)
|
accu.y_square.append((accu_data[:,ch*2+1]**2)*float((accu.n-1.0)*accu.n)+(accu_data[:,ch*2]**2)*accu.n)
|
||||||
|
|||||||
@@ -8,18 +8,11 @@ import collections
|
|||||||
import threading
|
import threading
|
||||||
import traceback
|
import traceback
|
||||||
import io
|
import io
|
||||||
if sys.version_info.major == 3 and sys.version_info.minor >= 10:
|
|
||||||
|
|
||||||
from collections.abc import MutableMapping
|
|
||||||
else:
|
|
||||||
from collections import MutableMapping
|
|
||||||
|
|
||||||
|
|
||||||
from . import ADC_Result
|
from . import ADC_Result
|
||||||
from . import Accumulation
|
from . import Accumulation
|
||||||
from . import MeasurementResult
|
from . import MeasurementResult
|
||||||
|
|
||||||
class DataPool(MutableMapping):
|
class DataPool(collections.abc.MutableMapping):
|
||||||
"""
|
"""
|
||||||
dictionary with sending change events
|
dictionary with sending change events
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ class MeasurementResult(Drawable.Drawable, collections.UserDict):
|
|||||||
sorted array of all dictionary entries without Accumulated Value objects with n==0
|
sorted array of all dictionary entries without Accumulated Value objects with n==0
|
||||||
"""
|
"""
|
||||||
keys=numpy.array([k for k in list(self.data.keys()) if not (isinstance(self.data[k], AccumulatedValue) and self.data[k].n==0)],
|
keys=numpy.array([k for k in list(self.data.keys()) if not (isinstance(self.data[k], AccumulatedValue) and self.data[k].n==0)],
|
||||||
dtype="float64")
|
dtype="Float64")
|
||||||
keys.sort()
|
keys.sort()
|
||||||
return keys
|
return keys
|
||||||
|
|
||||||
@@ -177,18 +177,18 @@ class MeasurementResult(Drawable.Drawable, collections.UserDict):
|
|||||||
|
|
||||||
def get_xydata(self):
|
def get_xydata(self):
|
||||||
k=self.get_xdata()
|
k=self.get_xdata()
|
||||||
v=numpy.array([self.data[key].mean() for key in k], dtype="float64")
|
v=numpy.array([self.data[key].mean() for key in k], dtype="Float64")
|
||||||
return [k,v]
|
return [k,v]
|
||||||
|
|
||||||
def get_errorplotdata(self):
|
def get_errorplotdata(self):
|
||||||
k=self.get_xdata()
|
k=self.get_xdata()
|
||||||
v=numpy.array([self.data[key].mean() for key in k], dtype="float64")
|
v=numpy.array([self.data[key].mean() for key in k], dtype="Float64")
|
||||||
e=numpy.array([self.data[key].mean_error() for key in k], dtype="float64")
|
e=numpy.array([self.data[key].mean_error() for key in k], dtype="Float64")
|
||||||
return [k,v,e]
|
return [k,v,e]
|
||||||
|
|
||||||
def get_lineplotdata(self):
|
def get_lineplotdata(self):
|
||||||
k=self.get_xdata()
|
k=self.get_xdata()
|
||||||
v=numpy.array(self.y, dtype="float64")
|
v=numpy.array(self.y, dtype="Float64")
|
||||||
return [k, v]
|
return [k, v]
|
||||||
|
|
||||||
def uses_statistics(self):
|
def uses_statistics(self):
|
||||||
|
|||||||
+16
-21
@@ -24,9 +24,9 @@ gi.require_version('GtkSource', '3.0')
|
|||||||
# gui graphics
|
# gui graphics
|
||||||
from gi.repository import GObject as gobject
|
from gi.repository import GObject as gobject
|
||||||
import sqlite3,uuid
|
import sqlite3,uuid
|
||||||
from pkg_resources import parse_version
|
|
||||||
|
|
||||||
#gobject.threads_init( )
|
#gobject.threads_init( )
|
||||||
|
|
||||||
from gi.repository import Gtk as gtk
|
from gi.repository import Gtk as gtk
|
||||||
|
|
||||||
gtk_version_missmatch = gtk.check_version( 3, 0, 0 )
|
gtk_version_missmatch = gtk.check_version( 3, 0, 0 )
|
||||||
@@ -64,10 +64,9 @@ max_points_to_display = 0
|
|||||||
import matplotlib.axes
|
import matplotlib.axes
|
||||||
import matplotlib.figure
|
import matplotlib.figure
|
||||||
#for printing issues
|
#for printing issues
|
||||||
#if hasattr( gtk, "PrintOperation" ):
|
if hasattr( gtk, "PrintOperation" ):
|
||||||
# import matplotlib.backends.backend_cairo
|
import matplotlib.backends.backend_cairo
|
||||||
|
|
||||||
print('backend:', matplotlib.get_backend()) # must print GTK3Agg
|
|
||||||
# import our own stuff
|
# import our own stuff
|
||||||
from damaris.gui import ExperimentWriter, ExperimentHandling
|
from damaris.gui import ExperimentWriter, ExperimentHandling
|
||||||
from damaris.gui import ResultReader, ResultHandling
|
from damaris.gui import ResultReader, ResultHandling
|
||||||
@@ -180,7 +179,7 @@ class DamarisGUI:
|
|||||||
# my notebook
|
# my notebook
|
||||||
self.main_notebook = self.xml_gui.get_object( "main_notebook" )
|
self.main_notebook = self.xml_gui.get_object( "main_notebook" )
|
||||||
|
|
||||||
self.log = LogWindow( self.xml_gui, self )
|
self.log = LogWindow( self.xml_gui , self)
|
||||||
|
|
||||||
self.sw = ScriptWidgets( self.xml_gui )
|
self.sw = ScriptWidgets( self.xml_gui )
|
||||||
|
|
||||||
@@ -194,7 +193,7 @@ class DamarisGUI:
|
|||||||
# lock file to prevent other DAMARIS to start immediatly
|
# lock file to prevent other DAMARIS to start immediatly
|
||||||
self.lockfile = LockFile() # = os.path.expanduser("~/.damaris.lock")
|
self.lockfile = LockFile() # = os.path.expanduser("~/.damaris.lock")
|
||||||
self.id = None
|
self.id = None
|
||||||
|
|
||||||
#to stop queued experiments
|
#to stop queued experiments
|
||||||
self.stop_experiment_flag = threading.Event()
|
self.stop_experiment_flag = threading.Event()
|
||||||
|
|
||||||
@@ -289,7 +288,6 @@ class DamarisGUI:
|
|||||||
self.toolbar_pause_button = self.xml_gui.get_object( "toolbar_pause_button" )
|
self.toolbar_pause_button = self.xml_gui.get_object( "toolbar_pause_button" )
|
||||||
|
|
||||||
# print button
|
# print button
|
||||||
# disabled 2026-02-24
|
|
||||||
#self.toolbar_print_button = self.xml_gui.get_object( "toolbar_print_button" )
|
#self.toolbar_print_button = self.xml_gui.get_object( "toolbar_print_button" )
|
||||||
#if not hasattr( gtk, "PrintOperation" ):
|
#if not hasattr( gtk, "PrintOperation" ):
|
||||||
# self.toolbar_print_button.set_sensitive( False )
|
# self.toolbar_print_button.set_sensitive( False )
|
||||||
@@ -543,7 +541,7 @@ class DamarisGUI:
|
|||||||
for r in still_running:
|
for r in still_running:
|
||||||
r.quit_flag.set( )
|
r.quit_flag.set( )
|
||||||
print("waiting for threads stoping...", end=' ')
|
print("waiting for threads stoping...", end=' ')
|
||||||
still_running = [x for x in [ self.si.exp_handling, self.si.res_handling, self.si.back_driver ] if x is not None and x.is_alive()]
|
still_running = [x for x in [ self.si.exp_handling, self.si.res_handling, self.si.back_driver ] if x is not None and x.is_alive( )]
|
||||||
for t in still_running:
|
for t in still_running:
|
||||||
t.join( )
|
t.join( )
|
||||||
print("done")
|
print("done")
|
||||||
@@ -626,7 +624,7 @@ class DamarisGUI:
|
|||||||
r_text = None
|
r_text = None
|
||||||
b_text = None
|
b_text = None
|
||||||
if self.si.exp_handling is not None:
|
if self.si.exp_handling is not None:
|
||||||
if not self.si.exp_handling.is_alive():
|
if not self.si.exp_handling.is_alive( ):
|
||||||
self.si.exp_handling.join( )
|
self.si.exp_handling.join( )
|
||||||
if self.si.exp_handling.raised_exception:
|
if self.si.exp_handling.raised_exception:
|
||||||
print("experiment script failed at line %d (function %s): %s" % (self.si.exp_handling.location[ 0 ],
|
print("experiment script failed at line %d (function %s): %s" % (self.si.exp_handling.location[ 0 ],
|
||||||
@@ -644,7 +642,7 @@ class DamarisGUI:
|
|||||||
e_text += experimenttimetext
|
e_text += experimenttimetext
|
||||||
|
|
||||||
if self.si.res_handling is not None:
|
if self.si.res_handling is not None:
|
||||||
if not self.si.res_handling.is_alive():
|
if not self.si.res_handling.is_alive( ):
|
||||||
self.si.res_handling.join( )
|
self.si.res_handling.join( )
|
||||||
if self.si.res_handling.raised_exception:
|
if self.si.res_handling.raised_exception:
|
||||||
print("result script failed at line %d (function %s): %s" % (self.si.res_handling.location[ 0 ],
|
print("result script failed at line %d (function %s): %s" % (self.si.res_handling.location[ 0 ],
|
||||||
@@ -659,7 +657,7 @@ class DamarisGUI:
|
|||||||
r_text = "Result Script Running (%d)" % r
|
r_text = "Result Script Running (%d)" % r
|
||||||
|
|
||||||
if self.si.back_driver is not None:
|
if self.si.back_driver is not None:
|
||||||
if not self.si.back_driver.is_alive():
|
if not self.si.back_driver.is_alive( ):
|
||||||
if self.si.back_driver.raised_exception:
|
if self.si.back_driver.raised_exception:
|
||||||
b_text = "Backend Failed"
|
b_text = "Backend Failed"
|
||||||
else:
|
else:
|
||||||
@@ -673,7 +671,7 @@ class DamarisGUI:
|
|||||||
b_text += backendtimetext
|
b_text += backendtimetext
|
||||||
|
|
||||||
if self.dump_thread is not None:
|
if self.dump_thread is not None:
|
||||||
if self.dump_thread.is_alive():
|
if self.dump_thread.is_alive( ):
|
||||||
sys.stdout.write( "." )
|
sys.stdout.write( "." )
|
||||||
self.dump_dots += 1
|
self.dump_dots += 1
|
||||||
if self.dump_dots > 80:
|
if self.dump_dots > 80:
|
||||||
@@ -715,7 +713,7 @@ class DamarisGUI:
|
|||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
if self.save_thread is not None:
|
if self.save_thread is not None:
|
||||||
if self.save_thread.is_alive():
|
if self.save_thread.is_alive( ):
|
||||||
sys.stdout.write( "." )
|
sys.stdout.write( "." )
|
||||||
self.dump_dots += 1
|
self.dump_dots += 1
|
||||||
if self.dump_dots > 80:
|
if self.dump_dots > 80:
|
||||||
@@ -1088,7 +1086,7 @@ class DamarisGUI:
|
|||||||
|
|
||||||
if requested_doc in self.doc_urls and self.doc_urls[ requested_doc ] is not None:
|
if requested_doc in self.doc_urls and self.doc_urls[ requested_doc ] is not None:
|
||||||
if self.doc_browser is not None:
|
if self.doc_browser is not None:
|
||||||
if not self.doc_browser.is_alive():
|
if not self.doc_browser.is_alive( ):
|
||||||
self.doc_browser.join( )
|
self.doc_browser.join( )
|
||||||
if self.doc_browser.my_webbrowser is not None:
|
if self.doc_browser.my_webbrowser is not None:
|
||||||
print("new browser tab")
|
print("new browser tab")
|
||||||
@@ -1151,8 +1149,7 @@ class LogWindow:
|
|||||||
self.textview.connect( "key-press-event", self.textview_keypress)
|
self.textview.connect( "key-press-event", self.textview_keypress)
|
||||||
self.textbuffer = self.textview.get_buffer( )
|
self.textbuffer = self.textview.get_buffer( )
|
||||||
self.logstream = log
|
self.logstream = log
|
||||||
print("here i am")
|
self.logstream.gui_log = self
|
||||||
#self.logstream.gui_log = self
|
|
||||||
self.last_timetag = None
|
self.last_timetag = None
|
||||||
self( "Started in directory %s\n" % os.getcwd( ) )
|
self( "Started in directory %s\n" % os.getcwd( ) )
|
||||||
|
|
||||||
@@ -2478,11 +2475,9 @@ class MonitorWidgets:
|
|||||||
self.display_table.attach( self.matplot_canvas, 0, 6, 0, 1, gtk.AttachOptions.EXPAND | gtk.AttachOptions.FILL, gtk.AttachOptions.EXPAND | gtk.AttachOptions.FILL, 0, 0 )
|
self.display_table.attach( self.matplot_canvas, 0, 6, 0, 1, gtk.AttachOptions.EXPAND | gtk.AttachOptions.FILL, gtk.AttachOptions.EXPAND | gtk.AttachOptions.FILL, 0, 0 )
|
||||||
self.matplot_canvas.show( )
|
self.matplot_canvas.show( )
|
||||||
|
|
||||||
# Matplot Toolbar hinzufuegen (Display_Table, 2. Zeile)
|
# Matplot Toolbar hinzufuegen (Display_Table, 2. Zeile)
|
||||||
if parse_version(matplotlib.__version__) >= parse_version("3.6"):
|
self.matplot_toolbar = matplotlib.backends.backend_gtk3.NavigationToolbar2GTK3( self.matplot_canvas,
|
||||||
self.matplot_toolbar = matplotlib.backends.backend_gtk3.NavigationToolbar2GTK3( self.matplot_canvas )
|
self.main_window )
|
||||||
else: #
|
|
||||||
self.matplot_toolbar = matplotlib.backends.backend_gtk3.NavigationToolbar2GTK3( self.matplot_canvas, self.main_window )
|
|
||||||
|
|
||||||
self.display_table.attach( self.matplot_toolbar, 0, 1, 1, 2, gtk.AttachOptions.FILL | gtk.AttachOptions.EXPAND, 0, 0, 0 )
|
self.display_table.attach( self.matplot_toolbar, 0, 1, 1, 2, gtk.AttachOptions.FILL | gtk.AttachOptions.EXPAND, 0, 0, 0 )
|
||||||
self.matplot_toolbar.show( )
|
self.matplot_toolbar.show( )
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ class ResultReader:
|
|||||||
self.result_description = {}
|
self.result_description = {}
|
||||||
self.in_description_section=True
|
self.in_description_section=True
|
||||||
self.in_description_data=()
|
self.in_description_data=()
|
||||||
for an_item in elem.iter():
|
for an_item in elem:
|
||||||
self.in_description_data = (an_item.get("key"), an_item.get("type"), an_item.text)
|
self.in_description_data = (an_item.get("key"), an_item.get("type"), an_item.text)
|
||||||
# make item contents to dictionary item:
|
# make item contents to dictionary item:
|
||||||
k,t,v=self.in_description_data
|
k,t,v=self.in_description_data
|
||||||
@@ -213,7 +213,7 @@ class ResultReader:
|
|||||||
self.adc_result_sample_counter>0:
|
self.adc_result_sample_counter>0:
|
||||||
# fill the ADC_Result with collected data
|
# fill the ADC_Result with collected data
|
||||||
# x data
|
# x data
|
||||||
self.result.x=numpy.arange(self.adc_result_sample_counter, dtype="float64")/\
|
self.result.x=numpy.arange(self.adc_result_sample_counter, dtype="float32")/\
|
||||||
self.result.get_sampling_rate()
|
self.result.get_sampling_rate()
|
||||||
self.result.y = []
|
self.result.y = []
|
||||||
nChannels = self.result.get_nChannels()
|
nChannels = self.result.get_nChannels()
|
||||||
@@ -293,7 +293,7 @@ class ResultReader:
|
|||||||
self.__filetype == ResultReader.ADCDATA_TYPE and \
|
self.__filetype == ResultReader.ADCDATA_TYPE and \
|
||||||
self.adc_result_sample_counter>0:
|
self.adc_result_sample_counter>0:
|
||||||
# fill the ADC_Result with collected data
|
# fill the ADC_Result with collected data
|
||||||
self.result.x=numpy.arange(self.adc_result_sample_counter, dtype="float64")/\
|
self.result.x=numpy.arange(self.adc_result_sample_counter, dtype="float32")/\
|
||||||
self.result.get_sampling_rate()
|
self.result.get_sampling_rate()
|
||||||
self.result.y=[]
|
self.result.y=[]
|
||||||
self.result.index=[]
|
self.result.index=[]
|
||||||
|
|||||||
+4
-2
@@ -644,6 +644,7 @@ Public License instead of this License.
|
|||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkToolButton" id="toolbar_print_button">
|
<object class="GtkToolButton" id="toolbar_print_button">
|
||||||
@@ -654,8 +655,9 @@ Public License instead of this License.
|
|||||||
<packing>
|
<packing>
|
||||||
<property name="homogeneous">True</property>
|
<property name="homogeneous">True</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkSeparatorToolItem" id="toolbutton2">
|
<object class="GtkSeparatorToolItem" id="toolbutton2">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ class ScriptInterface:
|
|||||||
next_dump_time+=dump_interval
|
next_dump_time+=dump_interval
|
||||||
|
|
||||||
if self.exp_handling is not None:
|
if self.exp_handling is not None:
|
||||||
if not self.exp_handling.isAlive():
|
if not self.exp_handling.is_alive():
|
||||||
self.exp_handling.join()
|
self.exp_handling.join()
|
||||||
if self.exp_handling.raised_exception:
|
if self.exp_handling.raised_exception:
|
||||||
print(": experiment script failed at line %d (function %s): %s"%(self.exp_handling.location[0],
|
print(": experiment script failed at line %d (function %s): %s"%(self.exp_handling.location[0],
|
||||||
@@ -81,7 +81,7 @@ class ScriptInterface:
|
|||||||
self.exp_handling = None
|
self.exp_handling = None
|
||||||
|
|
||||||
if self.res_handling is not None:
|
if self.res_handling is not None:
|
||||||
if not self.res_handling.isAlive():
|
if not self.res_handling.is_alive():
|
||||||
self.res_handling.join()
|
self.res_handling.join()
|
||||||
if self.res_handling.raised_exception:
|
if self.res_handling.raised_exception:
|
||||||
print(": result script failed at line %d (function %s): %s"%(self.res_handling.location[0],
|
print(": result script failed at line %d (function %s): %s"%(self.res_handling.location[0],
|
||||||
@@ -92,7 +92,7 @@ class ScriptInterface:
|
|||||||
self.res_handling = None
|
self.res_handling = None
|
||||||
|
|
||||||
if self.back_driver is not None:
|
if self.back_driver is not None:
|
||||||
if not self.back_driver.isAlive():
|
if not self.back_driver.is_alive():
|
||||||
print(": backend finished")
|
print(": backend finished")
|
||||||
self.back_driver=None
|
self.back_driver=None
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ class goniometer:
|
|||||||
|
|
||||||
def _recv(self):
|
def _recv(self):
|
||||||
retstr = self.serial.readline().strip().replace("\x00","")
|
retstr = self.serial.readline().strip().replace("\x00","")
|
||||||
search_result = re.search(r"<(\d+)>", retstr)
|
search_result = re.search("<(\d+)>", retstr)
|
||||||
if search_result != None:
|
if search_result != None:
|
||||||
angle = float(search_result.group(1))/36.0
|
angle = float(search_result.group(1))/36.0
|
||||||
self.current_angle = angle
|
self.current_angle = angle
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
def result():
|
def result():
|
||||||
|
accu = Accumulation(error=False)
|
||||||
for num,ts in enumerate(results):
|
for num,ts in enumerate(results):
|
||||||
|
data["accu"] = accu
|
||||||
data["ts %i"%num] = ts+0
|
data["ts %i"%num] = ts+0
|
||||||
data["fft"] = (ts+0).fft()
|
data["fft"] = (ts+0).fft()
|
||||||
data["ppm"] = (ts+0).fft().ppm(300e6)
|
data["ppm"] = (ts+0).fft().ppm(300e6)
|
||||||
|
accu+=ts
|
||||||
#print ts
|
#print ts
|
||||||
Reference in New Issue
Block a user