File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,14 +13,26 @@ def take_raw_exposures(self, num_exposures):
1313 first_frame_id = self .images .newest_available_frame_id
1414
1515 if was_acquiring :
16- # Ignore first to frames to ensure the frames were taken _after_ the
16+ # Ignore first two frames to ensure the frames were taken _after_ the
1717 # call to this function. This is not necessary if the acquisition just
1818 # started.
1919 first_frame_id += 2
2020
2121 try :
22- for i in range (num_exposures ):
23- yield self .images .get_frame (first_frame_id + i , 100000 ).data .copy ()
22+ i = 0
23+ num_exposures_remaining = num_exposures
24+
25+ while num_exposures_remaining >= 1 :
26+ try :
27+ frame = self .images .get_frame (first_frame_id + i , 100000 )
28+ except RuntimeError :
29+ # The frame wasn't available anymore because we were waiting too long.
30+ continue
31+ finally :
32+ i += 1
33+
34+ yield frame .data .copy ()
35+ num_exposures_remaining -= 1
2436 finally :
2537 if not was_acquiring :
2638 self .stop_acquisition ()
You can’t perform that action at this time.
0 commit comments