sdcard#
Data model for configuring an SD card. Will be instantiated in the constants module with specific values. This allows for the model to be reused across different miniscopes, and for consuming code to use a consistent, introspectable API
- pydantic model miniscope_io.sdcard.BufferHeaderPositions#
Positions in the header for each frame
Show JSON schema
{ "title": "BufferHeaderPositions", "description": "Positions in the header for each frame", "type": "object", "properties": { "length": { "default": 0, "title": "Length", "type": "integer" }, "linked_list": { "default": 1, "title": "Linked List", "type": "integer" }, "frame_num": { "default": 2, "title": "Frame Num", "type": "integer" }, "buffer_count": { "default": 3, "title": "Buffer Count", "type": "integer" }, "frame_buffer_count": { "default": 4, "title": "Frame Buffer Count", "type": "integer" }, "write_buffer_count": { "default": 5, "title": "Write Buffer Count", "type": "integer" }, "dropped_buffer_count": { "default": 6, "title": "Dropped Buffer Count", "type": "integer" }, "timestamp": { "default": 7, "title": "Timestamp", "type": "integer" }, "data_length": { "default": 8, "title": "Data Length", "type": "integer" }, "write_timestamp": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Write Timestamp" }, "battery_voltage": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Battery Voltage" } } }
- Fields:
- pydantic model miniscope_io.sdcard.ConfigPositions#
Image acquisition configuration positions
Show JSON schema
{ "title": "ConfigPositions", "description": "Image acquisition configuration positions", "type": "object", "properties": { "width": { "default": 0, "title": "Width", "type": "integer" }, "height": { "default": 1, "title": "Height", "type": "integer" }, "fs": { "default": 2, "title": "Fs", "type": "integer" }, "buffer_size": { "default": 3, "title": "Buffer Size", "type": "integer" }, "n_buffers_recorded": { "default": 4, "title": "N Buffers Recorded", "type": "integer" }, "n_buffers_dropped": { "default": 5, "title": "N Buffers Dropped", "type": "integer" } } }
- Fields:
- pydantic model miniscope_io.sdcard.DataHeader#
Header data at the start of each frame
Show JSON schema
{ "title": "DataHeader", "description": "Header data at the start of each frame", "type": "object", "properties": { "length": { "title": "Length", "type": "integer" }, "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" }, "data_length": { "title": "Data Length", "type": "integer" }, "write_timestamp": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Write Timestamp" }, "battery_voltage": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Battery Voltage" } }, "required": [ "length", "linked_list", "frame_num", "buffer_count", "frame_buffer_count", "write_buffer_count", "dropped_buffer_count", "timestamp", "data_length" ] }
- Fields:
- pydantic model miniscope_io.sdcard.SDConfig#
The configuration of a recording taken on this SD card.
Read from the locations given in
ConfigPositions
for an SD card with a givenSDLayout
Show JSON schema
{ "title": "SDConfig", "description": "The configuration of a recording taken on this SD card.\n\nRead from the locations given in :class:`.ConfigPositions` for an SD card with a given :class:`.SDLayout`", "type": "object", "properties": { "width": { "title": "Width", "type": "integer" }, "height": { "title": "Height", "type": "integer" }, "fs": { "title": "Fs", "type": "integer" }, "buffer_size": { "title": "Buffer Size", "type": "integer" }, "n_buffers_recorded": { "title": "N Buffers Recorded", "type": "integer" }, "n_buffers_dropped": { "title": "N Buffers Dropped", "type": "integer" } }, "required": [ "width", "height", "fs", "buffer_size", "n_buffers_recorded", "n_buffers_dropped" ] }
- Fields:
- pydantic model miniscope_io.sdcard.SDHeaderPositions#
Positions in the header for the whole SD card
Show JSON schema
{ "title": "SDHeaderPositions", "description": "Positions in the header for the whole SD card", "type": "object", "properties": { "gain": { "default": 4, "title": "Gain", "type": "integer" }, "led": { "default": 5, "title": "Led", "type": "integer" }, "ewl": { "default": 6, "title": "Ewl", "type": "integer" }, "record_length": { "default": 7, "title": "Record Length", "type": "integer" }, "fs": { "default": 8, "title": "Fs", "type": "integer" }, "delay_start": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Delay Start" }, "battery_cutoff": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Battery Cutoff" } } }
- Fields:
- pydantic model miniscope_io.sdcard.SDLayout#
Data layout of an SD Card.
Used by the
io.SDCard
class to tell it how data on the SD card is laid out.Show JSON schema
{ "title": "SDLayout", "description": "Data layout of an SD Card.\n\nUsed by the :class:`.io.SDCard` class to tell it how data on the SD card is laid out.", "type": "object", "properties": { "sectors": { "$ref": "#/$defs/SectorConfig" }, "write_key0": { "default": 226277911, "title": "Write Key0", "type": "integer" }, "write_key1": { "default": 226277911, "title": "Write Key1", "type": "integer" }, "write_key2": { "default": 226277911, "title": "Write Key2", "type": "integer" }, "write_key3": { "default": 226277911, "title": "Write Key3", "type": "integer" }, "word_size": { "default": 4, "title": "Word Size", "type": "integer" }, "header": { "allOf": [ { "$ref": "#/$defs/SDHeaderPositions" } ], "default": { "battery_cutoff": null, "delay_start": null, "ewl": 6, "fs": 8, "gain": 4, "led": 5, "record_length": 7 } }, "config": { "allOf": [ { "$ref": "#/$defs/ConfigPositions" } ], "default": { "buffer_size": 3, "fs": 2, "height": 1, "n_buffers_dropped": 5, "n_buffers_recorded": 4, "width": 0 } }, "buffer": { "allOf": [ { "$ref": "#/$defs/BufferHeaderPositions" } ], "default": { "battery_voltage": null, "buffer_count": 3, "data_length": 8, "dropped_buffer_count": 6, "frame_buffer_count": 4, "frame_num": 2, "length": 0, "linked_list": 1, "timestamp": 7, "write_buffer_count": 5, "write_timestamp": null } }, "version": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Version" } }, "$defs": { "BufferHeaderPositions": { "description": "Positions in the header for each frame", "properties": { "length": { "default": 0, "title": "Length", "type": "integer" }, "linked_list": { "default": 1, "title": "Linked List", "type": "integer" }, "frame_num": { "default": 2, "title": "Frame Num", "type": "integer" }, "buffer_count": { "default": 3, "title": "Buffer Count", "type": "integer" }, "frame_buffer_count": { "default": 4, "title": "Frame Buffer Count", "type": "integer" }, "write_buffer_count": { "default": 5, "title": "Write Buffer Count", "type": "integer" }, "dropped_buffer_count": { "default": 6, "title": "Dropped Buffer Count", "type": "integer" }, "timestamp": { "default": 7, "title": "Timestamp", "type": "integer" }, "data_length": { "default": 8, "title": "Data Length", "type": "integer" }, "write_timestamp": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Write Timestamp" }, "battery_voltage": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Battery Voltage" } }, "title": "BufferHeaderPositions", "type": "object" }, "ConfigPositions": { "description": "Image acquisition configuration positions", "properties": { "width": { "default": 0, "title": "Width", "type": "integer" }, "height": { "default": 1, "title": "Height", "type": "integer" }, "fs": { "default": 2, "title": "Fs", "type": "integer" }, "buffer_size": { "default": 3, "title": "Buffer Size", "type": "integer" }, "n_buffers_recorded": { "default": 4, "title": "N Buffers Recorded", "type": "integer" }, "n_buffers_dropped": { "default": 5, "title": "N Buffers Dropped", "type": "integer" } }, "title": "ConfigPositions", "type": "object" }, "SDHeaderPositions": { "description": "Positions in the header for the whole SD card", "properties": { "gain": { "default": 4, "title": "Gain", "type": "integer" }, "led": { "default": 5, "title": "Led", "type": "integer" }, "ewl": { "default": 6, "title": "Ewl", "type": "integer" }, "record_length": { "default": 7, "title": "Record Length", "type": "integer" }, "fs": { "default": 8, "title": "Fs", "type": "integer" }, "delay_start": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Delay Start" }, "battery_cutoff": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Battery Cutoff" } }, "title": "SDHeaderPositions", "type": "object" }, "SectorConfig": { "description": "Configuration of sector layout on the SD card.\n\nFor each sector, one can retrieve the position with the attribute *_pos,\n\nExamples:\n\n >>> sectors = SectorConfig(header=1023, config=1024, data=1025, size=512)\n >>> sectors.header\n 1023\n >>> # should be 1023 * 512\n >>> sectors.header_pos\n 523776", "properties": { "header": { "default": 1023, "title": "Header", "type": "integer" }, "config": { "default": 1024, "title": "Config", "type": "integer" }, "data": { "default": 1025, "title": "Data", "type": "integer" }, "size": { "default": 512, "title": "Size", "type": "integer" } }, "title": "SectorConfig", "type": "object" } }, "required": [ "sectors" ] }
- Fields:
- field buffer: BufferHeaderPositions = BufferHeaderPositions(length=0, linked_list=1, frame_num=2, buffer_count=3, frame_buffer_count=4, write_buffer_count=5, dropped_buffer_count=6, timestamp=7, data_length=8, write_timestamp=None, battery_voltage=None)#
- field config: ConfigPositions = ConfigPositions(width=0, height=1, fs=2, buffer_size=3, n_buffers_recorded=4, n_buffers_dropped=5)#
- field header: SDHeaderPositions = SDHeaderPositions(gain=4, led=5, ewl=6, record_length=7, fs=8, delay_start=None, battery_cutoff=None)#
- field sectors: SectorConfig [Required]#
- field version: str | None = None#
Not Implemented: version stored in the SD card header that indicates when this layout should be used
- pydantic model miniscope_io.sdcard.SectorConfig#
Configuration of sector layout on the SD card.
For each sector, one can retrieve the position with the attribute *_pos,
Examples
>>> sectors = SectorConfig(header=1023, config=1024, data=1025, size=512) >>> sectors.header 1023 >>> # should be 1023 * 512 >>> sectors.header_pos 523776
Show JSON schema
{ "title": "SectorConfig", "description": "Configuration of sector layout on the SD card.\n\nFor each sector, one can retrieve the position with the attribute *_pos,\n\nExamples:\n\n >>> sectors = SectorConfig(header=1023, config=1024, data=1025, size=512)\n >>> sectors.header\n 1023\n >>> # should be 1023 * 512\n >>> sectors.header_pos\n 523776", "type": "object", "properties": { "header": { "default": 1023, "title": "Header", "type": "integer" }, "config": { "default": 1024, "title": "Config", "type": "integer" }, "data": { "default": 1025, "title": "Data", "type": "integer" }, "size": { "default": 512, "title": "Size", "type": "integer" } } }
- Fields: