Closedown

This commit is contained in:
gac-x04sa
2018-10-31 15:52:09 +01:00
parent 9d4d5c8410
commit debb48e97b
4 changed files with 31 additions and 102 deletions

View File

@@ -55,8 +55,8 @@ class Image(DeviceBase, Readable):
def __init__(self, name, pixel):
DeviceBase.__init__(self, name)
self.pixel = pixel
self.roi = [0,0, self.pixel.PIX_XDIM-1, self.pixel.PIX_YDIM]
self.broi = [0,0, self.pixel.PIX_XDIM-1, self.pixel.PIX_YDIM]
self.roi = [0,0, self.pixel.PIX_XDIM-1, self.pixel.PIX_YDIM-1]
self.broi = [0,0, self.pixel.PIX_XDIM-1, self.pixel.PIX_YDIM-1]
self.intensity = ImageIntensity(self)
self.matrix = ImageMatrix(self)
self.corrected_intensity = ImageCorrectedIntensity(self)
@@ -76,6 +76,9 @@ class Image(DeviceBase, Readable):
if filename is None:
filename = self.pixel.get_image_filename()
print "Calculating intensity for: " + filename + " - threshold: " + str((threshold1, threshold2, threshold3, threshold4))
roi = get_roi()
bkroi = get_bg_roi()
tmp_file = self.pixel.image_root_folder + "tmp/spec_image_info.dat"
copyfile(filename, tmp_file)
@@ -83,7 +86,7 @@ class Image(DeviceBase, Readable):
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, \
self.roi[0], self.roi[1], self.roi[2], self.roi[3], self.broi[0], self.broi[1], self.broi[2], self.broi[3])
roi[0], roi[1], roi[2], roi[3], bkroi[0], bkroi[1], bkroi[2], bkroi[3])
except:
log("Error calculating intensity: " + str(filename) + " - " + str(sys.exc_info()[1]), False)
ret = None

View File

@@ -234,13 +234,11 @@ class Pixel(DeviceBase, Readable, Readable.IntegerType):
if os.path.isfile(filename):
break
if (time.time() - start) > file_timeout:
raise Exception("Timeout waiting for file: " + filename)
#raise Exception("Timeout waiting for file: " + filename)
print "Timeout waiting for file: " + filename
break
time.sleep (0.05)
def set_roi():
#TODO
pass
def set_auto_threshold(self):
#TODO
pass

View File

@@ -1,88 +0,0 @@
run("diffutils")
###################################################################################################\
#Setup
###################################################################################################
#alpha, delta, gamma, omegaV
setup_diff(fourcv, energy, ("mu", "delta", "gam", "eta"))
print_axis_setup()
setup_axis(alpha, alpha.getMinValue(), alpha.getMaxValue())
setup_axis(delta, delta.getMinValue(), 90) #delta.getMaxValue())
setup_axis(gamma, 0, gamma.getMaxValue())
setup_axis(omegaV, omegaV.getMinValue(), omegaV.getMaxValue())
if energy.isSimulated():
wavelength.write(1.305)
###################################################################################################\
#Orientation
###################################################################################################
#help(ub.ub)
ub.listub()
#alpha delta gamma omegaV
ub.newub('test')
ub.setub([[0.81374,0.02138,0.00228], [-0.02199,0.81543,0.00123], [0.00784,-0.00100,0.81347]])
"""
ub.setlat('cubic', 7.723, 7.707, 7.723, 90.0, 89.265, 90.0)
en = 9.5
#ub.addref([0, 0, 2], [9.78, 9.749, 19.586, 93.1159], en)
#"mu", "delta", "gam", "eta"
ub.addref([0, 1, 2], [9.728, 9.749, 19.586, 93.1159], en)
ub.addref([2, 2, 2], [9.605, 27.7, 20.932, 57.725], en)
ub.addref([2, 0, 2], [9.602, 19.499, 20.262, 8.669], en)
"""
#ub.ub()
#ub.trialub()
#ub.calcub()
ub.checkub()
###################################################################################################\
#Constraints
###################################################################################################
hkl.con('a_eq_b')
print hkl_to_angles(2, 0, 2)
"""
# H K L ov alp del gam nu dev'n
- - - - --- --- --- --- --- -----
1 0.0000 1.0000 2.0000 93.1159 9.7280 9.7490 19.5860 0.0000
0.0000 1.0000 2.0000 93.1295 9.7212 9.7488 19.5860 0.0000 0.0000
------------------------------------------------
2 2.0000 2.0000 2.0000 57.7252 9.6050 27.7006 20.9322 0.0000
2.0000 2.0000 2.0000 57.5840 9.8097 27.7194 20.9065 0.0000 0.0000
------------------------------------------------
3 2.0000 0.0000 2.0000 8.6687 9.6023 19.4996 20.2618 0.0000
2.0000 0.0000 2.0000 8.4510 9.8217 19.5132 20.2488 0.0000 0.0000
------------------------------------------------
Orientation Matrix by Row:
Row 1: 0.81374 0.02138 0.00228
Row 2: -0.02199 0.81543 0.00123
Row 3: 0.00784 -0.00100 0.81347
1874.X04V> wh
H K L = 2 0 2
BetaIn = 9.8218 BetaOut = 9.8218
Lambda = 1.305
omegaV alpha delta gamma nu
8.6687 9.6022 19.4996 20.2617 0.0000
"""

View File

@@ -104,19 +104,35 @@ def is_geometry_set():
return get_device("wavelength") is not None
def get_roi():
"""
"""
"""
"""
setting = get_setting(ROI_PREFERENCE)
try:
t = setting.strip().split(" ")
return (int(t[0]), int(t[1]), int(t[2]), int(t[3]))
except:
return (1,1, self.pixel.PIX_XDIM-1, self.pixel.PIX_YDIM-1)
return (1, 1, pixel.PIX_XDIM-1, pixel.PIX_YDIM-1)
def set_roi(x1, y1, x2, y2):
"""
"""
set_setting(ROI_PREFERENCE, str(int(x1)) + " " + str(int(x2)) + " " + str(int(x3)) + " " + str(int(x4)) )
"""
"""
set_setting(ROI_PREFERENCE, str(int(x1)) + " " + str(int(y1)) + " " + str(int(x2)) + " " + str(int(y2)) )
def get_bg_roi():
"""
"""
setting = get_setting(BG_ROI_PREFERENCE)
try:
t = setting.strip().split(" ")
return (int(t[0]), int(t[1]), int(t[2]), int(t[3]))
except:
return (1, 1, pixel.PIX_XDIM-1, pixel.PIX_YDIM-1)
def set_bg_roi(x1, y1, x2, y2):
"""
"""
set_setting(BG_ROI_PREFERENCE, str(int(x1)) + " " + str(int(y1)) + " " + str(int(x2)) + " " + str(int(y2)) )
###################################################################################################