Photometrics / PyVCAM

Python3.X wrapper for Photometrics and QImaging PVCAM based cameras
MIT License
36 stars 17 forks source link

Can't get frame after initializing #27

Closed koschie closed 1 year ago

koschie commented 2 years ago

Hi,

I'm having trouble getting a frame after initializing and getting the cam object. I'm just following the installation and lines on the readme page for taking a single frame. I'm not sure what exactly the issue is, the same steps worked on a different computer with the same os (ubuntu), one is intel (worked on) and the other is amd (one having an issue).

Any help would be appreciated.

Edit: i tested it again, and the python module doesn't work on either computer. The linux app that comes with the sdk works, but not the python module

Error message with traceback:


---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
Input In [8], in <cell line: 1>()
----> 1 frame = cam.get_frame(exp_time=10)

File ~/miniconda3/envs/hs_nta_acq/lib/python3.10/site-packages/pyvcam-2.1.5-py3.10-linux-x86_64.egg/pyvcam/camera.py:469, in Camera.get_frame(self, exp_time, timeout_ms)
    461 def get_frame(self, exp_time=None, timeout_ms=WAIT_FOREVER):
    462     """Calls the pvc.get_frame function with the current camera settings.
    463 
    464     Parameter:
   (...)
    467         A 2D np.array containing the pixel data from the captured frame.
    468     """
--> 469     self.start_seq(exp_time=exp_time, num_frames=1)
    470     frame, fps, frame_count = self.poll_frame(timeout_ms=timeout_ms)
    471     self.finish()

File ~/miniconda3/envs/hs_nta_acq/lib/python3.10/site-packages/pyvcam-2.1.5-py3.10-linux-x86_64.egg/pyvcam/camera.py:571, in Camera.start_seq(self, exp_time, num_frames)
    563 def start_seq(self, exp_time=None, num_frames=1):
    564     """Calls the pvc.start_seq function to setup a non-circular buffer acquisition.
    565 
    566     Parameter:
   (...)
    569         None
    570     """
--> 571     self._set_dtype()
    573     if not isinstance(exp_time, int):
    574         exp_time = self.exp_time

File ~/miniconda3/envs/hs_nta_acq/lib/python3.10/site-packages/pyvcam-2.1.5-py3.10-linux-x86_64.egg/pyvcam/camera.py:661, in Camera._set_dtype(self)
    660 def _set_dtype(self):
--> 661     bit_depth = self.bit_depth
    662     bytes_per_pixel = int(np.ceil(bit_depth / 8))
    663     dtypeKind = 'u{}'.format(bytes_per_pixel)

File ~/miniconda3/envs/hs_nta_acq/lib/python3.10/site-packages/pyvcam-2.1.5-py3.10-linux-x86_64.egg/pyvcam/camera.py:751, in Camera.bit_depth(self)
    749 @property
    750 def bit_depth(self):
--> 751     return self.get_param(const.PARAM_BIT_DEPTH)

File ~/miniconda3/envs/hs_nta_acq/lib/python3.10/site-packages/pyvcam-2.1.5-py3.10-linux-x86_64.egg/pyvcam/camera.py:300, in Camera.get_param(self, param_id, param_attr)
    287 def get_param(self, param_id, param_attr=const.ATTR_CURRENT):
    288     """Gets the current value of a specified parameter.
    289 
    290     Parameter(s):
   (...)
    298         Value of specified parameter.
    299     """
--> 300     return pvc.get_param(self.__handle, param_id, param_attr)

RuntimeError: This is not the handle of an open device (PL_ERR_DEVICE_HANDLE_INVALID)```

Here is my system for the record:

`Linux jmerham 5.15.0-46-generic #49-Ubuntu SMP Thu Aug 4 18:03:25 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux`
lwalder commented 2 years ago

Hello, my understanding is that the camera works fine on both computers when used with the provided PVCamTest application but not with the Python wrapper.

Could you please provide the following:

koschie commented 2 years ago

Yes, you are correct.

PVCAM version 3-9-11-2 and we have the Prime BSI Express

lwalder commented 1 year ago

Did you install the pvcam-sdk as well? Was there any error reported during setup.py install? Because the log shows that even the basic PVCAM calls are failing. Seems to me the PyVCAM wasn't correctly installed.

I just tested this on clean Ubuntu 22.04, and this worked fine:

1) Install PVCAM 3.9.11.2 and the SDK 2) Install python3-setuptools, python3-pip 3) pip3 install numpy 4) python3 setup.py install --user 5) python3 tests/seq_mode.py