pyrtc.isio_bridge

Mirror pyrtc streams to and from ImageStreamIO (milk / CACAO) shared memory.

ImageStreamIO (ISIO) is the shared-memory format of milk and CACAO, used at Subaru/SCExAO, MagAO-X, COSMIC and others. An IsioBridge copies one stream in one direction, so pyrtc can use ISIO camera and DM drivers and milk viewers, or feed a CACAO RTC:

isio_wfs:                       # pyrtc -> ISIO
  class_name: pyrtc.isio_bridge.IsioBridge
  direction: to_isio
  isio_name: pyrtc_wfs
  input_streams: {input: wfs}
  functions: [mirror]
isio_dm:                        # ISIO -> pyrtc
  class_name: pyrtc.isio_bridge.IsioBridge
  direction: from_isio
  isio_name: dm00disp
  output_streams: {output: dm_from_cacao}
  functions: [mirror]

Or from the command line:

python -m pyrtc.isio_bridge to-isio wfs pyrtc_wfs
python -m pyrtc.isio_bridge from-isio dm00disp dm_from_cacao

Needs the ImageStreamIO Python module (ImageStreamIOWrap); build it with pip install git+https://github.com/milk-org/ImageStreamIO. ISIO files live in MILK_SHM_DIR (/milk/shm or /tmp).

Axes are reversed at the boundary, so images keep their orientation: pyrtc arrays are row-major and indexed [y, x] (#162), while ISIO images are column-major with size = [x, y] (size[0] is the fastest axis, milk’s x). A pyrtc (height, width) stream becomes an ISIO image with size = [width, height] holding the same bytes, and an ISIO [nx, ny] image becomes a pyrtc (ny, nx) stream. (pyrtc 1.x kept the shape, which matched milk while pyrtc streams were (width, height).) The ISIO-to-pyrtc direction publishes each new ISIO frame (its cnt0 becomes the pyrtc frame_id) within about poll_interval. Waiting uses non-blocking semaphore polls, because the ISIO module’s blocking waits hold the GIL and would stall every other pyrtc thread.

Functions

main([argv])

Classes

IsioBridge(conf)

Copy one stream between pyrtc (pyshmem) and ImageStreamIO, in one direction.