Stream#
Models for miniscope_io.stream_daq
- pydantic model miniscope_io.models.stream.StreamBufferHeaderFormat#
Show JSON schema
{ "title": "StreamBufferHeaderFormat", "type": "object", "properties": { "linked_list": { "anyOf": [ { "type": "integer" }, { "maxItems": 2, "minItems": 2, "prefixItems": [ { "type": "integer" }, { "type": "integer" } ], "type": "array" }, { "maxItems": 2, "minItems": 2, "prefixItems": [ { "type": "number" }, { "type": "number" } ], "type": "array" } ], "title": "Linked List" }, "frame_num": { "anyOf": [ { "type": "integer" }, { "maxItems": 2, "minItems": 2, "prefixItems": [ { "type": "integer" }, { "type": "integer" } ], "type": "array" }, { "maxItems": 2, "minItems": 2, "prefixItems": [ { "type": "number" }, { "type": "number" } ], "type": "array" } ], "title": "Frame Num" }, "buffer_count": { "anyOf": [ { "type": "integer" }, { "maxItems": 2, "minItems": 2, "prefixItems": [ { "type": "integer" }, { "type": "integer" } ], "type": "array" }, { "maxItems": 2, "minItems": 2, "prefixItems": [ { "type": "number" }, { "type": "number" } ], "type": "array" } ], "title": "Buffer Count" }, "frame_buffer_count": { "anyOf": [ { "type": "integer" }, { "maxItems": 2, "minItems": 2, "prefixItems": [ { "type": "integer" }, { "type": "integer" } ], "type": "array" }, { "maxItems": 2, "minItems": 2, "prefixItems": [ { "type": "number" }, { "type": "number" } ], "type": "array" } ], "title": "Frame Buffer Count" }, "timestamp": { "anyOf": [ { "type": "integer" }, { "maxItems": 2, "minItems": 2, "prefixItems": [ { "type": "integer" }, { "type": "integer" } ], "type": "array" }, { "maxItems": 2, "minItems": 2, "prefixItems": [ { "type": "number" }, { "type": "number" } ], "type": "array" } ], "title": "Timestamp" }, "pixel_count": { "anyOf": [ { "maxItems": 2, "minItems": 2, "prefixItems": [ { "type": "integer" }, { "type": "integer" } ], "type": "array" }, { "maxItems": 2, "minItems": 2, "prefixItems": [ { "type": "number" }, { "type": "number" } ], "type": "array" } ], "title": "Pixel Count" } }, "required": [ "linked_list", "frame_num", "buffer_count", "frame_buffer_count", "timestamp", "pixel_count" ] }
- pydantic model miniscope_io.models.stream.StreamDaqConfig#
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.
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.
LSB (bool, optional) – Whether the sourse is in “LSB” mode or not, by default True. If not LSB, then the incoming bitstream is expected to be in Most Significant Bit first mode and data are transmitted in normal order. If LSB, then the incoming bitstream is in the format that each 32-bit words are bit-wise reversed on its own. Furthermore, the order of 32-bit words in the pixel data within the buffer is reversed (but the order of words in the header is preserved). Note that this format does not correspond to the usual LSB-first convention and the parameter name is chosen for the lack of better words.
..todo:: – Takuya - double-check the definitions around blocks and buffers in the firmware and add description.
Show JSON schema
{ "title": "StreamDaqConfig", "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. 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.\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.\npreamble: str\n 32-bit preamble used to locate the start of each buffer. 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 :class:`.MetadataHeaderFormat`.\n The user is responsible to ensure that `header_len` is larger than the largest bit position defined in :class:`.MetadataHeaderFormat` 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.\nLSB : bool, optional\n Whether the sourse is in \"LSB\" mode or not, by default True.\n If `not LSB`, then the incoming bitstream is expected to be in Most Significant Bit first mode and data are transmitted in normal order.\n If `LSB`, then the incoming bitstream is in the format that each 32-bit words are bit-wise reversed on its own.\n Furthermore, the order of 32-bit words in the pixel data within the buffer is reversed (but the order of words in the header is preserved).\n Note that this format does not correspond to the usual LSB-first convention and the parameter name is chosen for the lack of better words.\n\n..todo::\n Takuya - double-check the definitions around blocks and buffers in the firmware and add description.", "type": "object", "properties": { "device": { "title": "Device", "type": "string" }, "bitstream": { "anyOf": [ { "format": "path", "type": "string" }, { "type": "null" } ], "title": "Bitstream" }, "port": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "title": "Port" }, "baudrate": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Baudrate" }, "frame_width": { "title": "Frame Width", "type": "integer" }, "frame_height": { "title": "Frame Height", "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" }, "LSB": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "title": "Lsb" } }, "required": [ "device", "bitstream", "port", "baudrate", "frame_width", "frame_height", "preamble", "header_len", "buffer_block_length", "block_size", "num_buffers", "LSB" ] }
- Fields:
- Validators: