Script execution

This commit is contained in:
gac-x04sa
2019-02-26 14:55:15 +01:00
parent 2fd6cf3b5d
commit 7344318aaf
+11 -2
View File
@@ -104,6 +104,14 @@ def wait_for_files(filepaths):
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)
class Image(DeviceBase, Readable):
def __init__(self, name, pixel):
@@ -124,7 +132,8 @@ class Image(DeviceBase, Readable):
filename = self.pixel.get_image_filename()
print "Waiting image file: " + filename
wait_for_files([filename])
size = 4 * self.pixel.PIX_XDIM, self.pixel.PIX_YDIM
wait_for_file_size(filename, size)
threshold1 = self.pixel.threshold1
@@ -139,7 +148,7 @@ class Image(DeviceBase, Readable):
tmp_file = self.pixel.image_root_folder + "tmp/spec_image_info.dat"
copyfile(filename, tmp_file)
try:
try:
ret = img_get_int(tmp_file, threshold1, threshold2, threshold3, threshold4, \
self.pixel.image_header_length, self.pixel.PIX_XDIM, self.pixel.PIX_YDIM,self.pixel.PIX_COLOR_DEPTH, \
roi[0], roi[1], roi[2], roi[3], bkroi[0], bkroi[1], bkroi[2], bkroi[3])