Public Access
clean up tests and folders
This commit is contained in:
1 parent
c8192ecbb0
commit
5e37c1baa3
12 files changed
+35
-29
No files matched your search
+15
-14
@@ -65,7 +65,7 @@ class Accumulation(Errorable, Drawable, DamarisFFT, Signalpath):
|
|||||||
self.common_descriptions=None
|
self.common_descriptions=None
|
||||||
self.time_period=[]
|
self.time_period=[]
|
||||||
self.job_id = None # this does not make sense for an object accumulated from multiple job_ids
|
self.job_id = None # this does not make sense for an object accumulated from multiple job_ids
|
||||||
self.job_ids = []
|
self.job_ids = {}
|
||||||
|
|
||||||
self.use_error = error
|
self.use_error = error
|
||||||
if self.uses_statistics():
|
if self.uses_statistics():
|
||||||
@@ -498,8 +498,8 @@ class Accumulation(Errorable, Drawable, DamarisFFT, Signalpath):
|
|||||||
expectedrows=len(self.job_ids))
|
expectedrows=len(self.job_ids))
|
||||||
new_row=jobid_table.row
|
new_row=jobid_table.row
|
||||||
for i,job_id in enumerate(self.job_ids):
|
for i,job_id in enumerate(self.job_ids):
|
||||||
|
new_row["job_date"] = self.job_ids[job_id].isoformat(timespec='milliseconds')
|
||||||
new_row["job_id"]=job_id
|
new_row["job_id"]=job_id
|
||||||
new_row["job_date"]="Not Implemented"
|
|
||||||
new_row.append()
|
new_row.append()
|
||||||
jobid_table.flush()
|
jobid_table.flush()
|
||||||
# end save job_ids
|
# end save job_ids
|
||||||
@@ -616,7 +616,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)
|
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="float32"), 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
|
||||||
self.lock.release()
|
self.lock.release()
|
||||||
return r
|
return r
|
||||||
|
|
||||||
@@ -626,7 +626,7 @@ class Accumulation(Errorable, Drawable, DamarisFFT, Signalpath):
|
|||||||
# todo: this is seems to be bugy!!!! (Achim)
|
# todo: this is seems to be bugy!!!! (Achim)
|
||||||
if not other.contains_data():
|
if not other.contains_data():
|
||||||
return
|
return
|
||||||
# Self empty (copy)
|
# Self empty (copy ADC_Result)
|
||||||
if not self.contains_data():
|
if not self.contains_data():
|
||||||
tmp_y = []
|
tmp_y = []
|
||||||
tmp_ysquare = []
|
tmp_ysquare = []
|
||||||
@@ -645,11 +645,11 @@ class Accumulation(Errorable, Drawable, DamarisFFT, Signalpath):
|
|||||||
r.time_period=[other.job_date,other.job_date]
|
r.time_period=[other.job_date,other.job_date]
|
||||||
r.job_id = other.job_id
|
r.job_id = other.job_id
|
||||||
r.common_descriptions=other.description.copy()
|
r.common_descriptions=other.description.copy()
|
||||||
r.job_ids.append(other.job_id)
|
r.job_ids[other.job_id] = other.get_job_date()
|
||||||
self.lock.release()
|
self.lock.release()
|
||||||
return r
|
return r
|
||||||
|
|
||||||
# Other and self not empty (self + other)
|
# Other and self not empty (self + other ADC_Result)
|
||||||
else:
|
else:
|
||||||
self.lock.acquire()
|
self.lock.acquire()
|
||||||
|
|
||||||
@@ -679,7 +679,7 @@ class Accumulation(Errorable, Drawable, DamarisFFT, Signalpath):
|
|||||||
max(self.time_period[1],other.job_date)]
|
max(self.time_period[1],other.job_date)]
|
||||||
r.job_id = other.job_id
|
r.job_id = other.job_id
|
||||||
r.job_ids = self.job_ids
|
r.job_ids = self.job_ids
|
||||||
r.job_ids.append(other.job_id)
|
r.job_ids[other.job_id] = other.get_job_date()
|
||||||
|
|
||||||
if self.common_descriptions is not None:
|
if self.common_descriptions is not None:
|
||||||
r.common_descriptions={}
|
r.common_descriptions={}
|
||||||
@@ -712,11 +712,11 @@ class Accumulation(Errorable, Drawable, DamarisFFT, Signalpath):
|
|||||||
tmp_ysquare.append(other.y_square[i])
|
tmp_ysquare.append(other.y_square[i])
|
||||||
r.time_period=other.time_period[:]
|
r.time_period=other.time_period[:]
|
||||||
r.job_id = other.job_id
|
r.job_id = other.job_id
|
||||||
|
r.job_ids = other.job_ids
|
||||||
if other.common_descriptions is not None:
|
if other.common_descriptions is not None:
|
||||||
r.common_descriptions=other.common_descriptions.copy()
|
r.common_descriptions=other.common_descriptions.copy()
|
||||||
else:
|
else:
|
||||||
r.common_descriptions=None
|
r.common_descriptions=None
|
||||||
|
|
||||||
self.lock.release()
|
self.lock.release()
|
||||||
return r
|
return r
|
||||||
|
|
||||||
@@ -750,7 +750,9 @@ class Accumulation(Errorable, Drawable, DamarisFFT, Signalpath):
|
|||||||
|
|
||||||
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])]
|
||||||
r.job_id = other.job_id # added by Oleg Petrov
|
r.job_id = other.job_id
|
||||||
|
for i in other.job_ids:
|
||||||
|
r.job_ids[i] = other.job_ids[i]
|
||||||
r.common_descriptions={}
|
r.common_descriptions={}
|
||||||
if self.common_descriptions is not None and other.common_descriptions is not None:
|
if self.common_descriptions is not None and other.common_descriptions is not None:
|
||||||
for key in list(self.common_descriptions.keys()):
|
for key in list(self.common_descriptions.keys()):
|
||||||
@@ -817,13 +819,13 @@ class Accumulation(Errorable, Drawable, DamarisFFT, Signalpath):
|
|||||||
|
|
||||||
self.time_period=[other.job_date,other.job_date]
|
self.time_period=[other.job_date,other.job_date]
|
||||||
self.job_id = other.job_id # added by Oleg Petrov
|
self.job_id = other.job_id # added by Oleg Petrov
|
||||||
self.job_ids.append(other.job_id)
|
self.job_ids[other.job_id] = other.get_job_date()
|
||||||
self.common_descriptions=other.description.copy()
|
self.common_descriptions=other.description.copy()
|
||||||
|
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
|
||||||
# Other and self not empty (self + other)
|
# Other and self not empty (self + other/ADC_Result)
|
||||||
else:
|
else:
|
||||||
self.lock.acquire()
|
self.lock.acquire()
|
||||||
|
|
||||||
@@ -847,15 +849,14 @@ class Accumulation(Errorable, Drawable, DamarisFFT, Signalpath):
|
|||||||
max(self.time_period[1],other.job_date)]
|
max(self.time_period[1],other.job_date)]
|
||||||
|
|
||||||
self.job_id = other.job_id
|
self.job_id = other.job_id
|
||||||
self.job_ids.append(other.job_id)
|
|
||||||
|
self.job_ids[other.job_id] = other.get_job_date()
|
||||||
if self.common_descriptions is not None:
|
if self.common_descriptions is not None:
|
||||||
for key in list(self.common_descriptions.keys()):
|
for key in list(self.common_descriptions.keys()):
|
||||||
if not (key in other.description and self.common_descriptions[key]==other.description[key]):
|
if not (key in other.description and self.common_descriptions[key]==other.description[key]):
|
||||||
del self.common_descriptions[key]
|
del self.common_descriptions[key]
|
||||||
|
|
||||||
self.set_title(self.__title_pattern % self.n)
|
self.set_title(self.__title_pattern % self.n)
|
||||||
self.lock.release()
|
self.lock.release()
|
||||||
|
|
||||||
return self
|
return self
|
||||||
|
|
||||||
# Accumulation
|
# Accumulation
|
||||||
|
|||||||
@@ -905,9 +905,12 @@ class DamarisGUI:
|
|||||||
last_end = logtextbuffer.get_mark( "lastdumped" )
|
last_end = logtextbuffer.get_mark( "lastdumped" )
|
||||||
if last_end is None:
|
if last_end is None:
|
||||||
last_end = logtextbuffer.create_mark( "lastdumped", logtextbuffer.get_start_iter( ), left_gravity=True )
|
last_end = logtextbuffer.create_mark( "lastdumped", logtextbuffer.get_start_iter( ), left_gravity=True )
|
||||||
logtext_start = logtextbuffer.get_iter_at_mark( last_end )
|
#logtext_start = logtextbuffer.get_iter_at_mark( last_end )
|
||||||
logtext_end = logtextbuffer.get_end_iter( )
|
logtext_end = logtextbuffer.get_end_iter( )
|
||||||
logtextbuffer.move_mark( last_end, logtext_end )
|
logtextbuffer.move_mark( last_end, logtext_end )
|
||||||
|
# Create new iterators after the mark move
|
||||||
|
logtext_start = logtextbuffer.get_iter_at_mark( last_end )
|
||||||
|
logtext_end = logtextbuffer.get_end_iter( )
|
||||||
# recode from unicode
|
# recode from unicode
|
||||||
logtext = logtextbuffer.get_text( logtext_start, logtext_end, True )
|
logtext = logtextbuffer.get_text( logtext_start, logtext_end, True )
|
||||||
# avoid circular references (seems to be necessary with gtk-2.12)
|
# avoid circular references (seems to be necessary with gtk-2.12)
|
||||||
|
|||||||
+16
-14
@@ -56,11 +56,14 @@ class ResultReader:
|
|||||||
yield self.get_result_object(expected_filename)
|
yield self.get_result_object(expected_filename)
|
||||||
# purge result file
|
# purge result file
|
||||||
if self.clear_results:
|
if self.clear_results:
|
||||||
if os.path.isfile(expected_filename): os.remove(expected_filename)
|
if os.path.isfile(expected_filename):
|
||||||
|
os.remove(expected_filename)
|
||||||
if self.clear_jobs:
|
if self.clear_jobs:
|
||||||
if os.path.isfile(expected_filename[:-7]): os.remove(expected_filename[:-7])
|
# job_name.result -> job_name
|
||||||
|
if os.path.isfile(expected_filename[:-7]):
|
||||||
|
os.remove(expected_filename[:-7])
|
||||||
self.no+=1
|
self.no+=1
|
||||||
expected_filename=os.path.join(self.spool_dir,self.result_pattern%(self.no))
|
expected_filename=os.path.join(self.spool_dir, self.result_pattern % self.no)
|
||||||
return
|
return
|
||||||
|
|
||||||
def get_result_object(self, in_filename):
|
def get_result_object(self, in_filename):
|
||||||
@@ -80,8 +83,10 @@ class ResultReader:
|
|||||||
time.sleep(0.05)
|
time.sleep(0.05)
|
||||||
retries+=1
|
retries+=1
|
||||||
|
|
||||||
# get date of last modification
|
# get date of last modification
|
||||||
self.result_job_date = datetime.fromtimestamp(os.stat(in_filename)[8])
|
stat_result = os.stat(in_filename)
|
||||||
|
mtime = stat_result.st_mtime
|
||||||
|
self.result_job_date = datetime.fromtimestamp(mtime)
|
||||||
if ELEMENT_TREE:
|
if ELEMENT_TREE:
|
||||||
self.__parseFile = self.__parseFile_cETree
|
self.__parseFile = self.__parseFile_cETree
|
||||||
else:
|
else:
|
||||||
@@ -155,7 +160,7 @@ class ResultReader:
|
|||||||
self.result.set_nChannels(int(elem.get("channels")))
|
self.result.set_nChannels(int(elem.get("channels")))
|
||||||
|
|
||||||
self.result.set_description_dictionary(self.result_description.copy())
|
self.result.set_description_dictionary(self.result_description.copy())
|
||||||
title = "ADC-Result: job-id=%d"%int(self.result_job_number)
|
title = "ADC_Result: job-id=%d"%int(self.result_job_number)
|
||||||
if len(self.result_description) > 0:
|
if len(self.result_description) > 0:
|
||||||
for k,v in self.result_description.items():
|
for k,v in self.result_description.items():
|
||||||
title += ", %s=%s"%(k,v)
|
title += ", %s=%s"%(k,v)
|
||||||
@@ -166,22 +171,19 @@ class ResultReader:
|
|||||||
else:
|
else:
|
||||||
if float(elem.get("rate")) != self.result.get_sampling_rate():
|
if float(elem.get("rate")) != self.result.get_sampling_rate():
|
||||||
print("sample rate different in ADC_Result, found %f, former value %f"%\
|
print("sample rate different in ADC_Result, found %f, former value %f"%\
|
||||||
(float(in_attribute["rate"]),self.result.get_sampling_rate()))
|
(float(elem.get("rate")),self.result.get_sampling_rate()))
|
||||||
new_samples = int(elem.get("samples"))
|
new_samples = int(elem.get("samples"))
|
||||||
self.adc_result_sample_counter += new_samples
|
self.adc_result_sample_counter += new_samples
|
||||||
|
|
||||||
|
# extract adcdata (here base64 encoded)
|
||||||
self.adc_result_trailing_chars = "".join(elem.text.splitlines())
|
self.adc_result_trailing_chars = "".join(elem.text.splitlines())
|
||||||
tmp_string = base64.standard_b64decode(self.adc_result_trailing_chars)
|
tmp_string = base64.standard_b64decode(self.adc_result_trailing_chars)
|
||||||
self.adc_result_trailing_chars = None
|
|
||||||
tmp = numpy.fromstring(tmp_string,dtype='int16')
|
tmp = numpy.fromstring(tmp_string, dtype='int16')
|
||||||
tmp_string = None
|
|
||||||
self.adc_result_parts.append(tmp)
|
self.adc_result_parts.append(tmp)
|
||||||
tmp = None
|
|
||||||
# we do not need this adcdata anymore, delete it
|
# we do not need this adcdata anymore, delete it
|
||||||
elem.clear()
|
elem.clear()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
elif elem.tag == 'error':
|
elif elem.tag == 'error':
|
||||||
self.__filetype = ResultReader.ERROR_TYPE
|
self.__filetype = ResultReader.ERROR_TYPE
|
||||||
|
|
||||||
|
|||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Reference in new issue
Block a user