Photometrics / PyVCAM

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

Read speed is lower than expected #21

Closed fabinjoe closed 3 years ago

fabinjoe commented 3 years ago

I am using a Retiga Electro Camera to obtain a live data stream. I have been using the PyVCAM to obtain the data from the camera. The camera is connected through an USB3.0 port. The camera claims to obtain the output at 25fps. However, I wrote the following snippet of code to obtain the time taken to read a frame from get_frame() function.

cam.open()
cam.start_live(exp_time=20)

for i in range(100):
    t0 = time()
    frame = cam.get_frame()
    print( time() - t0 )

From running the code, I have observed that it takes more than 120ms to read a frame(as plotted below). This gives us an average output frame-rate of 8.33 (which is much lower than the expected value).
Additionally using cam.readout_time gives an output which is an order of magnitude less than what we obtained(about 12ms).

screenshot

I was wondering if this is expected from using the PyVCAM module, and whether there are methods to optimize the read speed performance.

stevebellinger commented 3 years ago

Can you please repeat the frame rate test using poll_frame rather than get_frame?

See tests/live_mode.py for an example.

fabinjoe commented 3 years ago

Thank you so much for the reply, this method did improve the speed. Now we are receiving an output similar to that of the camera specifications.