Skip to content

Changing the ROI of cameras with one pixel row #120

Description

@T-Funk

When trying to change the ROI of a camera such as PyLoN-IR with 1x1024 pixels the input check throws an error due to taking the modulo by 0. This is because the check expects the minimum to be divisible by pstep which is defined as zero by the camera.

The ROI limits of the camera are (retrieved using get_roi_limits):
(TAxisROILimit(min=4, max=1024, pstep=4, sstep=4, maxbin=1), TAxisROILimit(min=1, max=1, pstep=0, sstep=0, maxbin=1))

And the traceback of the error:
Traceback (most recent call last):
line 57, in init_cam
self.cam.set_roi(hstart=4, hend=1000, hbin=1)
line 715, in wrapped
return func(self,*args,**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "\Lib\site-packages\pylablib\devices\PrincetonInstruments\picam.py", line 484, in set_roi
vstart,vend,_=self._truncate_roi_axis((vstart,vend,vbin),vlim)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "\Lib\site-packages\pylablib\devices\interface\camera.py", line 1351, in _truncate_roi_axis
return truncate_roi_axis(roi,lim,symmetric=symmetric)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "\Lib\site-packages\pylablib\devices\interface\camera.py", line 1256, in truncate_roi_axis
_validate_roi_limit(lim,symmetric=symmetric)
File "\Lib\site-packages\pylablib\devices\interface\camera.py", line 1233, in _validate_roi_limit
if smin%pstep:
~~~~^~~~~~
ZeroDivisionError: integer modulo by zero

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions