Script execution
This commit is contained in:
+19
-16
@@ -7,14 +7,13 @@ class ImageIntensity(DeviceBase, Readable):
|
||||
self.setParent(image)
|
||||
|
||||
def read(self):
|
||||
val = self.getParent().read()
|
||||
setCache(val)
|
||||
if val is None:
|
||||
return None
|
||||
(I_sum, area_I, thresh1_count, thresh2_count, thresh3_count, thresh4_count, I_sum_bgr, area_bgr) = val
|
||||
ret = I_sum
|
||||
if area_bgr > 0:
|
||||
ret = ret - ((I_sum_bgr / area_bgr) * area_I)
|
||||
ret = self.getParent().read()
|
||||
if ret is not None:
|
||||
(I_sum, area_I, thresh1_count, thresh2_count, thresh3_count, thresh4_count, I_sum_bgr, area_bgr) = ret
|
||||
ret = I_sum
|
||||
#if area_bgr > 0:
|
||||
# ret = ret - ((I_sum_bgr / area_bgr) * area_I)
|
||||
self.setCache(ret, None)
|
||||
return ret
|
||||
|
||||
|
||||
@@ -25,12 +24,14 @@ class ImageCorrectedIntensity(DeviceBase, Readable):
|
||||
|
||||
def read(self):
|
||||
ret = self.getParent().intensity.take()
|
||||
if ret is None:
|
||||
return None
|
||||
trans = transm.value
|
||||
if (trans == 0.0) or (count_time==0):
|
||||
return float("nan")
|
||||
return ret / count_time / transm.value
|
||||
if ret is not None:
|
||||
trans = transm.value
|
||||
if (trans == 0.0) or (count_time==0):
|
||||
ret= float("nan")
|
||||
else:
|
||||
ret = ret / count_time / transm.value
|
||||
self.setCache(ret, None)
|
||||
return ret
|
||||
|
||||
|
||||
class Image(DeviceBase, Readable):
|
||||
@@ -43,7 +44,7 @@ class Image(DeviceBase, Readable):
|
||||
self.corrected_intensity = ImageCorrectedIntensity(self)
|
||||
|
||||
|
||||
def get_int(self, threshold1= None, threshold2= None, threshold3= None, threshold4= None, filename = None):
|
||||
def get_int(self, threshold1= None, threshold2= None, threshold3= None, threshold4= None, filename = None):
|
||||
if threshold1 is None:
|
||||
threshold1 = self.pixel.PIX_THRESH1
|
||||
if threshold2 is None:
|
||||
@@ -54,7 +55,9 @@ class Image(DeviceBase, Readable):
|
||||
threshold4 = self.pixel.PIX_THRESH4
|
||||
if filename is None:
|
||||
filename = self.pixel.get_image_filename()
|
||||
tmp_file = self.pixel.image_root_folder + "tmp/spec_image_info.dat"
|
||||
print "Calculating intensity for: ", filename, " - threshold: " , threshold1, threshold2, threshold3, threshold4
|
||||
|
||||
tmp_file = self.pixel.image_root_folder + "tmp/spec_image_info.dat"
|
||||
copyfile(filename, tmp_file)
|
||||
|
||||
ret = img_get_int(tmp_file, threshold1, threshold2, threshold3, threshold4, \
|
||||
|
||||
Reference in New Issue
Block a user