Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timeout when using Merlin #75

Closed
GearoidM opened this issue Jun 13, 2023 · 4 comments · Fixed by #76
Closed

Timeout when using Merlin #75

GearoidM opened this issue Jun 13, 2023 · 4 comments · Fixed by #76

Comments

@GearoidM
Copy link

Hello,

I am getting the following error after running Instamatic on a Merlin detector for a short time ( < 5 minutes).

Exception in thread Thread-2:
Traceback (most recent call last):
File "c:\users\merlin\appdata\local\programs\python\python38\lib\threading.py", line 932, in _bootstrap_inner
self.run()
File "c:\users\merlin\appdata\local\programs\python\python38\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "c:\users\merlin\appdata\local\programs\python\python38\lib\site-packages\instamatic\camera\videostream.py", line 56, in run
frame = self.cam.getImage(exposure=self.frametime, binsize=self.binsize)
File "c:\users\merlin\appdata\local\programs\python\python38\lib\site-packages\instamatic\camera\camera_merlin.py", line 196, in getImage
framedata = self.receive_data(nbytes=self._frame_length)
File "c:\users\merlin\appdata\local\programs\python\python38\lib\site-packages\instamatic\camera\camera_merlin.py", line 86, in receive_data
data.extend(self.s_data.recv(nbytes - len(data)))
socket.timeout: timed out

@stefsmeets
Copy link
Member

Thanks for report! When acquiring data using software trigger, I set Merlin to collect 10k frames:

# Set NUMFRAMESTOACQUIRE to a large number
# Merlin will only collect this number of frames with SOFTTRIGGER
self.merlin_set('NUMFRAMESTOACQUIRE', 10_000)

I think you may be hitting this number, after which Merlin will no longer send frames and the command needs to be refreshed. Changing the exposure time will reset the acquisition, and also the frame counter. Does this sound possible?

@stefsmeets
Copy link
Member

I added a check that tracks the frame number and resets when the number of frames to acquire gets hit. I will test and merge it on Friday.

@GearoidM
Copy link
Author

Yeah, that seems to be what is happening. The timeout occurred at around 8.35 minutes for a 0.05 s exposure time. So that's about 10000 frames. I then tested changing the exposure time and Instamatic did not timeout after this, implying the counter was reset by this action. I think your check should solve this issue, then. Thanks!

@stefsmeets
Copy link
Member

I set the number to the maximum value of 42949672950. This means you can collect for over a year with continuous 1 ms exposures to hit the limit 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants