Show message if ADC_Data is clipped (solves #16)
This commit is contained in:
@@ -61,6 +61,7 @@ class Accumulation(Errorable, Drawable, DamarisFFT, Signalpath):
|
||||
self.xlabel = "Time / s"
|
||||
self.ylabel = "Avg. Samples [Digits]"
|
||||
self.lock=threading.RLock()
|
||||
self.is_clipped = False
|
||||
|
||||
self.common_descriptions=None
|
||||
self.time_period=[]
|
||||
@@ -616,6 +617,7 @@ class Accumulation(Errorable, Drawable, DamarisFFT, Signalpath):
|
||||
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:
|
||||
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.is_clipped = self.is_clipped
|
||||
r.job_id = self.job_id
|
||||
r.job_ids = self.job_ids.copy()
|
||||
r.time_period = self.time_period[:] if self.time_period is not None else None
|
||||
@@ -645,6 +647,8 @@ class Accumulation(Errorable, Drawable, DamarisFFT, Signalpath):
|
||||
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:
|
||||
r = Accumulation(x = numpy.array(other.x, dtype="float32"), y = tmp_y, index = other.index, sampl_freq = other.sampling_rate, n = 1, error = False)
|
||||
if hasattr(other, "is_clipped"):
|
||||
r.is_clipped = other.is_clipped
|
||||
r.time_period=[other.job_date,other.job_date]
|
||||
r.job_id = other.job_id
|
||||
r.common_descriptions=other.description.copy()
|
||||
@@ -678,6 +682,7 @@ class Accumulation(Errorable, Drawable, DamarisFFT, Signalpath):
|
||||
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:
|
||||
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.is_clipped = self.is_clipped or (hasattr(other, "is_clipped") and other.is_clipped)
|
||||
r.time_period=[min(self.time_period[0],other.job_date),
|
||||
max(self.time_period[1],other.job_date)]
|
||||
r.job_id = other.job_id
|
||||
@@ -744,13 +749,14 @@ class Accumulation(Errorable, Drawable, DamarisFFT, Signalpath):
|
||||
|
||||
for i in range(self.get_number_of_channels()):
|
||||
tmp_y.append(self.y[i] + other.y[i])
|
||||
tmp_ysquare.append(self.y_square[i] + other.y_square[i])
|
||||
if self.uses_statistics():
|
||||
tmp_ysquare.append(self.y_square[i] + other.y_square[i])
|
||||
|
||||
if self.uses_statistics():
|
||||
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:
|
||||
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.is_clipped = self.is_clipped or (hasattr(other, "is_clipped") and other.is_clipped)
|
||||
r.time_period=[min(self.time_period[0],other.time_period[0]),
|
||||
max(self.time_period[1],other.time_period[1])]
|
||||
r.job_id = other.job_id
|
||||
@@ -954,6 +960,8 @@ class Accumulation(Errorable, Drawable, DamarisFFT, Signalpath):
|
||||
self.set_title(self.__title_pattern % self.n)
|
||||
self.lock.release()
|
||||
|
||||
if hasattr(other, "is_clipped"):
|
||||
self.is_clipped = other.is_clipped
|
||||
self.time_period=[other.job_date,other.job_date]
|
||||
self.job_id = other.job_id # added by Oleg Petrov
|
||||
self.job_ids[other.job_id] = other.get_job_date()
|
||||
@@ -982,6 +990,8 @@ class Accumulation(Errorable, Drawable, DamarisFFT, Signalpath):
|
||||
self.y_square[i] += numpy.array(other.y[i], dtype="float32") ** 2
|
||||
|
||||
self.n += 1
|
||||
if hasattr(other, "is_clipped"):
|
||||
self.is_clipped = self.is_clipped or other.is_clipped
|
||||
self.time_period=[min(self.time_period[0],other.job_date),
|
||||
max(self.time_period[1],other.job_date)]
|
||||
|
||||
@@ -1020,6 +1030,8 @@ class Accumulation(Errorable, Drawable, DamarisFFT, Signalpath):
|
||||
self.y_square.append(self.y[i] ** 2)
|
||||
|
||||
self.set_title(self.__title_pattern % self.n)
|
||||
if hasattr(other, "is_clipped"):
|
||||
self.is_clipped = other.is_clipped
|
||||
self.common_descriptions=other.common_desriptions.copy()
|
||||
self.time_period=other.time_period[:]
|
||||
self.job_id = other.job_id # added by Oleg Petrov
|
||||
@@ -1049,6 +1061,8 @@ class Accumulation(Errorable, Drawable, DamarisFFT, Signalpath):
|
||||
self.y_square[i] += other.y_square[i]
|
||||
|
||||
self.n += other.n
|
||||
if hasattr(other, "is_clipped"):
|
||||
self.is_clipped = self.is_clipped or other.is_clipped
|
||||
self.time_period=[min(self.time_period[0],other.time_period[0]),
|
||||
max(self.time_period[1],other.time_period[1])]
|
||||
self.job_id = other.job_id
|
||||
|
||||
Reference in New Issue
Block a user