Script execution
This commit is contained in:
+11
-2
@@ -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])
|
||||
|
||||
Reference in New Issue
Block a user