diff --git a/.bonsai/Bonsai.config b/.bonsai/Bonsai.config index bd63aed..446a0e4 100644 --- a/.bonsai/Bonsai.config +++ b/.bonsai/Bonsai.config @@ -5,8 +5,11 @@ - + + + + @@ -16,7 +19,8 @@ - + + @@ -29,6 +33,7 @@ + @@ -40,17 +45,21 @@ - - + + + + + + @@ -61,6 +70,7 @@ + @@ -73,8 +83,11 @@ - + + + + @@ -84,7 +97,8 @@ - + + @@ -96,6 +110,7 @@ + @@ -108,12 +123,13 @@ - - + + + diff --git a/.bonsai/Settings/src/main.editor b/.bonsai/Settings/src/main.editor index 998d34c..227521a 100644 --- a/.bonsai/Settings/src/main.editor +++ b/.bonsai/Settings/src/main.editor @@ -13,8 +13,9 @@ - + + diff --git a/.bonsai/Settings/src/main.layout b/.bonsai/Settings/src/main.layout index 0829d87..16a2d20 100644 --- a/.bonsai/Settings/src/main.layout +++ b/.bonsai/Settings/src/main.layout @@ -1,2 +1,266 @@  - \ No newline at end of file + + + + + false + + 130 + 130 + + + 336 + 82 + + Bonsai.Design.ObjectTextVisualizer + + + + + + + + false + + 344 + 310 + + + 334 + 64 + + Bonsai.Design.ObjectTextVisualizer + + + + + + false + + 361 + 396 + + + 334 + 64 + + Bonsai.Design.ObjectTextVisualizer + + + + + + + + false + + 511 + 236 + + + 334 + 64 + + Bonsai.Design.ObjectTextVisualizer + + + + + + false + + 500 + 144 + + + 334 + 64 + + Bonsai.Design.ObjectTextVisualizer + + + + + + + + + + false + + 468 + 132 + + + 336 + 75 + + Bonsai.Design.ObjectTextVisualizer + + + + + + false + + 182 + 182 + + + 336 + 137 + + Bonsai.Design.ObjectTextVisualizer + + + + + + + + + 451 + 134 + + + 418 + 606 + + Bonsai.Gui.TableLayoutPanelVisualizer + + + + Bonsai.Gui.GroupBoxVisualizer + + + + Bonsai.Gui.TableLayoutPanelVisualizer + + + + Bonsai.Gui.ButtonVisualizer + + + + + + Bonsai.Gui.ButtonVisualizer + + + + + + + + + + + + Bonsai.Gui.GroupBoxVisualizer + + + + Bonsai.Design.ObjectTextVisualizer + + + + + + + + + Bonsai.Gui.GroupBoxVisualizer + + + + Bonsai.Gui.ZedGraph.RollingGraphVisualizer + + + 0 + -1 + 1 + true + + + + + + + + Bonsai.Gui.GroupBoxVisualizer + + + + Bonsai.Gui.ZedGraph.RollingGraphVisualizer + + + 0 + 0 + 1.1 + true + + + + + + + + Bonsai.Gui.GroupBoxVisualizer + + + + Bonsai.Vision.Design.IplImageVisualizer + + + + + + + + + Bonsai.Gui.GroupBoxVisualizer + + + + Bonsai.Design.Visualizers.TimeSeriesVisualizer + + + 640 + 10 + 30 + true + + + + + + + + Bonsai.Vision.Design.IplImageVisualizer + + + + + + + + + + + false + + 144 + 156 + + + 994 + 196 + + Bonsai.Design.ObjectTextVisualizer + + + + + + + \ No newline at end of file diff --git a/examples/rig.py b/examples/rig.py index 76fb67f..53ffcfc 100644 --- a/examples/rig.py +++ b/examples/rig.py @@ -3,22 +3,47 @@ from ucl_open_hf_visual.rig import ( UclOpenHfVisualRig ) -from ucl_open.rigs.device import ( - SerialDeviceModule +from ucl_open_hf_visual.rig import ( + MatrixArduino, + MatrixArduinoPhotodiode, + SyncQuad ) from ucl_open.rigs.device import ( Screen, ) +from ucl_open.rigs.video import ( + SpinnakerCamera +) +from ucl_open.rigs.displays import ( + DisplayCalibration, + DisplayIntrinsics +) rig = UclOpenHfVisualRig( screen=Screen( - texture_assets_directory="../textures" + texture_assets_directory="../textures", + calibration={"main": DisplayCalibration( + intrinsics=DisplayIntrinsics( + frame_width=640, + frame_height=480 + ) + )} + ), + sync_quad=SyncQuad( + extent_x=0.1, + extent_y=0.1, + location_x=-1, + location_y=-1 ), - arduino=SerialDeviceModule( - port_name="COM10", + arduino=MatrixArduino( + port_name="COM4", baud_rate=1000000, - new_line="\n", - pattern="%d" + new_line=r"\n" + ), + arduino_photodiode=MatrixArduinoPhotodiode( + port_name="COM5", + baud_rate=250000, + new_line=r"\n" ) ) diff --git a/examples/session.py b/examples/session.py index 2874664..100f045 100644 --- a/examples/session.py +++ b/examples/session.py @@ -1,13 +1,17 @@ import datetime import os -from ucl_open.rigs.experiment import Experiment +from ucl_open_hf_visual.session import UclOpenSession # TODO - autofill experiment fields -session = Experiment( +# TODO - versions, repo configs etc. +session = UclOpenSession( workflow="main.bonsai", commit="", - repository_url="https://github.com/ucl-open/hf-visual" + repository_url="https://github.com/ucl-open/hf-visual", + logging_root_path="C:/Users/saleem_lab/Documents/GitHub/hf-visual/temp_data", + animal_id="mouse-001", + session_id="001" ) def main(path_seed: str = "./local/{schema}.json"): diff --git a/examples/task.py b/examples/task.py index d396aba..8617adf 100644 --- a/examples/task.py +++ b/examples/task.py @@ -7,10 +7,10 @@ task_logic = UclOpenHfVisualTaskLogic( task_parameters=UclOpenHfVisualTaskParameters( - available_textures=["SN_1_1", "SynthIm_1_1"], - inter_presentation_texture="SN_1_2", - presentation_time=1, - inter_presentation_time=0.5 + available_textures=["SN_1_1", "SynthIm_1_1", "SynthIm_1_5"], + inter_presentation_texture="blankStim_1", + presentation_time=0.25, + inter_presentation_time=0.75 ), ) diff --git a/local_packages/UclOpen.Core.0.1.2-dev0.nupkg b/local_packages/UclOpen.Core.0.1.2-dev0.nupkg index acb9223..b31e092 100644 Binary files a/local_packages/UclOpen.Core.0.1.2-dev0.nupkg and b/local_packages/UclOpen.Core.0.1.2-dev0.nupkg differ diff --git a/local_packages/UclOpen.Core.0.1.3-dev0.nupkg b/local_packages/UclOpen.Core.0.1.3-dev0.nupkg deleted file mode 100644 index 9e182d2..0000000 Binary files a/local_packages/UclOpen.Core.0.1.3-dev0.nupkg and /dev/null differ diff --git a/local_packages/UclOpen.Devices.0.1.1-dev0.nupkg b/local_packages/UclOpen.Devices.0.1.1-dev0.nupkg deleted file mode 100644 index 90a5ac0..0000000 Binary files a/local_packages/UclOpen.Devices.0.1.1-dev0.nupkg and /dev/null differ diff --git a/local_packages/UclOpen.Devices.0.1.2-dev0.nupkg b/local_packages/UclOpen.Devices.0.1.2-dev0.nupkg index 2fa7e18..45d26bc 100644 Binary files a/local_packages/UclOpen.Devices.0.1.2-dev0.nupkg and b/local_packages/UclOpen.Devices.0.1.2-dev0.nupkg differ diff --git a/local_packages/UclOpen.Devices.0.1.3-dev0.nupkg b/local_packages/UclOpen.Devices.0.1.3-dev0.nupkg deleted file mode 100644 index a414d4b..0000000 Binary files a/local_packages/UclOpen.Devices.0.1.3-dev0.nupkg and /dev/null differ diff --git a/local_packages/UclOpen.Logging.0.1.0-dev0.nupkg b/local_packages/UclOpen.Logging.0.1.0-dev0.nupkg deleted file mode 100644 index dbae9da..0000000 Binary files a/local_packages/UclOpen.Logging.0.1.0-dev0.nupkg and /dev/null differ diff --git a/local_packages/UclOpen.Logging.0.1.2-dev0.nupkg b/local_packages/UclOpen.Logging.0.1.2-dev0.nupkg index 4d8f3df..25cb41e 100644 Binary files a/local_packages/UclOpen.Logging.0.1.2-dev0.nupkg and b/local_packages/UclOpen.Logging.0.1.2-dev0.nupkg differ diff --git a/local_packages/UclOpen.Logging.0.1.3-dev0.nupkg b/local_packages/UclOpen.Logging.0.1.3-dev0.nupkg index 3f8e185..22c2e68 100644 Binary files a/local_packages/UclOpen.Logging.0.1.3-dev0.nupkg and b/local_packages/UclOpen.Logging.0.1.3-dev0.nupkg differ diff --git a/pyproject.toml b/pyproject.toml index 59d11aa..e107add 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -62,4 +62,4 @@ default-groups = ['dev'] required-version = '>=0.8.4' [tool.uv.sources] -ucl-open-rigs = {git = "https://github.com/ucl-open/ucl_open_rigs/", branch = "visual-displays"} \ No newline at end of file +ucl-open-rigs = {git = "https://github.com/ucl-open/ucl_open_rigs/", branch = "test_build"} \ No newline at end of file diff --git a/src/DataSchemas/ucl_open_hf_visual.json b/src/DataSchemas/ucl_open_hf_visual.json index 428f52a..5e1939c 100644 --- a/src/DataSchemas/ucl_open_hf_visual.json +++ b/src/DataSchemas/ucl_open_hf_visual.json @@ -94,108 +94,169 @@ "title": "DisplayIntrinsics", "type": "object" }, - "Experiment": { - "description": "The base class for creating ucl-open experiment models.", + "MatrixArduino": { "properties": { - "workflow": { - "description": "Path to the workflow running the experiment.", - "title": "Workflow", + "deviceType": { + "const": "MatrixArduino", + "default": "MatrixArduino", + "title": "DeviceType", "type": "string" }, - "commit": { - "description": "Commit hash of the experiment/rig repo.", - "title": "Commit", + "portName": { + "description": "The name of the device serial port.", + "examples": [ + "COMx" + ], + "title": "PortName", "type": "string" }, - "repositoryUrl": { - "description": "The URL of the git repository used to version experiment source code.", - "title": "RepositoryUrl", + "baudRate": { + "default": 9600, + "description": "Baud rate for serial communication.", + "title": "BaudRate", + "type": "integer" + }, + "encoding": { + "default": null, + "description": "Optional text encoding for interpreting incoming bytes.", + "oneOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Encoding" + }, + "newLine": { + "default": "\r\n", + "description": "Line termination sequence used to delimit incoming messages.", + "title": "NewLine", + "type": "string" + }, + "parity": { + "default": "None", + "description": "Parity checking mode for the serial port.", + "title": "Parity", + "type": "string" + }, + "parityReplace": { + "default": 63, + "description": "Byte used to replace invalid bytes detected by a parity error.", + "title": "ParityReplace", + "type": "integer" + }, + "dataBits": { + "default": 8, + "description": "Number of data bits per serial frame.", + "title": "DataBits", + "type": "integer" + }, + "stopBits": { + "default": "One", + "description": "Number of stop bits per serial frame.", + "title": "StopBits", + "type": "string" + }, + "handshake": { + "default": "None", + "description": "Hardware or software handshaking mode.", + "title": "Handshake", + "type": "string" + }, + "discardNull": { + "default": false, + "description": "Whether to discard null bytes appearing in the serial stream.", + "title": "DiscardNull", + "type": "boolean" + }, + "dtrEnable": { + "default": false, + "description": "Whether to enable Data Terminal Ready (DTR) control line.", + "title": "DtrEnable", + "type": "boolean" + }, + "rtsEnable": { + "default": false, + "description": "Whether to enable Request To Send (RTS) control line.", + "title": "RtsEnable", + "type": "boolean" + }, + "readBufferSize": { + "default": 4096, + "description": "Size, in bytes, of the read buffer.", + "title": "ReadBufferSize", + "type": "integer" + }, + "writeBufferSize": { + "default": 2048, + "description": "Size, in bytes, of the write buffer.", + "title": "WriteBufferSize", + "type": "integer" + }, + "receivedBytesThreshold": { + "default": 1, + "description": "Minimum number of bytes in the buffer that triggers a read event.", + "title": "ReceivedBytesThreshold", + "type": "integer" + }, + "serialMessageSubjectName": { + "default": "SerialMessages", + "description": "Name of the subject to which parsed serial messages are published.", + "title": "SerialMessageSubjectName", "type": "string" } }, "required": [ - "workflow", - "commit", - "repositoryUrl" + "portName" ], - "title": "Experiment", + "title": "MatrixArduino", "type": "object" }, - "Screen": { + "MatrixArduinoData": { "properties": { - "deviceType": { - "const": "Screen", - "default": "Screen", - "description": "Device type", - "title": "DeviceType", - "type": "string" - }, - "displayIndex": { - "default": 1, - "description": "Display index", - "title": "DisplayIndex", + "encoderCount": { + "title": "EncoderCount", "type": "integer" }, - "targetRenderFrequency": { - "default": 60, - "description": "Target render frequency", - "title": "TargetRenderFrequency", - "type": "number" - }, - "targetUpdateFrequency": { - "default": 120, - "description": "Target update frequency", - "title": "TargetUpdateFrequency", - "type": "number" + "lickCountLeft": { + "title": "LickCountLeft", + "type": "integer" }, - "textureAssetsDirectory": { - "default": "Textures", - "description": "Calibration directory", - "title": "TextureAssetsDirectory", - "type": "string" + "lickCountRight": { + "title": "LickCountRight", + "type": "integer" }, - "calibration": { - "default": null, - "description": "Calibration parameters for a set of named display monitors for visual stimuli", - "oneOf": [ - { - "additionalProperties": { - "$ref": "#/$defs/DisplayCalibration" - }, - "type": "object" - }, - { - "type": "null" - } - ], - "title": "Calibration" + "lastSyncPulseTime": { + "title": "LastSyncPulseTime", + "type": "integer" }, - "brightness": { - "default": 0, - "description": "Brightness", - "maximum": 1, - "minimum": -1, - "title": "Brightness", - "type": "number" + "photodiodeVal": { + "title": "PhotodiodeVal", + "type": "integer" }, - "contrast": { - "default": 1, - "description": "Contrast", - "maximum": 1, - "minimum": -1, - "title": "Contrast", - "type": "number" + "currentMs": { + "title": "CurrentMs", + "type": "integer" } }, - "title": "Screen", + "required": [ + "encoderCount", + "lickCountLeft", + "lickCountRight", + "lastSyncPulseTime", + "photodiodeVal", + "currentMs" + ], + "title": "MatrixArduinoData", "type": "object" }, - "SerialDeviceModule": { - "description": "Represents the SerialDevice workflow module.\n\nMirrors all externalized properties of SerialDevice.bonsai, including\nport configuration, framing, buffer settings, and parsing pattern.", + "MatrixArduinoPhotodiode": { "properties": { "deviceType": { - "const": "SerialDevice", - "default": "SerialDevice", + "const": "MatrixArduinoPhotodiode", + "default": "MatrixArduinoPhotodiode", "title": "DeviceType", "type": "string" }, @@ -213,12 +274,6 @@ "title": "BaudRate", "type": "integer" }, - "pattern": { - "default": "", - "description": "Pattern used to parse each incoming serial line (same syntax as Bonsai Parse/ScanPattern).", - "title": "Pattern", - "type": "string" - }, "encoding": { "default": null, "description": "Optional text encoding for interpreting incoming bytes.", @@ -314,7 +369,122 @@ "required": [ "portName" ], - "title": "SerialDeviceModule", + "title": "MatrixArduinoPhotodiode", + "type": "object" + }, + "MatrixArduinoPhotodiodeData": { + "properties": { + "photodiodeVal": { + "title": "PhotodiodeVal", + "type": "integer" + }, + "syncVal": { + "title": "SyncVal", + "type": "integer" + } + }, + "required": [ + "photodiodeVal", + "syncVal" + ], + "title": "MatrixArduinoPhotodiodeData", + "type": "object" + }, + "Screen": { + "properties": { + "deviceType": { + "const": "Screen", + "default": "Screen", + "description": "Device type", + "title": "DeviceType", + "type": "string" + }, + "displayIndex": { + "default": 1, + "description": "Display index", + "title": "DisplayIndex", + "type": "integer" + }, + "targetRenderFrequency": { + "default": 60, + "description": "Target render frequency", + "title": "TargetRenderFrequency", + "type": "number" + }, + "targetUpdateFrequency": { + "default": 120, + "description": "Target update frequency", + "title": "TargetUpdateFrequency", + "type": "number" + }, + "textureAssetsDirectory": { + "default": "Textures", + "description": "Calibration directory", + "title": "TextureAssetsDirectory", + "type": "string" + }, + "calibration": { + "default": null, + "description": "Calibration parameters for a set of named display monitors for visual stimuli", + "oneOf": [ + { + "additionalProperties": { + "$ref": "#/$defs/DisplayCalibration" + }, + "type": "object" + }, + { + "type": "null" + } + ], + "title": "Calibration" + }, + "brightness": { + "default": 0, + "description": "Brightness", + "maximum": 1, + "minimum": -1, + "title": "Brightness", + "type": "number" + }, + "contrast": { + "default": 1, + "description": "Contrast", + "maximum": 1, + "minimum": -1, + "title": "Contrast", + "type": "number" + } + }, + "title": "Screen", + "type": "object" + }, + "SyncQuad": { + "properties": { + "extentX": { + "title": "ExtentX", + "type": "number" + }, + "extentY": { + "title": "ExtentY", + "type": "number" + }, + "locationX": { + "title": "LocationX", + "type": "number" + }, + "locationY": { + "title": "LocationY", + "type": "number" + } + }, + "required": [ + "extentX", + "extentY", + "locationX", + "locationY" + ], + "title": "SyncQuad", "type": "object" }, "UclOpenHfVisualRig": { @@ -328,14 +498,23 @@ "screen": { "$ref": "#/$defs/Screen" }, + "syncQuad": { + "$ref": "#/$defs/SyncQuad" + }, "arduino": { - "$ref": "#/$defs/SerialDeviceModule", + "$ref": "#/$defs/MatrixArduino", "title": "Arduino" + }, + "arduinoPhotodiode": { + "$ref": "#/$defs/MatrixArduinoPhotodiode", + "title": "ArduinoPhotodiode" } }, "required": [ "screen", - "arduino" + "syncQuad", + "arduino", + "arduinoPhotodiode" ], "title": "UclOpenHfVisualRig", "type": "object" @@ -411,20 +590,61 @@ "title": "UclOpenHfVisualTaskParameters", "type": "object" }, + "UclOpenSession": { + "properties": { + "workflow": { + "description": "Path to the workflow running the experiment.", + "title": "Workflow", + "type": "string" + }, + "commit": { + "description": "Commit hash of the experiment/rig repo.", + "title": "Commit", + "type": "string" + }, + "repositoryUrl": { + "description": "The URL of the git repository used to version experiment source code.", + "title": "RepositoryUrl", + "type": "string" + }, + "loggingRootPath": { + "title": "LoggingRootPath", + "type": "string" + }, + "animalId": { + "title": "AnimalId", + "type": "string" + }, + "sessionId": { + "title": "SessionId", + "type": "string" + } + }, + "required": [ + "workflow", + "commit", + "repositoryUrl", + "loggingRootPath", + "animalId", + "sessionId" + ], + "title": "UclOpenSession", + "type": "object" + }, "Vector3": { "properties": { "x": { - "description": "X coordinate of the point", + "description": "X coordinate of the point.", "title": "X", "type": "number" }, "y": { - "description": "Y coordinate of the point", + "description": "Y coordinate of the point.", "title": "Y", "type": "number" }, "z": { - "description": "Z coordinate of the point", + "description": "Z coordinate of the point.", "title": "Z", "type": "number" } diff --git a/src/Extensions/ParseMatrixPhotodiodeSerialDevice.cs b/src/Extensions/ParseMatrixPhotodiodeSerialDevice.cs new file mode 100644 index 0000000..49594bc --- /dev/null +++ b/src/Extensions/ParseMatrixPhotodiodeSerialDevice.cs @@ -0,0 +1,22 @@ +using System; +using System.Reactive.Linq; +using Bonsai; +using Bonsai.Harp; +using UclOpenHfVisualDataSchema; + +public class ParseMatrixPhotodiodeSerialDevice : Transform +{ + public override IObservable Process(IObservable source) + { + return source.Select(value => + { + var values = value.Split(','); + var matrixArduinoData = new MatrixArduinoPhotodiodeData + { + PhotodiodeVal = Convert.ToInt32(values[0]), + SyncVal = Convert.ToInt32(values[0]) + }; + return matrixArduinoData; + }); + } +} \ No newline at end of file diff --git a/src/Extensions/ParseMatrixSerialDevice.cs b/src/Extensions/ParseMatrixSerialDevice.cs new file mode 100644 index 0000000..f4134d1 --- /dev/null +++ b/src/Extensions/ParseMatrixSerialDevice.cs @@ -0,0 +1,26 @@ +using System; +using System.Reactive.Linq; +using Bonsai; +using Bonsai.Harp; +using UclOpenHfVisualDataSchema; + +public class ParseMatrixSerialDevice : Transform> +{ + public override IObservable> Process(IObservable source) + { + return source.Select(value => + { + var values = value.Split(','); + var matrixArduinoData = new MatrixArduinoData + { + EncoderCount = Convert.ToInt32(values[0]), + LickCountLeft = Convert.ToInt32(values[1]), + LickCountRight = Convert.ToInt32(values[2]), + LastSyncPulseTime = Convert.ToInt32(values[3]), + PhotodiodeVal = Convert.ToInt32(values[4]), + CurrentMs = Convert.ToInt32(values[5]), + }; + return new Timestamped(matrixArduinoData, matrixArduinoData.CurrentMs / 1000d); + }); + } +} \ No newline at end of file diff --git a/src/Extensions/UclOpenHfVisual.Generated.cs b/src/Extensions/UclOpenHfVisual.Generated.cs index 39afd30..1412428 100644 --- a/src/Extensions/UclOpenHfVisual.Generated.cs +++ b/src/Extensions/UclOpenHfVisual.Generated.cs @@ -321,319 +321,1036 @@ public override string ToString() } - /// - /// The base class for creating ucl-open experiment models. - /// [System.CodeDom.Compiler.GeneratedCodeAttribute("Bonsai.Sgen", "0.6.1.0 (Newtonsoft.Json v13.0.0.0)")] - [System.ComponentModel.DescriptionAttribute("The base class for creating ucl-open experiment models.")] [Bonsai.WorkflowElementCategoryAttribute(Bonsai.ElementCategory.Source)] [Bonsai.CombinatorAttribute(MethodName="Generate")] - public partial class Experiment + public partial class MatrixArduino { - private string _workflow; + private string _deviceType; - private string _commit; + private string _portName; - private string _repositoryUrl; + private int _baudRate; + + private string _encoding; + + private string _newLine; + + private string _parity; + + private int _parityReplace; + + private int _dataBits; + + private string _stopBits; + + private string _handshake; + + private bool _discardNull; + + private bool _dtrEnable; + + private bool _rtsEnable; + + private int _readBufferSize; + + private int _writeBufferSize; - public Experiment() + private int _receivedBytesThreshold; + + private string _serialMessageSubjectName; + + public MatrixArduino() { + _deviceType = "MatrixArduino"; + _baudRate = 9600; + _newLine = "\r\n"; + _parity = "None"; + _parityReplace = 63; + _dataBits = 8; + _stopBits = "One"; + _handshake = "None"; + _discardNull = false; + _dtrEnable = false; + _rtsEnable = false; + _readBufferSize = 4096; + _writeBufferSize = 2048; + _receivedBytesThreshold = 1; + _serialMessageSubjectName = "SerialMessages"; } - protected Experiment(Experiment other) + protected MatrixArduino(MatrixArduino other) { - _workflow = other._workflow; - _commit = other._commit; - _repositoryUrl = other._repositoryUrl; + _deviceType = other._deviceType; + _portName = other._portName; + _baudRate = other._baudRate; + _encoding = other._encoding; + _newLine = other._newLine; + _parity = other._parity; + _parityReplace = other._parityReplace; + _dataBits = other._dataBits; + _stopBits = other._stopBits; + _handshake = other._handshake; + _discardNull = other._discardNull; + _dtrEnable = other._dtrEnable; + _rtsEnable = other._rtsEnable; + _readBufferSize = other._readBufferSize; + _writeBufferSize = other._writeBufferSize; + _receivedBytesThreshold = other._receivedBytesThreshold; + _serialMessageSubjectName = other._serialMessageSubjectName; } - /// - /// Path to the workflow running the experiment. - /// - [Newtonsoft.Json.JsonPropertyAttribute("workflow", Required=Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DescriptionAttribute("Path to the workflow running the experiment.")] - public string Workflow + [Newtonsoft.Json.JsonPropertyAttribute("deviceType")] + public string DeviceType { get { - return _workflow; + return _deviceType; } set { - _workflow = value; + _deviceType = value; } } /// - /// Commit hash of the experiment/rig repo. + /// The name of the device serial port. /// - [Newtonsoft.Json.JsonPropertyAttribute("commit", Required=Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DescriptionAttribute("Commit hash of the experiment/rig repo.")] - public string Commit + [Newtonsoft.Json.JsonPropertyAttribute("portName", Required=Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DescriptionAttribute("The name of the device serial port.")] + public string PortName { get { - return _commit; + return _portName; } set { - _commit = value; + _portName = value; } } /// - /// The URL of the git repository used to version experiment source code. + /// Baud rate for serial communication. /// - [Newtonsoft.Json.JsonPropertyAttribute("repositoryUrl", Required=Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DescriptionAttribute("The URL of the git repository used to version experiment source code.")] - public string RepositoryUrl + [Newtonsoft.Json.JsonPropertyAttribute("baudRate")] + [System.ComponentModel.DescriptionAttribute("Baud rate for serial communication.")] + public int BaudRate { get { - return _repositoryUrl; + return _baudRate; } set { - _repositoryUrl = value; - } - } - - public System.IObservable Generate() - { - return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new Experiment(this))); - } - - public System.IObservable Generate(System.IObservable source) - { - return System.Reactive.Linq.Observable.Select(source, _ => new Experiment(this)); - } - - protected virtual bool PrintMembers(System.Text.StringBuilder stringBuilder) - { - stringBuilder.Append("Workflow = " + _workflow + ", "); - stringBuilder.Append("Commit = " + _commit + ", "); - stringBuilder.Append("RepositoryUrl = " + _repositoryUrl); - return true; - } - - public override string ToString() - { - System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); - stringBuilder.Append(GetType().Name); - stringBuilder.Append(" { "); - if (PrintMembers(stringBuilder)) - { - stringBuilder.Append(" "); + _baudRate = value; } - stringBuilder.Append("}"); - return stringBuilder.ToString(); - } - } - - - [System.CodeDom.Compiler.GeneratedCodeAttribute("Bonsai.Sgen", "0.6.1.0 (Newtonsoft.Json v13.0.0.0)")] - [Bonsai.WorkflowElementCategoryAttribute(Bonsai.ElementCategory.Source)] - [Bonsai.CombinatorAttribute(MethodName="Generate")] - public partial class Screen - { - - private string _deviceType; - - private int _displayIndex; - - private double _targetRenderFrequency; - - private double _targetUpdateFrequency; - - private string _textureAssetsDirectory; - - private System.Collections.Generic.Dictionary _calibration; - - private double _brightness; - - private double _contrast; - - public Screen() - { - _deviceType = "Screen"; - _displayIndex = 1; - _targetRenderFrequency = 60D; - _targetUpdateFrequency = 120D; - _textureAssetsDirectory = "Textures"; - _brightness = 0D; - _contrast = 1D; - } - - protected Screen(Screen other) - { - _deviceType = other._deviceType; - _displayIndex = other._displayIndex; - _targetRenderFrequency = other._targetRenderFrequency; - _targetUpdateFrequency = other._targetUpdateFrequency; - _textureAssetsDirectory = other._textureAssetsDirectory; - _calibration = other._calibration; - _brightness = other._brightness; - _contrast = other._contrast; } /// - /// Device type + /// Optional text encoding for interpreting incoming bytes. /// - [Newtonsoft.Json.JsonPropertyAttribute("deviceType")] - [System.ComponentModel.DescriptionAttribute("Device type")] - public string DeviceType + [Newtonsoft.Json.JsonPropertyAttribute("encoding")] + [System.ComponentModel.DescriptionAttribute("Optional text encoding for interpreting incoming bytes.")] + public string Encoding { get { - return _deviceType; + return _encoding; } set { - _deviceType = value; + _encoding = value; } } /// - /// Display index + /// Line termination sequence used to delimit incoming messages. /// - [Newtonsoft.Json.JsonPropertyAttribute("displayIndex")] - [System.ComponentModel.DescriptionAttribute("Display index")] - public int DisplayIndex + [Newtonsoft.Json.JsonPropertyAttribute("newLine")] + [System.ComponentModel.DescriptionAttribute("Line termination sequence used to delimit incoming messages.")] + public string NewLine { get { - return _displayIndex; + return _newLine; } set { - _displayIndex = value; + _newLine = value; } } /// - /// Target render frequency + /// Parity checking mode for the serial port. /// - [Newtonsoft.Json.JsonPropertyAttribute("targetRenderFrequency")] - [System.ComponentModel.DescriptionAttribute("Target render frequency")] - public double TargetRenderFrequency + [Newtonsoft.Json.JsonPropertyAttribute("parity")] + [System.ComponentModel.DescriptionAttribute("Parity checking mode for the serial port.")] + public string Parity { get { - return _targetRenderFrequency; + return _parity; } set { - _targetRenderFrequency = value; + _parity = value; } } /// - /// Target update frequency + /// Byte used to replace invalid bytes detected by a parity error. /// - [Newtonsoft.Json.JsonPropertyAttribute("targetUpdateFrequency")] - [System.ComponentModel.DescriptionAttribute("Target update frequency")] - public double TargetUpdateFrequency + [Newtonsoft.Json.JsonPropertyAttribute("parityReplace")] + [System.ComponentModel.DescriptionAttribute("Byte used to replace invalid bytes detected by a parity error.")] + public int ParityReplace { get { - return _targetUpdateFrequency; + return _parityReplace; } set { - _targetUpdateFrequency = value; + _parityReplace = value; } } /// - /// Calibration directory + /// Number of data bits per serial frame. /// - [Newtonsoft.Json.JsonPropertyAttribute("textureAssetsDirectory")] - [System.ComponentModel.DescriptionAttribute("Calibration directory")] - public string TextureAssetsDirectory + [Newtonsoft.Json.JsonPropertyAttribute("dataBits")] + [System.ComponentModel.DescriptionAttribute("Number of data bits per serial frame.")] + public int DataBits { get { - return _textureAssetsDirectory; + return _dataBits; } set { - _textureAssetsDirectory = value; + _dataBits = value; } } /// - /// Calibration parameters for a set of named display monitors for visual stimuli + /// Number of stop bits per serial frame. /// - [System.Xml.Serialization.XmlIgnoreAttribute()] - [Newtonsoft.Json.JsonPropertyAttribute("calibration")] - [System.ComponentModel.DescriptionAttribute("Calibration parameters for a set of named display monitors for visual stimuli")] - public System.Collections.Generic.Dictionary Calibration + [Newtonsoft.Json.JsonPropertyAttribute("stopBits")] + [System.ComponentModel.DescriptionAttribute("Number of stop bits per serial frame.")] + public string StopBits { get { - return _calibration; + return _stopBits; } set { - _calibration = value; + _stopBits = value; } } /// - /// Brightness + /// Hardware or software handshaking mode. /// - [Newtonsoft.Json.JsonPropertyAttribute("brightness")] - [System.ComponentModel.DescriptionAttribute("Brightness")] - public double Brightness + [Newtonsoft.Json.JsonPropertyAttribute("handshake")] + [System.ComponentModel.DescriptionAttribute("Hardware or software handshaking mode.")] + public string Handshake + { + get + { + return _handshake; + } + set + { + _handshake = value; + } + } + + /// + /// Whether to discard null bytes appearing in the serial stream. + /// + [Newtonsoft.Json.JsonPropertyAttribute("discardNull")] + [System.ComponentModel.DescriptionAttribute("Whether to discard null bytes appearing in the serial stream.")] + public bool DiscardNull + { + get + { + return _discardNull; + } + set + { + _discardNull = value; + } + } + + /// + /// Whether to enable Data Terminal Ready (DTR) control line. + /// + [Newtonsoft.Json.JsonPropertyAttribute("dtrEnable")] + [System.ComponentModel.DescriptionAttribute("Whether to enable Data Terminal Ready (DTR) control line.")] + public bool DtrEnable + { + get + { + return _dtrEnable; + } + set + { + _dtrEnable = value; + } + } + + /// + /// Whether to enable Request To Send (RTS) control line. + /// + [Newtonsoft.Json.JsonPropertyAttribute("rtsEnable")] + [System.ComponentModel.DescriptionAttribute("Whether to enable Request To Send (RTS) control line.")] + public bool RtsEnable + { + get + { + return _rtsEnable; + } + set + { + _rtsEnable = value; + } + } + + /// + /// Size, in bytes, of the read buffer. + /// + [Newtonsoft.Json.JsonPropertyAttribute("readBufferSize")] + [System.ComponentModel.DescriptionAttribute("Size, in bytes, of the read buffer.")] + public int ReadBufferSize + { + get + { + return _readBufferSize; + } + set + { + _readBufferSize = value; + } + } + + /// + /// Size, in bytes, of the write buffer. + /// + [Newtonsoft.Json.JsonPropertyAttribute("writeBufferSize")] + [System.ComponentModel.DescriptionAttribute("Size, in bytes, of the write buffer.")] + public int WriteBufferSize + { + get + { + return _writeBufferSize; + } + set + { + _writeBufferSize = value; + } + } + + /// + /// Minimum number of bytes in the buffer that triggers a read event. + /// + [Newtonsoft.Json.JsonPropertyAttribute("receivedBytesThreshold")] + [System.ComponentModel.DescriptionAttribute("Minimum number of bytes in the buffer that triggers a read event.")] + public int ReceivedBytesThreshold + { + get + { + return _receivedBytesThreshold; + } + set + { + _receivedBytesThreshold = value; + } + } + + /// + /// Name of the subject to which parsed serial messages are published. + /// + [Newtonsoft.Json.JsonPropertyAttribute("serialMessageSubjectName")] + [System.ComponentModel.DescriptionAttribute("Name of the subject to which parsed serial messages are published.")] + public string SerialMessageSubjectName + { + get + { + return _serialMessageSubjectName; + } + set + { + _serialMessageSubjectName = value; + } + } + + public System.IObservable Generate() + { + return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new MatrixArduino(this))); + } + + public System.IObservable Generate(System.IObservable source) + { + return System.Reactive.Linq.Observable.Select(source, _ => new MatrixArduino(this)); + } + + protected virtual bool PrintMembers(System.Text.StringBuilder stringBuilder) + { + stringBuilder.Append("DeviceType = " + _deviceType + ", "); + stringBuilder.Append("PortName = " + _portName + ", "); + stringBuilder.Append("BaudRate = " + _baudRate + ", "); + stringBuilder.Append("Encoding = " + _encoding + ", "); + stringBuilder.Append("NewLine = " + _newLine + ", "); + stringBuilder.Append("Parity = " + _parity + ", "); + stringBuilder.Append("ParityReplace = " + _parityReplace + ", "); + stringBuilder.Append("DataBits = " + _dataBits + ", "); + stringBuilder.Append("StopBits = " + _stopBits + ", "); + stringBuilder.Append("Handshake = " + _handshake + ", "); + stringBuilder.Append("DiscardNull = " + _discardNull + ", "); + stringBuilder.Append("DtrEnable = " + _dtrEnable + ", "); + stringBuilder.Append("RtsEnable = " + _rtsEnable + ", "); + stringBuilder.Append("ReadBufferSize = " + _readBufferSize + ", "); + stringBuilder.Append("WriteBufferSize = " + _writeBufferSize + ", "); + stringBuilder.Append("ReceivedBytesThreshold = " + _receivedBytesThreshold + ", "); + stringBuilder.Append("SerialMessageSubjectName = " + _serialMessageSubjectName); + return true; + } + + public override string ToString() + { + System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); + stringBuilder.Append(GetType().Name); + stringBuilder.Append(" { "); + if (PrintMembers(stringBuilder)) + { + stringBuilder.Append(" "); + } + stringBuilder.Append("}"); + return stringBuilder.ToString(); + } + } + + + [System.CodeDom.Compiler.GeneratedCodeAttribute("Bonsai.Sgen", "0.6.1.0 (Newtonsoft.Json v13.0.0.0)")] + [Bonsai.WorkflowElementCategoryAttribute(Bonsai.ElementCategory.Source)] + [Bonsai.CombinatorAttribute(MethodName="Generate")] + public partial class MatrixArduinoData + { + + private int _encoderCount; + + private int _lickCountLeft; + + private int _lickCountRight; + + private int _lastSyncPulseTime; + + private int _photodiodeVal; + + private int _currentMs; + + public MatrixArduinoData() + { + } + + protected MatrixArduinoData(MatrixArduinoData other) + { + _encoderCount = other._encoderCount; + _lickCountLeft = other._lickCountLeft; + _lickCountRight = other._lickCountRight; + _lastSyncPulseTime = other._lastSyncPulseTime; + _photodiodeVal = other._photodiodeVal; + _currentMs = other._currentMs; + } + + [Newtonsoft.Json.JsonPropertyAttribute("encoderCount", Required=Newtonsoft.Json.Required.Always)] + public int EncoderCount + { + get + { + return _encoderCount; + } + set + { + _encoderCount = value; + } + } + + [Newtonsoft.Json.JsonPropertyAttribute("lickCountLeft", Required=Newtonsoft.Json.Required.Always)] + public int LickCountLeft + { + get + { + return _lickCountLeft; + } + set + { + _lickCountLeft = value; + } + } + + [Newtonsoft.Json.JsonPropertyAttribute("lickCountRight", Required=Newtonsoft.Json.Required.Always)] + public int LickCountRight + { + get + { + return _lickCountRight; + } + set + { + _lickCountRight = value; + } + } + + [Newtonsoft.Json.JsonPropertyAttribute("lastSyncPulseTime", Required=Newtonsoft.Json.Required.Always)] + public int LastSyncPulseTime + { + get + { + return _lastSyncPulseTime; + } + set + { + _lastSyncPulseTime = value; + } + } + + [Newtonsoft.Json.JsonPropertyAttribute("photodiodeVal", Required=Newtonsoft.Json.Required.Always)] + public int PhotodiodeVal + { + get + { + return _photodiodeVal; + } + set + { + _photodiodeVal = value; + } + } + + [Newtonsoft.Json.JsonPropertyAttribute("currentMs", Required=Newtonsoft.Json.Required.Always)] + public int CurrentMs + { + get + { + return _currentMs; + } + set + { + _currentMs = value; + } + } + + public System.IObservable Generate() + { + return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new MatrixArduinoData(this))); + } + + public System.IObservable Generate(System.IObservable source) + { + return System.Reactive.Linq.Observable.Select(source, _ => new MatrixArduinoData(this)); + } + + protected virtual bool PrintMembers(System.Text.StringBuilder stringBuilder) + { + stringBuilder.Append("EncoderCount = " + _encoderCount + ", "); + stringBuilder.Append("LickCountLeft = " + _lickCountLeft + ", "); + stringBuilder.Append("LickCountRight = " + _lickCountRight + ", "); + stringBuilder.Append("LastSyncPulseTime = " + _lastSyncPulseTime + ", "); + stringBuilder.Append("PhotodiodeVal = " + _photodiodeVal + ", "); + stringBuilder.Append("CurrentMs = " + _currentMs); + return true; + } + + public override string ToString() + { + System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); + stringBuilder.Append(GetType().Name); + stringBuilder.Append(" { "); + if (PrintMembers(stringBuilder)) + { + stringBuilder.Append(" "); + } + stringBuilder.Append("}"); + return stringBuilder.ToString(); + } + } + + + [System.CodeDom.Compiler.GeneratedCodeAttribute("Bonsai.Sgen", "0.6.1.0 (Newtonsoft.Json v13.0.0.0)")] + [Bonsai.WorkflowElementCategoryAttribute(Bonsai.ElementCategory.Source)] + [Bonsai.CombinatorAttribute(MethodName="Generate")] + public partial class MatrixArduinoPhotodiode + { + + private string _deviceType; + + private string _portName; + + private int _baudRate; + + private string _encoding; + + private string _newLine; + + private string _parity; + + private int _parityReplace; + + private int _dataBits; + + private string _stopBits; + + private string _handshake; + + private bool _discardNull; + + private bool _dtrEnable; + + private bool _rtsEnable; + + private int _readBufferSize; + + private int _writeBufferSize; + + private int _receivedBytesThreshold; + + private string _serialMessageSubjectName; + + public MatrixArduinoPhotodiode() + { + _deviceType = "MatrixArduinoPhotodiode"; + _baudRate = 9600; + _newLine = "\r\n"; + _parity = "None"; + _parityReplace = 63; + _dataBits = 8; + _stopBits = "One"; + _handshake = "None"; + _discardNull = false; + _dtrEnable = false; + _rtsEnable = false; + _readBufferSize = 4096; + _writeBufferSize = 2048; + _receivedBytesThreshold = 1; + _serialMessageSubjectName = "SerialMessages"; + } + + protected MatrixArduinoPhotodiode(MatrixArduinoPhotodiode other) + { + _deviceType = other._deviceType; + _portName = other._portName; + _baudRate = other._baudRate; + _encoding = other._encoding; + _newLine = other._newLine; + _parity = other._parity; + _parityReplace = other._parityReplace; + _dataBits = other._dataBits; + _stopBits = other._stopBits; + _handshake = other._handshake; + _discardNull = other._discardNull; + _dtrEnable = other._dtrEnable; + _rtsEnable = other._rtsEnable; + _readBufferSize = other._readBufferSize; + _writeBufferSize = other._writeBufferSize; + _receivedBytesThreshold = other._receivedBytesThreshold; + _serialMessageSubjectName = other._serialMessageSubjectName; + } + + [Newtonsoft.Json.JsonPropertyAttribute("deviceType")] + public string DeviceType + { + get + { + return _deviceType; + } + set + { + _deviceType = value; + } + } + + /// + /// The name of the device serial port. + /// + [Newtonsoft.Json.JsonPropertyAttribute("portName", Required=Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DescriptionAttribute("The name of the device serial port.")] + public string PortName + { + get + { + return _portName; + } + set + { + _portName = value; + } + } + + /// + /// Baud rate for serial communication. + /// + [Newtonsoft.Json.JsonPropertyAttribute("baudRate")] + [System.ComponentModel.DescriptionAttribute("Baud rate for serial communication.")] + public int BaudRate + { + get + { + return _baudRate; + } + set + { + _baudRate = value; + } + } + + /// + /// Optional text encoding for interpreting incoming bytes. + /// + [Newtonsoft.Json.JsonPropertyAttribute("encoding")] + [System.ComponentModel.DescriptionAttribute("Optional text encoding for interpreting incoming bytes.")] + public string Encoding + { + get + { + return _encoding; + } + set + { + _encoding = value; + } + } + + /// + /// Line termination sequence used to delimit incoming messages. + /// + [Newtonsoft.Json.JsonPropertyAttribute("newLine")] + [System.ComponentModel.DescriptionAttribute("Line termination sequence used to delimit incoming messages.")] + public string NewLine + { + get + { + return _newLine; + } + set + { + _newLine = value; + } + } + + /// + /// Parity checking mode for the serial port. + /// + [Newtonsoft.Json.JsonPropertyAttribute("parity")] + [System.ComponentModel.DescriptionAttribute("Parity checking mode for the serial port.")] + public string Parity { get { - return _brightness; + return _parity; } set { - _brightness = value; + _parity = value; + } + } + + /// + /// Byte used to replace invalid bytes detected by a parity error. + /// + [Newtonsoft.Json.JsonPropertyAttribute("parityReplace")] + [System.ComponentModel.DescriptionAttribute("Byte used to replace invalid bytes detected by a parity error.")] + public int ParityReplace + { + get + { + return _parityReplace; + } + set + { + _parityReplace = value; + } + } + + /// + /// Number of data bits per serial frame. + /// + [Newtonsoft.Json.JsonPropertyAttribute("dataBits")] + [System.ComponentModel.DescriptionAttribute("Number of data bits per serial frame.")] + public int DataBits + { + get + { + return _dataBits; + } + set + { + _dataBits = value; + } + } + + /// + /// Number of stop bits per serial frame. + /// + [Newtonsoft.Json.JsonPropertyAttribute("stopBits")] + [System.ComponentModel.DescriptionAttribute("Number of stop bits per serial frame.")] + public string StopBits + { + get + { + return _stopBits; + } + set + { + _stopBits = value; + } + } + + /// + /// Hardware or software handshaking mode. + /// + [Newtonsoft.Json.JsonPropertyAttribute("handshake")] + [System.ComponentModel.DescriptionAttribute("Hardware or software handshaking mode.")] + public string Handshake + { + get + { + return _handshake; + } + set + { + _handshake = value; + } + } + + /// + /// Whether to discard null bytes appearing in the serial stream. + /// + [Newtonsoft.Json.JsonPropertyAttribute("discardNull")] + [System.ComponentModel.DescriptionAttribute("Whether to discard null bytes appearing in the serial stream.")] + public bool DiscardNull + { + get + { + return _discardNull; + } + set + { + _discardNull = value; + } + } + + /// + /// Whether to enable Data Terminal Ready (DTR) control line. + /// + [Newtonsoft.Json.JsonPropertyAttribute("dtrEnable")] + [System.ComponentModel.DescriptionAttribute("Whether to enable Data Terminal Ready (DTR) control line.")] + public bool DtrEnable + { + get + { + return _dtrEnable; + } + set + { + _dtrEnable = value; + } + } + + /// + /// Whether to enable Request To Send (RTS) control line. + /// + [Newtonsoft.Json.JsonPropertyAttribute("rtsEnable")] + [System.ComponentModel.DescriptionAttribute("Whether to enable Request To Send (RTS) control line.")] + public bool RtsEnable + { + get + { + return _rtsEnable; + } + set + { + _rtsEnable = value; + } + } + + /// + /// Size, in bytes, of the read buffer. + /// + [Newtonsoft.Json.JsonPropertyAttribute("readBufferSize")] + [System.ComponentModel.DescriptionAttribute("Size, in bytes, of the read buffer.")] + public int ReadBufferSize + { + get + { + return _readBufferSize; + } + set + { + _readBufferSize = value; + } + } + + /// + /// Size, in bytes, of the write buffer. + /// + [Newtonsoft.Json.JsonPropertyAttribute("writeBufferSize")] + [System.ComponentModel.DescriptionAttribute("Size, in bytes, of the write buffer.")] + public int WriteBufferSize + { + get + { + return _writeBufferSize; + } + set + { + _writeBufferSize = value; + } + } + + /// + /// Minimum number of bytes in the buffer that triggers a read event. + /// + [Newtonsoft.Json.JsonPropertyAttribute("receivedBytesThreshold")] + [System.ComponentModel.DescriptionAttribute("Minimum number of bytes in the buffer that triggers a read event.")] + public int ReceivedBytesThreshold + { + get + { + return _receivedBytesThreshold; + } + set + { + _receivedBytesThreshold = value; + } + } + + /// + /// Name of the subject to which parsed serial messages are published. + /// + [Newtonsoft.Json.JsonPropertyAttribute("serialMessageSubjectName")] + [System.ComponentModel.DescriptionAttribute("Name of the subject to which parsed serial messages are published.")] + public string SerialMessageSubjectName + { + get + { + return _serialMessageSubjectName; + } + set + { + _serialMessageSubjectName = value; + } + } + + public System.IObservable Generate() + { + return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new MatrixArduinoPhotodiode(this))); + } + + public System.IObservable Generate(System.IObservable source) + { + return System.Reactive.Linq.Observable.Select(source, _ => new MatrixArduinoPhotodiode(this)); + } + + protected virtual bool PrintMembers(System.Text.StringBuilder stringBuilder) + { + stringBuilder.Append("DeviceType = " + _deviceType + ", "); + stringBuilder.Append("PortName = " + _portName + ", "); + stringBuilder.Append("BaudRate = " + _baudRate + ", "); + stringBuilder.Append("Encoding = " + _encoding + ", "); + stringBuilder.Append("NewLine = " + _newLine + ", "); + stringBuilder.Append("Parity = " + _parity + ", "); + stringBuilder.Append("ParityReplace = " + _parityReplace + ", "); + stringBuilder.Append("DataBits = " + _dataBits + ", "); + stringBuilder.Append("StopBits = " + _stopBits + ", "); + stringBuilder.Append("Handshake = " + _handshake + ", "); + stringBuilder.Append("DiscardNull = " + _discardNull + ", "); + stringBuilder.Append("DtrEnable = " + _dtrEnable + ", "); + stringBuilder.Append("RtsEnable = " + _rtsEnable + ", "); + stringBuilder.Append("ReadBufferSize = " + _readBufferSize + ", "); + stringBuilder.Append("WriteBufferSize = " + _writeBufferSize + ", "); + stringBuilder.Append("ReceivedBytesThreshold = " + _receivedBytesThreshold + ", "); + stringBuilder.Append("SerialMessageSubjectName = " + _serialMessageSubjectName); + return true; + } + + public override string ToString() + { + System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); + stringBuilder.Append(GetType().Name); + stringBuilder.Append(" { "); + if (PrintMembers(stringBuilder)) + { + stringBuilder.Append(" "); + } + stringBuilder.Append("}"); + return stringBuilder.ToString(); + } + } + + + [System.CodeDom.Compiler.GeneratedCodeAttribute("Bonsai.Sgen", "0.6.1.0 (Newtonsoft.Json v13.0.0.0)")] + [Bonsai.WorkflowElementCategoryAttribute(Bonsai.ElementCategory.Source)] + [Bonsai.CombinatorAttribute(MethodName="Generate")] + public partial class MatrixArduinoPhotodiodeData + { + + private int _photodiodeVal; + + private int _syncVal; + + public MatrixArduinoPhotodiodeData() + { + } + + protected MatrixArduinoPhotodiodeData(MatrixArduinoPhotodiodeData other) + { + _photodiodeVal = other._photodiodeVal; + _syncVal = other._syncVal; + } + + [Newtonsoft.Json.JsonPropertyAttribute("photodiodeVal", Required=Newtonsoft.Json.Required.Always)] + public int PhotodiodeVal + { + get + { + return _photodiodeVal; + } + set + { + _photodiodeVal = value; } } - /// - /// Contrast - /// - [Newtonsoft.Json.JsonPropertyAttribute("contrast")] - [System.ComponentModel.DescriptionAttribute("Contrast")] - public double Contrast + [Newtonsoft.Json.JsonPropertyAttribute("syncVal", Required=Newtonsoft.Json.Required.Always)] + public int SyncVal { get { - return _contrast; + return _syncVal; } set { - _contrast = value; + _syncVal = value; } } - public System.IObservable Generate() + public System.IObservable Generate() { - return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new Screen(this))); + return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new MatrixArduinoPhotodiodeData(this))); } - public System.IObservable Generate(System.IObservable source) + public System.IObservable Generate(System.IObservable source) { - return System.Reactive.Linq.Observable.Select(source, _ => new Screen(this)); + return System.Reactive.Linq.Observable.Select(source, _ => new MatrixArduinoPhotodiodeData(this)); } protected virtual bool PrintMembers(System.Text.StringBuilder stringBuilder) { - stringBuilder.Append("DeviceType = " + _deviceType + ", "); - stringBuilder.Append("DisplayIndex = " + _displayIndex + ", "); - stringBuilder.Append("TargetRenderFrequency = " + _targetRenderFrequency + ", "); - stringBuilder.Append("TargetUpdateFrequency = " + _targetUpdateFrequency + ", "); - stringBuilder.Append("TextureAssetsDirectory = " + _textureAssetsDirectory + ", "); - stringBuilder.Append("Calibration = " + _calibration + ", "); - stringBuilder.Append("Brightness = " + _brightness + ", "); - stringBuilder.Append("Contrast = " + _contrast); + stringBuilder.Append("PhotodiodeVal = " + _photodiodeVal + ", "); + stringBuilder.Append("SyncVal = " + _syncVal); return true; } @@ -652,100 +1369,56 @@ public override string ToString() } - /// - /// Represents the SerialDevice workflow module. - /// - ///Mirrors all externalized properties of SerialDevice.bonsai, including - ///port configuration, framing, buffer settings, and parsing pattern. - /// [System.CodeDom.Compiler.GeneratedCodeAttribute("Bonsai.Sgen", "0.6.1.0 (Newtonsoft.Json v13.0.0.0)")] - [System.ComponentModel.DescriptionAttribute("Represents the SerialDevice workflow module.\n\nMirrors all externalized properties" + - " of SerialDevice.bonsai, including\nport configuration, framing, buffer settings," + - " and parsing pattern.")] [Bonsai.WorkflowElementCategoryAttribute(Bonsai.ElementCategory.Source)] [Bonsai.CombinatorAttribute(MethodName="Generate")] - public partial class SerialDeviceModule + public partial class Screen { private string _deviceType; - private string _portName; - - private int _baudRate; - - private string _pattern; - - private string _encoding; - - private string _newLine; - - private string _parity; - - private int _parityReplace; - - private int _dataBits; - - private string _stopBits; - - private string _handshake; - - private bool _discardNull; + private int _displayIndex; - private bool _dtrEnable; + private double _targetRenderFrequency; - private bool _rtsEnable; + private double _targetUpdateFrequency; - private int _readBufferSize; + private string _textureAssetsDirectory; - private int _writeBufferSize; + private System.Collections.Generic.Dictionary _calibration; - private int _receivedBytesThreshold; + private double _brightness; - private string _serialMessageSubjectName; + private double _contrast; - public SerialDeviceModule() + public Screen() { - _deviceType = "SerialDevice"; - _baudRate = 9600; - _pattern = ""; - _newLine = "\r\n"; - _parity = "None"; - _parityReplace = 63; - _dataBits = 8; - _stopBits = "One"; - _handshake = "None"; - _discardNull = false; - _dtrEnable = false; - _rtsEnable = false; - _readBufferSize = 4096; - _writeBufferSize = 2048; - _receivedBytesThreshold = 1; - _serialMessageSubjectName = "SerialMessages"; + _deviceType = "Screen"; + _displayIndex = 1; + _targetRenderFrequency = 60D; + _targetUpdateFrequency = 120D; + _textureAssetsDirectory = "Textures"; + _brightness = 0D; + _contrast = 1D; } - protected SerialDeviceModule(SerialDeviceModule other) + protected Screen(Screen other) { _deviceType = other._deviceType; - _portName = other._portName; - _baudRate = other._baudRate; - _pattern = other._pattern; - _encoding = other._encoding; - _newLine = other._newLine; - _parity = other._parity; - _parityReplace = other._parityReplace; - _dataBits = other._dataBits; - _stopBits = other._stopBits; - _handshake = other._handshake; - _discardNull = other._discardNull; - _dtrEnable = other._dtrEnable; - _rtsEnable = other._rtsEnable; - _readBufferSize = other._readBufferSize; - _writeBufferSize = other._writeBufferSize; - _receivedBytesThreshold = other._receivedBytesThreshold; - _serialMessageSubjectName = other._serialMessageSubjectName; + _displayIndex = other._displayIndex; + _targetRenderFrequency = other._targetRenderFrequency; + _targetUpdateFrequency = other._targetUpdateFrequency; + _textureAssetsDirectory = other._textureAssetsDirectory; + _calibration = other._calibration; + _brightness = other._brightness; + _contrast = other._contrast; } + /// + /// Device type + /// [Newtonsoft.Json.JsonPropertyAttribute("deviceType")] + [System.ComponentModel.DescriptionAttribute("Device type")] public string DeviceType { get @@ -759,325 +1432,257 @@ public string DeviceType } /// - /// The name of the device serial port. + /// Display index /// - [Newtonsoft.Json.JsonPropertyAttribute("portName", Required=Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DescriptionAttribute("The name of the device serial port.")] - public string PortName + [Newtonsoft.Json.JsonPropertyAttribute("displayIndex")] + [System.ComponentModel.DescriptionAttribute("Display index")] + public int DisplayIndex { get { - return _portName; + return _displayIndex; } set { - _portName = value; + _displayIndex = value; } } /// - /// Baud rate for serial communication. + /// Target render frequency /// - [Newtonsoft.Json.JsonPropertyAttribute("baudRate")] - [System.ComponentModel.DescriptionAttribute("Baud rate for serial communication.")] - public int BaudRate + [Newtonsoft.Json.JsonPropertyAttribute("targetRenderFrequency")] + [System.ComponentModel.DescriptionAttribute("Target render frequency")] + public double TargetRenderFrequency { get { - return _baudRate; + return _targetRenderFrequency; } set { - _baudRate = value; + _targetRenderFrequency = value; } } /// - /// Pattern used to parse each incoming serial line (same syntax as Bonsai Parse/ScanPattern). + /// Target update frequency /// - [Newtonsoft.Json.JsonPropertyAttribute("pattern")] - [System.ComponentModel.DescriptionAttribute("Pattern used to parse each incoming serial line (same syntax as Bonsai Parse/Scan" + - "Pattern).")] - public string Pattern + [Newtonsoft.Json.JsonPropertyAttribute("targetUpdateFrequency")] + [System.ComponentModel.DescriptionAttribute("Target update frequency")] + public double TargetUpdateFrequency { get { - return _pattern; + return _targetUpdateFrequency; } set { - _pattern = value; + _targetUpdateFrequency = value; } } /// - /// Optional text encoding for interpreting incoming bytes. + /// Calibration directory /// - [Newtonsoft.Json.JsonPropertyAttribute("encoding")] - [System.ComponentModel.DescriptionAttribute("Optional text encoding for interpreting incoming bytes.")] - public string Encoding + [Newtonsoft.Json.JsonPropertyAttribute("textureAssetsDirectory")] + [System.ComponentModel.DescriptionAttribute("Calibration directory")] + public string TextureAssetsDirectory { get { - return _encoding; + return _textureAssetsDirectory; } set { - _encoding = value; + _textureAssetsDirectory = value; } } /// - /// Line termination sequence used to delimit incoming messages. + /// Calibration parameters for a set of named display monitors for visual stimuli /// - [Newtonsoft.Json.JsonPropertyAttribute("newLine")] - [System.ComponentModel.DescriptionAttribute("Line termination sequence used to delimit incoming messages.")] - public string NewLine + [System.Xml.Serialization.XmlIgnoreAttribute()] + [Newtonsoft.Json.JsonPropertyAttribute("calibration")] + [System.ComponentModel.DescriptionAttribute("Calibration parameters for a set of named display monitors for visual stimuli")] + public System.Collections.Generic.Dictionary Calibration { get { - return _newLine; + return _calibration; } set { - _newLine = value; + _calibration = value; } } /// - /// Parity checking mode for the serial port. + /// Brightness /// - [Newtonsoft.Json.JsonPropertyAttribute("parity")] - [System.ComponentModel.DescriptionAttribute("Parity checking mode for the serial port.")] - public string Parity + [Newtonsoft.Json.JsonPropertyAttribute("brightness")] + [System.ComponentModel.DescriptionAttribute("Brightness")] + public double Brightness { get { - return _parity; + return _brightness; } set { - _parity = value; + _brightness = value; } } /// - /// Byte used to replace invalid bytes detected by a parity error. + /// Contrast /// - [Newtonsoft.Json.JsonPropertyAttribute("parityReplace")] - [System.ComponentModel.DescriptionAttribute("Byte used to replace invalid bytes detected by a parity error.")] - public int ParityReplace + [Newtonsoft.Json.JsonPropertyAttribute("contrast")] + [System.ComponentModel.DescriptionAttribute("Contrast")] + public double Contrast { get { - return _parityReplace; + return _contrast; } set { - _parityReplace = value; + _contrast = value; } } - /// - /// Number of data bits per serial frame. - /// - [Newtonsoft.Json.JsonPropertyAttribute("dataBits")] - [System.ComponentModel.DescriptionAttribute("Number of data bits per serial frame.")] - public int DataBits + public System.IObservable Generate() { - get - { - return _dataBits; - } - set - { - _dataBits = value; - } + return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new Screen(this))); } - /// - /// Number of stop bits per serial frame. - /// - [Newtonsoft.Json.JsonPropertyAttribute("stopBits")] - [System.ComponentModel.DescriptionAttribute("Number of stop bits per serial frame.")] - public string StopBits + public System.IObservable Generate(System.IObservable source) { - get - { - return _stopBits; - } - set - { - _stopBits = value; - } + return System.Reactive.Linq.Observable.Select(source, _ => new Screen(this)); } - /// - /// Hardware or software handshaking mode. - /// - [Newtonsoft.Json.JsonPropertyAttribute("handshake")] - [System.ComponentModel.DescriptionAttribute("Hardware or software handshaking mode.")] - public string Handshake + protected virtual bool PrintMembers(System.Text.StringBuilder stringBuilder) { - get - { - return _handshake; - } - set - { - _handshake = value; - } + stringBuilder.Append("DeviceType = " + _deviceType + ", "); + stringBuilder.Append("DisplayIndex = " + _displayIndex + ", "); + stringBuilder.Append("TargetRenderFrequency = " + _targetRenderFrequency + ", "); + stringBuilder.Append("TargetUpdateFrequency = " + _targetUpdateFrequency + ", "); + stringBuilder.Append("TextureAssetsDirectory = " + _textureAssetsDirectory + ", "); + stringBuilder.Append("Calibration = " + _calibration + ", "); + stringBuilder.Append("Brightness = " + _brightness + ", "); + stringBuilder.Append("Contrast = " + _contrast); + return true; } - /// - /// Whether to discard null bytes appearing in the serial stream. - /// - [Newtonsoft.Json.JsonPropertyAttribute("discardNull")] - [System.ComponentModel.DescriptionAttribute("Whether to discard null bytes appearing in the serial stream.")] - public bool DiscardNull + public override string ToString() { - get - { - return _discardNull; - } - set + System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); + stringBuilder.Append(GetType().Name); + stringBuilder.Append(" { "); + if (PrintMembers(stringBuilder)) { - _discardNull = value; + stringBuilder.Append(" "); } + stringBuilder.Append("}"); + return stringBuilder.ToString(); } + } + + + [System.CodeDom.Compiler.GeneratedCodeAttribute("Bonsai.Sgen", "0.6.1.0 (Newtonsoft.Json v13.0.0.0)")] + [Bonsai.WorkflowElementCategoryAttribute(Bonsai.ElementCategory.Source)] + [Bonsai.CombinatorAttribute(MethodName="Generate")] + public partial class SyncQuad + { - /// - /// Whether to enable Data Terminal Ready (DTR) control line. - /// - [Newtonsoft.Json.JsonPropertyAttribute("dtrEnable")] - [System.ComponentModel.DescriptionAttribute("Whether to enable Data Terminal Ready (DTR) control line.")] - public bool DtrEnable + private double _extentX; + + private double _extentY; + + private double _locationX; + + private double _locationY; + + public SyncQuad() { - get - { - return _dtrEnable; - } - set - { - _dtrEnable = value; - } } - /// - /// Whether to enable Request To Send (RTS) control line. - /// - [Newtonsoft.Json.JsonPropertyAttribute("rtsEnable")] - [System.ComponentModel.DescriptionAttribute("Whether to enable Request To Send (RTS) control line.")] - public bool RtsEnable + protected SyncQuad(SyncQuad other) { - get - { - return _rtsEnable; - } - set - { - _rtsEnable = value; - } + _extentX = other._extentX; + _extentY = other._extentY; + _locationX = other._locationX; + _locationY = other._locationY; } - /// - /// Size, in bytes, of the read buffer. - /// - [Newtonsoft.Json.JsonPropertyAttribute("readBufferSize")] - [System.ComponentModel.DescriptionAttribute("Size, in bytes, of the read buffer.")] - public int ReadBufferSize + [Newtonsoft.Json.JsonPropertyAttribute("extentX", Required=Newtonsoft.Json.Required.Always)] + public double ExtentX { get { - return _readBufferSize; + return _extentX; } set { - _readBufferSize = value; + _extentX = value; } } - /// - /// Size, in bytes, of the write buffer. - /// - [Newtonsoft.Json.JsonPropertyAttribute("writeBufferSize")] - [System.ComponentModel.DescriptionAttribute("Size, in bytes, of the write buffer.")] - public int WriteBufferSize + [Newtonsoft.Json.JsonPropertyAttribute("extentY", Required=Newtonsoft.Json.Required.Always)] + public double ExtentY { get { - return _writeBufferSize; + return _extentY; } set { - _writeBufferSize = value; + _extentY = value; } } - /// - /// Minimum number of bytes in the buffer that triggers a read event. - /// - [Newtonsoft.Json.JsonPropertyAttribute("receivedBytesThreshold")] - [System.ComponentModel.DescriptionAttribute("Minimum number of bytes in the buffer that triggers a read event.")] - public int ReceivedBytesThreshold + [Newtonsoft.Json.JsonPropertyAttribute("locationX", Required=Newtonsoft.Json.Required.Always)] + public double LocationX { get { - return _receivedBytesThreshold; + return _locationX; } set { - _receivedBytesThreshold = value; + _locationX = value; } } - /// - /// Name of the subject to which parsed serial messages are published. - /// - [Newtonsoft.Json.JsonPropertyAttribute("serialMessageSubjectName")] - [System.ComponentModel.DescriptionAttribute("Name of the subject to which parsed serial messages are published.")] - public string SerialMessageSubjectName + [Newtonsoft.Json.JsonPropertyAttribute("locationY", Required=Newtonsoft.Json.Required.Always)] + public double LocationY { get { - return _serialMessageSubjectName; + return _locationY; } set { - _serialMessageSubjectName = value; + _locationY = value; } } - public System.IObservable Generate() + public System.IObservable Generate() { - return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new SerialDeviceModule(this))); + return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new SyncQuad(this))); } - public System.IObservable Generate(System.IObservable source) + public System.IObservable Generate(System.IObservable source) { - return System.Reactive.Linq.Observable.Select(source, _ => new SerialDeviceModule(this)); + return System.Reactive.Linq.Observable.Select(source, _ => new SyncQuad(this)); } protected virtual bool PrintMembers(System.Text.StringBuilder stringBuilder) { - stringBuilder.Append("DeviceType = " + _deviceType + ", "); - stringBuilder.Append("PortName = " + _portName + ", "); - stringBuilder.Append("BaudRate = " + _baudRate + ", "); - stringBuilder.Append("Pattern = " + _pattern + ", "); - stringBuilder.Append("Encoding = " + _encoding + ", "); - stringBuilder.Append("NewLine = " + _newLine + ", "); - stringBuilder.Append("Parity = " + _parity + ", "); - stringBuilder.Append("ParityReplace = " + _parityReplace + ", "); - stringBuilder.Append("DataBits = " + _dataBits + ", "); - stringBuilder.Append("StopBits = " + _stopBits + ", "); - stringBuilder.Append("Handshake = " + _handshake + ", "); - stringBuilder.Append("DiscardNull = " + _discardNull + ", "); - stringBuilder.Append("DtrEnable = " + _dtrEnable + ", "); - stringBuilder.Append("RtsEnable = " + _rtsEnable + ", "); - stringBuilder.Append("ReadBufferSize = " + _readBufferSize + ", "); - stringBuilder.Append("WriteBufferSize = " + _writeBufferSize + ", "); - stringBuilder.Append("ReceivedBytesThreshold = " + _receivedBytesThreshold + ", "); - stringBuilder.Append("SerialMessageSubjectName = " + _serialMessageSubjectName); + stringBuilder.Append("ExtentX = " + _extentX + ", "); + stringBuilder.Append("ExtentY = " + _extentY + ", "); + stringBuilder.Append("LocationX = " + _locationX + ", "); + stringBuilder.Append("LocationY = " + _locationY); return true; } @@ -1106,20 +1711,28 @@ public partial class UclOpenHfVisualRig private Screen _screen; - private SerialDeviceModule _arduino; + private SyncQuad _syncQuad; + + private MatrixArduino _arduino; + + private MatrixArduinoPhotodiode _arduinoPhotodiode; public UclOpenHfVisualRig() { _version = "0.0.0-rc1"; _screen = new Screen(); - _arduino = new SerialDeviceModule(); + _syncQuad = new SyncQuad(); + _arduino = new MatrixArduino(); + _arduinoPhotodiode = new MatrixArduinoPhotodiode(); } protected UclOpenHfVisualRig(UclOpenHfVisualRig other) { _version = other._version; _screen = other._screen; + _syncQuad = other._syncQuad; _arduino = other._arduino; + _arduinoPhotodiode = other._arduinoPhotodiode; } [Newtonsoft.Json.JsonPropertyAttribute("version")] @@ -1149,9 +1762,23 @@ public Screen Screen } } + [System.Xml.Serialization.XmlIgnoreAttribute()] + [Newtonsoft.Json.JsonPropertyAttribute("syncQuad", Required=Newtonsoft.Json.Required.Always)] + public SyncQuad SyncQuad + { + get + { + return _syncQuad; + } + set + { + _syncQuad = value; + } + } + [System.Xml.Serialization.XmlIgnoreAttribute()] [Newtonsoft.Json.JsonPropertyAttribute("arduino", Required=Newtonsoft.Json.Required.Always)] - public SerialDeviceModule Arduino + public MatrixArduino Arduino { get { @@ -1163,6 +1790,20 @@ public SerialDeviceModule Arduino } } + [System.Xml.Serialization.XmlIgnoreAttribute()] + [Newtonsoft.Json.JsonPropertyAttribute("arduinoPhotodiode", Required=Newtonsoft.Json.Required.Always)] + public MatrixArduinoPhotodiode ArduinoPhotodiode + { + get + { + return _arduinoPhotodiode; + } + set + { + _arduinoPhotodiode = value; + } + } + public System.IObservable Generate() { return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new UclOpenHfVisualRig(this))); @@ -1177,7 +1818,9 @@ protected virtual bool PrintMembers(System.Text.StringBuilder stringBuilder) { stringBuilder.Append("Version = " + _version + ", "); stringBuilder.Append("Screen = " + _screen + ", "); - stringBuilder.Append("Arduino = " + _arduino); + stringBuilder.Append("SyncQuad = " + _syncQuad + ", "); + stringBuilder.Append("Arduino = " + _arduino + ", "); + stringBuilder.Append("ArduinoPhotodiode = " + _arduinoPhotodiode); return true; } @@ -1439,6 +2082,164 @@ public override string ToString() } + [System.CodeDom.Compiler.GeneratedCodeAttribute("Bonsai.Sgen", "0.6.1.0 (Newtonsoft.Json v13.0.0.0)")] + [Bonsai.WorkflowElementCategoryAttribute(Bonsai.ElementCategory.Source)] + [Bonsai.CombinatorAttribute(MethodName="Generate")] + public partial class UclOpenSession + { + + private string _workflow; + + private string _commit; + + private string _repositoryUrl; + + private string _loggingRootPath; + + private string _animalId; + + private string _sessionId; + + public UclOpenSession() + { + } + + protected UclOpenSession(UclOpenSession other) + { + _workflow = other._workflow; + _commit = other._commit; + _repositoryUrl = other._repositoryUrl; + _loggingRootPath = other._loggingRootPath; + _animalId = other._animalId; + _sessionId = other._sessionId; + } + + /// + /// Path to the workflow running the experiment. + /// + [Newtonsoft.Json.JsonPropertyAttribute("workflow", Required=Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DescriptionAttribute("Path to the workflow running the experiment.")] + public string Workflow + { + get + { + return _workflow; + } + set + { + _workflow = value; + } + } + + /// + /// Commit hash of the experiment/rig repo. + /// + [Newtonsoft.Json.JsonPropertyAttribute("commit", Required=Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DescriptionAttribute("Commit hash of the experiment/rig repo.")] + public string Commit + { + get + { + return _commit; + } + set + { + _commit = value; + } + } + + /// + /// The URL of the git repository used to version experiment source code. + /// + [Newtonsoft.Json.JsonPropertyAttribute("repositoryUrl", Required=Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DescriptionAttribute("The URL of the git repository used to version experiment source code.")] + public string RepositoryUrl + { + get + { + return _repositoryUrl; + } + set + { + _repositoryUrl = value; + } + } + + [Newtonsoft.Json.JsonPropertyAttribute("loggingRootPath", Required=Newtonsoft.Json.Required.Always)] + public string LoggingRootPath + { + get + { + return _loggingRootPath; + } + set + { + _loggingRootPath = value; + } + } + + [Newtonsoft.Json.JsonPropertyAttribute("animalId", Required=Newtonsoft.Json.Required.Always)] + public string AnimalId + { + get + { + return _animalId; + } + set + { + _animalId = value; + } + } + + [Newtonsoft.Json.JsonPropertyAttribute("sessionId", Required=Newtonsoft.Json.Required.Always)] + public string SessionId + { + get + { + return _sessionId; + } + set + { + _sessionId = value; + } + } + + public System.IObservable Generate() + { + return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new UclOpenSession(this))); + } + + public System.IObservable Generate(System.IObservable source) + { + return System.Reactive.Linq.Observable.Select(source, _ => new UclOpenSession(this)); + } + + protected virtual bool PrintMembers(System.Text.StringBuilder stringBuilder) + { + stringBuilder.Append("Workflow = " + _workflow + ", "); + stringBuilder.Append("Commit = " + _commit + ", "); + stringBuilder.Append("RepositoryUrl = " + _repositoryUrl + ", "); + stringBuilder.Append("LoggingRootPath = " + _loggingRootPath + ", "); + stringBuilder.Append("AnimalId = " + _animalId + ", "); + stringBuilder.Append("SessionId = " + _sessionId); + return true; + } + + public override string ToString() + { + System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); + stringBuilder.Append(GetType().Name); + stringBuilder.Append(" { "); + if (PrintMembers(stringBuilder)) + { + stringBuilder.Append(" "); + } + stringBuilder.Append("}"); + return stringBuilder.ToString(); + } + } + + [System.CodeDom.Compiler.GeneratedCodeAttribute("Bonsai.Sgen", "0.6.1.0 (Newtonsoft.Json v13.0.0.0)")] [Bonsai.WorkflowElementCategoryAttribute(Bonsai.ElementCategory.Source)] [Bonsai.CombinatorAttribute(MethodName="Generate")] @@ -1463,10 +2264,10 @@ protected Vector3(Vector3 other) } /// - /// X coordinate of the point + /// X coordinate of the point. /// [Newtonsoft.Json.JsonPropertyAttribute("x", Required=Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DescriptionAttribute("X coordinate of the point")] + [System.ComponentModel.DescriptionAttribute("X coordinate of the point.")] public double X { get @@ -1480,10 +2281,10 @@ public double X } /// - /// Y coordinate of the point + /// Y coordinate of the point. /// [Newtonsoft.Json.JsonPropertyAttribute("y", Required=Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DescriptionAttribute("Y coordinate of the point")] + [System.ComponentModel.DescriptionAttribute("Y coordinate of the point.")] public double Y { get @@ -1497,10 +2298,10 @@ public double Y } /// - /// Z coordinate of the point + /// Z coordinate of the point. /// [Newtonsoft.Json.JsonPropertyAttribute("z", Required=Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DescriptionAttribute("Z coordinate of the point")] + [System.ComponentModel.DescriptionAttribute("Z coordinate of the point.")] public double Z { get @@ -1579,9 +2380,24 @@ public System.IObservable Process(System.IObservable return Process(source); } - public System.IObservable Process(System.IObservable source) + public System.IObservable Process(System.IObservable source) + { + return Process(source); + } + + public System.IObservable Process(System.IObservable source) + { + return Process(source); + } + + public System.IObservable Process(System.IObservable source) + { + return Process(source); + } + + public System.IObservable Process(System.IObservable source) { - return Process(source); + return Process(source); } public System.IObservable Process(System.IObservable source) @@ -1589,9 +2405,9 @@ public System.IObservable Process(System.IObservable source) return Process(source); } - public System.IObservable Process(System.IObservable source) + public System.IObservable Process(System.IObservable source) { - return Process(source); + return Process(source); } public System.IObservable Process(System.IObservable source) @@ -1609,6 +2425,11 @@ public System.IObservable Process(System.IObservable(source); } + public System.IObservable Process(System.IObservable source) + { + return Process(source); + } + public System.IObservable Process(System.IObservable source) { return Process(source); @@ -1626,12 +2447,16 @@ public System.IObservable Process(System.IObservable source) [System.Xml.Serialization.XmlIncludeAttribute(typeof(Bonsai.Expressions.TypeMapping))] [System.Xml.Serialization.XmlIncludeAttribute(typeof(Bonsai.Expressions.TypeMapping))] [System.Xml.Serialization.XmlIncludeAttribute(typeof(Bonsai.Expressions.TypeMapping))] - [System.Xml.Serialization.XmlIncludeAttribute(typeof(Bonsai.Expressions.TypeMapping))] + [System.Xml.Serialization.XmlIncludeAttribute(typeof(Bonsai.Expressions.TypeMapping))] + [System.Xml.Serialization.XmlIncludeAttribute(typeof(Bonsai.Expressions.TypeMapping))] + [System.Xml.Serialization.XmlIncludeAttribute(typeof(Bonsai.Expressions.TypeMapping))] + [System.Xml.Serialization.XmlIncludeAttribute(typeof(Bonsai.Expressions.TypeMapping))] [System.Xml.Serialization.XmlIncludeAttribute(typeof(Bonsai.Expressions.TypeMapping))] - [System.Xml.Serialization.XmlIncludeAttribute(typeof(Bonsai.Expressions.TypeMapping))] + [System.Xml.Serialization.XmlIncludeAttribute(typeof(Bonsai.Expressions.TypeMapping))] [System.Xml.Serialization.XmlIncludeAttribute(typeof(Bonsai.Expressions.TypeMapping))] [System.Xml.Serialization.XmlIncludeAttribute(typeof(Bonsai.Expressions.TypeMapping))] [System.Xml.Serialization.XmlIncludeAttribute(typeof(Bonsai.Expressions.TypeMapping))] + [System.Xml.Serialization.XmlIncludeAttribute(typeof(Bonsai.Expressions.TypeMapping))] [System.Xml.Serialization.XmlIncludeAttribute(typeof(Bonsai.Expressions.TypeMapping))] public partial class DeserializeFromJson : Bonsai.Expressions.SingleArgumentExpressionBuilder { diff --git a/src/main.bonsai b/src/main.bonsai index be11309..70224c3 100644 --- a/src/main.bonsai +++ b/src/main.bonsai @@ -4,12 +4,19 @@ xmlns:io="clr-namespace:Bonsai.IO;assembly=Bonsai.System" xmlns:rx="clr-namespace:Bonsai.Reactive;assembly=Bonsai.Core" xmlns:p1="clr-namespace:UclOpenHfVisualDataSchema;assembly=Extensions" + xmlns:p2="clr-namespace:System.Reactive;assembly=System.Reactive.Core" + xmlns:sys="clr-namespace:System;assembly=mscorlib" + xmlns:p3="clr-namespace:;assembly=Extensions" xmlns:gl="clr-namespace:Bonsai.Shaders;assembly=Bonsai.Shaders" xmlns:res="clr-namespace:Bonsai.Resources;assembly=Bonsai.System" - xmlns:num="clr-namespace:Bonsai.Numerics;assembly=Bonsai.Numerics" xmlns:scr="clr-namespace:Bonsai.Scripting.Expressions;assembly=Bonsai.Scripting.Expressions" + xmlns:cv="clr-namespace:Bonsai.Vision;assembly=Bonsai.Vision" + xmlns:num="clr-namespace:Bonsai.Numerics;assembly=Bonsai.Numerics" + xmlns:gui="clr-namespace:Bonsai.Gui;assembly=Bonsai.Gui" + xmlns:zg="clr-namespace:Bonsai.Gui.ZedGraph;assembly=Bonsai.Gui.ZedGraph" + xmlns:p4="clr-namespace:UclOpen.Core;assembly=UclOpen.Core" xmlns:harp="clr-namespace:Bonsai.Harp;assembly=Bonsai.Harp" - xmlns:p2="clr-namespace:UclOpen.Core;assembly=UclOpen.Core" + xmlns:p5="clr-namespace:UclOpen.Logging;assembly=UclOpen.Logging" xmlns="https://bonsai-rx.org/2018/workflow"> @@ -18,6 +25,10 @@ + + TODO + + ReadSchemas @@ -27,7 +38,7 @@ - C:\Users\neurogears\source\repos\ucl-open\hf-visual\local\Experiment.json + C:\Users\saleem_lab\Documents\GitHub\hf-visual\local\UclOpenSession.json @@ -38,7 +49,7 @@ - C:\Users\neurogears\source\repos\ucl-open\hf-visual\local\UclOpenHfVisualRig.json + C:\Users\saleem_lab\Documents\GitHub\hf-visual\local\UclOpenHfVisualRig.json @@ -49,7 +60,7 @@ - C:\Users\neurogears\source\repos\ucl-open\hf-visual\local\UclOpenHfVisualTaskLogic.json + C:\Users\saleem_lab\Documents\GitHub\hf-visual\local\UclOpenHfVisualTaskLogic.json @@ -82,7 +93,7 @@ RawSessionSchema - + @@ -90,7 +101,7 @@ - SubjectSchema + SessionSchema RawRigSchema @@ -142,587 +153,2033 @@ - - RigSchema - - - Arduino - - - - - - - - - - - COM10 - 1000000 - - - - None - 63 - 8 - One - None - false - false - false - 4096 - 2048 - 1 - Arduino - %d - , - SerialMessages - - - RigSchema - - - Screen - - - - - - - - - - - 640 - 480 - On - false - Black - DepthBufferBit ColorBufferBit - true - - Resizable - Fullscreen - Second - 60 - 120 - - - - 8 - 8 - 8 - 8 - - 16 - 0 - 0 - - 0 - 0 - 0 - 0 - - 2 - false - - - - - - - - - RigSchema - - - Screen.TextureAssetsDirectory - - - - - - - - TODO - + + Initialization + + + + StartExperiment + + + StopExperiment + + + CurrentTexture + + + + - LoadTextureBank + Hardware - - - + + RigSchema + + + Arduino + + + + + + + + + + COM4 + 1000000 + us-ascii + \n + None + 63 + 8 + One + None + false + true + false + 4096 + 2048 + 1 + Arduino + SerialMessagesMatrix + + + RigSchema + + + ArduinoPhotodiode + + + + + + + + + + COM5 + 250000 + us-ascii + \n + None + 63 + 8 + One + None + false + true + false + 4096 + 2048 + 1 + ArduinoPhotodiode + SerialMessagesPhotodiode + + + SerialMessagesMatrix - - ../textures - *.tif - TopDirectoryOnly - + + + + MatrixArduino + + + SerialMessagesPhotodiode - + - - LoadTexture + + MatrixPhotodiode + + + Display - - Source1 + + RigSchema + + + Screen + + + + + + + + + + RigSchema + + + Screen.Calibration + + + + main + + + + Intrinsics.FrameWidth + + + + + + + + RigSchema + + + Screen.Calibration + + + + main + + + + Intrinsics.FrameHeight + + + + + - - 1 + + 640 + 480 + On + false + Black + DepthBufferBit ColorBufferBit + true + + Resizable + Fullscreen + Second + 60 + 120 + + + + 8 + 8 + 8 + 8 + + 16 + 0 + 0 + + 0 + 0 + 0 + 0 + + 2 + false + - - TexturePath + + + + + + RigSchema + + + Screen.TextureAssetsDirectory + + + + + + + + TODO + + + + LoadTextureBank + + + + + + + + + ../textures + *.tif + TopDirectoryOnly + + + + + + + LoadTexture + + + + Source1 + + + + 1 + + + + TexturePath + + + TexturePath + + + + + + TexturePath + + + + + + + + + + + Rgba + Repeat + Repeat + Linear + Linear + ../textures\SynthIm_42_5.tif + Unchanged + Vertical + + + + + + + + + + + + + + + + + + + + + + + + Item1 + Item2 + + + + + + TextureBank + + + + + + + + + + + + + + + + + + -1 + 1 + -1 + 1 + + + DrawCall + + + + + + + + + + + + + + DebugView + + + DrawCall + + + + 2 + 2 + 0 + 0 + 0 + 0 + 1 + 1 + 0 + 0 + + + DrawCall - TexturePath + SyncQuadColor + + + it ? 1.0 : 0.0 - + + + + + + + + + Item1 - TexturePath + RigSchema + + + SyncQuad - + + + + + + 0.1 + 0.1 + -1 + -1 + 0 + 0 + 0 + 0 + 0 + 1 + - - - - Rgba - Repeat - Repeat - Linear - Linear - ../textures\SynthIm_42_5.tif - Unchanged - Vertical + + false - - + + SyncQuadColor - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + - + + 0 + + - - Item1 - Item2 + + MatrixArduino - - + + - - TextureBank + + CameraStream - - - + + + + + + + + + - - - - - -1 - 1 - -1 - 1 - - - DrawCall - - - DrawCall - - - - 2 - 2 - 0 - 0 - 0 - 0 - 1 - 1 - 0 - 0 - - - TaskLogicParameters - - - AvailableTextures - - - - - - - - - TextureBank - - - - - - PresentationSequence + + TaskLogic - - Source1 - - - - 1 - - - - TextureName - - - TextureBank - - - TextureName - - - - - - - - - SN_1_1 - - - - - Texture0 - Image - - Texture2D - - TaskLogicParameters - PresentationTime - - - TimeSpan.FromSeconds(it) - - - - - + AvailableTextures - - PT1S - - - - TextureBank - - - - - - Item2 - - - TaskLogicParameters - - - InterPresentationTexture - - - - - - - - - SN_1_2 - + - - Texture0 - Image - - Texture2D - + - TaskLogicParameters - - - InterPresentationTime - - - TimeSpan.FromSeconds(it) - - - - - - - - - PT0.5S - + TextureBank - - 1 - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Algernon - 001 - C:\Users\neurogears\source\repos\ucl-open\hf-visual\temp_data + + PresentationSequence + + + + Source1 + + + + 1 + + + + TextureName + + + TextureBank + + + TaskLogicParameters + + + InterPresentationTexture + + + + + + + + + blankStim_1 + + + + + Texture0 + Image + + Texture2D + + + + UpdateSyncQuad + + + + Source1 + + + + + + + false + + + + SyncQuadColor + + + + + + + + + + + + + UpdateCurrentTexture + + + + Source1 + + + TaskLogicParameters + + + InterPresentationTexture + + + + + + Item2 + + + CurrentTexture + + + + + + + + + + + + + + + TaskLogicParameters + + + InterPresentationTime + + + TimeSpan.FromSeconds(it) + + + + + + + + + PT0.5S + + + + TextureBank + + + + + + Item2 + + + TextureName + + + + + + + + + SN_1_1 + + + + + Texture0 + Image + + Texture2D + + + + UpdateSyncQuad + + + + Source1 + + + + + + + true + + + + SyncQuadColor + + + + + + + + + + + + + UpdateCurrentTexture + + + + Source1 + + + TextureName + + + + + + Item2 + + + CurrentTexture + + + + + + + + + + + + + + TaskLogicParameters + + + PresentationTime + + + TimeSpan.FromSeconds(it) + + + + + + + + + PT1S + + + + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - SerialMessages - - - new( - it[0] as EncoderCount, - it[1] as LickCountLeft, - it[2] as LickCountRight, - it[3] as LastSyncPulseTime, - it[4] as PhotodiodeVal, - it[5] as ArduinoMilliseconds -) - - - ArduinoMilliseconds - - - - 1000 - + StartExperiment - + + + + StopExperiment - + - - TODO - + + Visualizer + + + + StartButton + true + true + Start + + + StartExperiment + + + + Source1 + + + + StartExperiment + + + + + + + + + + + + + StopButton + true + true + Stop + + + StopExperiment + + + + Source1 + + + + StopExperiment + + + + + + + + + + + + + ExperimentControls + true + true + 2 + 1 + + + + + + + ExperimentControls + true + true + Experiment Controls + + + + CurrentTexture + + + + CurrentTexture + true + true + Current Texture + + + + MatrixArduino + + + Value.EncoderCount + + + None + 2 + + + + + + + + Encoder + true + true + Encoder + + + + MatrixArduino + + + Value.LastSyncPulseTime + + + + + + + 1 + + + + + + 2 + + + + None + 2 + + + + + + + + SyncPulse + true + true + Sync Pulse + + + + DebugView + + + + Display + true + true + Display + + + + MatrixPhotodiode + + + PhotodiodeVal + + + + Photodiode + true + true + Photodiode + + + + CameraStream + + + + ExperimentPanel + true + true + 2 + 4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - LogData + Logging - - Source1 + + SessionSchema - - - + + LoggingRootPath + + + + + + + + SessionSchema + + + AnimalId + + + + + + + + SessionSchema + + + SessionId + + + + + + + + Plimbo + 001 + C:/Users/saleem_lab/Documents/GitHub/hf-visual/temp_data + + + MatrixArduino + + + TODO + - FormatFileName - Generates a log filename based on the input timestamp. + LogData - - PathPrefix + + Source1 + + + + + + + FormatFileName + Generates a log filename based on the input timestamp. + + + + PathPrefix + + + Source1 + + + + + + + Arduino + + + + + 1 + + + + + + + + + + + csv + + + + + 1 + + + + + + + {0}\{1}\{2}.{3} + Item1,Item2,Item3,Item4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + C:/Users/saleem_lab/Documents/GitHub/hf-visual/temp_data\sub-Plimbo\ses-001_date-2025-12-11T17-45-39\Arduino\Arduino.csv + false + false + None + true + it + + + + + + + + + + + + + + + MatrixPhotodiode + + + MatrixArduino + + + Seconds + + + + + + + + + LogData + + Source1 - + + - - - Arduino - + + FormatFileName + Generates a log filename based on the input timestamp. + + + + PathPrefix + + + Source1 + + + + + + + ArduinoPhotodiode + + + + + 1 + + + + + + + + + + + csv + + + + + 1 + + + + + + + {0}\{1}\{2}.{3} + Item1,Item2,Item3,Item4 + + + + + + + + + + + + + + + + + + - - - 1 - + + + + - - + + + + + C:/Users/saleem_lab/Documents/GitHub/hf-visual/temp_data\sub-Plimbo\ses-001_date-2025-12-11T17-45-39\ArduinoPhotodiode\ArduinoPhotodiode.csv + false + false + None + true + it + + + + + + + + + + + + + + + CurrentTexture + + + MatrixArduino + + + Seconds + + + + + + + + + LogData + + + + Source1 - + + + + + FormatFileName + Generates a log filename based on the input timestamp. + + + + PathPrefix + + + Source1 + + + + + + + Texture + + + + + 1 + + + + + + + + + + + csv + + + + + 1 + + + + + + + {0}\{1}\{2}.{3} + Item1,Item2,Item3,Item4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + C:/Users/saleem_lab/Documents/GitHub/hf-visual/temp_data\sub-Plimbo\ses-001_date-2025-12-11T17-45-39\Texture\Texture.csv + false + false + None + true + it + + + + + + + + + + + + + + + CameraStream + + + MatrixArduino + + + Seconds + + + + + + + + + LogVideo + + + + Source1 + + + + + + FormatFileName + Generates a log filename based on the input timestamp. + + + + PathPrefix + + + Source1 + + + + + + + VideoData + + + + + + + + + + + csv + + + + + 1 + + + + + + + {0}\{1}\{2}.{3} + Item1,Item2,Item3,Item4 + + + + + + + + + + + + + + + + + + + + + + + + + C:/Users/saleem_lab/Documents/GitHub/hf-visual/temp_data\sub-Plimbo\ses-001_date-2025-12-11T17-45-39\VideoData\VideoData.csv + false + false + None + true + Seconds,Value.Size + + + Value + + + FormatFileName + Generates a log filename based on the input timestamp. + + + + PathPrefix + + + Source1 + + + + + + + VideoData + + + + + + + + + + + avi + + + + + 1 + + + + + + + {0}\{1}\{2}.{3} + Item1,Item2,Item3,Item4 + + + + + + + + + + + + + + + + + + + + + + + + + - - csv + + C:/Users/saleem_lab/Documents/GitHub/hf-visual/temp_data\sub-Plimbo\ses-001_date-2025-12-11T17-45-39\VideoData\VideoData.avi + None + true + false + FMP4 + 50 + + 0 + 0 + + NearestNeighbor + + + + + + + + + + + + + + + + + + + RigSchema + + + + None + + + + + PT1S + + + + LogDataSchema + + + + Source1 + + + + + + FormatFileName + Generates a log filename based on the input timestamp. + + + + PathPrefix + + + Source1 + + + + + + + RigSchema + + + + + 1 + + + + + + + + + + + json + + + + + 1 + + + + + + + {0}\{1}\{2}.{3} + Item1,Item2,Item3,Item4 + + + + + + + + + + + + + + + + + + + + + + + + - - 1 + + C:/Users/saleem_lab/Documents/GitHub/hf-visual/temp_data\sub-Plimbo\ses-001_date-2025-12-11T17-45-39\RigSchema\RigSchema.json + None + false - - + + + + + + + + + + + + + TaskLogicSchema + + + + None + + + + + PT1S + + + + LogDataSchema + + + + Source1 + + + - - {0}\{1}\{2}.{3} - Item1,Item2,Item3,Item4 + + FormatFileName + Generates a log filename based on the input timestamp. + + + + PathPrefix + + + Source1 + + + + + + + TaskLogicSchema + + + + + 1 + + + + + + + + + + + json + + + + + 1 + + + + + + + {0}\{1}\{2}.{3} + Item1,Item2,Item3,Item4 + + + + + + + + + + + + + + + + + + + + + + + + + + + C:/Users/saleem_lab/Documents/GitHub/hf-visual/temp_data\sub-Plimbo\ses-001_date-2025-12-11T17-45-39\TaskLogicSchema\TaskLogicSchema.json + None + false + - - - - + + + + - - - - - - - - - - - + + SessionSchema - - + + + None + - - C:\Users\neurogears\source\repos\ucl-open\hf-visual\temp_data\sub-Algernon\ses-001_date-2025-12-10T17-50-17\Arduino\Arduino.csv - false - false - None - true - it + + + PT1S + + + + TODO + + + + LogDataSchema + + + + Source1 + + + + + + FormatFileName + Generates a log filename based on the input timestamp. + + + + PathPrefix + + + Source1 + + + + + + + SessionSchema + + + + + 1 + + + + + + + + + + + json + + + + + 1 + + + + + + + {0}\{1}\{2}.{3} + Item1,Item2,Item3,Item4 + + + + + + + + + + + + + + + + + + + + + + + + + + + C:/Users/saleem_lab/Documents/GitHub/hf-visual/temp_data\sub-Plimbo\ses-001_date-2025-12-11T17-45-39\SessionSchema\SessionSchema.json + None + false + + + + + + + + + + + + - - + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + \ No newline at end of file diff --git a/src/ucl_open_hf_visual/data_types.py b/src/ucl_open_hf_visual/data_types.py new file mode 100644 index 0000000..0e0e3f0 --- /dev/null +++ b/src/ucl_open_hf_visual/data_types.py @@ -0,0 +1,13 @@ +from ucl_open.rigs.base import BaseSchema + +class MatrixArduinoData(BaseSchema): + encoder_count: int + lick_count_left: int + lick_count_right: int + last_sync_pulse_time: int + photodiode_val: int + current_ms: int + +class MatrixArduinoPhotodiodeData(BaseSchema): + photodiode_val: int + sync_val: int \ No newline at end of file diff --git a/src/ucl_open_hf_visual/regenerate.py b/src/ucl_open_hf_visual/regenerate.py index 7099b92..ada4d08 100644 --- a/src/ucl_open_hf_visual/regenerate.py +++ b/src/ucl_open_hf_visual/regenerate.py @@ -7,6 +7,8 @@ import ucl_open_hf_visual.rig import ucl_open_hf_visual.task +import ucl_open_hf_visual.data_types +import ucl_open_hf_visual.session SCHEMA_ROOT = Path("./src/DataSchemas/") EXTENSIONS_ROOT = Path("./src/Extensions/") @@ -17,7 +19,9 @@ def main(): models = [ ucl_open_hf_visual.task.UclOpenHfVisualTaskLogic, ucl_open_hf_visual.rig.UclOpenHfVisualRig, - Experiment, + ucl_open_hf_visual.session.UclOpenSession, + ucl_open_hf_visual.data_types.MatrixArduinoData, + ucl_open_hf_visual.data_types.MatrixArduinoPhotodiodeData ] model = pydantic.RootModel[Union[tuple(models)]] diff --git a/src/ucl_open_hf_visual/rig.py b/src/ucl_open_hf_visual/rig.py index 5398565..4e0270e 100644 --- a/src/ucl_open_hf_visual/rig.py +++ b/src/ucl_open_hf_visual/rig.py @@ -5,12 +5,28 @@ from ucl_open.rigs.base import BaseSchema from ucl_open.rigs.device import Screen # TODO - change to ucl rigs from ucl_open.rigs.device import SerialDeviceModule +# from ucl_open.rigs.video import ArducamOV9180 from ucl_open_hf_visual import __semver__ +# TODO - should be part of main package? +# TODO - should be able to define generic number of sync quads (e.g. for different screens) +class SyncQuad(BaseSchema): + extent_x: float + extent_y: float + location_x: float + location_y: float + +class MatrixArduino(SerialDeviceModule): + device_type: Literal["MatrixArduino"] = "MatrixArduino" + +class MatrixArduinoPhotodiode(SerialDeviceModule): + device_type: Literal["MatrixArduinoPhotodiode"] = "MatrixArduinoPhotodiode" class UclOpenHfVisualRig(BaseSchema): version: Literal[__semver__] = __semver__ # type: ignore screen: Screen - arduino: SerialDeviceModule + sync_quad: SyncQuad + arduino: MatrixArduino + arduino_photodiode: MatrixArduinoPhotodiode ... \ No newline at end of file diff --git a/src/ucl_open_hf_visual/session.py b/src/ucl_open_hf_visual/session.py new file mode 100644 index 0000000..e3d6ae1 --- /dev/null +++ b/src/ucl_open_hf_visual/session.py @@ -0,0 +1,7 @@ +from ucl_open.rigs.experiment import Experiment + +# TODO - should be part of ucl open rigs +class UclOpenSession(Experiment): + logging_root_path: str + animal_id: str + session_id: str \ No newline at end of file diff --git a/src/ucl_open_hf_visual/visual_stimulation.py b/src/ucl_open_hf_visual/visual_stimulation.py index cb138ef..a8c9945 100644 --- a/src/ucl_open_hf_visual/visual_stimulation.py +++ b/src/ucl_open_hf_visual/visual_stimulation.py @@ -4,7 +4,7 @@ from typing import Literal from pydantic import Field -from swc.aeon.schema import BaseSchema, Device +from ucl_open.rigs.base import BaseSchema, Device class Vector3(BaseSchema): x: float = Field(default=0, description="X coordinate of the point") diff --git a/textures/blankStim_1.tif b/textures/blankStim_1.tif new file mode 100644 index 0000000..0979dc9 Binary files /dev/null and b/textures/blankStim_1.tif differ diff --git a/textures/blankStim_2.tif b/textures/blankStim_2.tif new file mode 100644 index 0000000..0979dc9 Binary files /dev/null and b/textures/blankStim_2.tif differ diff --git a/uv.lock b/uv.lock index 18f5a83..8894d56 100644 --- a/uv.lock +++ b/uv.lock @@ -775,7 +775,7 @@ requires-dist = [ { name = "contraqctor", marker = "extra == 'data'", specifier = "<0.5.0" }, { name = "pydantic-settings" }, { name = "swc-aeon", specifier = ">=0.1.0" }, - { name = "ucl-open-rigs", git = "https://github.com/ucl-open/ucl_open_rigs/?branch=visual-displays" }, + { name = "ucl-open-rigs", git = "https://github.com/ucl-open/ucl_open_rigs/?branch=test_build" }, ] provides-extras = ["data"] @@ -790,7 +790,7 @@ dev = [ [[package]] name = "ucl-open-rigs" version = "0.1.0" -source = { git = "https://github.com/ucl-open/ucl_open_rigs/?branch=visual-displays#1bdf5495e28d3dc764657a146ee020625ea7daa1" } +source = { git = "https://github.com/ucl-open/ucl_open_rigs/?branch=test_build#5cabc5b4d596747a60cf74431f5b76c4bdbfe019" } dependencies = [ { name = "pydantic" }, { name = "pydantic-yaml" },