Skip to content

Commit 8e2ceee

Browse files
committed
Merge branch '20-bpm-add-min-max-for-manual-scale-mode' into 'master'
Resolve "bpm add min-max for manual scale mode" Closes esrf-bliss#20 See merge request limagroup/Lima-tango-python!44
2 parents 9667a44 + 4405942 commit 8e2ceee

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

plugins/Bpm.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ def write_return_bpm_profiles(self,attr):
470470
data = attr.get_write_value()
471471
self.return_bpm_profiles = data
472472
#update the property
473-
prop = {'return_bpmpylon/PylonBase.h_profiles': data}
473+
prop = {'return_bpm_profiles': data}
474474
PyTango.Database().put_device_property(self.get_name(), prop)
475475

476476
def is_return_bpm_profiles_allowed(self,mode) :
@@ -659,7 +659,6 @@ def construct_bvdata(bpm):
659659
if not bpm.autoscale:
660660
min_val = bpm.min_max[0]
661661
max_val = bpm.min_max[1]
662-
if max_val == 0: max_val = 1
663662
scale_image = image.buffer.clip(min_val, max_val)
664663

665664
# auto scaling: use natural image intensity
@@ -668,6 +667,7 @@ def construct_bvdata(bpm):
668667
max_val = image.buffer.max()
669668
if max_val == 0: max_val = 1
670669
scale_image = image.buffer
670+
671671

672672
# logarithmic scaling
673673
if bpm.lut_method=="LOG":
@@ -677,9 +677,10 @@ def construct_bvdata(bpm):
677677
scale_image = numpy.log10(scale_image.clip(1, None))
678678
min_val += 1
679679
min_val = numpy.log10(min_val)
680-
max_val = numpy.log10(max_val if max_val > 0 else 1)
680+
max_val = numpy.log10(max_val)
681681

682682
# scale the image to the whole range 16bit before palette transformation for 0 to 65535
683+
if max_val == min_val: max_val+=1
683684
scaling = (2**16 - 1.) / (max_val - min_val)
684685
scale_image = ((scale_image - min_val) * scaling).astype(numpy.uint16)
685686

@@ -701,11 +702,10 @@ def construct_bvdata(bpm):
701702
profile_x = last_proj_x.tobytes()
702703
profile_y = last_proj_y.tobytes()
703704
else:
704-
profile_x = image.buffer[:,bpm.beammark[0]].astype(numpy.uint64)
705-
profile_x = profile_x.tobytes()
706-
profile_y = image.buffer[bpm.beammark[1],:].astype(numpy.uint64)
705+
profile_y = image.buffer[:,bpm.beammark[0]].astype(numpy.uint64)
707706
profile_y = profile_y.tobytes()
708-
707+
profile_x = image.buffer[bpm.beammark[1],:].astype(numpy.uint64)
708+
profile_x = profile_x.tobytes()
709709

710710
bvdata_format='dldddliiiidd%ds%ds%ds' %(len(profile_x),len(profile_y),len(image_jpeg))
711711
bvdata = struct.pack(

0 commit comments

Comments
 (0)