Hello,
I run into issues when trying to set ROIs with x and/or y binning using the picam library and a PYLon BR Excelon camera. The trace is the following:
cam = PI.PicamCamera('555555') #With serial number for my camera
cam.set_roi(hstart=0, hend=1340, vstart=0, vend=100, hbin=2, vbin=1)
#(0, 1340, 0, 100, 2, 1)
cam.grab()
PicamLibError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_5820/57262705.py in <module>
----> 1 cam.grab()
~\.conda\envs\pmd_dev\lib\site-packages\pylablib\devices\interface\camera.py in grab(self, nframes, frame_timeout, missing_frame, return_info, buff_size)
524 acq_params=self._get_grab_acquisition_parameters(nframes,buff_size)
525 frames,info=[],[]
--> 526 self.start_acquisition(**acq_params)
527 try:
528 while len(frames)<nframes:
~\.conda\envs\pmd_dev\lib\site-packages\pylablib\devices\PrincetonInstruments\picam.py in start_acquisition(self, *args, **kwargs)
498 self._frame_counter.reset(self._acq_params["nframes"])
499 self._commit_parameters()
--> 500 lib.Picam_StartAcquisition(self.handle)
501 def stop_acquisition(self):
502 if self.acquisition_in_progress():
<string> in <lambda>(camera)
~\.conda\envs\pmd_dev\lib\site-packages\pylablib\core\utils\ctypes_wrap.py in wrapped_func(*vargs, **kwargs)
276 return a
277 call_args=[_to_call_arg(n,t,a) for (n,t,a) in zip(argnames,prep_argtypes,func_args)]
--> 278 retval=func(*call_args)
279 res=self._convert_results(rvals or [None],dict(zip(argnames,func_args)),retval,kwargs,rconv)
280 if (not self.tuple_single_retval) and len(res)==0:
~\.conda\envs\pmd_dev\lib\site-packages\pylablib\devices\PrincetonInstruments\picam_lib.py in errchecker(result, func, arguments)
42 def errchecker(result, func, arguments): # pylint: disable=unused-argument
43 if result not in passing:
---> 44 raise PicamLibError(func.__name__,result,lib=lib)
45 return result
46 return errchecker
PicamLibError: function 'Picam_StartAcquisition' raised error 30(PicamError_InvalidAcquisitionBuffer): Invalid Acquisition Buffer
Interestingly, if I do the following I am able to grab one single frame correctly and then I get a different error.
cam = PI.PicamCamera('555555') #With serial number for my camera
cam.set_roi(hstart=0, hend=1340, vstart=0, vend=100, hbin=2, vbin=1)
#(0, 1340, 0, 100, 2, 1)
cam.start_acquisition()
cam.read_oldest_image()
# array([[ 8642, 8930, 8769, ..., 10725, 10941, 11006],
# [ 9702, 9723, 9791, ..., 11412, 11205, 11122],
# [10224, 10151, 10315, ..., 12148, 11835, 12082],
# ...,
# [59284, 58933, 58707, ..., 64423, 64048, 64103],
# [59473, 59159, 59371, ..., 64822, 65382, 64892],
# [57627, 57855, 57832, ..., 62657, 63563, 62808]], dtype=uint16)
_.shape
(100, 670)
cam.read_oldest_image()
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_4736/680920542.py in <module>
----> 1 cam.read_oldest_image()
~\.conda\envs\pmd_dev\lib\site-packages\pylablib\devices\interface\camera.py in read_oldest_image(self, peek, return_info)
474 If ``return_info==True``, return tuple ``(frame, info)``, where ``info`` is an info tuples (camera-dependent, see :meth:`read_multiple_images`).
475 """
--> 476 rng=self.get_new_images_range()
477 if rng is None or rng[0]==rng[1]:
478 return None
~\.conda\envs\pmd_dev\lib\site-packages\pylablib\devices\interface\camera.py in get_new_images_range(self)
403 If some images were in the buffer were overwritten, exclude them from the range.
404 """
--> 405 acquired_frames=self._get_acquired_frames()
406 if acquired_frames is None:
407 return None
~\.conda\envs\pmd_dev\lib\site-packages\pylablib\devices\PrincetonInstruments\picam.py in _get_acquired_frames(self)
528 break
529 def _get_acquired_frames(self):
--> 530 self._wait_for_acquisition_update(reps=3)
531 return self._waited_frames
532
~\.conda\envs\pmd_dev\lib\site-packages\pylablib\devices\PrincetonInstruments\picam.py in _wait_for_acquisition_update(self, timeout, reps)
521 try:
522 avail,_=lib.Picam_WaitForAcquisitionUpdate(self.handle,timeout)
--> 523 assert avail.initial_readout==ctypes.addressof(self._buffer)+(self._waited_frames%self._buffer_frames)*self._frame_bytes
524 self._waited_frames+=avail.readout_count
525 except PicamLibError as err:
AssertionError:
Any idea why it should be the case?
Hello,
I run into issues when trying to set ROIs with x and/or y binning using the picam library and a PYLon BR Excelon camera. The trace is the following:
Interestingly, if I do the following I am able to grab one single frame correctly and then I get a different error.
Any idea why it should be the case?