buffer

Models for a data stream from a miniscope device: header formats, containers, etc.

pydantic model mio.models.buffer.BufferHeader

Container for the data stream’s header, structured by MetadataHeaderFormat

Show JSON schema
{
   "title": "BufferHeader",
   "description": "Container for the data stream's header, structured by :class:`.MetadataHeaderFormat`",
   "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"
      },
      "write_buffer_count": {
         "title": "Write Buffer Count",
         "type": "integer"
      },
      "dropped_buffer_count": {
         "title": "Dropped Buffer Count",
         "type": "integer"
      },
      "timestamp": {
         "title": "Timestamp",
         "type": "integer"
      },
      "write_timestamp": {
         "title": "Write Timestamp",
         "type": "integer"
      }
   },
   "required": [
      "linked_list",
      "frame_num",
      "buffer_count",
      "frame_buffer_count",
      "write_buffer_count",
      "dropped_buffer_count",
      "timestamp",
      "write_timestamp"
   ]
}

Fields:
field buffer_count: int [Required]
field dropped_buffer_count: int [Required]
field frame_buffer_count: int [Required]
field frame_num: int [Required]
field linked_list: int [Required]
field timestamp: int [Required]
field write_buffer_count: int [Required]
field write_timestamp: int [Required]
classmethod from_format(vals: Sequence, format: BufferHeaderFormat, construct: bool = False) _T

Instantiate a buffer header from linearized values (eg. in an ndarray or list) and an associated format that tells us what index the model values are found in that data.

Parameters:
  • vals (list, numpy.ndarray) – Indexable values to cast to the header model

  • format (BufferHeaderFormat) – Format used to index values

  • construct (bool) – If True , use model_construct() to create the model instance (ie. without validation, but faster). Default: False

Returns:

BufferHeader

pydantic model mio.models.buffer.BufferHeaderFormat

Format model used to parse header at the beginning of every buffer.

Parameters:
  • linked_list (int) – Index of data buffers within the circulating structure. This increments with each buffer until it reaches [num_buffers](../api/stream_daq.md), then resets to zero.

  • frame_num (int) – The index of the image frame, which increments with each image frame (comprising multiple data buffers).

  • buffer_count (int) – Index of data buffers, which increments with each buffer.

  • frame_buffer_count (int) – Index of the data buffer within the image frame. It is set to frame_buffer_count = 0 at the first buffer in each frame.

  • write_buffer_count (int) – Number of data buffers transmitted out of the MCU.

  • dropped_buffer_count (int) – Number of dropped data buffers.

  • timestamp (int) – Timestamp in milliseconds. This should increase approximately by 1 / framerate * 1000 every frame.

  • write_timestamp (int) – Timestamp in milliseconds when the buffer was transmitted out of the MCU.

Show JSON schema
{
   "title": "BufferHeaderFormat",
   "description": "Format model used to parse header at the beginning of every buffer.\n\nParameters\n----------\nlinked_list: int\n    Index of data buffers within the circulating structure.\n    This increments with each buffer until it reaches [`num_buffers`](../api/stream_daq.md),\n    then resets to zero.\nframe_num: int\n    The index of the image frame, which increments with each image frame\n    (comprising multiple data buffers).\nbuffer_count: int\n    Index of data buffers, which increments with each buffer.\nframe_buffer_count: int\n    Index of the data buffer within the image frame.\n    It is set to `frame_buffer_count = 0` at the first buffer in each frame.\nwrite_buffer_count: int\n    Number of data buffers transmitted out of the MCU.\ndropped_buffer_count: int\n    Number of dropped data buffers.\ntimestamp: int\n    Timestamp in milliseconds.\n    This should increase approximately by `1 / framerate * 1000` every frame.\nwrite_timestamp: int\n    Timestamp in milliseconds when the buffer was transmitted out of the MCU.",
   "type": "object",
   "properties": {
      "id": {
         "pattern": "[\\w\\-\\/#]+",
         "title": "Id",
         "type": "string"
      },
      "mio_model": {
         "default": null,
         "title": "Mio Model",
         "type": "string"
      },
      "mio_version": {
         "default": "0.6.1.dev10+g42c564f",
         "title": "Mio Version",
         "type": "string"
      },
      "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"
      },
      "write_buffer_count": {
         "title": "Write Buffer Count",
         "type": "integer"
      },
      "dropped_buffer_count": {
         "title": "Dropped Buffer Count",
         "type": "integer"
      },
      "timestamp": {
         "title": "Timestamp",
         "type": "integer"
      },
      "write_timestamp": {
         "title": "Write Timestamp",
         "type": "integer"
      }
   },
   "required": [
      "id",
      "linked_list",
      "frame_num",
      "buffer_count",
      "frame_buffer_count",
      "write_buffer_count",
      "dropped_buffer_count",
      "timestamp",
      "write_timestamp"
   ]
}

Fields:
Validators:

field buffer_count: int [Required]
field dropped_buffer_count: int [Required]
field frame_buffer_count: int [Required]
field frame_num: int [Required]
field linked_list: int [Required]
field timestamp: int [Required]
field write_buffer_count: int [Required]
field write_timestamp: int [Required]