Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions deapi/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ def connect(self, host: str = "127.0.0.1", port: int = 13240, read_only=False):
self._initialize_attributes()
self.update_scan_size()
self.update_image_size()
self.update_feature_hw_binning()
self.virtual_masks = []
for i in range(4):
self.virtual_masks.append(VirtualMask(client=self, index=i))
Expand All @@ -249,6 +250,9 @@ def update_image_size(self):
self.image_sizex = self["Image Size X (pixels)"]
self.image_sizey = self["Image Size Y (pixels)"]

def update_feature_hw_binning(self):
self.feature_hw_binning = self["Feature - Hardware Binning"]

def disconnect(self):
"""
Disconnects from the server.
Expand Down Expand Up @@ -1002,12 +1006,13 @@ def set_binning(self, bin_x, bin_y, use_hw=True):
if commandVersion >= 13:
retval = self.SetProperty("Server Normalize Properties", "Off")

retval &= self.SetProperty(
"Hardware Binning X", 2 if bin_x >= 2 and use_hw else 1
)
retval &= self.SetProperty(
"Hardware Binning Y", 2 if bin_y >= 2 and use_hw else 1
)
if self.feature_hw_binning == "On":
retval &= self.SetProperty(
"Hardware Binning X", 2 if bin_x >= 2 and use_hw else 1
)
retval &= self.SetProperty(
"Hardware Binning Y", 2 if bin_y >= 2 and use_hw else 1
)

prop_hw_bin_x = self.GetProperty("Hardware Binning X")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems we don't need to get the property if feature_hw_binning is "Off"? HW bin is always 1?

prop_hw_bin_y = self.GetProperty("Hardware Binning Y")
Expand Down
Loading