diff --git a/config/diffcalc/.nfs000000000035186000000816 b/config/diffcalc/.nfs000000000035186000000816 deleted file mode 100644 index e69de29..0000000 diff --git a/config/settings.properties b/config/settings.properties index 97bffda..9fca859 100644 --- a/config/settings.properties +++ b/config/settings.properties @@ -1,4 +1,4 @@ -#Tue Feb 26 14:41:07 CET 2019 +#Tue Feb 26 14:55:18 CET 2019 count_time=1.0 geometry=fourcv roi=190 45 290 125 diff --git a/script/cpython/image_functions.py b/script/cpython/image_functions.py index 480cd47..3859b67 100644 --- a/script/cpython/image_functions.py +++ b/script/cpython/image_functions.py @@ -3,6 +3,7 @@ import numpy def img_get_int(fname, thres1, thres2, thres3, thres4, header, width, height, depth, x1,y1,x2,y2, bx1,by1,bx2,by2 ): # read actual image file img = numpy.fromfile(fname, dtype=numpy.uint32) + print len(img), height, width img.shape = height, width # signal roi area_I = ( x2 - x1 + 1) * ( y2 - y1 + 1) diff --git a/script/local.py b/script/local.py index cec5993..2d48ce8 100644 --- a/script/local.py +++ b/script/local.py @@ -276,14 +276,13 @@ def is_locked(filepath): """ locked = None file_object = None - if os.path.exists(filepath): + filepath = os.path.abspath(filepath) + if os.path.exists(filepath): try: - print "Trying to open %s." % filepath buffer_size = 8 # Opening file in append mode and read the first 8 characters. file_object = open(filepath, 'a', buffer_size) if file_object: - print "%s is not locked." % filepath locked = False except IOError, message: print "File is locked (unable to open in append mode). %s." % \ @@ -292,7 +291,6 @@ def is_locked(filepath): finally: if file_object: file_object.close() - print "%s closed." % filepath else: print "%s not found." % filepath return locked @@ -303,22 +301,27 @@ def wait_for_files(filepaths): For a file to be ready it must exist and can be opened in append mode. """ - wait_time = 5 + wait_time = 0.01 for filepath in filepaths: + filepath = os.path.abspath(filepath) # If the file doesn't exist, wait wait_time seconds and try again # until it's found. while not os.path.exists(filepath): - print "%s hasn't arrived. Waiting %s seconds." % \ - (filepath, wait_time) time.sleep(wait_time) # If the file exists but locked, wait wait_time seconds and check # again until it's no longer locked by another process. while is_locked(filepath): - print "%s is currently in use. Waiting %s seconds." % \ - (filepath, wait_time) time.sleep(wait_time) +def wait_for_file_size(filepath, size): + wait_time = 0.01 + filepath = os.path.abspath(filepath) + # If the file doesn't exist, wait wait_time seconds and try again + # until it's found. + while not os.path.exists(filepath) and os.path.getsize(filepath) < size: + time.sleep(wait_time) + ################################################################################################### # Configuration