mocks#
Synthetic devices for headless / GUI-only iteration.
These mock devices produce realistic data on daemon threads without any
serial or camera hardware. They are used by the scaffold --rig dev
template and by the test suite.
Mock encoder
Produces random click counts via BaseDataProducer.
Usage in hardware.yaml:
encoder:
type: mock
sample_interval_ms: 100
Or programmatically:
from mesofield.devices.mocks import MockEncoderDevice
dev = MockEncoderDevice({"id": "encoder", "sample_interval_ms": 50})
dev.start()
...
dev.stop()
Mock camera
Subclasses BaseCamera for the cosmetic + manifest surface every
camera shares, and BaseDataProducer for the buffer + record()
mechanism every queue-pushing producer needs.
YAML registration via type: mock_camera:
camera:
type: mock_camera
primary: true
width: 64
height: 64
frame_interval_ms: 50
output:
suffix: meso
file_type: ome.tiff
bids_type: func
- class mesofield.devices.mocks.MockEncoderDevice[source]#
Bases:
BaseDataProducerSynthetic encoder that records random click counts.
- class mesofield.devices.mocks.MockFrameProducer[source]#
Bases:
BaseCamera,BaseDataProducerSynthetic camera producing real OME-TIFF + frame metadata JSON.
- arm(config)[source]#
Per-run prep: set up the writer + (optionally) an MDA sequence.
The default body fits both MMCamera (which needs a sequence) and OpenCV/Mock (where
set_sequenceis a no-op). Subclasses override only when they need additional prep.- Parameters:
config (ExperimentConfig)
- Return type:
None
- snap()[source]#
Capture a single frame outside any recording, return it as an ndarray.
Used by the GUI’s snap button. Implementations should NOT alter recording state – snap is preview-only – but they SHOULD call
_save_snap_png()so each snap also lands a*_snap.png.- Return type:
- start_live()[source]#
Begin continuous live preview WITHOUT writing to disk.
Subscribers receive frames via
image_ready(Qt) /signals.data(psygnal). No recording side-effects; pair withstop_live().- Return type:
None
- stop_live()[source]#
End the continuous live preview started by
start_live().- Return type:
None