stream¶
Models for miniscope_io.stream_daq
- pydantic model miniscope_io.models.stream.StreamBufferHeader¶
Refinements of
BufferHeaderforStreamDaqShow JSON schema
{ "title": "StreamBufferHeader", "description": "Refinements of :class:`.BufferHeader` for\n:class:`~miniscope_io.stream_daq.StreamDaq`", "type": "object", "properties": { "linked_list": { "title": "Linked List", "type": "integer" }, "frame_num": { "title": "Frame Num", "type": "integer" }, "buffer_count": { "title": "Buffer Count", "type": "integer" }, "frame_buffer_count": { "title": "Frame Buffer Count", "type": "integer" }, "timestamp": { "title": "Timestamp", "type": "integer" }, "pixel_count": { "title": "Pixel Count", "type": "integer" } }, "required": [ "linked_list", "frame_num", "buffer_count", "frame_buffer_count", "timestamp", "pixel_count" ] }
- Fields:
- pydantic model miniscope_io.models.stream.StreamBufferHeaderFormat¶
Refinements of
BufferHeaderFormatforStreamDaqShow JSON schema
{ "title": "StreamBufferHeaderFormat", "description": "Refinements of :class:`.BufferHeaderFormat` for\n:class:`~miniscope_io.stream_daq.StreamDaq`", "type": "object", "properties": { "linked_list": { "title": "Linked List", "type": "integer" }, "frame_num": { "title": "Frame Num", "type": "integer" }, "buffer_count": { "title": "Buffer Count", "type": "integer" }, "frame_buffer_count": { "title": "Frame Buffer Count", "type": "integer" }, "timestamp": { "title": "Timestamp", "type": "integer" }, "pixel_count": { "title": "Pixel Count", "type": "integer" } }, "required": [ "linked_list", "frame_num", "buffer_count", "frame_buffer_count", "timestamp", "pixel_count" ] }
- Fields:
- pydantic model miniscope_io.models.stream.StreamDevConfig¶
Format model used to parse DAQ configuration yaml file (examples are in ./config) The model attributes are key-value pairs needed for reconstructing frames from data streams.
- Parameters:
device (str) – Interface hardware used for receiving data. Current options are “OK” (Opal Kelly XEM 7310) and “UART” (generic UART-USB converters). Only “OK” is supported at the moment.
bitstream (str, optional) – Required when device is “OK”. The configuration bitstream file to upload to the Opal Kelly board. This uploads a Manchester decoder HDL and different bitstream files are required to configure different data rates and bit polarity. This is a binary file synthesized using Vivado, and details for generating this file will be provided in later updates.
port (str, optional) – Required when device is “UART”. COM port connected to the UART-USB converter.
baudrate (Optional[int]) – Required when device is “UART”. Baudrate of the connection to the UART-USB converter.
frame_width (int) – Frame width of transferred image. This is used to reconstruct image.
frame_height (int) – Frame height of transferred image. This is used to reconstruct image.
fs (int) – Framerate of acquired stream
preamble (str) – 32-bit preamble used to locate the start of each buffer. The header and image data follows this preamble. This is used as a hex but imported as a string because yaml doesn’t support hex format.
header_len (int, optional) – Length of header in bits. (For 32-bit words, 32 * number of words) This is useful when not all the variable/words in the header are defined in
MetadataHeaderFormat. The user is responsible to ensure that header_len is larger than the largest bit position defined inMetadataHeaderFormatotherwise unexpected behavior might occur.pix_depth (int, optional) – Bit-depth of each pixel, by default 8.
buffer_block_length (int) – Defines the data buffer structure. This value needs to match the Miniscope firmware. Number of blocks per each data buffer. This is required to calculate the number of pixels contained in one data buffer.
block_size (int) – Defines the data buffer structure. This value needs to match the Miniscope firmware. Number of 32-bit words per data block. This is required to calculate the number of pixels contained in one data buffer.
num_buffers (int) – Defines the data buffer structure. This value needs to match the Miniscope firmware. This is the number of buffers that the source microcontroller cycles around. This isn’t strictly required for data reconstruction but useful for debugging.
reverse_header_bits (bool, optional) – If True, reverse the bits within each byte of the header. Default is False.
reverse_header_bytes (bool, optional) – If True, reverse the byte order within each 32-bit word of the header. This is used for handling endianness in systems where the byte order needs to be swapped. Default is False.
reverse_payload_bits (bool, optional) – If True, reverse the bits within each byte of the payload. Default is False.
reverse_payload_bytes (bool, optional) – If True, reverse the byte order within each 32-bit word of the payload. This is used for handling endianness in systems where the byte order needs to be swapped. Default is False.
..todo:: – Move port (for USART) to a user config area. This should make this pure device config.
Show JSON schema
{ "title": "StreamDevConfig", "description": "Format model used to parse DAQ configuration yaml file (examples are in ./config)\nThe model attributes are key-value pairs needed for reconstructing frames from data streams.\n\nParameters\n----------\ndevice: str\n Interface hardware used for receiving data.\n Current options are \"OK\" (Opal Kelly XEM 7310) and \"UART\" (generic UART-USB converters).\n Only \"OK\" is supported at the moment.\nbitstream: str, optional\n Required when device is \"OK\".\n The configuration bitstream file to upload to the Opal Kelly board.\n This uploads a Manchester decoder HDL and different bitstream files are required\n to configure different data rates and bit polarity.\n This is a binary file synthesized using Vivado,\n and details for generating this file will be provided in later updates.\nport: str, optional\n Required when device is \"UART\".\n COM port connected to the UART-USB converter.\nbaudrate: Optional[int]\n Required when device is \"UART\".\n Baudrate of the connection to the UART-USB converter.\nframe_width: int\n Frame width of transferred image. This is used to reconstruct image.\nframe_height: int\n Frame height of transferred image. This is used to reconstruct image.\nfs: int\n Framerate of acquired stream\npreamble: str\n 32-bit preamble used to locate the start of each buffer.\n The header and image data follows this preamble.\n This is used as a hex but imported as a string because yaml doesn't support hex format.\nheader_len : int, optional\n Length of header in bits. (For 32-bit words, 32 * number of words)\n This is useful when not all the variable/words in the header are defined in\n :class:`.MetadataHeaderFormat`.\n The user is responsible to ensure that `header_len` is larger than the largest bit\n position defined in :class:`.MetadataHeaderFormat`\n otherwise unexpected behavior might occur.\npix_depth : int, optional\n Bit-depth of each pixel, by default 8.\nbuffer_block_length: int\n Defines the data buffer structure. This value needs to match the Miniscope firmware.\n Number of blocks per each data buffer.\n This is required to calculate the number of pixels contained in one data buffer.\nblock_size: int\n Defines the data buffer structure. This value needs to match the Miniscope firmware.\n Number of 32-bit words per data block.\n This is required to calculate the number of pixels contained in one data buffer.\nnum_buffers: int\n Defines the data buffer structure. This value needs to match the Miniscope firmware.\n This is the number of buffers that the source microcontroller cycles around.\n This isn't strictly required for data reconstruction but useful for debugging.\nreverse_header_bits : bool, optional\n If True, reverse the bits within each byte of the header.\n Default is False.\nreverse_header_bytes : bool, optional\n If True, reverse the byte order within each 32-bit word of the header.\n This is used for handling endianness in systems where the byte order needs to be swapped.\n Default is False.\nreverse_payload_bits : bool, optional\n If True, reverse the bits within each byte of the payload.\n Default is False.\nreverse_payload_bytes : bool, optional\n If True, reverse the byte order within each 32-bit word of the payload.\n This is used for handling endianness in systems where the byte order needs to be swapped.\n Default is False.\n\n..todo::\n Move port (for USART) to a user config area. This should make this pure device config.", "type": "object", "properties": { "device": { "enum": [ "OK", "UART" ], "title": "Device", "type": "string" }, "bitstream": { "anyOf": [ { "format": "path", "type": "string" }, { "type": "null" } ], "default": null, "title": "Bitstream" }, "port": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Port" }, "baudrate": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Baudrate" }, "frame_width": { "title": "Frame Width", "type": "integer" }, "frame_height": { "title": "Frame Height", "type": "integer" }, "fs": { "default": 20, "title": "Fs", "type": "integer" }, "preamble": { "format": "binary", "title": "Preamble", "type": "string" }, "header_len": { "title": "Header Len", "type": "integer" }, "pix_depth": { "default": 8, "title": "Pix Depth", "type": "integer" }, "buffer_block_length": { "title": "Buffer Block Length", "type": "integer" }, "block_size": { "title": "Block Size", "type": "integer" }, "num_buffers": { "title": "Num Buffers", "type": "integer" }, "reverse_header_bits": { "default": false, "title": "Reverse Header Bits", "type": "boolean" }, "reverse_header_bytes": { "default": false, "title": "Reverse Header Bytes", "type": "boolean" }, "reverse_payload_bits": { "default": false, "title": "Reverse Payload Bits", "type": "boolean" }, "reverse_payload_bytes": { "default": false, "title": "Reverse Payload Bytes", "type": "boolean" } }, "required": [ "device", "frame_width", "frame_height", "preamble", "header_len", "buffer_block_length", "block_size", "num_buffers" ] }
- Fields:
- Validators: