rx_processor
rx_processor
Parallel processing of RxData objects using a persistent process pool.
Each ADC gate is submitted to the pool directly from the receive card thread while the acquisition
is still running. Raw samples are transferred to the workers via shared memory (see RxData);
each worker runs RxData.process_data (scaling, demodulation, phase correction, decimation).
After the last average, RxProcessor.collect returns the processed objects ordered by index.
RxProcessor
RxProcessor(num_workers: int = 1)
Processes RxData items using a persistent pool of worker processes.
submit() is thread-safe and can be called directly from the rx_card
streaming thread. collect() is called after all averages complete
(by which point every streaming thread has been joined) and waits for
all outstanding futures.
Usage
processor = RxProcessor(num_workers=2) processor.start()
pass processor.submit as submit_fn to rx_card.start_operation()
results = processor.collect(expected_count=N, timeout=T)
Repeat collect() for each subsequent run.
processor.shutdown()
Initialize the rx processor.
Parameters:
-
num_workers(int, default:1) –Number of worker processes in the process pool, by default 1.
Source code in src/console/spcm_control/rx_processor.py
start
Create the process pool and pre-warm all worker processes.
Source code in src/console/spcm_control/rx_processor.py
submit
Submit one RxData item for async processing.
Thread-safe: may be called from any thread, including the rx_card streaming thread.
Source code in src/console/spcm_control/rx_processor.py
collect
Wait for all submitted futures and return results ordered by index.
Parameters:
-
expected_count(int) –Number of RxData items expected in this batch.
-
timeout(float, default:60.0) –Maximum seconds to wait for all futures to complete.
Returns:
-
List of processed RxData objects ordered by global index.–
Source code in src/console/spcm_control/rx_processor.py
shutdown
Shut down the process pool.