* 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:
Markus Rosenstihl
2026-03-09 10:55:55 +01:00
parent 29f003c99e
commit 28e6c9d1a0
10 changed files with 79 additions and 87 deletions
+13 -14
View File
@@ -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!")
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.cont_data = True
@@ -231,8 +231,7 @@ class ADC_Result(Resultable, Drawable, DamarisFFT, Signalpath):
if self.description is not None:
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)
# save interval information
@@ -246,8 +245,8 @@ class ADC_Result(Resultable, Drawable, DamarisFFT, Signalpath):
name="indices",
description={"start": tables.UInt64Col(),
"length": tables.UInt64Col(),
"start_time": tables.Float64Col(),
"dwelltime": tables.Float64Col()},
"start_time": tables.Float32Col(),
"dwelltime": tables.Float32Col()},
title="indices of adc data intervals",
filters=filter,
expectedrows=len(self.index))
@@ -341,7 +340,7 @@ class ADC_Result(Resultable, Drawable, DamarisFFT, Signalpath):
tmp_y = []
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)
self.lock.release()
@@ -362,7 +361,7 @@ class ADC_Result(Resultable, Drawable, DamarisFFT, Signalpath):
tmp_y = []
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)
self.lock.release()
@@ -378,7 +377,7 @@ class ADC_Result(Resultable, Drawable, DamarisFFT, Signalpath):
tmp_y = []
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)
self.lock.release()
@@ -395,7 +394,7 @@ class ADC_Result(Resultable, Drawable, DamarisFFT, Signalpath):
tmp_y = []
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)
self.lock.release()
@@ -415,7 +414,7 @@ class ADC_Result(Resultable, Drawable, DamarisFFT, Signalpath):
tmp_y = []
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)
self.lock.release()
@@ -431,7 +430,7 @@ class ADC_Result(Resultable, Drawable, DamarisFFT, Signalpath):
tmp_y = []
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)
self.lock.release()
@@ -447,7 +446,7 @@ class ADC_Result(Resultable, Drawable, DamarisFFT, Signalpath):
tmp_y = []
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)
self.lock.release()
@@ -517,7 +516,7 @@ def read_from_hdf(hdf_node):
# now do the real data
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]):
adc.y.append(adc_data[:,ch])