66
77import cuvis
88
9- ### default directories and files
9+ # default directories and files
1010data_dir = None
1111lib_dir = None
1212
3030loc_output = os .path .join (os .getcwd (), "EX07_video" )
3131
3232# parameters
33- loc_exptime = 100 # in ms
33+ loc_exptime = 100 # in ms
3434loc_autoexp = False
3535loc_fps = 2
3636
@@ -51,15 +51,15 @@ def run_example_recordVideoFromSessionFile(userSettingsDir=loc_settings,
5151 print ("loading acquisition context..." )
5252 acquisitionContext = cuvis .AcquisitionContext (session , simulate = True ) #
5353 # using images from session file instead of camera
54- session_info = cuvis .SessionData ("video" ,0 , 0 )
54+ session_info = cuvis .SessionData ("video" , 0 , 0 )
5555 acquisitionContext .session_info = session_info
5656
5757 print ("prepare saving of measurements..." )
5858 saveArgs = cuvis .SaveArgs (export_dir = recDir ,
59- allow_overwrite = True ,
60- allow_session_file = True ,
61- fps = fps ,
62- operation_mode = cuvis .OperationMode .Internal )
59+ allow_overwrite = True ,
60+ allow_session_file = True ,
61+ fps = fps ,
62+ operation_mode = cuvis .OperationMode .Internal )
6363
6464 print ("writing files to: {}" .format (recDir ))
6565 cubeExporter = cuvis .CubeExporter (saveArgs )
@@ -86,22 +86,18 @@ def run_example_recordVideoFromSessionFile(userSettingsDir=loc_settings,
8686
8787 print ("initializing simulated hardware..." )
8888 acquisitionContext .integration_time = exposure
89- acquisitionContext .operation_mode = cuvis .OperationMode .Internal
89+ acquisitionContext .operation_mode = cuvis .OperationMode .Internal
9090 acquisitionContext .fps = fps
9191 acquisitionContext .auto_exp = autoExp
9292 acquisitionContext .set_continuous (True )
9393
9494 print ("configuring worker..." )
95- workerSettings = cuvis .WorkerSettings (keep_out_of_sequence = False ,
96- poll_intervall = 10 ,
97- worker_count = 0 ,
98- hard_limit = 10 ,
99- soft_limit = 10 ,
100- can_drop = True )
95+ workerSettings = cuvis .WorkerSettings ()
10196 worker = cuvis .Worker (workerSettings )
10297 worker .set_acquisition_context (acquisitionContext )
10398 worker .set_processing_context (processingContext )
10499 worker .set_exporter (cubeExporter )
100+ worker .start_processing ()
105101
106102 print ("recording...! (will stop after 2 minutes)" )
107103 start = datetime .now ()
@@ -113,20 +109,23 @@ def run_example_recordVideoFromSessionFile(userSettingsDir=loc_settings,
113109 else :
114110 time .sleep (0.001 )
115111
116- workerContainer = worker .get_next_result ()
112+ workerContainer = worker .get_next_result (0 )
117113 if workerContainer .mesu .data is not None :
118114 print ("current handle index: {}" .format (
119115 workerContainer .mesu .session_info .sequence_number ))
120- if worker .get_queue_limits ()["soft_limit" ] == worker .get_queue_used ():
121- print ("worker queue is full! Main() loop can not keep up!" )
116+
117+ workerState = worker .state
118+ if workerState .resultsInQueue == worker .output_queue_limit :
119+ print ("worker output queue is full! Main() loop can not keep up!" )
122120 break
123- if acquisitionContext .queue_size == acquisitionContext .queue_used :
121+
122+ if workerState .measurementsInQueue == worker .mandatory_queue_limit :
124123 print ("acquisition queue is full! Worker can not keep up!" )
125124 break
126125
127126 print ("acquisition stopped..." )
128127 acquisitionContext .set_continuous (False )
129-
128+ worker . stop_processing ()
130129 cuvis .shutdown ()
131130 print ("finished." )
132131
@@ -167,7 +166,7 @@ def run_example_recordVideoFromSessionFile(userSettingsDir=loc_settings,
167166 fps = int (fps )
168167
169168 run_example_recordVideoFromSessionFile (userSettingsDir , factoryDir , recDir , exposure ,
170- autoExp , fps )
169+ autoExp , fps )
171170
172171 while 1 :
173172 sys .exit (0 )
0 commit comments