Closedown
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import numpy
|
||||
|
||||
def img_get_int(fname, thres1, thres2, thres3, thres4, header, width, height, depth, x1,y1,x2,y2, bx1,by1,bx2,by2 ):
|
||||
def img_get_int(fname, thres1, thres2, thres3, thres4, header, width, height, depth, x1,y1,x2,y2, bx1,by1,bx2,by2 , filter_median = False, filter_nsigma = 0):
|
||||
# read actual image file
|
||||
img = numpy.fromfile(fname, dtype=numpy.uint32)
|
||||
img.shape = height, width
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from jeputils import *
|
||||
|
||||
def img_get_int(fname, thres1, thres2, thres3, thres4, header, width, height, depth, x1,y1,x2,y2, bx1,by1,bx2,by2 ):
|
||||
ret = call_jep("cpython/image_functions", "img_get_int", [fname, thres1, thres2, thres3, thres4, header, width, height, depth, x1,y1,x2,y2, bx1,by1,bx2,by2])
|
||||
def img_get_int(fname, thres1, thres2, thres3, thres4, header, width, height, depth, x1,y1,x2,y2, bx1,by1,bx2,by2 , filter_median = False, filter_nsigma = 0)):
|
||||
ret = call_jep("cpython/image_functions", "img_get_int", [fname, thres1, thres2, thres3, thres4, header, width, height, depth, x1,y1,x2,y2, bx1,by1,bx2,by2, filter_median, filter_nsigma)])
|
||||
#return ret
|
||||
#TODO: Why I_sum ans I_sum_bgr are strings?
|
||||
(I_sum, area_I, thresh1_count, thresh2_count, thresh3_count, thresh4_count, I_sum_bgr, area_bgr) = ret
|
||||
|
||||
+96
-2
@@ -272,8 +272,8 @@ def get_diag_channels():
|
||||
return diag_channels
|
||||
|
||||
def get_diag_name(diag):
|
||||
return ch.psi.utils.Str.toTitleCase(diag.getName()).replace(" ", "")
|
||||
|
||||
return ch.psi.utils.Str.toTitleCase(diag if is_string(diag) else diag.getName()).replace(" ", "")
|
||||
|
||||
def print_diag():
|
||||
for f in get_diag_channels():
|
||||
print "%-25s %s" % (get_diag_name(f) , str(f.read()))
|
||||
@@ -378,6 +378,100 @@ def wait_for_file_size(filepath, size, timeout = None):
|
||||
time.sleep(wait_time)
|
||||
|
||||
|
||||
###################################################################################################
|
||||
# Scan commands
|
||||
###################################################################################################
|
||||
|
||||
def relscan(motor, start, end, number_of_steps, count_time):
|
||||
"""
|
||||
Relative scan
|
||||
"""
|
||||
set_count_time(count_time)
|
||||
detectors = [mythen, mythen.acquire_time, pixel, pixel.image_filename, image.intensity,image.corrected_intensity, image.matrix]
|
||||
#TODO: Set based on experiment context
|
||||
pixel.set_path("../../expdata/bml_20190703/pixel/", "images")
|
||||
#TODO: should be set automatically
|
||||
set_roi(173,88,285,136)
|
||||
show_panel(detector_image)
|
||||
pixel.show()
|
||||
pixel.assert_ready()
|
||||
return lscan (motor, detectors, start, end, int(number_of_steps), relative=True, before_read=before_sample, after_read=after_sample)
|
||||
|
||||
def absscan(motor, start, end, number_of_steps, count_time):
|
||||
"""
|
||||
Absolute scan
|
||||
"""
|
||||
set_count_time(count_time)
|
||||
detectors = [mythen, mythen.acquire_time, pixel, pixel.image_filename, image.intensity,image.corrected_intensity, image.matrix]
|
||||
#TODO: Set based on experiment context
|
||||
pixel.set_path("../../expdata/bml_20190703/pixel/", "images")
|
||||
#TODO: should be set automatically
|
||||
set_roi(173,88,285,136)
|
||||
show_panel(detector_image)
|
||||
pixel.show()
|
||||
pixel.assert_ready()
|
||||
return lscan (motor, detectors, start, end, int(number_of_steps), relative=False, before_read=before_sample, after_read=after_sample)
|
||||
|
||||
def abs2scan(motor1, start1, end1, motor2, start2, end2, number_of_steps, count_time):
|
||||
"""
|
||||
Absolute scan of 2 motors
|
||||
"""
|
||||
set_count_time(count_time)
|
||||
detectors = [mythen, mythen.acquire_time, pixel, pixel.image_filename, image.intensity,image.corrected_intensity, image.matrix]
|
||||
#TODO: Set based on experiment context
|
||||
pixel.set_path("../../expdata/bml_20190703/pixel/", "images")
|
||||
#TODO: should be set automatically
|
||||
set_roi(173,88,285,136)
|
||||
show_panel(detector_image)
|
||||
pixel.show()
|
||||
pixel.assert_ready()
|
||||
return lscan ([motor1, motor2], detectors, [start1, start2], [end1, end2], int(number_of_steps), relative=False, before_read=before_sample, after_read=after_sample)
|
||||
|
||||
def hrodscan(start, end, number_of_steps, count_time):
|
||||
"""
|
||||
Scan on l
|
||||
"""
|
||||
return absscan (h, start, end, number_of_steps, count_time)
|
||||
|
||||
def krodscan(start, end, number_of_steps, count_time):
|
||||
"""
|
||||
Scan on k
|
||||
"""
|
||||
return absscan (k, start, end, number_of_steps, count_time)
|
||||
|
||||
def lrodscan(start, end, number_of_steps, count_time):
|
||||
"""
|
||||
Scan on l
|
||||
"""
|
||||
return absscan (l, start, end, number_of_steps, count_time)
|
||||
|
||||
|
||||
def hkllinscan(hstart, hfinish, kstart, kfinish, lstart, lfinish, number_of_steps, count_time):
|
||||
"""
|
||||
Linear scan on hkl
|
||||
"""
|
||||
vector = []
|
||||
hs = float(hfinish - hstart)/number_of_steps
|
||||
ks = float(kfinish - kstart)/number_of_steps
|
||||
ls = float(lfinish - lstart)/number_of_steps
|
||||
for i in range(number_of_steps+1):
|
||||
hp = hstart + i * hs
|
||||
kp = kstart + i * ks
|
||||
lp = lstart + i * ls
|
||||
vector.append([hp, kp, lp] )
|
||||
|
||||
set_count_time(count_time)
|
||||
detectors = [mythen, mythen.acquire_time, pixel, pixel.image_filename, image.intensity,image.corrected_intensity, image.matrix]
|
||||
#TODO: Set based on experiment context
|
||||
pixel.set_path("../../expdata/bml_20190703/pixel/", "images")
|
||||
#TODO: should be set automatically
|
||||
set_roi(173,88,285,136)
|
||||
show_panel(detector_image)
|
||||
pixel.show()
|
||||
pixel.assert_ready()
|
||||
return hklscan(vector, detectors,latency = 0.0, before_read=before_sample, after_read=after_sample)
|
||||
|
||||
|
||||
|
||||
###################################################################################################
|
||||
# Configuration
|
||||
|
||||
@@ -297,4 +297,3 @@ def auto_after_sample(rec, scan):
|
||||
else:
|
||||
RETRY_COUNT = 0
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user