processors#
Real-time, per-frame processors for camera DataProducers.
A FrameProcessor subscribes to a camera’s signals.frame,
runs compute(img, idx, ts) on a daemon worker thread, and emits the
result on both signals.data (for the DataQueue / CSV logger) and a
Qt-compatible valueUpdated(time, value) signal (for the existing
SerialWidget plotter).
- class mesofield.processors.FrameProcessor[source]#
Bases:
objectBase class for per-frame, real-time processors.
Acquisition stays on the camera thread;
computeruns on a daemon worker thread fed by a bounded queue (size 1, drop-oldest replace) so processing latency cannot stall the camera. Subclasses implement one method:def compute(self, img, idx, ts) -> float | None: ...
Returning
Noneskips emission for that frame. Otherwise the scalar is emitted on:self.signals.data(value, ts)– psygnal; pushed onto the DataQueue / CSV logger when the processor is registered withDataManager.register_hardware_device().self.valueUpdated(t, value)–pyqtSignal(float, float); Qt’s cross-thread queued connection makesSerialWidgetsafe to drive from the worker thread.
- compute(img, idx, ts)[source]#
Subclass hook: return one scalar (or
None) per frame.Called on every frame the attached camera emits. Implementations should be fast — anything heavy will starve the camera buffer. Return
Noneto skip emitting a sample for this frame.
- attach(camera=None)[source]#
Attach to a camera’s
signals.frameand start the worker.cameradefaults to whatever was passed at construction time (self.camera); callers building processors first and attaching later may pass it explicitly.- Parameters:
camera (Optional['DataProducer'])
- Return type:
None
- class mesofield.processors.FrameMean[source]#
Bases:
FrameProcessor