base#
Threaded base class for real-time camera frame processors.
- class mesofield.processors.base.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