From 813c76e92ca1d2668a367136dad75ab6afec3549 Mon Sep 17 00:00:00 2001 From: Laurent Claustre Date: Tue, 3 Dec 2019 10:06:52 +0100 Subject: [PATCH 1/3] finally return profile along X and along Y as profile_y and profile_x, logic isn't it? --- plugins/Bpm.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/plugins/Bpm.py b/plugins/Bpm.py index 85b9eca..e100d00 100644 --- a/plugins/Bpm.py +++ b/plugins/Bpm.py @@ -701,11 +701,10 @@ def construct_bvdata(bpm): profile_x = last_proj_x.tobytes() profile_y = last_proj_y.tobytes() else: - profile_x = image.buffer[:,bpm.beammark[0]].astype(numpy.uint64) - profile_x = profile_x.tobytes() - profile_y = image.buffer[bpm.beammark[1],:].astype(numpy.uint64) + profile_y = image.buffer[:,bpm.beammark[0]].astype(numpy.uint64) profile_y = profile_y.tobytes() - + profile_x = image.buffer[bpm.beammark[1],:].astype(numpy.uint64) + profile_x = profile_x.tobytes() bvdata_format='dldddliiiidd%ds%ds%ds' %(len(profile_x),len(profile_y),len(image_jpeg)) bvdata = struct.pack( From c7c43aa93f581a4dfad050d4496db270e1265262 Mon Sep 17 00:00:00 2001 From: Laurent Claustre Date: Tue, 3 Dec 2019 10:08:05 +0100 Subject: [PATCH 2/3] hoops, property return_bpm_profiles miss-spelt --- plugins/Bpm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/Bpm.py b/plugins/Bpm.py index e100d00..1fa8ae3 100644 --- a/plugins/Bpm.py +++ b/plugins/Bpm.py @@ -470,7 +470,7 @@ def write_return_bpm_profiles(self,attr): data = attr.get_write_value() self.return_bpm_profiles = data #update the property - prop = {'return_bpmpylon/PylonBase.h_profiles': data} + prop = {'return_bpm_profiles': data} PyTango.Database().put_device_property(self.get_name(), prop) def is_return_bpm_profiles_allowed(self,mode) : From 4405942256ecc704983254bffd7f50e29a3127db Mon Sep 17 00:00:00 2001 From: Laurent Claustre Date: Tue, 3 Dec 2019 10:08:37 +0100 Subject: [PATCH 3/3] fixed valid min/max before scaling --- plugins/Bpm.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/Bpm.py b/plugins/Bpm.py index 1fa8ae3..0798e04 100644 --- a/plugins/Bpm.py +++ b/plugins/Bpm.py @@ -659,7 +659,6 @@ def construct_bvdata(bpm): if not bpm.autoscale: min_val = bpm.min_max[0] max_val = bpm.min_max[1] - if max_val == 0: max_val = 1 scale_image = image.buffer.clip(min_val, max_val) # auto scaling: use natural image intensity @@ -668,6 +667,7 @@ def construct_bvdata(bpm): max_val = image.buffer.max() if max_val == 0: max_val = 1 scale_image = image.buffer + # logarithmic scaling if bpm.lut_method=="LOG": @@ -677,9 +677,10 @@ def construct_bvdata(bpm): scale_image = numpy.log10(scale_image.clip(1, None)) min_val += 1 min_val = numpy.log10(min_val) - max_val = numpy.log10(max_val if max_val > 0 else 1) + max_val = numpy.log10(max_val) # scale the image to the whole range 16bit before palette transformation for 0 to 65535 + if max_val == min_val: max_val+=1 scaling = (2**16 - 1.) / (max_val - min_val) scale_image = ((scale_image - min_val) * scaling).astype(numpy.uint16)