tabs/spaces artifacts cleaned

This commit is contained in:
Markus Rosenstihl 2019-01-24 15:51:30 +01:00
parent bda210638e
commit 6ca48e54e5
3 changed files with 19 additions and 31 deletions

View File

@ -23,11 +23,11 @@ class ADC_Result(Resultable, Drawable, DamarisFFT, Signalpath):
def __init__(self, x = None, y = None, index = None, sampl_freq = None, desc = None, job_id = None, job_date = None):
Resultable.__init__(self)
Drawable.__init__(self)
# Title of this accumulation: set Values: Job-ID and Description (plotted in GUI -> look Drawable)
# Is set in ResultReader.py (or in copy-construktor)
self.__title_pattern = "ADC-Result: job_id = %s, desc = %s"
# Axis-Labels (inherited from Drawable)
self.xlabel = "Time (s)"
self.ylabel = "Samples [Digits]"
@ -68,10 +68,10 @@ class ADC_Result(Resultable, Drawable, DamarisFFT, Signalpath):
if self.contains_data():
print "Warning ADC-Result: Tried to run \"create_data_space()\" more than once."
return
if channels <= 0: raise ValueError("ValueError: You cant create an ADC-Result with less than 1 channel!")
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"))
@ -134,13 +134,13 @@ class ADC_Result(Resultable, Drawable, DamarisFFT, Signalpath):
def set_sampling_rate(self, hz):
"Sets the samplingfrequency in hz"
self.sampling_rate = float(hz)
self.sampling_rate = float(hz)
def get_nChannels(self):
"Gets the number of channels"
return self.nChannels + 0
return self.nChannels + 0
def set_nChannels(self, channels):
"Sets the number of channels"
self.nChannels = int(channels)
@ -192,7 +192,7 @@ class ADC_Result(Resultable, Drawable, DamarisFFT, Signalpath):
the_destination=destination
if type(destination) in types.StringTypes:
the_destination=file(destination, "w")
self.lock.acquire()
try:
xdata=self.get_xdata()
@ -211,7 +211,7 @@ class ADC_Result(Resultable, Drawable, DamarisFFT, Signalpath):
the_destination=None
xdata=ydata=None
finally:
self.lock.release()
self.lock.release()
def write_to_hdf(self, hdffile, where, name, title, complib=None, complevel=None):
accu_group=hdffile.create_group(where=where,name=name,title=title)
@ -270,7 +270,7 @@ class ADC_Result(Resultable, Drawable, DamarisFFT, Signalpath):
dtype = "Int32")
for ch in xrange(channel_no):
timedata[:,ch]=self.get_ydata(ch)
# save data
time_slice_data=None
if filter is not None:
@ -399,7 +399,7 @@ class ADC_Result(Resultable, Drawable, DamarisFFT, Signalpath):
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()
else:
raise ValueError("ValueError: Cannot multiply \"%s\" to ADC-Result!") % str(other.__class__)
raise ValueError("ValueError: Cannot multiply \"%s\" to ADC-Result!") % str(other.__class__)
def __rmul__(self, other):
@ -422,7 +422,7 @@ class ADC_Result(Resultable, Drawable, DamarisFFT, Signalpath):
else:
raise ValueError("ValueError: Cannot multiply \"%s\" to ADC-Result!") % str(other.__class__)
def __div__(self, other):
"Redefining self / other (scalar)"
if isinstance(other, types.IntType) or isinstance(other, types.FloatType):
@ -500,7 +500,7 @@ def read_from_hdf(hdf_node):
int(timestring[15:17]), # second
int(timestring[18:21])*1000 # microsecond
)
# start with indices
for r in hdf_node.indices.iterrows():
@ -515,7 +515,7 @@ def read_from_hdf(hdf_node):
adc.cont_data=True
# 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
for ch in xrange(adc_data.shape[1]):

View File

@ -36,7 +36,7 @@ class DataPool(UserDict.DictMixin):
new_key=2
deleted_key=3
destroy=4
def __init__(self, what, subject="", origin=None):
self.what=what
self.subject=subject
@ -128,7 +128,7 @@ class DataPool(UserDict.DictMixin):
dump_dir=dump_file.create_group(dump_dir,
name=dir_part+"_%03d"%extension_count,
title=part)
# convert last part of key to a valid name
group_keyname="dict_"+str(namelist[-1]).translate(DataPool.translation_table)
# avoid double names by adding number extension

View File

@ -62,7 +62,6 @@ class Drawable:
except:
raise
def get_number_of_channels(self):
"Returns the number of channels in y"
return len(self.y)
@ -137,7 +136,7 @@ class Drawable:
def get_xmin(self):
"Returns minimun of x"
"Returns minimun of x"
return self.x.min()
def set_xmin(self, xmin):
@ -179,14 +178,3 @@ class Drawable:
def set_ymax(self, ymax):
"Sets maximum of y"
self.ymax = ymax