From cca0ca93f3ce4c86642fbaf43724bc884ce21e72 Mon Sep 17 00:00:00 2001 From: Micah Woodard Date: Thu, 3 Sep 2026 10:48:04 -0700 Subject: [PATCH 1/7] adds flip state and rotation for visualization --- schema/aind_behavior_dynamic_foraging.json | 270 ++-- .../AindBehaviorDynamicForaging.Generated.cs | 1129 +++++++++-------- src/aind_behavior_dynamic_foraging/rig.py | 9 +- 3 files changed, 737 insertions(+), 671 deletions(-) diff --git a/schema/aind_behavior_dynamic_foraging.json b/schema/aind_behavior_dynamic_foraging.json index 3b66b544..5b788400 100644 --- a/schema/aind_behavior_dynamic_foraging.json +++ b/schema/aind_behavior_dynamic_foraging.json @@ -31,7 +31,7 @@ "type": "string" }, "triggered_camera_controller": { - "$ref": "#/$defs/CameraController_SpinnakerCamera_", + "$ref": "#/$defs/CameraController_DynamicForagingSpinnakerCamera_", "description": "Required camera controller to triggered cameras." }, "monitoring_camera_controller": { @@ -970,7 +970,7 @@ "title": "BlockBasedTrialGeneratorSpec", "type": "object" }, - "CameraController_SpinnakerCamera_": { + "CameraController_DynamicForagingSpinnakerCamera_": { "properties": { "device_type": { "const": "CameraController", @@ -992,7 +992,7 @@ }, "cameras": { "additionalProperties": { - "$ref": "#/$defs/SpinnakerCamera" + "$ref": "#/$defs/DynamicForagingSpinnakerCamera" }, "description": "Cameras to be instantiated", "title": "Cameras", @@ -1016,7 +1016,7 @@ "required": [ "cameras" ], - "title": "CameraController[SpinnakerCamera]", + "title": "CameraController[DynamicForagingSpinnakerCamera]", "type": "object" }, "CameraController_WebCamera_": { @@ -1750,6 +1750,144 @@ "title": "DynamicForagingSoundCard", "type": "object" }, + "DynamicForagingSpinnakerCamera": { + "description": "A SpinnakerCamera for the dynamic foraging rig. This is a subclass of the SpinnakerCamera that includes camera orientation settings.", + "properties": { + "device_type": { + "const": "SpinnakerCamera", + "default": "SpinnakerCamera", + "title": "Device Type", + "type": "string" + }, + "calibration": { + "default": null, + "description": "Calibration for the device.", + "oneOf": [ + { + "$ref": "#/$defs/BaseModel" + }, + { + "type": "null" + } + ] + }, + "serial_number": { + "description": "Camera serial number", + "title": "Serial Number", + "type": "string" + }, + "binning": { + "default": 1, + "description": "Binning", + "minimum": 1, + "title": "Binning", + "type": "integer" + }, + "color_processing": { + "default": "Default", + "description": "Color processing", + "enum": [ + "Default", + "NoColorProcessing" + ], + "title": "Color Processing", + "type": "string" + }, + "exposure": { + "default": 1000, + "description": "Exposure time", + "minimum": 100, + "title": "Exposure", + "type": "integer" + }, + "gain": { + "default": 0, + "description": "Gain", + "minimum": 0, + "title": "Gain", + "type": "number" + }, + "gamma": { + "default": null, + "description": "Gamma. If None, will disable gamma correction.", + "oneOf": [ + { + "minimum": 0, + "type": "number" + }, + { + "type": "null" + } + ], + "title": "Gamma" + }, + "adc_bit_depth": { + "default": 0, + "description": "ADC bit depth. If None will be left as default.", + "oneOf": [ + { + "$ref": "#/$defs/SpinnakerCameraAdcBitDepth" + }, + { + "type": "null" + } + ] + }, + "pixel_format": { + "default": 0, + "description": "Pixel format. If None will be left as default.", + "oneOf": [ + { + "$ref": "#/$defs/SpinnakerCameraPixelFormat" + }, + { + "type": "null" + } + ] + }, + "region_of_interest": { + "$ref": "#/$defs/Rect", + "default": { + "x": 0, + "y": 0, + "width": 0, + "height": 0 + }, + "description": "Region of interest" + }, + "video_writer": { + "default": null, + "description": "Video writer. If not provided, no video will be saved.", + "oneOf": [ + { + "$ref": "#/$defs/VideoWriter" + }, + { + "type": "null" + } + ] + }, + "flip_state": { + "default": 2, + "description": "Camera flip state", + "exclusiveMinimum": 0, + "maximum": 2, + "title": "Flip State", + "type": "number" + }, + "rotation": { + "default": 0, + "description": "Camera rotation angle in radians", + "title": "Rotation", + "type": "number" + } + }, + "required": [ + "serial_number" + ], + "title": "DynamicForagingSpinnakerCamera", + "type": "object" + }, "ExponentialDistribution": { "description": "An exponential probability distribution.\n\nModels time between events in a Poisson process. Commonly used\nfor wait times and inter-event intervals.", "properties": { @@ -3022,130 +3160,6 @@ "title": "SoundCardCalibration", "type": "object" }, - "SpinnakerCamera": { - "description": "Spinnaker camera device configuration.", - "properties": { - "device_type": { - "const": "SpinnakerCamera", - "default": "SpinnakerCamera", - "title": "Device Type", - "type": "string" - }, - "calibration": { - "default": null, - "description": "Calibration for the device.", - "oneOf": [ - { - "$ref": "#/$defs/BaseModel" - }, - { - "type": "null" - } - ] - }, - "serial_number": { - "description": "Camera serial number", - "title": "Serial Number", - "type": "string" - }, - "binning": { - "default": 1, - "description": "Binning", - "minimum": 1, - "title": "Binning", - "type": "integer" - }, - "color_processing": { - "default": "Default", - "description": "Color processing", - "enum": [ - "Default", - "NoColorProcessing" - ], - "title": "Color Processing", - "type": "string" - }, - "exposure": { - "default": 1000, - "description": "Exposure time", - "minimum": 100, - "title": "Exposure", - "type": "integer" - }, - "gain": { - "default": 0, - "description": "Gain", - "minimum": 0, - "title": "Gain", - "type": "number" - }, - "gamma": { - "default": null, - "description": "Gamma. If None, will disable gamma correction.", - "oneOf": [ - { - "minimum": 0, - "type": "number" - }, - { - "type": "null" - } - ], - "title": "Gamma" - }, - "adc_bit_depth": { - "default": 0, - "description": "ADC bit depth. If None will be left as default.", - "oneOf": [ - { - "$ref": "#/$defs/SpinnakerCameraAdcBitDepth" - }, - { - "type": "null" - } - ] - }, - "pixel_format": { - "default": 0, - "description": "Pixel format. If None will be left as default.", - "oneOf": [ - { - "$ref": "#/$defs/SpinnakerCameraPixelFormat" - }, - { - "type": "null" - } - ] - }, - "region_of_interest": { - "$ref": "#/$defs/Rect", - "default": { - "x": 0, - "y": 0, - "width": 0, - "height": 0 - }, - "description": "Region of interest" - }, - "video_writer": { - "default": null, - "description": "Video writer. If not provided, no video will be saved.", - "oneOf": [ - { - "$ref": "#/$defs/VideoWriter" - }, - { - "type": "null" - } - ] - } - }, - "required": [ - "serial_number" - ], - "title": "SpinnakerCamera", - "type": "object" - }, "SpinnakerCameraAdcBitDepth": { "description": "ADC bit depth options for Spinnaker cameras.", "enum": [ diff --git a/src/Extensions/AindBehaviorDynamicForaging.Generated.cs b/src/Extensions/AindBehaviorDynamicForaging.Generated.cs index 7519d110..18cb7e4a 100644 --- a/src/Extensions/AindBehaviorDynamicForaging.Generated.cs +++ b/src/Extensions/AindBehaviorDynamicForaging.Generated.cs @@ -25,7 +25,7 @@ public partial class AindDynamicForagingRig private string _dataDirectory; - private CameraControllerSpinnakerCamera _triggeredCameraController; + private CameraControllerDynamicForagingSpinnakerCamera _triggeredCameraController; private CameraControllerWebCamera _monitoringCameraController; @@ -51,7 +51,7 @@ public AindDynamicForagingRig() { _aindBehaviorServicesPkgVersion = "0.13.7"; _version = "0.0.2-rc37"; - _triggeredCameraController = new CameraControllerSpinnakerCamera(); + _triggeredCameraController = new CameraControllerDynamicForagingSpinnakerCamera(); _harpBehavior = new HarpBehavior(); _harpClockGenerator = new HarpWhiteRabbit(); _harpSoundCard = new DynamicForagingSoundCard(); @@ -162,7 +162,7 @@ public string DataDirectory [System.Xml.Serialization.XmlIgnoreAttribute()] [Newtonsoft.Json.JsonPropertyAttribute("triggered_camera_controller", Required=Newtonsoft.Json.Required.Always)] [System.ComponentModel.DescriptionAttribute("Required camera controller to triggered cameras.")] - public CameraControllerSpinnakerCamera TriggeredCameraController + public CameraControllerDynamicForagingSpinnakerCamera TriggeredCameraController { get { @@ -1822,25 +1822,25 @@ protected override bool PrintMembers(System.Text.StringBuilder stringBuilder) [System.CodeDom.Compiler.GeneratedCodeAttribute("Bonsai.Sgen", "0.9.0.0 (Newtonsoft.Json v13.0.0.0)")] [Bonsai.WorkflowElementCategoryAttribute(Bonsai.ElementCategory.Source)] [Bonsai.CombinatorAttribute(MethodName="Generate")] - public partial class CameraControllerSpinnakerCamera + public partial class CameraControllerDynamicForagingSpinnakerCamera { private string _deviceType; private BaseModel _calibration; - private System.Collections.Generic.Dictionary _cameras; + private System.Collections.Generic.Dictionary _cameras; private int? _frameRate; - public CameraControllerSpinnakerCamera() + public CameraControllerDynamicForagingSpinnakerCamera() { _deviceType = "CameraController"; - _cameras = new System.Collections.Generic.Dictionary(); + _cameras = new System.Collections.Generic.Dictionary(); _frameRate = 30; } - protected CameraControllerSpinnakerCamera(CameraControllerSpinnakerCamera other) + protected CameraControllerDynamicForagingSpinnakerCamera(CameraControllerDynamicForagingSpinnakerCamera other) { _deviceType = other._deviceType; _calibration = other._calibration; @@ -1885,7 +1885,7 @@ public BaseModel Calibration [System.Xml.Serialization.XmlIgnoreAttribute()] [Newtonsoft.Json.JsonPropertyAttribute("cameras", Required=Newtonsoft.Json.Required.Always)] [System.ComponentModel.DescriptionAttribute("Cameras to be instantiated")] - public System.Collections.Generic.Dictionary Cameras + public System.Collections.Generic.Dictionary Cameras { get { @@ -1914,14 +1914,14 @@ public int? FrameRate } } - public System.IObservable Generate() + public System.IObservable Generate() { - return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new CameraControllerSpinnakerCamera(this))); + return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new CameraControllerDynamicForagingSpinnakerCamera(this))); } - public System.IObservable Generate(System.IObservable source) + public System.IObservable Generate(System.IObservable source) { - return System.Reactive.Linq.Observable.Select(source, _ => new CameraControllerSpinnakerCamera(this)); + return System.Reactive.Linq.Observable.Select(source, _ => new CameraControllerDynamicForagingSpinnakerCamera(this)); } protected virtual bool PrintMembers(System.Text.StringBuilder stringBuilder) @@ -3444,35 +3444,75 @@ public override string ToString() } + /// + /// A SpinnakerCamera for the dynamic foraging rig. This is a subclass of the SpinnakerCamera that includes camera orientation settings. + /// [System.CodeDom.Compiler.GeneratedCodeAttribute("Bonsai.Sgen", "0.9.0.0 (Newtonsoft.Json v13.0.0.0)")] + [System.ComponentModel.DescriptionAttribute("A SpinnakerCamera for the dynamic foraging rig. This is a subclass of the Spinnak" + + "erCamera that includes camera orientation settings.")] [Bonsai.WorkflowElementCategoryAttribute(Bonsai.ElementCategory.Source)] [Bonsai.CombinatorAttribute(MethodName="Generate")] - public partial class HarpBehavior + public partial class DynamicForagingSpinnakerCamera { private string _deviceType; private BaseModel _calibration; - private int _whoAmI; - private string _serialNumber; - private string _portName; + private int _binning; - public HarpBehavior() + private DynamicForagingSpinnakerCameraColorProcessing _colorProcessing; + + private int _exposure; + + private double _gain; + + private double? _gamma; + + private SpinnakerCameraAdcBitDepth? _adcBitDepth; + + private SpinnakerCameraPixelFormat? _pixelFormat; + + private Rect _regionOfInterest; + + private VideoWriter _videoWriter; + + private double _flipState; + + private double _rotation; + + public DynamicForagingSpinnakerCamera() { - _deviceType = "Behavior"; - _whoAmI = 1216; + _deviceType = "SpinnakerCamera"; + _binning = 1; + _colorProcessing = DynamicForagingSpinnakerCameraColorProcessing.Default; + _exposure = 1000; + _gain = 0D; + _adcBitDepth = SpinnakerCameraAdcBitDepth.Adc8bit; + _pixelFormat = SpinnakerCameraPixelFormat.Mono8; + _regionOfInterest = new Rect(); + _flipState = 2D; + _rotation = 0D; } - protected HarpBehavior(HarpBehavior other) + protected DynamicForagingSpinnakerCamera(DynamicForagingSpinnakerCamera other) { _deviceType = other._deviceType; _calibration = other._calibration; - _whoAmI = other._whoAmI; _serialNumber = other._serialNumber; - _portName = other._portName; + _binning = other._binning; + _colorProcessing = other._colorProcessing; + _exposure = other._exposure; + _gain = other._gain; + _gamma = other._gamma; + _adcBitDepth = other._adcBitDepth; + _pixelFormat = other._pixelFormat; + _regionOfInterest = other._regionOfInterest; + _videoWriter = other._videoWriter; + _flipState = other._flipState; + _rotation = other._rotation; } [Newtonsoft.Json.JsonPropertyAttribute("device_type")] @@ -3506,70 +3546,238 @@ public BaseModel Calibration } } - [Newtonsoft.Json.JsonPropertyAttribute("who_am_i")] - public int WhoAmI + /// + /// Camera serial number + /// + [Newtonsoft.Json.JsonPropertyAttribute("serial_number", Required=Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DescriptionAttribute("Camera serial number")] + public string SerialNumber { get { - return _whoAmI; + return _serialNumber; } set { - _whoAmI = value; + _serialNumber = value; } } /// - /// Device serial number + /// Binning /// - [Newtonsoft.Json.JsonPropertyAttribute("serial_number")] - [System.ComponentModel.DescriptionAttribute("Device serial number")] - public string SerialNumber + [Newtonsoft.Json.JsonPropertyAttribute("binning")] + [System.ComponentModel.DescriptionAttribute("Binning")] + public int Binning { get { - return _serialNumber; + return _binning; } set { - _serialNumber = value; + _binning = value; } } /// - /// Device port name + /// Color processing /// - [Newtonsoft.Json.JsonPropertyAttribute("port_name", Required=Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DescriptionAttribute("Device port name")] - public string PortName + [Newtonsoft.Json.JsonPropertyAttribute("color_processing")] + [System.ComponentModel.DescriptionAttribute("Color processing")] + public DynamicForagingSpinnakerCameraColorProcessing ColorProcessing { get { - return _portName; + return _colorProcessing; } set { - _portName = value; + _colorProcessing = value; } } - public System.IObservable Generate() + /// + /// Exposure time + /// + [Newtonsoft.Json.JsonPropertyAttribute("exposure")] + [System.ComponentModel.DescriptionAttribute("Exposure time")] + public int Exposure { - return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new HarpBehavior(this))); + get + { + return _exposure; + } + set + { + _exposure = value; + } } - public System.IObservable Generate(System.IObservable source) + /// + /// Gain + /// + [Newtonsoft.Json.JsonPropertyAttribute("gain")] + [System.ComponentModel.DescriptionAttribute("Gain")] + public double Gain { - return System.Reactive.Linq.Observable.Select(source, _ => new HarpBehavior(this)); + get + { + return _gain; + } + set + { + _gain = value; + } + } + + /// + /// Gamma. If None, will disable gamma correction. + /// + [Newtonsoft.Json.JsonPropertyAttribute("gamma")] + [System.ComponentModel.DescriptionAttribute("Gamma. If None, will disable gamma correction.")] + public double? Gamma + { + get + { + return _gamma; + } + set + { + _gamma = value; + } + } + + /// + /// ADC bit depth. If None will be left as default. + /// + [Newtonsoft.Json.JsonPropertyAttribute("adc_bit_depth")] + [System.ComponentModel.DescriptionAttribute("ADC bit depth. If None will be left as default.")] + public SpinnakerCameraAdcBitDepth? AdcBitDepth + { + get + { + return _adcBitDepth; + } + set + { + _adcBitDepth = value; + } + } + + /// + /// Pixel format. If None will be left as default. + /// + [Newtonsoft.Json.JsonPropertyAttribute("pixel_format")] + [System.ComponentModel.DescriptionAttribute("Pixel format. If None will be left as default.")] + public SpinnakerCameraPixelFormat? PixelFormat + { + get + { + return _pixelFormat; + } + set + { + _pixelFormat = value; + } + } + + /// + /// Region of interest + /// + [System.Xml.Serialization.XmlIgnoreAttribute()] + [Newtonsoft.Json.JsonPropertyAttribute("region_of_interest")] + [System.ComponentModel.DescriptionAttribute("Region of interest")] + public Rect RegionOfInterest + { + get + { + return _regionOfInterest; + } + set + { + _regionOfInterest = value; + } + } + + /// + /// Video writer. If not provided, no video will be saved. + /// + [System.Xml.Serialization.XmlIgnoreAttribute()] + [Newtonsoft.Json.JsonPropertyAttribute("video_writer")] + [System.ComponentModel.DescriptionAttribute("Video writer. If not provided, no video will be saved.")] + public VideoWriter VideoWriter + { + get + { + return _videoWriter; + } + set + { + _videoWriter = value; + } + } + + /// + /// Camera flip state + /// + [Newtonsoft.Json.JsonPropertyAttribute("flip_state")] + [System.ComponentModel.DescriptionAttribute("Camera flip state")] + public double FlipState + { + get + { + return _flipState; + } + set + { + _flipState = value; + } + } + + /// + /// Camera rotation angle in radians + /// + [Newtonsoft.Json.JsonPropertyAttribute("rotation")] + [System.ComponentModel.DescriptionAttribute("Camera rotation angle in radians")] + public double Rotation + { + get + { + return _rotation; + } + set + { + _rotation = value; + } + } + + public System.IObservable Generate() + { + return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new DynamicForagingSpinnakerCamera(this))); + } + + public System.IObservable Generate(System.IObservable source) + { + return System.Reactive.Linq.Observable.Select(source, _ => new DynamicForagingSpinnakerCamera(this)); } protected virtual bool PrintMembers(System.Text.StringBuilder stringBuilder) { stringBuilder.Append("DeviceType = " + _deviceType + ", "); stringBuilder.Append("Calibration = " + _calibration + ", "); - stringBuilder.Append("WhoAmI = " + _whoAmI + ", "); stringBuilder.Append("SerialNumber = " + _serialNumber + ", "); - stringBuilder.Append("PortName = " + _portName); + stringBuilder.Append("Binning = " + _binning + ", "); + stringBuilder.Append("ColorProcessing = " + _colorProcessing + ", "); + stringBuilder.Append("Exposure = " + _exposure + ", "); + stringBuilder.Append("Gain = " + _gain + ", "); + stringBuilder.Append("Gamma = " + _gamma + ", "); + stringBuilder.Append("AdcBitDepth = " + _adcBitDepth + ", "); + stringBuilder.Append("PixelFormat = " + _pixelFormat + ", "); + stringBuilder.Append("RegionOfInterest = " + _regionOfInterest + ", "); + stringBuilder.Append("VideoWriter = " + _videoWriter + ", "); + stringBuilder.Append("FlipState = " + _flipState + ", "); + stringBuilder.Append("Rotation = " + _rotation); return true; } @@ -3591,7 +3799,7 @@ public override string ToString() [System.CodeDom.Compiler.GeneratedCodeAttribute("Bonsai.Sgen", "0.9.0.0 (Newtonsoft.Json v13.0.0.0)")] [Bonsai.WorkflowElementCategoryAttribute(Bonsai.ElementCategory.Source)] [Bonsai.CombinatorAttribute(MethodName="Generate")] - public partial class HarpEnvironmentSensor + public partial class HarpBehavior { private string _deviceType; @@ -3604,13 +3812,13 @@ public partial class HarpEnvironmentSensor private string _portName; - public HarpEnvironmentSensor() + public HarpBehavior() { - _deviceType = "EnvironmentSensor"; - _whoAmI = 1405; + _deviceType = "Behavior"; + _whoAmI = 1216; } - protected HarpEnvironmentSensor(HarpEnvironmentSensor other) + protected HarpBehavior(HarpBehavior other) { _deviceType = other._deviceType; _calibration = other._calibration; @@ -3697,14 +3905,158 @@ public string PortName } } - public System.IObservable Generate() + public System.IObservable Generate() { - return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new HarpEnvironmentSensor(this))); + return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new HarpBehavior(this))); } - public System.IObservable Generate(System.IObservable source) + public System.IObservable Generate(System.IObservable source) { - return System.Reactive.Linq.Observable.Select(source, _ => new HarpEnvironmentSensor(this)); + return System.Reactive.Linq.Observable.Select(source, _ => new HarpBehavior(this)); + } + + protected virtual bool PrintMembers(System.Text.StringBuilder stringBuilder) + { + stringBuilder.Append("DeviceType = " + _deviceType + ", "); + stringBuilder.Append("Calibration = " + _calibration + ", "); + stringBuilder.Append("WhoAmI = " + _whoAmI + ", "); + stringBuilder.Append("SerialNumber = " + _serialNumber + ", "); + stringBuilder.Append("PortName = " + _portName); + 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.9.0.0 (Newtonsoft.Json v13.0.0.0)")] + [Bonsai.WorkflowElementCategoryAttribute(Bonsai.ElementCategory.Source)] + [Bonsai.CombinatorAttribute(MethodName="Generate")] + public partial class HarpEnvironmentSensor + { + + private string _deviceType; + + private BaseModel _calibration; + + private int _whoAmI; + + private string _serialNumber; + + private string _portName; + + public HarpEnvironmentSensor() + { + _deviceType = "EnvironmentSensor"; + _whoAmI = 1405; + } + + protected HarpEnvironmentSensor(HarpEnvironmentSensor other) + { + _deviceType = other._deviceType; + _calibration = other._calibration; + _whoAmI = other._whoAmI; + _serialNumber = other._serialNumber; + _portName = other._portName; + } + + [Newtonsoft.Json.JsonPropertyAttribute("device_type")] + public string DeviceType + { + get + { + return _deviceType; + } + set + { + _deviceType = value; + } + } + + /// + /// Calibration for the device. + /// + [System.Xml.Serialization.XmlIgnoreAttribute()] + [Newtonsoft.Json.JsonPropertyAttribute("calibration")] + [System.ComponentModel.DescriptionAttribute("Calibration for the device.")] + public BaseModel Calibration + { + get + { + return _calibration; + } + set + { + _calibration = value; + } + } + + [Newtonsoft.Json.JsonPropertyAttribute("who_am_i")] + public int WhoAmI + { + get + { + return _whoAmI; + } + set + { + _whoAmI = value; + } + } + + /// + /// Device serial number + /// + [Newtonsoft.Json.JsonPropertyAttribute("serial_number")] + [System.ComponentModel.DescriptionAttribute("Device serial number")] + public string SerialNumber + { + get + { + return _serialNumber; + } + set + { + _serialNumber = value; + } + } + + /// + /// Device port name + /// + [Newtonsoft.Json.JsonPropertyAttribute("port_name", Required=Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DescriptionAttribute("Device port name")] + public string PortName + { + get + { + return _portName; + } + set + { + _portName = value; + } + } + + public System.IObservable Generate() + { + return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new HarpEnvironmentSensor(this))); + } + + public System.IObservable Generate(System.IObservable source) + { + return System.Reactive.Linq.Observable.Select(source, _ => new HarpEnvironmentSensor(this)); } protected virtual bool PrintMembers(System.Text.StringBuilder stringBuilder) @@ -5178,625 +5530,318 @@ public string Version } /// - /// Name of the experiment - /// - [Newtonsoft.Json.JsonPropertyAttribute("experiment")] - [System.ComponentModel.DescriptionAttribute("Name of the experiment")] - public string Experiment - { - get - { - return _experiment; - } - set - { - _experiment = value; - } - } - - /// - /// Name of the experimenter - /// - [System.Xml.Serialization.XmlIgnoreAttribute()] - [Newtonsoft.Json.JsonPropertyAttribute("experimenter")] - [System.ComponentModel.DescriptionAttribute("Name of the experimenter")] - public System.Collections.Generic.List Experimenter - { - get - { - return _experimenter; - } - set - { - _experimenter = value; - } - } - - /// - /// Date of the experiment - /// - [System.Xml.Serialization.XmlIgnoreAttribute()] - [Newtonsoft.Json.JsonPropertyAttribute("date")] - [System.ComponentModel.DescriptionAttribute("Date of the experiment")] - public System.DateTimeOffset Date - { - get - { - return _date; - } - set - { - _date = value; - } - } - - [Newtonsoft.Json.JsonIgnoreAttribute()] - [System.ComponentModel.BrowsableAttribute(false)] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - [System.Xml.Serialization.XmlElementAttribute("Date")] - public string DateXml - { - get - { - return _date.ToString("o"); - } - set - { - _date = System.DateTimeOffset.Parse(value); - } - } - - /// - /// Name of the session. This will be used to create a folder in the root path. If not provided, it will be generated using subject and date. - /// - [Newtonsoft.Json.JsonPropertyAttribute("session_name")] - [System.ComponentModel.DescriptionAttribute("Name of the session. This will be used to create a folder in the root path. If no" + - "t provided, it will be generated using subject and date.")] - public string SessionName - { - get - { - return _sessionName; - } - set - { - _sessionName = value; - } - } - - /// - /// Name of the subject - /// - [Newtonsoft.Json.JsonPropertyAttribute("subject", Required=Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DescriptionAttribute("Name of the subject")] - public string Subject - { - get - { - return _subject; - } - set - { - _subject = value; - } - } - - /// - /// Notes about the experiment - /// - [Newtonsoft.Json.JsonPropertyAttribute("notes")] - [System.ComponentModel.DescriptionAttribute("Notes about the experiment")] - public string Notes - { - get - { - return _notes; - } - set - { - _notes = value; - } - } - - /// - /// Commit hash of the repository - /// - [Newtonsoft.Json.JsonPropertyAttribute("commit_hash")] - [System.ComponentModel.DescriptionAttribute("Commit hash of the repository")] - public string CommitHash - { - get - { - return _commitHash; - } - set - { - _commitHash = value; - } - } - - /// - /// Allow running from a dirty repository - /// - [Newtonsoft.Json.JsonPropertyAttribute("allow_dirty_repo")] - [System.ComponentModel.DescriptionAttribute("Allow running from a dirty repository")] - public bool AllowDirtyRepo - { - get - { - return _allowDirtyRepo; - } - set - { - _allowDirtyRepo = value; - } - } - - /// - /// Skip hardware validation - /// - [Newtonsoft.Json.JsonPropertyAttribute("skip_hardware_validation")] - [System.ComponentModel.DescriptionAttribute("Skip hardware validation")] - public bool SkipHardwareValidation - { - get - { - return _skipHardwareValidation; - } - set - { - _skipHardwareValidation = value; - } - } - - public System.IObservable Generate() - { - return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new Session(this))); - } - - public System.IObservable Generate(System.IObservable source) - { - return System.Reactive.Linq.Observable.Select(source, _ => new Session(this)); - } - - protected virtual bool PrintMembers(System.Text.StringBuilder stringBuilder) - { - stringBuilder.Append("AindBehaviorServicesPkgVersion = " + _aindBehaviorServicesPkgVersion + ", "); - stringBuilder.Append("Version = " + _version + ", "); - stringBuilder.Append("Experiment = " + _experiment + ", "); - stringBuilder.Append("Experimenter = " + _experimenter + ", "); - stringBuilder.Append("Date = " + _date + ", "); - stringBuilder.Append("SessionName = " + _sessionName + ", "); - stringBuilder.Append("Subject = " + _subject + ", "); - stringBuilder.Append("Notes = " + _notes + ", "); - stringBuilder.Append("CommitHash = " + _commitHash + ", "); - stringBuilder.Append("AllowDirtyRepo = " + _allowDirtyRepo + ", "); - stringBuilder.Append("SkipHardwareValidation = " + _skipHardwareValidation); - 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(); - } - } - - - /// - /// Calibration model for the sound card. Contains the waveforms to play for each cue. - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("Bonsai.Sgen", "0.9.0.0 (Newtonsoft.Json v13.0.0.0)")] - [System.ComponentModel.DescriptionAttribute("Calibration model for the sound card. Contains the waveforms to play for each cue" + - ".")] - [Bonsai.WorkflowElementCategoryAttribute(Bonsai.ElementCategory.Source)] - [Bonsai.CombinatorAttribute(MethodName="Generate")] - public partial class SoundCardCalibration - { - - private Waveform _goCue; - - private Waveform _csPlus; - - private Waveform _csMinus; - - public SoundCardCalibration() - { - _goCue = new Waveform(); - _csPlus = new Waveform(); - _csMinus = new Waveform(); - } - - protected SoundCardCalibration(SoundCardCalibration other) - { - _goCue = other._goCue; - _csPlus = other._csPlus; - _csMinus = other._csMinus; - } - - /// - /// Waveform to play for go cue - /// - [System.Xml.Serialization.XmlIgnoreAttribute()] - [Newtonsoft.Json.JsonPropertyAttribute("go_cue")] - [System.ComponentModel.DescriptionAttribute("Waveform to play for go cue")] - public Waveform GoCue - { - get - { - return _goCue; - } - set - { - _goCue = value; - } - } - - /// - /// Waveform to play for CS+ cue - /// - [System.Xml.Serialization.XmlIgnoreAttribute()] - [Newtonsoft.Json.JsonPropertyAttribute("cs_plus")] - [System.ComponentModel.DescriptionAttribute("Waveform to play for CS+ cue")] - public Waveform CsPlus - { - get - { - return _csPlus; - } - set - { - _csPlus = value; - } - } - - /// - /// Waveform to play for CS- cue - /// - [System.Xml.Serialization.XmlIgnoreAttribute()] - [Newtonsoft.Json.JsonPropertyAttribute("cs_minus")] - [System.ComponentModel.DescriptionAttribute("Waveform to play for CS- cue")] - public Waveform CsMinus - { - get - { - return _csMinus; - } - set - { - _csMinus = value; - } - } - - public System.IObservable Generate() - { - return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new SoundCardCalibration(this))); - } - - public System.IObservable Generate(System.IObservable source) - { - return System.Reactive.Linq.Observable.Select(source, _ => new SoundCardCalibration(this)); - } - - protected virtual bool PrintMembers(System.Text.StringBuilder stringBuilder) - { - stringBuilder.Append("GoCue = " + _goCue + ", "); - stringBuilder.Append("CsPlus = " + _csPlus + ", "); - stringBuilder.Append("CsMinus = " + _csMinus); - 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(); - } - } - - - /// - /// Spinnaker camera device configuration. - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("Bonsai.Sgen", "0.9.0.0 (Newtonsoft.Json v13.0.0.0)")] - [System.ComponentModel.DescriptionAttribute("Spinnaker camera device configuration.")] - [Bonsai.WorkflowElementCategoryAttribute(Bonsai.ElementCategory.Source)] - [Bonsai.CombinatorAttribute(MethodName="Generate")] - public partial class SpinnakerCamera - { - - private string _deviceType; - - private BaseModel _calibration; - - private string _serialNumber; - - private int _binning; - - private SpinnakerCameraColorProcessing _colorProcessing; - - private int _exposure; - - private double _gain; - - private double? _gamma; - - private SpinnakerCameraAdcBitDepth? _adcBitDepth; - - private SpinnakerCameraPixelFormat? _pixelFormat; - - private Rect _regionOfInterest; - - private VideoWriter _videoWriter; - - public SpinnakerCamera() - { - _deviceType = "SpinnakerCamera"; - _binning = 1; - _colorProcessing = SpinnakerCameraColorProcessing.Default; - _exposure = 1000; - _gain = 0D; - _adcBitDepth = SpinnakerCameraAdcBitDepth.Adc8bit; - _pixelFormat = SpinnakerCameraPixelFormat.Mono8; - _regionOfInterest = new Rect(); - } - - protected SpinnakerCamera(SpinnakerCamera other) - { - _deviceType = other._deviceType; - _calibration = other._calibration; - _serialNumber = other._serialNumber; - _binning = other._binning; - _colorProcessing = other._colorProcessing; - _exposure = other._exposure; - _gain = other._gain; - _gamma = other._gamma; - _adcBitDepth = other._adcBitDepth; - _pixelFormat = other._pixelFormat; - _regionOfInterest = other._regionOfInterest; - _videoWriter = other._videoWriter; - } - - [Newtonsoft.Json.JsonPropertyAttribute("device_type")] - public string DeviceType + /// Name of the experiment + /// + [Newtonsoft.Json.JsonPropertyAttribute("experiment")] + [System.ComponentModel.DescriptionAttribute("Name of the experiment")] + public string Experiment { get { - return _deviceType; + return _experiment; } set { - _deviceType = value; + _experiment = value; } } /// - /// Calibration for the device. + /// Name of the experimenter /// [System.Xml.Serialization.XmlIgnoreAttribute()] - [Newtonsoft.Json.JsonPropertyAttribute("calibration")] - [System.ComponentModel.DescriptionAttribute("Calibration for the device.")] - public BaseModel Calibration + [Newtonsoft.Json.JsonPropertyAttribute("experimenter")] + [System.ComponentModel.DescriptionAttribute("Name of the experimenter")] + public System.Collections.Generic.List Experimenter { get { - return _calibration; + return _experimenter; } set { - _calibration = value; + _experimenter = value; } } /// - /// Camera serial number + /// Date of the experiment /// - [Newtonsoft.Json.JsonPropertyAttribute("serial_number", Required=Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DescriptionAttribute("Camera serial number")] - public string SerialNumber + [System.Xml.Serialization.XmlIgnoreAttribute()] + [Newtonsoft.Json.JsonPropertyAttribute("date")] + [System.ComponentModel.DescriptionAttribute("Date of the experiment")] + public System.DateTimeOffset Date { get { - return _serialNumber; + return _date; } set { - _serialNumber = value; + _date = value; + } + } + + [Newtonsoft.Json.JsonIgnoreAttribute()] + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + [System.Xml.Serialization.XmlElementAttribute("Date")] + public string DateXml + { + get + { + return _date.ToString("o"); + } + set + { + _date = System.DateTimeOffset.Parse(value); } } /// - /// Binning + /// Name of the session. This will be used to create a folder in the root path. If not provided, it will be generated using subject and date. /// - [Newtonsoft.Json.JsonPropertyAttribute("binning")] - [System.ComponentModel.DescriptionAttribute("Binning")] - public int Binning + [Newtonsoft.Json.JsonPropertyAttribute("session_name")] + [System.ComponentModel.DescriptionAttribute("Name of the session. This will be used to create a folder in the root path. If no" + + "t provided, it will be generated using subject and date.")] + public string SessionName { get { - return _binning; + return _sessionName; } set { - _binning = value; + _sessionName = value; } } /// - /// Color processing + /// Name of the subject /// - [Newtonsoft.Json.JsonPropertyAttribute("color_processing")] - [System.ComponentModel.DescriptionAttribute("Color processing")] - public SpinnakerCameraColorProcessing ColorProcessing + [Newtonsoft.Json.JsonPropertyAttribute("subject", Required=Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DescriptionAttribute("Name of the subject")] + public string Subject { get { - return _colorProcessing; + return _subject; } set { - _colorProcessing = value; + _subject = value; } } /// - /// Exposure time + /// Notes about the experiment /// - [Newtonsoft.Json.JsonPropertyAttribute("exposure")] - [System.ComponentModel.DescriptionAttribute("Exposure time")] - public int Exposure + [Newtonsoft.Json.JsonPropertyAttribute("notes")] + [System.ComponentModel.DescriptionAttribute("Notes about the experiment")] + public string Notes { get { - return _exposure; + return _notes; } set { - _exposure = value; + _notes = value; } } /// - /// Gain + /// Commit hash of the repository /// - [Newtonsoft.Json.JsonPropertyAttribute("gain")] - [System.ComponentModel.DescriptionAttribute("Gain")] - public double Gain + [Newtonsoft.Json.JsonPropertyAttribute("commit_hash")] + [System.ComponentModel.DescriptionAttribute("Commit hash of the repository")] + public string CommitHash { get { - return _gain; + return _commitHash; } set { - _gain = value; + _commitHash = value; } } /// - /// Gamma. If None, will disable gamma correction. + /// Allow running from a dirty repository /// - [Newtonsoft.Json.JsonPropertyAttribute("gamma")] - [System.ComponentModel.DescriptionAttribute("Gamma. If None, will disable gamma correction.")] - public double? Gamma + [Newtonsoft.Json.JsonPropertyAttribute("allow_dirty_repo")] + [System.ComponentModel.DescriptionAttribute("Allow running from a dirty repository")] + public bool AllowDirtyRepo { get { - return _gamma; + return _allowDirtyRepo; } set { - _gamma = value; + _allowDirtyRepo = value; } } /// - /// ADC bit depth. If None will be left as default. + /// Skip hardware validation /// - [Newtonsoft.Json.JsonPropertyAttribute("adc_bit_depth")] - [System.ComponentModel.DescriptionAttribute("ADC bit depth. If None will be left as default.")] - public SpinnakerCameraAdcBitDepth? AdcBitDepth + [Newtonsoft.Json.JsonPropertyAttribute("skip_hardware_validation")] + [System.ComponentModel.DescriptionAttribute("Skip hardware validation")] + public bool SkipHardwareValidation { get { - return _adcBitDepth; + return _skipHardwareValidation; } set { - _adcBitDepth = value; + _skipHardwareValidation = value; + } + } + + public System.IObservable Generate() + { + return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new Session(this))); + } + + public System.IObservable Generate(System.IObservable source) + { + return System.Reactive.Linq.Observable.Select(source, _ => new Session(this)); + } + + protected virtual bool PrintMembers(System.Text.StringBuilder stringBuilder) + { + stringBuilder.Append("AindBehaviorServicesPkgVersion = " + _aindBehaviorServicesPkgVersion + ", "); + stringBuilder.Append("Version = " + _version + ", "); + stringBuilder.Append("Experiment = " + _experiment + ", "); + stringBuilder.Append("Experimenter = " + _experimenter + ", "); + stringBuilder.Append("Date = " + _date + ", "); + stringBuilder.Append("SessionName = " + _sessionName + ", "); + stringBuilder.Append("Subject = " + _subject + ", "); + stringBuilder.Append("Notes = " + _notes + ", "); + stringBuilder.Append("CommitHash = " + _commitHash + ", "); + stringBuilder.Append("AllowDirtyRepo = " + _allowDirtyRepo + ", "); + stringBuilder.Append("SkipHardwareValidation = " + _skipHardwareValidation); + 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(); + } + } + + + /// + /// Calibration model for the sound card. Contains the waveforms to play for each cue. + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("Bonsai.Sgen", "0.9.0.0 (Newtonsoft.Json v13.0.0.0)")] + [System.ComponentModel.DescriptionAttribute("Calibration model for the sound card. Contains the waveforms to play for each cue" + + ".")] + [Bonsai.WorkflowElementCategoryAttribute(Bonsai.ElementCategory.Source)] + [Bonsai.CombinatorAttribute(MethodName="Generate")] + public partial class SoundCardCalibration + { + + private Waveform _goCue; + + private Waveform _csPlus; + + private Waveform _csMinus; + + public SoundCardCalibration() + { + _goCue = new Waveform(); + _csPlus = new Waveform(); + _csMinus = new Waveform(); + } + + protected SoundCardCalibration(SoundCardCalibration other) + { + _goCue = other._goCue; + _csPlus = other._csPlus; + _csMinus = other._csMinus; } /// - /// Pixel format. If None will be left as default. + /// Waveform to play for go cue /// - [Newtonsoft.Json.JsonPropertyAttribute("pixel_format")] - [System.ComponentModel.DescriptionAttribute("Pixel format. If None will be left as default.")] - public SpinnakerCameraPixelFormat? PixelFormat + [System.Xml.Serialization.XmlIgnoreAttribute()] + [Newtonsoft.Json.JsonPropertyAttribute("go_cue")] + [System.ComponentModel.DescriptionAttribute("Waveform to play for go cue")] + public Waveform GoCue { get { - return _pixelFormat; + return _goCue; } set { - _pixelFormat = value; + _goCue = value; } } /// - /// Region of interest + /// Waveform to play for CS+ cue /// [System.Xml.Serialization.XmlIgnoreAttribute()] - [Newtonsoft.Json.JsonPropertyAttribute("region_of_interest")] - [System.ComponentModel.DescriptionAttribute("Region of interest")] - public Rect RegionOfInterest + [Newtonsoft.Json.JsonPropertyAttribute("cs_plus")] + [System.ComponentModel.DescriptionAttribute("Waveform to play for CS+ cue")] + public Waveform CsPlus { get { - return _regionOfInterest; + return _csPlus; } set { - _regionOfInterest = value; + _csPlus = value; } } /// - /// Video writer. If not provided, no video will be saved. + /// Waveform to play for CS- cue /// [System.Xml.Serialization.XmlIgnoreAttribute()] - [Newtonsoft.Json.JsonPropertyAttribute("video_writer")] - [System.ComponentModel.DescriptionAttribute("Video writer. If not provided, no video will be saved.")] - public VideoWriter VideoWriter + [Newtonsoft.Json.JsonPropertyAttribute("cs_minus")] + [System.ComponentModel.DescriptionAttribute("Waveform to play for CS- cue")] + public Waveform CsMinus { get { - return _videoWriter; + return _csMinus; } set { - _videoWriter = value; + _csMinus = value; } } - public System.IObservable Generate() + public System.IObservable Generate() { - return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new SpinnakerCamera(this))); + return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new SoundCardCalibration(this))); } - public System.IObservable Generate(System.IObservable source) + public System.IObservable Generate(System.IObservable source) { - return System.Reactive.Linq.Observable.Select(source, _ => new SpinnakerCamera(this)); + return System.Reactive.Linq.Observable.Select(source, _ => new SoundCardCalibration(this)); } protected virtual bool PrintMembers(System.Text.StringBuilder stringBuilder) { - stringBuilder.Append("DeviceType = " + _deviceType + ", "); - stringBuilder.Append("Calibration = " + _calibration + ", "); - stringBuilder.Append("SerialNumber = " + _serialNumber + ", "); - stringBuilder.Append("Binning = " + _binning + ", "); - stringBuilder.Append("ColorProcessing = " + _colorProcessing + ", "); - stringBuilder.Append("Exposure = " + _exposure + ", "); - stringBuilder.Append("Gain = " + _gain + ", "); - stringBuilder.Append("Gamma = " + _gamma + ", "); - stringBuilder.Append("AdcBitDepth = " + _adcBitDepth + ", "); - stringBuilder.Append("PixelFormat = " + _pixelFormat + ", "); - stringBuilder.Append("RegionOfInterest = " + _regionOfInterest + ", "); - stringBuilder.Append("VideoWriter = " + _videoWriter); + stringBuilder.Append("GoCue = " + _goCue + ", "); + stringBuilder.Append("CsPlus = " + _csPlus + ", "); + stringBuilder.Append("CsMinus = " + _csMinus); return true; } @@ -8270,7 +8315,7 @@ public enum BehaviorStabilityParametersBehaviorEvaluationMode [System.CodeDom.Compiler.GeneratedCodeAttribute("Bonsai.Sgen", "0.9.0.0 (Newtonsoft.Json v13.0.0.0)")] [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] - public enum SpinnakerCameraColorProcessing + public enum DynamicForagingSpinnakerCameraColorProcessing { [System.Runtime.Serialization.EnumMemberAttribute(Value="Default")] @@ -8630,9 +8675,9 @@ public System.IObservable Process(System.IObservable(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) @@ -8675,6 +8720,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); @@ -8755,11 +8805,6 @@ 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); @@ -8850,7 +8895,7 @@ 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))] @@ -8859,6 +8904,7 @@ 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))] @@ -8875,7 +8921,6 @@ 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))] diff --git a/src/aind_behavior_dynamic_foraging/rig.py b/src/aind_behavior_dynamic_foraging/rig.py index 8608a95c..308e1635 100644 --- a/src/aind_behavior_dynamic_foraging/rig.py +++ b/src/aind_behavior_dynamic_foraging/rig.py @@ -72,9 +72,16 @@ class DynamicForagingAindManipulator(aind_manipulator.AindManipulator): ) +class DynamicForagingSpinnakerCamera(cameras.SpinnakerCamera): + """A SpinnakerCamera for the dynamic foraging rig. This is a subclass of the SpinnakerCamera that includes camera orientation settings.""" + + flip_state: float = Field(default=2, gt=0, le=2, description="Camera flip state", validate_default=True) + rotation: float = Field(default=0, description="Camera rotation angle in radians", validate_default=True) + + class AindDynamicForagingRig(rig.Rig): version: Literal[__semver__] = __semver__ - triggered_camera_controller: cameras.CameraController[cameras.SpinnakerCamera] = Field( + triggered_camera_controller: cameras.CameraController[DynamicForagingSpinnakerCamera] = Field( description="Required camera controller to triggered cameras." ) monitoring_camera_controller: Optional[cameras.CameraController[cameras.WebCamera]] = Field( From 3487ac7ad32323af9a37ff8c7de8ce3175c3cb60 Mon Sep 17 00:00:00 2001 From: Micah Woodard Date: Thu, 3 Sep 2026 10:50:45 -0700 Subject: [PATCH 2/7] improves doc string --- schema/aind_behavior_dynamic_foraging.json | 2 +- src/Extensions/AindBehaviorDynamicForaging.Generated.cs | 4 ++-- src/aind_behavior_dynamic_foraging/rig.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/schema/aind_behavior_dynamic_foraging.json b/schema/aind_behavior_dynamic_foraging.json index 5b788400..ca3426dd 100644 --- a/schema/aind_behavior_dynamic_foraging.json +++ b/schema/aind_behavior_dynamic_foraging.json @@ -1751,7 +1751,7 @@ "type": "object" }, "DynamicForagingSpinnakerCamera": { - "description": "A SpinnakerCamera for the dynamic foraging rig. This is a subclass of the SpinnakerCamera that includes camera orientation settings.", + "description": "A SpinnakerCamera for the dynamic foraging rig. This is a subclass of the SpinnakerCamera that includes camera image rotation for visualizers.", "properties": { "device_type": { "const": "SpinnakerCamera", diff --git a/src/Extensions/AindBehaviorDynamicForaging.Generated.cs b/src/Extensions/AindBehaviorDynamicForaging.Generated.cs index 18cb7e4a..6d607e01 100644 --- a/src/Extensions/AindBehaviorDynamicForaging.Generated.cs +++ b/src/Extensions/AindBehaviorDynamicForaging.Generated.cs @@ -3445,11 +3445,11 @@ public override string ToString() /// - /// A SpinnakerCamera for the dynamic foraging rig. This is a subclass of the SpinnakerCamera that includes camera orientation settings. + /// A SpinnakerCamera for the dynamic foraging rig. This is a subclass of the SpinnakerCamera that includes camera image rotation for visualizers. /// [System.CodeDom.Compiler.GeneratedCodeAttribute("Bonsai.Sgen", "0.9.0.0 (Newtonsoft.Json v13.0.0.0)")] [System.ComponentModel.DescriptionAttribute("A SpinnakerCamera for the dynamic foraging rig. This is a subclass of the Spinnak" + - "erCamera that includes camera orientation settings.")] + "erCamera that includes camera image rotation for visualizers.")] [Bonsai.WorkflowElementCategoryAttribute(Bonsai.ElementCategory.Source)] [Bonsai.CombinatorAttribute(MethodName="Generate")] public partial class DynamicForagingSpinnakerCamera diff --git a/src/aind_behavior_dynamic_foraging/rig.py b/src/aind_behavior_dynamic_foraging/rig.py index 308e1635..e43660b1 100644 --- a/src/aind_behavior_dynamic_foraging/rig.py +++ b/src/aind_behavior_dynamic_foraging/rig.py @@ -73,7 +73,7 @@ class DynamicForagingAindManipulator(aind_manipulator.AindManipulator): class DynamicForagingSpinnakerCamera(cameras.SpinnakerCamera): - """A SpinnakerCamera for the dynamic foraging rig. This is a subclass of the SpinnakerCamera that includes camera orientation settings.""" + """A SpinnakerCamera for the dynamic foraging rig. This is a subclass of the SpinnakerCamera that includes camera image rotation for visualizers.""" flip_state: float = Field(default=2, gt=0, le=2, description="Camera flip state", validate_default=True) rotation: float = Field(default=0, description="Camera rotation angle in radians", validate_default=True) From 85a68df013c9427bac8ea1a3614ba51e208160e2 Mon Sep 17 00:00:00 2001 From: Micah Woodard Date: Thu, 3 Sep 2026 10:52:51 -0700 Subject: [PATCH 3/7] fixes example --- examples/rig.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/rig.py b/examples/rig.py index 67b32378..6b5d4136 100644 --- a/examples/rig.py +++ b/examples/rig.py @@ -19,6 +19,7 @@ DynamicForagingAindManipulator, DynamicForagingSoundCard, RigCalibration, + DynamicForagingSpinnakerCamera, ) manipulator_calibration = AindManipulatorCalibration( @@ -48,13 +49,13 @@ rig_name="test_rig", computer_name="test_computer", data_directory="D:/Data/", - triggered_camera_controller=cameras.CameraController[cameras.SpinnakerCamera]( + triggered_camera_controller=cameras.CameraController[DynamicForagingSpinnakerCamera]( frame_rate=120, cameras={ - "BodyCamera": cameras.SpinnakerCamera( + "BodyCamera": DynamicForagingSpinnakerCamera( serial_number="23349426", binning=1, exposure=1000, gain=8, video_writer=None ), - "SideCamera": cameras.SpinnakerCamera( + "SideCamera": DynamicForagingSpinnakerCamera( serial_number="23349424", binning=1, exposure=1000, gain=8, video_writer=None ), }, From 5d06f213efff0d2be0c4bdf381b65157230d262d Mon Sep 17 00:00:00 2001 From: Micah Woodard Date: Thu, 3 Sep 2026 10:54:43 -0700 Subject: [PATCH 4/7] lints --- examples/rig.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/rig.py b/examples/rig.py index 6b5d4136..f25f89f3 100644 --- a/examples/rig.py +++ b/examples/rig.py @@ -18,8 +18,8 @@ AindDynamicForagingRig, DynamicForagingAindManipulator, DynamicForagingSoundCard, - RigCalibration, DynamicForagingSpinnakerCamera, + RigCalibration, ) manipulator_calibration = AindManipulatorCalibration( From 50c26300ca089df79193158fb3017a440766df13 Mon Sep 17 00:00:00 2001 From: Micah Woodard Date: Fri, 4 Sep 2026 10:30:16 -0700 Subject: [PATCH 5/7] uses composite class instead of inheritance --- examples/rig.py | 5 +- schema/aind_behavior_dynamic_foraging.json | 291 ++- .../AindBehaviorDynamicForaging.Generated.cs | 2144 +++++++++-------- src/Extensions/Hardware.bonsai | 4 +- src/Extensions/HardwareQA.bonsai | 2 +- src/Extensions/Logging.bonsai | 4 +- src/aind_behavior_dynamic_foraging/rig.py | 24 +- .../instrument.py | 14 +- 8 files changed, 1355 insertions(+), 1133 deletions(-) diff --git a/examples/rig.py b/examples/rig.py index f25f89f3..50feca26 100644 --- a/examples/rig.py +++ b/examples/rig.py @@ -20,6 +20,7 @@ DynamicForagingSoundCard, DynamicForagingSpinnakerCamera, RigCalibration, + SpinnakerCamera, ) manipulator_calibration = AindManipulatorCalibration( @@ -53,10 +54,10 @@ frame_rate=120, cameras={ "BodyCamera": DynamicForagingSpinnakerCamera( - serial_number="23349426", binning=1, exposure=1000, gain=8, video_writer=None + camera=SpinnakerCamera(serial_number="23349426", binning=1, exposure=1000, gain=8, video_writer=None) ), "SideCamera": DynamicForagingSpinnakerCamera( - serial_number="23349424", binning=1, exposure=1000, gain=8, video_writer=None + camera=SpinnakerCamera(serial_number="23349424", binning=1, exposure=1000, gain=8, video_writer=None) ), }, ), diff --git a/schema/aind_behavior_dynamic_foraging.json b/schema/aind_behavior_dynamic_foraging.json index ca3426dd..44d04a5d 100644 --- a/schema/aind_behavior_dynamic_foraging.json +++ b/schema/aind_behavior_dynamic_foraging.json @@ -1751,139 +1751,23 @@ "type": "object" }, "DynamicForagingSpinnakerCamera": { - "description": "A SpinnakerCamera for the dynamic foraging rig. This is a subclass of the SpinnakerCamera that includes camera image rotation for visualizers.", + "description": "A SpinnakerCamera for the dynamic foraging rig that includes camera image rotation for visualizers.", "properties": { - "device_type": { - "const": "SpinnakerCamera", - "default": "SpinnakerCamera", - "title": "Device Type", - "type": "string" - }, - "calibration": { - "default": null, - "description": "Calibration for the device.", - "oneOf": [ - { - "$ref": "#/$defs/BaseModel" - }, - { - "type": "null" - } - ] - }, - "serial_number": { - "description": "Camera serial number", - "title": "Serial Number", - "type": "string" - }, - "binning": { - "default": 1, - "description": "Binning", - "minimum": 1, - "title": "Binning", - "type": "integer" - }, - "color_processing": { - "default": "Default", - "description": "Color processing", - "enum": [ - "Default", - "NoColorProcessing" - ], - "title": "Color Processing", - "type": "string" - }, - "exposure": { - "default": 1000, - "description": "Exposure time", - "minimum": 100, - "title": "Exposure", - "type": "integer" - }, - "gain": { - "default": 0, - "description": "Gain", - "minimum": 0, - "title": "Gain", - "type": "number" - }, - "gamma": { - "default": null, - "description": "Gamma. If None, will disable gamma correction.", - "oneOf": [ - { - "minimum": 0, - "type": "number" - }, - { - "type": "null" - } - ], - "title": "Gamma" + "camera": { + "$ref": "#/$defs/SpinnakerCamera", + "description": "Spinnaker camera instance" }, - "adc_bit_depth": { - "default": 0, - "description": "ADC bit depth. If None will be left as default.", - "oneOf": [ - { - "$ref": "#/$defs/SpinnakerCameraAdcBitDepth" - }, - { - "type": "null" - } - ] - }, - "pixel_format": { - "default": 0, - "description": "Pixel format. If None will be left as default.", - "oneOf": [ - { - "$ref": "#/$defs/SpinnakerCameraPixelFormat" - }, - { - "type": "null" - } - ] - }, - "region_of_interest": { - "$ref": "#/$defs/Rect", + "visualizer_settings": { + "$ref": "#/$defs/VisualizerSettings", "default": { - "x": 0, - "y": 0, - "width": 0, - "height": 0 + "flip_state": null, + "rotation": 0.0 }, - "description": "Region of interest" - }, - "video_writer": { - "default": null, - "description": "Video writer. If not provided, no video will be saved.", - "oneOf": [ - { - "$ref": "#/$defs/VideoWriter" - }, - { - "type": "null" - } - ] - }, - "flip_state": { - "default": 2, - "description": "Camera flip state", - "exclusiveMinimum": 0, - "maximum": 2, - "title": "Flip State", - "type": "number" - }, - "rotation": { - "default": 0, - "description": "Camera rotation angle in radians", - "title": "Rotation", - "type": "number" + "description": "Visualizer settings for the camera" } }, "required": [ - "serial_number" + "camera" ], "title": "DynamicForagingSpinnakerCamera", "type": "object" @@ -3160,6 +3044,130 @@ "title": "SoundCardCalibration", "type": "object" }, + "SpinnakerCamera": { + "description": "Spinnaker camera device configuration.", + "properties": { + "device_type": { + "const": "SpinnakerCamera", + "default": "SpinnakerCamera", + "title": "Device Type", + "type": "string" + }, + "calibration": { + "default": null, + "description": "Calibration for the device.", + "oneOf": [ + { + "$ref": "#/$defs/BaseModel" + }, + { + "type": "null" + } + ] + }, + "serial_number": { + "description": "Camera serial number", + "title": "Serial Number", + "type": "string" + }, + "binning": { + "default": 1, + "description": "Binning", + "minimum": 1, + "title": "Binning", + "type": "integer" + }, + "color_processing": { + "default": "Default", + "description": "Color processing", + "enum": [ + "Default", + "NoColorProcessing" + ], + "title": "Color Processing", + "type": "string" + }, + "exposure": { + "default": 1000, + "description": "Exposure time", + "minimum": 100, + "title": "Exposure", + "type": "integer" + }, + "gain": { + "default": 0, + "description": "Gain", + "minimum": 0, + "title": "Gain", + "type": "number" + }, + "gamma": { + "default": null, + "description": "Gamma. If None, will disable gamma correction.", + "oneOf": [ + { + "minimum": 0, + "type": "number" + }, + { + "type": "null" + } + ], + "title": "Gamma" + }, + "adc_bit_depth": { + "default": 0, + "description": "ADC bit depth. If None will be left as default.", + "oneOf": [ + { + "$ref": "#/$defs/SpinnakerCameraAdcBitDepth" + }, + { + "type": "null" + } + ] + }, + "pixel_format": { + "default": 0, + "description": "Pixel format. If None will be left as default.", + "oneOf": [ + { + "$ref": "#/$defs/SpinnakerCameraPixelFormat" + }, + { + "type": "null" + } + ] + }, + "region_of_interest": { + "$ref": "#/$defs/Rect", + "default": { + "x": 0, + "y": 0, + "width": 0, + "height": 0 + }, + "description": "Region of interest" + }, + "video_writer": { + "default": null, + "description": "Video writer. If not provided, no video will be saved.", + "oneOf": [ + { + "$ref": "#/$defs/VideoWriter" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "serial_number" + ], + "title": "SpinnakerCamera", + "type": "object" + }, "SpinnakerCameraAdcBitDepth": { "description": "ADC bit depth options for Spinnaker cameras.", "enum": [ @@ -4125,6 +4133,37 @@ "title": "VideoWriterOpenCv", "type": "object" }, + "VisualizerSettings": { + "description": "Visualizer settings for the dynamic foraging rig's camera. This includes camera image rotation and flip state for visualizers.", + "properties": { + "flip_state": { + "default": null, + "description": "Camera flip state", + "oneOf": [ + { + "enum": [ + "horizontal", + "vertical", + "both" + ], + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Flip State" + }, + "rotation": { + "default": 0, + "description": "Camera rotation angle in radians", + "title": "Rotation", + "type": "number" + } + }, + "title": "VisualizerSettings", + "type": "object" + }, "WaterValveCalibration": { "description": "Represents a water valve calibration.", "properties": { diff --git a/src/Extensions/AindBehaviorDynamicForaging.Generated.cs b/src/Extensions/AindBehaviorDynamicForaging.Generated.cs index 6d607e01..6a0590fc 100644 --- a/src/Extensions/AindBehaviorDynamicForaging.Generated.cs +++ b/src/Extensions/AindBehaviorDynamicForaging.Generated.cs @@ -3445,74 +3445,129 @@ public override string ToString() /// - /// A SpinnakerCamera for the dynamic foraging rig. This is a subclass of the SpinnakerCamera that includes camera image rotation for visualizers. + /// A SpinnakerCamera for the dynamic foraging rig that includes camera image rotation for visualizers. /// [System.CodeDom.Compiler.GeneratedCodeAttribute("Bonsai.Sgen", "0.9.0.0 (Newtonsoft.Json v13.0.0.0)")] - [System.ComponentModel.DescriptionAttribute("A SpinnakerCamera for the dynamic foraging rig. This is a subclass of the Spinnak" + - "erCamera that includes camera image rotation for visualizers.")] + [System.ComponentModel.DescriptionAttribute("A SpinnakerCamera for the dynamic foraging rig that includes camera image rotatio" + + "n for visualizers.")] [Bonsai.WorkflowElementCategoryAttribute(Bonsai.ElementCategory.Source)] [Bonsai.CombinatorAttribute(MethodName="Generate")] public partial class DynamicForagingSpinnakerCamera { - private string _deviceType; + private SpinnakerCamera _camera; - private BaseModel _calibration; + private VisualizerSettings _visualizerSettings; - private string _serialNumber; + public DynamicForagingSpinnakerCamera() + { + _camera = new SpinnakerCamera(); + _visualizerSettings = new VisualizerSettings(); + } - private int _binning; + protected DynamicForagingSpinnakerCamera(DynamicForagingSpinnakerCamera other) + { + _camera = other._camera; + _visualizerSettings = other._visualizerSettings; + } - private DynamicForagingSpinnakerCameraColorProcessing _colorProcessing; + /// + /// Spinnaker camera instance + /// + [System.Xml.Serialization.XmlIgnoreAttribute()] + [Newtonsoft.Json.JsonPropertyAttribute("camera", Required=Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DescriptionAttribute("Spinnaker camera instance")] + public SpinnakerCamera Camera + { + get + { + return _camera; + } + set + { + _camera = value; + } + } - private int _exposure; + /// + /// Visualizer settings for the camera + /// + [System.Xml.Serialization.XmlIgnoreAttribute()] + [Newtonsoft.Json.JsonPropertyAttribute("visualizer_settings")] + [System.ComponentModel.DescriptionAttribute("Visualizer settings for the camera")] + public VisualizerSettings VisualizerSettings + { + get + { + return _visualizerSettings; + } + set + { + _visualizerSettings = value; + } + } - private double _gain; + public System.IObservable Generate() + { + return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new DynamicForagingSpinnakerCamera(this))); + } - private double? _gamma; + public System.IObservable Generate(System.IObservable source) + { + return System.Reactive.Linq.Observable.Select(source, _ => new DynamicForagingSpinnakerCamera(this)); + } - private SpinnakerCameraAdcBitDepth? _adcBitDepth; + protected virtual bool PrintMembers(System.Text.StringBuilder stringBuilder) + { + stringBuilder.Append("Camera = " + _camera + ", "); + stringBuilder.Append("VisualizerSettings = " + _visualizerSettings); + return true; + } - private SpinnakerCameraPixelFormat? _pixelFormat; + 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.9.0.0 (Newtonsoft.Json v13.0.0.0)")] + [Bonsai.WorkflowElementCategoryAttribute(Bonsai.ElementCategory.Source)] + [Bonsai.CombinatorAttribute(MethodName="Generate")] + public partial class HarpBehavior + { - private Rect _regionOfInterest; + private string _deviceType; - private VideoWriter _videoWriter; + private BaseModel _calibration; - private double _flipState; + private int _whoAmI; - private double _rotation; + private string _serialNumber; - public DynamicForagingSpinnakerCamera() + private string _portName; + + public HarpBehavior() { - _deviceType = "SpinnakerCamera"; - _binning = 1; - _colorProcessing = DynamicForagingSpinnakerCameraColorProcessing.Default; - _exposure = 1000; - _gain = 0D; - _adcBitDepth = SpinnakerCameraAdcBitDepth.Adc8bit; - _pixelFormat = SpinnakerCameraPixelFormat.Mono8; - _regionOfInterest = new Rect(); - _flipState = 2D; - _rotation = 0D; + _deviceType = "Behavior"; + _whoAmI = 1216; } - protected DynamicForagingSpinnakerCamera(DynamicForagingSpinnakerCamera other) + protected HarpBehavior(HarpBehavior other) { _deviceType = other._deviceType; _calibration = other._calibration; + _whoAmI = other._whoAmI; _serialNumber = other._serialNumber; - _binning = other._binning; - _colorProcessing = other._colorProcessing; - _exposure = other._exposure; - _gain = other._gain; - _gamma = other._gamma; - _adcBitDepth = other._adcBitDepth; - _pixelFormat = other._pixelFormat; - _regionOfInterest = other._regionOfInterest; - _videoWriter = other._videoWriter; - _flipState = other._flipState; - _rotation = other._rotation; + _portName = other._portName; } [Newtonsoft.Json.JsonPropertyAttribute("device_type")] @@ -3546,238 +3601,214 @@ public BaseModel Calibration } } - /// - /// Camera serial number - /// - [Newtonsoft.Json.JsonPropertyAttribute("serial_number", Required=Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DescriptionAttribute("Camera serial number")] - public string SerialNumber + [Newtonsoft.Json.JsonPropertyAttribute("who_am_i")] + public int WhoAmI { get { - return _serialNumber; + return _whoAmI; } set { - _serialNumber = value; + _whoAmI = value; } } /// - /// Binning + /// Device serial number /// - [Newtonsoft.Json.JsonPropertyAttribute("binning")] - [System.ComponentModel.DescriptionAttribute("Binning")] - public int Binning + [Newtonsoft.Json.JsonPropertyAttribute("serial_number")] + [System.ComponentModel.DescriptionAttribute("Device serial number")] + public string SerialNumber { get { - return _binning; + return _serialNumber; } set { - _binning = value; + _serialNumber = value; } } /// - /// Color processing + /// Device port name /// - [Newtonsoft.Json.JsonPropertyAttribute("color_processing")] - [System.ComponentModel.DescriptionAttribute("Color processing")] - public DynamicForagingSpinnakerCameraColorProcessing ColorProcessing + [Newtonsoft.Json.JsonPropertyAttribute("port_name", Required=Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DescriptionAttribute("Device port name")] + public string PortName { get { - return _colorProcessing; + return _portName; } set { - _colorProcessing = value; + _portName = value; } } - /// - /// Exposure time - /// - [Newtonsoft.Json.JsonPropertyAttribute("exposure")] - [System.ComponentModel.DescriptionAttribute("Exposure time")] - public int Exposure + public System.IObservable Generate() + { + return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new HarpBehavior(this))); + } + + public System.IObservable Generate(System.IObservable source) + { + return System.Reactive.Linq.Observable.Select(source, _ => new HarpBehavior(this)); + } + + protected virtual bool PrintMembers(System.Text.StringBuilder stringBuilder) + { + stringBuilder.Append("DeviceType = " + _deviceType + ", "); + stringBuilder.Append("Calibration = " + _calibration + ", "); + stringBuilder.Append("WhoAmI = " + _whoAmI + ", "); + stringBuilder.Append("SerialNumber = " + _serialNumber + ", "); + stringBuilder.Append("PortName = " + _portName); + 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.9.0.0 (Newtonsoft.Json v13.0.0.0)")] + [Bonsai.WorkflowElementCategoryAttribute(Bonsai.ElementCategory.Source)] + [Bonsai.CombinatorAttribute(MethodName="Generate")] + public partial class HarpEnvironmentSensor + { + + private string _deviceType; + + private BaseModel _calibration; + + private int _whoAmI; + + private string _serialNumber; + + private string _portName; + + public HarpEnvironmentSensor() + { + _deviceType = "EnvironmentSensor"; + _whoAmI = 1405; + } + + protected HarpEnvironmentSensor(HarpEnvironmentSensor other) + { + _deviceType = other._deviceType; + _calibration = other._calibration; + _whoAmI = other._whoAmI; + _serialNumber = other._serialNumber; + _portName = other._portName; + } + + [Newtonsoft.Json.JsonPropertyAttribute("device_type")] + public string DeviceType { get { - return _exposure; + return _deviceType; } set { - _exposure = value; + _deviceType = value; } } /// - /// Gain + /// Calibration for the device. /// - [Newtonsoft.Json.JsonPropertyAttribute("gain")] - [System.ComponentModel.DescriptionAttribute("Gain")] - public double Gain + [System.Xml.Serialization.XmlIgnoreAttribute()] + [Newtonsoft.Json.JsonPropertyAttribute("calibration")] + [System.ComponentModel.DescriptionAttribute("Calibration for the device.")] + public BaseModel Calibration { get { - return _gain; + return _calibration; } set { - _gain = value; + _calibration = value; } } - /// - /// Gamma. If None, will disable gamma correction. - /// - [Newtonsoft.Json.JsonPropertyAttribute("gamma")] - [System.ComponentModel.DescriptionAttribute("Gamma. If None, will disable gamma correction.")] - public double? Gamma + [Newtonsoft.Json.JsonPropertyAttribute("who_am_i")] + public int WhoAmI { get { - return _gamma; + return _whoAmI; } set { - _gamma = value; + _whoAmI = value; } } /// - /// ADC bit depth. If None will be left as default. + /// Device serial number /// - [Newtonsoft.Json.JsonPropertyAttribute("adc_bit_depth")] - [System.ComponentModel.DescriptionAttribute("ADC bit depth. If None will be left as default.")] - public SpinnakerCameraAdcBitDepth? AdcBitDepth + [Newtonsoft.Json.JsonPropertyAttribute("serial_number")] + [System.ComponentModel.DescriptionAttribute("Device serial number")] + public string SerialNumber { get { - return _adcBitDepth; + return _serialNumber; } set { - _adcBitDepth = value; + _serialNumber = value; } } /// - /// Pixel format. If None will be left as default. - /// - [Newtonsoft.Json.JsonPropertyAttribute("pixel_format")] - [System.ComponentModel.DescriptionAttribute("Pixel format. If None will be left as default.")] - public SpinnakerCameraPixelFormat? PixelFormat - { - get - { - return _pixelFormat; - } - set - { - _pixelFormat = value; - } - } - - /// - /// Region of interest - /// - [System.Xml.Serialization.XmlIgnoreAttribute()] - [Newtonsoft.Json.JsonPropertyAttribute("region_of_interest")] - [System.ComponentModel.DescriptionAttribute("Region of interest")] - public Rect RegionOfInterest - { - get - { - return _regionOfInterest; - } - set - { - _regionOfInterest = value; - } - } - - /// - /// Video writer. If not provided, no video will be saved. - /// - [System.Xml.Serialization.XmlIgnoreAttribute()] - [Newtonsoft.Json.JsonPropertyAttribute("video_writer")] - [System.ComponentModel.DescriptionAttribute("Video writer. If not provided, no video will be saved.")] - public VideoWriter VideoWriter - { - get - { - return _videoWriter; - } - set - { - _videoWriter = value; - } - } - - /// - /// Camera flip state - /// - [Newtonsoft.Json.JsonPropertyAttribute("flip_state")] - [System.ComponentModel.DescriptionAttribute("Camera flip state")] - public double FlipState - { - get - { - return _flipState; - } - set - { - _flipState = value; - } - } - - /// - /// Camera rotation angle in radians + /// Device port name /// - [Newtonsoft.Json.JsonPropertyAttribute("rotation")] - [System.ComponentModel.DescriptionAttribute("Camera rotation angle in radians")] - public double Rotation + [Newtonsoft.Json.JsonPropertyAttribute("port_name", Required=Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DescriptionAttribute("Device port name")] + public string PortName { get { - return _rotation; + return _portName; } set { - _rotation = value; + _portName = value; } } - public System.IObservable Generate() + public System.IObservable Generate() { - return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new DynamicForagingSpinnakerCamera(this))); + return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new HarpEnvironmentSensor(this))); } - public System.IObservable Generate(System.IObservable source) + public System.IObservable Generate(System.IObservable source) { - return System.Reactive.Linq.Observable.Select(source, _ => new DynamicForagingSpinnakerCamera(this)); + return System.Reactive.Linq.Observable.Select(source, _ => new HarpEnvironmentSensor(this)); } protected virtual bool PrintMembers(System.Text.StringBuilder stringBuilder) { stringBuilder.Append("DeviceType = " + _deviceType + ", "); stringBuilder.Append("Calibration = " + _calibration + ", "); + stringBuilder.Append("WhoAmI = " + _whoAmI + ", "); stringBuilder.Append("SerialNumber = " + _serialNumber + ", "); - stringBuilder.Append("Binning = " + _binning + ", "); - stringBuilder.Append("ColorProcessing = " + _colorProcessing + ", "); - stringBuilder.Append("Exposure = " + _exposure + ", "); - stringBuilder.Append("Gain = " + _gain + ", "); - stringBuilder.Append("Gamma = " + _gamma + ", "); - stringBuilder.Append("AdcBitDepth = " + _adcBitDepth + ", "); - stringBuilder.Append("PixelFormat = " + _pixelFormat + ", "); - stringBuilder.Append("RegionOfInterest = " + _regionOfInterest + ", "); - stringBuilder.Append("VideoWriter = " + _videoWriter + ", "); - stringBuilder.Append("FlipState = " + _flipState + ", "); - stringBuilder.Append("Rotation = " + _rotation); + stringBuilder.Append("PortName = " + _portName); return true; } @@ -3799,7 +3830,7 @@ public override string ToString() [System.CodeDom.Compiler.GeneratedCodeAttribute("Bonsai.Sgen", "0.9.0.0 (Newtonsoft.Json v13.0.0.0)")] [Bonsai.WorkflowElementCategoryAttribute(Bonsai.ElementCategory.Source)] [Bonsai.CombinatorAttribute(MethodName="Generate")] - public partial class HarpBehavior + public partial class HarpLicketySplit { private string _deviceType; @@ -3812,13 +3843,13 @@ public partial class HarpBehavior private string _portName; - public HarpBehavior() + public HarpLicketySplit() { - _deviceType = "Behavior"; - _whoAmI = 1216; + _deviceType = "LicketySplit"; + _whoAmI = 1400; } - protected HarpBehavior(HarpBehavior other) + protected HarpLicketySplit(HarpLicketySplit other) { _deviceType = other._deviceType; _calibration = other._calibration; @@ -3905,14 +3936,14 @@ public string PortName } } - public System.IObservable Generate() + public System.IObservable Generate() { - return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new HarpBehavior(this))); + return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new HarpLicketySplit(this))); } - public System.IObservable Generate(System.IObservable source) + public System.IObservable Generate(System.IObservable source) { - return System.Reactive.Linq.Observable.Select(source, _ => new HarpBehavior(this)); + return System.Reactive.Linq.Observable.Select(source, _ => new HarpLicketySplit(this)); } protected virtual bool PrintMembers(System.Text.StringBuilder stringBuilder) @@ -3943,7 +3974,7 @@ public override string ToString() [System.CodeDom.Compiler.GeneratedCodeAttribute("Bonsai.Sgen", "0.9.0.0 (Newtonsoft.Json v13.0.0.0)")] [Bonsai.WorkflowElementCategoryAttribute(Bonsai.ElementCategory.Source)] [Bonsai.CombinatorAttribute(MethodName="Generate")] - public partial class HarpEnvironmentSensor + public partial class HarpSniffDetector { private string _deviceType; @@ -3956,13 +3987,13 @@ public partial class HarpEnvironmentSensor private string _portName; - public HarpEnvironmentSensor() + public HarpSniffDetector() { - _deviceType = "EnvironmentSensor"; - _whoAmI = 1405; + _deviceType = "SniffDetector"; + _whoAmI = 1401; } - protected HarpEnvironmentSensor(HarpEnvironmentSensor other) + protected HarpSniffDetector(HarpSniffDetector other) { _deviceType = other._deviceType; _calibration = other._calibration; @@ -4049,14 +4080,14 @@ public string PortName } } - public System.IObservable Generate() + public System.IObservable Generate() { - return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new HarpEnvironmentSensor(this))); + return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new HarpSniffDetector(this))); } - public System.IObservable Generate(System.IObservable source) + public System.IObservable Generate(System.IObservable source) { - return System.Reactive.Linq.Observable.Select(source, _ => new HarpEnvironmentSensor(this)); + return System.Reactive.Linq.Observable.Select(source, _ => new HarpSniffDetector(this)); } protected virtual bool PrintMembers(System.Text.StringBuilder stringBuilder) @@ -4087,7 +4118,7 @@ public override string ToString() [System.CodeDom.Compiler.GeneratedCodeAttribute("Bonsai.Sgen", "0.9.0.0 (Newtonsoft.Json v13.0.0.0)")] [Bonsai.WorkflowElementCategoryAttribute(Bonsai.ElementCategory.Source)] [Bonsai.CombinatorAttribute(MethodName="Generate")] - public partial class HarpLicketySplit + public partial class HarpWhiteRabbit { private string _deviceType; @@ -4100,19 +4131,23 @@ public partial class HarpLicketySplit private string _portName; - public HarpLicketySplit() + private System.Collections.Generic.List _connectedClockOutputs; + + public HarpWhiteRabbit() { - _deviceType = "LicketySplit"; - _whoAmI = 1400; + _deviceType = "WhiteRabbit"; + _whoAmI = 1404; + _connectedClockOutputs = new System.Collections.Generic.List(); } - protected HarpLicketySplit(HarpLicketySplit other) + protected HarpWhiteRabbit(HarpWhiteRabbit other) { _deviceType = other._deviceType; _calibration = other._calibration; _whoAmI = other._whoAmI; _serialNumber = other._serialNumber; _portName = other._portName; + _connectedClockOutputs = other._connectedClockOutputs; } [Newtonsoft.Json.JsonPropertyAttribute("device_type")] @@ -4193,14 +4228,32 @@ public string PortName } } - public System.IObservable Generate() + /// + /// Connected clock outputs + /// + [System.Xml.Serialization.XmlIgnoreAttribute()] + [Newtonsoft.Json.JsonPropertyAttribute("connected_clock_outputs")] + [System.ComponentModel.DescriptionAttribute("Connected clock outputs")] + public System.Collections.Generic.List ConnectedClockOutputs { - return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new HarpLicketySplit(this))); + get + { + return _connectedClockOutputs; + } + set + { + _connectedClockOutputs = value; + } } - public System.IObservable Generate(System.IObservable source) + public System.IObservable Generate() { - return System.Reactive.Linq.Observable.Select(source, _ => new HarpLicketySplit(this)); + return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new HarpWhiteRabbit(this))); + } + + public System.IObservable Generate(System.IObservable source) + { + return System.Reactive.Linq.Observable.Select(source, _ => new HarpWhiteRabbit(this)); } protected virtual bool PrintMembers(System.Text.StringBuilder stringBuilder) @@ -4209,7 +4262,8 @@ protected virtual bool PrintMembers(System.Text.StringBuilder stringBuilder) stringBuilder.Append("Calibration = " + _calibration + ", "); stringBuilder.Append("WhoAmI = " + _whoAmI + ", "); stringBuilder.Append("SerialNumber = " + _serialNumber + ", "); - stringBuilder.Append("PortName = " + _portName); + stringBuilder.Append("PortName = " + _portName + ", "); + stringBuilder.Append("ConnectedClockOutputs = " + _connectedClockOutputs); return true; } @@ -4231,129 +4285,151 @@ public override string ToString() [System.CodeDom.Compiler.GeneratedCodeAttribute("Bonsai.Sgen", "0.9.0.0 (Newtonsoft.Json v13.0.0.0)")] [Bonsai.WorkflowElementCategoryAttribute(Bonsai.ElementCategory.Source)] [Bonsai.CombinatorAttribute(MethodName="Generate")] - public partial class HarpSniffDetector + public partial class IntegrationTestTrialGeneratorSpec : TrialGeneratorSpec { - private string _deviceType; + public IntegrationTestTrialGeneratorSpec() + { + } - private BaseModel _calibration; + protected IntegrationTestTrialGeneratorSpec(IntegrationTestTrialGeneratorSpec other) : + base(other) + { + } - private int _whoAmI; + public System.IObservable Generate() + { + return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new IntegrationTestTrialGeneratorSpec(this))); + } - private string _serialNumber; + public System.IObservable Generate(System.IObservable source) + { + return System.Reactive.Linq.Observable.Select(source, _ => new IntegrationTestTrialGeneratorSpec(this)); + } - private string _portName; + protected override bool PrintMembers(System.Text.StringBuilder stringBuilder) + { + return base.PrintMembers(stringBuilder); + } + } + + + /// + /// Input for water valve calibration class + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("Bonsai.Sgen", "0.9.0.0 (Newtonsoft.Json v13.0.0.0)")] + [System.ComponentModel.DescriptionAttribute("Input for water valve calibration class")] + [Bonsai.WorkflowElementCategoryAttribute(Bonsai.ElementCategory.Source)] + [Bonsai.CombinatorAttribute(MethodName="Generate")] + public partial class Measurement + { - public HarpSniffDetector() + private double _valveOpenInterval; + + private double _valveOpenTime; + + private System.Collections.Generic.List _waterWeight; + + private int _repeatCount; + + public Measurement() { - _deviceType = "SniffDetector"; - _whoAmI = 1401; + _waterWeight = new System.Collections.Generic.List(); } - protected HarpSniffDetector(HarpSniffDetector other) + protected Measurement(Measurement other) { - _deviceType = other._deviceType; - _calibration = other._calibration; - _whoAmI = other._whoAmI; - _serialNumber = other._serialNumber; - _portName = other._portName; + _valveOpenInterval = other._valveOpenInterval; + _valveOpenTime = other._valveOpenTime; + _waterWeight = other._waterWeight; + _repeatCount = other._repeatCount; } - [Newtonsoft.Json.JsonPropertyAttribute("device_type")] - public string DeviceType + /// + /// Time between two consecutive valve openings (s) + /// + [Newtonsoft.Json.JsonPropertyAttribute("valve_open_interval", Required=Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DescriptionAttribute("Time between two consecutive valve openings (s)")] + public double ValveOpenInterval { get { - return _deviceType; + return _valveOpenInterval; } set { - _deviceType = value; + _valveOpenInterval = value; } } /// - /// Calibration for the device. + /// Valve open interval (s) /// - [System.Xml.Serialization.XmlIgnoreAttribute()] - [Newtonsoft.Json.JsonPropertyAttribute("calibration")] - [System.ComponentModel.DescriptionAttribute("Calibration for the device.")] - public BaseModel Calibration - { - get - { - return _calibration; - } - set - { - _calibration = value; - } - } - - [Newtonsoft.Json.JsonPropertyAttribute("who_am_i")] - public int WhoAmI + [Newtonsoft.Json.JsonPropertyAttribute("valve_open_time", Required=Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DescriptionAttribute("Valve open interval (s)")] + public double ValveOpenTime { get { - return _whoAmI; + return _valveOpenTime; } set { - _whoAmI = value; + _valveOpenTime = value; } } /// - /// Device serial number + /// Weight of water delivered (g) /// - [Newtonsoft.Json.JsonPropertyAttribute("serial_number")] - [System.ComponentModel.DescriptionAttribute("Device serial number")] - public string SerialNumber + [System.Xml.Serialization.XmlIgnoreAttribute()] + [Newtonsoft.Json.JsonPropertyAttribute("water_weight", Required=Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DescriptionAttribute("Weight of water delivered (g)")] + public System.Collections.Generic.List WaterWeight { get { - return _serialNumber; + return _waterWeight; } set { - _serialNumber = value; + _waterWeight = value; } } /// - /// Device port name + /// Number of times the valve opened. /// - [Newtonsoft.Json.JsonPropertyAttribute("port_name", Required=Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DescriptionAttribute("Device port name")] - public string PortName + [Newtonsoft.Json.JsonPropertyAttribute("repeat_count", Required=Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DescriptionAttribute("Number of times the valve opened.")] + public int RepeatCount { get { - return _portName; + return _repeatCount; } set { - _portName = value; + _repeatCount = value; } } - public System.IObservable Generate() + public System.IObservable Generate() { - return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new HarpSniffDetector(this))); + return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new Measurement(this))); } - public System.IObservable Generate(System.IObservable source) + public System.IObservable Generate(System.IObservable source) { - return System.Reactive.Linq.Observable.Select(source, _ => new HarpSniffDetector(this)); + return System.Reactive.Linq.Observable.Select(source, _ => new Measurement(this)); } protected virtual bool PrintMembers(System.Text.StringBuilder stringBuilder) { - stringBuilder.Append("DeviceType = " + _deviceType + ", "); - stringBuilder.Append("Calibration = " + _calibration + ", "); - stringBuilder.Append("WhoAmI = " + _whoAmI + ", "); - stringBuilder.Append("SerialNumber = " + _serialNumber + ", "); - stringBuilder.Append("PortName = " + _portName); + stringBuilder.Append("ValveOpenInterval = " + _valveOpenInterval + ", "); + stringBuilder.Append("ValveOpenTime = " + _valveOpenTime + ", "); + stringBuilder.Append("WaterWeight = " + _waterWeight + ", "); + stringBuilder.Append("RepeatCount = " + _repeatCount); return true; } @@ -4372,155 +4448,196 @@ public override string ToString() } + /// + /// Metadata for trial. These fields will NOT be used by the task engine. + /// [System.CodeDom.Compiler.GeneratedCodeAttribute("Bonsai.Sgen", "0.9.0.0 (Newtonsoft.Json v13.0.0.0)")] + [System.ComponentModel.DescriptionAttribute("Metadata for trial. These fields will NOT be used by the task engine.")] [Bonsai.WorkflowElementCategoryAttribute(Bonsai.ElementCategory.Source)] [Bonsai.CombinatorAttribute(MethodName="Generate")] - public partial class HarpWhiteRabbit + public partial class Metadata { - private string _deviceType; - - private BaseModel _calibration; - - private int _whoAmI; - - private string _serialNumber; + private double? _pRewardLeft; - private string _portName; + private double? _pRewardRight; - private System.Collections.Generic.List _connectedClockOutputs; + private object _extra; - public HarpWhiteRabbit() + public Metadata() { - _deviceType = "WhiteRabbit"; - _whoAmI = 1404; - _connectedClockOutputs = new System.Collections.Generic.List(); } - protected HarpWhiteRabbit(HarpWhiteRabbit other) + protected Metadata(Metadata other) { - _deviceType = other._deviceType; - _calibration = other._calibration; - _whoAmI = other._whoAmI; - _serialNumber = other._serialNumber; - _portName = other._portName; - _connectedClockOutputs = other._connectedClockOutputs; + _pRewardLeft = other._pRewardLeft; + _pRewardRight = other._pRewardRight; + _extra = other._extra; } - [Newtonsoft.Json.JsonPropertyAttribute("device_type")] - public string DeviceType + /// + /// Metadata for block probability of reward on the left side if response is made. + /// + [Newtonsoft.Json.JsonPropertyAttribute("p_reward_left")] + [System.ComponentModel.DescriptionAttribute("Metadata for block probability of reward on the left side if response is made.")] + public double? PRewardLeft { get { - return _deviceType; + return _pRewardLeft; } set { - _deviceType = value; + _pRewardLeft = value; } } /// - /// Calibration for the device. + /// Metadata for the probability of reward on the right side if response is made. /// - [System.Xml.Serialization.XmlIgnoreAttribute()] - [Newtonsoft.Json.JsonPropertyAttribute("calibration")] - [System.ComponentModel.DescriptionAttribute("Calibration for the device.")] - public BaseModel Calibration + [Newtonsoft.Json.JsonPropertyAttribute("p_reward_right")] + [System.ComponentModel.DescriptionAttribute("Metadata for the probability of reward on the right side if response is made.")] + public double? PRewardRight { get { - return _calibration; + return _pRewardRight; } set { - _calibration = value; + _pRewardRight = value; } } - [Newtonsoft.Json.JsonPropertyAttribute("who_am_i")] - public int WhoAmI + /// + /// Additional metadata to include with the trial. This field will NOT be used or validated by the task engine. + /// + [System.Xml.Serialization.XmlIgnoreAttribute()] + [Newtonsoft.Json.JsonPropertyAttribute("extra")] + [System.ComponentModel.DescriptionAttribute("Additional metadata to include with the trial. This field will NOT be used or val" + + "idated by the task engine.")] + public object Extra { get { - return _whoAmI; + return _extra; } set { - _whoAmI = value; + _extra = value; } } - /// - /// Device serial number - /// - [Newtonsoft.Json.JsonPropertyAttribute("serial_number")] - [System.ComponentModel.DescriptionAttribute("Device serial number")] - public string SerialNumber + public System.IObservable Generate() { - get - { - return _serialNumber; - } - set + return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new Metadata(this))); + } + + public System.IObservable Generate(System.IObservable source) + { + return System.Reactive.Linq.Observable.Select(source, _ => new Metadata(this)); + } + + protected virtual bool PrintMembers(System.Text.StringBuilder stringBuilder) + { + stringBuilder.Append("PRewardLeft = " + _pRewardLeft + ", "); + stringBuilder.Append("PRewardRight = " + _pRewardRight + ", "); + stringBuilder.Append("Extra = " + _extra); + return true; + } + + public override string ToString() + { + System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); + stringBuilder.Append(GetType().Name); + stringBuilder.Append(" { "); + if (PrintMembers(stringBuilder)) { - _serialNumber = value; + stringBuilder.Append(" "); } + stringBuilder.Append("}"); + return stringBuilder.ToString(); + } + } + + + /// + /// Defines the conditions under which a block is extended due to perseveration on minimum probability side. + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("Bonsai.Sgen", "0.9.0.0 (Newtonsoft.Json v13.0.0.0)")] + [System.ComponentModel.DescriptionAttribute("Defines the conditions under which a block is extended due to perseveration on mi" + + "nimum probability side.")] + [Bonsai.WorkflowElementCategoryAttribute(Bonsai.ElementCategory.Source)] + [Bonsai.CombinatorAttribute(MethodName="Generate")] + public partial class MinimumProbabilityPerseverationConditions + { + + private int _choiceStreak; + + private int _blockExtension; + + public MinimumProbabilityPerseverationConditions() + { + _choiceStreak = 4; + _blockExtension = 4; + } + + protected MinimumProbabilityPerseverationConditions(MinimumProbabilityPerseverationConditions other) + { + _choiceStreak = other._choiceStreak; + _blockExtension = other._blockExtension; } /// - /// Device port name + /// Number of consecutive choices on the minimum-probability side required to extend both block lengths. /// - [Newtonsoft.Json.JsonPropertyAttribute("port_name", Required=Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DescriptionAttribute("Device port name")] - public string PortName + [Newtonsoft.Json.JsonPropertyAttribute("choice_streak")] + [System.ComponentModel.DescriptionAttribute("Number of consecutive choices on the minimum-probability side required to extend " + + "both block lengths.")] + public int ChoiceStreak { get { - return _portName; + return _choiceStreak; } set { - _portName = value; + _choiceStreak = value; } } /// - /// Connected clock outputs + /// Number of trials to extend both block lengths when the choice streak condition is met. /// - [System.Xml.Serialization.XmlIgnoreAttribute()] - [Newtonsoft.Json.JsonPropertyAttribute("connected_clock_outputs")] - [System.ComponentModel.DescriptionAttribute("Connected clock outputs")] - public System.Collections.Generic.List ConnectedClockOutputs + [Newtonsoft.Json.JsonPropertyAttribute("block_extension")] + [System.ComponentModel.DescriptionAttribute("Number of trials to extend both block lengths when the choice streak condition is" + + " met.")] + public int BlockExtension { get { - return _connectedClockOutputs; + return _blockExtension; } set { - _connectedClockOutputs = value; + _blockExtension = value; } } - public System.IObservable Generate() + public System.IObservable Generate() { - return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new HarpWhiteRabbit(this))); + return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new MinimumProbabilityPerseverationConditions(this))); } - public System.IObservable Generate(System.IObservable source) + public System.IObservable Generate(System.IObservable source) { - return System.Reactive.Linq.Observable.Select(source, _ => new HarpWhiteRabbit(this)); + return System.Reactive.Linq.Observable.Select(source, _ => new MinimumProbabilityPerseverationConditions(this)); } protected virtual bool PrintMembers(System.Text.StringBuilder stringBuilder) { - stringBuilder.Append("DeviceType = " + _deviceType + ", "); - stringBuilder.Append("Calibration = " + _calibration + ", "); - stringBuilder.Append("WhoAmI = " + _whoAmI + ", "); - stringBuilder.Append("SerialNumber = " + _serialNumber + ", "); - stringBuilder.Append("PortName = " + _portName + ", "); - stringBuilder.Append("ConnectedClockOutputs = " + _connectedClockOutputs); + stringBuilder.Append("ChoiceStreak = " + _choiceStreak + ", "); + stringBuilder.Append("BlockExtension = " + _blockExtension); return true; } @@ -4539,154 +4656,106 @@ public override string ToString() } + /// + /// Settings for the quick retract feature. + /// [System.CodeDom.Compiler.GeneratedCodeAttribute("Bonsai.Sgen", "0.9.0.0 (Newtonsoft.Json v13.0.0.0)")] + [System.ComponentModel.DescriptionAttribute("Settings for the quick retract feature.")] [Bonsai.WorkflowElementCategoryAttribute(Bonsai.ElementCategory.Source)] [Bonsai.CombinatorAttribute(MethodName="Generate")] - public partial class IntegrationTestTrialGeneratorSpec : TrialGeneratorSpec + public partial class QuickRetractSettings { - public IntegrationTestTrialGeneratorSpec() - { - } - - protected IntegrationTestTrialGeneratorSpec(IntegrationTestTrialGeneratorSpec other) : - base(other) - { - } - - public System.IObservable Generate() - { - return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new IntegrationTestTrialGeneratorSpec(this))); - } - - public System.IObservable Generate(System.IObservable source) - { - return System.Reactive.Linq.Observable.Select(source, _ => new IntegrationTestTrialGeneratorSpec(this)); - } - - protected override bool PrintMembers(System.Text.StringBuilder stringBuilder) - { - return base.PrintMembers(stringBuilder); - } - } - - - /// - /// Input for water valve calibration class - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("Bonsai.Sgen", "0.9.0.0 (Newtonsoft.Json v13.0.0.0)")] - [System.ComponentModel.DescriptionAttribute("Input for water valve calibration class")] - [Bonsai.WorkflowElementCategoryAttribute(Bonsai.ElementCategory.Source)] - [Bonsai.CombinatorAttribute(MethodName="Generate")] - public partial class Measurement - { - - private double _valveOpenInterval; - - private double _valveOpenTime; - - private System.Collections.Generic.List _waterWeight; + private bool _enableDuringQuiescence; - private int _repeatCount; + private AllenNeuralDynamics.AindBehaviorServices.Distributions.Distribution _timeToResetDuringQuiescence; - public Measurement() - { - _waterWeight = new System.Collections.Generic.List(); - } + private bool _enableOnResponse; - protected Measurement(Measurement other) + public QuickRetractSettings() { - _valveOpenInterval = other._valveOpenInterval; - _valveOpenTime = other._valveOpenTime; - _waterWeight = other._waterWeight; - _repeatCount = other._repeatCount; + _enableDuringQuiescence = false; + _timeToResetDuringQuiescence = new AllenNeuralDynamics.AindBehaviorServices.Distributions.Distribution(); + _enableOnResponse = false; } - /// - /// Time between two consecutive valve openings (s) - /// - [Newtonsoft.Json.JsonPropertyAttribute("valve_open_interval", Required=Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DescriptionAttribute("Time between two consecutive valve openings (s)")] - public double ValveOpenInterval + protected QuickRetractSettings(QuickRetractSettings other) { - get - { - return _valveOpenInterval; - } - set - { - _valveOpenInterval = value; - } + _enableDuringQuiescence = other._enableDuringQuiescence; + _timeToResetDuringQuiescence = other._timeToResetDuringQuiescence; + _enableOnResponse = other._enableOnResponse; } /// - /// Valve open interval (s) + /// If true, the quick retract feature is enabled during the quiescence period. /// - [Newtonsoft.Json.JsonPropertyAttribute("valve_open_time", Required=Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DescriptionAttribute("Valve open interval (s)")] - public double ValveOpenTime + [Newtonsoft.Json.JsonPropertyAttribute("enable_during_quiescence")] + [System.ComponentModel.DescriptionAttribute("If true, the quick retract feature is enabled during the quiescence period.")] + public bool EnableDuringQuiescence { get { - return _valveOpenTime; + return _enableDuringQuiescence; } set { - _valveOpenTime = value; + _enableDuringQuiescence = value; } } /// - /// Weight of water delivered (g) + /// If enable_during_quiescence is true, this is the time the spout will take to reset. If the quiescence period is shorter than this time, the spout will retract at the end of the period. /// [System.Xml.Serialization.XmlIgnoreAttribute()] - [Newtonsoft.Json.JsonPropertyAttribute("water_weight", Required=Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DescriptionAttribute("Weight of water delivered (g)")] - public System.Collections.Generic.List WaterWeight + [Newtonsoft.Json.JsonPropertyAttribute("time_to_reset_during_quiescence")] + [System.ComponentModel.DescriptionAttribute("If enable_during_quiescence is true, this is the time the spout will take to rese" + + "t. If the quiescence period is shorter than this time, the spout will retract at" + + " the end of the period.")] + public AllenNeuralDynamics.AindBehaviorServices.Distributions.Distribution TimeToResetDuringQuiescence { get { - return _waterWeight; + return _timeToResetDuringQuiescence; } set { - _waterWeight = value; + _timeToResetDuringQuiescence = value; } } /// - /// Number of times the valve opened. + /// If true, the quick retract feature is enabled immediately after a response is registered. /// - [Newtonsoft.Json.JsonPropertyAttribute("repeat_count", Required=Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DescriptionAttribute("Number of times the valve opened.")] - public int RepeatCount + [Newtonsoft.Json.JsonPropertyAttribute("enable_on_response")] + [System.ComponentModel.DescriptionAttribute("If true, the quick retract feature is enabled immediately after a response is reg" + + "istered.")] + public bool EnableOnResponse { get { - return _repeatCount; + return _enableOnResponse; } set { - _repeatCount = value; + _enableOnResponse = value; } } - public System.IObservable Generate() + public System.IObservable Generate() { - return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new Measurement(this))); + return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new QuickRetractSettings(this))); } - public System.IObservable Generate(System.IObservable source) + public System.IObservable Generate(System.IObservable source) { - return System.Reactive.Linq.Observable.Select(source, _ => new Measurement(this)); + return System.Reactive.Linq.Observable.Select(source, _ => new QuickRetractSettings(this)); } protected virtual bool PrintMembers(System.Text.StringBuilder stringBuilder) { - stringBuilder.Append("ValveOpenInterval = " + _valveOpenInterval + ", "); - stringBuilder.Append("ValveOpenTime = " + _valveOpenTime + ", "); - stringBuilder.Append("WaterWeight = " + _waterWeight + ", "); - stringBuilder.Append("RepeatCount = " + _repeatCount); + stringBuilder.Append("EnableDuringQuiescence = " + _enableDuringQuiescence + ", "); + stringBuilder.Append("TimeToResetDuringQuiescence = " + _timeToResetDuringQuiescence + ", "); + stringBuilder.Append("EnableOnResponse = " + _enableOnResponse); return true; } @@ -4706,100 +4775,123 @@ public override string ToString() /// - /// Metadata for trial. These fields will NOT be used by the task engine. + /// Represents a rectangle defined by its top-left corner, width, and height. /// [System.CodeDom.Compiler.GeneratedCodeAttribute("Bonsai.Sgen", "0.9.0.0 (Newtonsoft.Json v13.0.0.0)")] - [System.ComponentModel.DescriptionAttribute("Metadata for trial. These fields will NOT be used by the task engine.")] + [System.ComponentModel.DescriptionAttribute("Represents a rectangle defined by its top-left corner, width, and height.")] [Bonsai.WorkflowElementCategoryAttribute(Bonsai.ElementCategory.Source)] [Bonsai.CombinatorAttribute(MethodName="Generate")] - public partial class Metadata + public partial class Rect { - private double? _pRewardLeft; + private int _x; - private double? _pRewardRight; + private int _y; - private object _extra; + private int _width; - public Metadata() + private int _height; + + public Rect() { + _x = 0; + _y = 0; + _width = 0; + _height = 0; } - protected Metadata(Metadata other) + protected Rect(Rect other) { - _pRewardLeft = other._pRewardLeft; - _pRewardRight = other._pRewardRight; - _extra = other._extra; + _x = other._x; + _y = other._y; + _width = other._width; + _height = other._height; } /// - /// Metadata for block probability of reward on the left side if response is made. + /// X coordinate of the top-left corner /// - [Newtonsoft.Json.JsonPropertyAttribute("p_reward_left")] - [System.ComponentModel.DescriptionAttribute("Metadata for block probability of reward on the left side if response is made.")] - public double? PRewardLeft + [Newtonsoft.Json.JsonPropertyAttribute("x")] + [System.ComponentModel.DescriptionAttribute("X coordinate of the top-left corner")] + public int X { get { - return _pRewardLeft; + return _x; } set { - _pRewardLeft = value; + _x = value; } } /// - /// Metadata for the probability of reward on the right side if response is made. + /// Y coordinate of the top-left corner /// - [Newtonsoft.Json.JsonPropertyAttribute("p_reward_right")] - [System.ComponentModel.DescriptionAttribute("Metadata for the probability of reward on the right side if response is made.")] - public double? PRewardRight + [Newtonsoft.Json.JsonPropertyAttribute("y")] + [System.ComponentModel.DescriptionAttribute("Y coordinate of the top-left corner")] + public int Y { get { - return _pRewardRight; + return _y; } set { - _pRewardRight = value; + _y = value; } } /// - /// Additional metadata to include with the trial. This field will NOT be used or validated by the task engine. + /// Width of the rectangle /// - [System.Xml.Serialization.XmlIgnoreAttribute()] - [Newtonsoft.Json.JsonPropertyAttribute("extra")] - [System.ComponentModel.DescriptionAttribute("Additional metadata to include with the trial. This field will NOT be used or val" + - "idated by the task engine.")] - public object Extra + [Newtonsoft.Json.JsonPropertyAttribute("width")] + [System.ComponentModel.DescriptionAttribute("Width of the rectangle")] + public int Width { get { - return _extra; + return _width; } set { - _extra = value; + _width = value; } } - public System.IObservable Generate() + /// + /// Height of the rectangle + /// + [Newtonsoft.Json.JsonPropertyAttribute("height")] + [System.ComponentModel.DescriptionAttribute("Height of the rectangle")] + public int Height { - return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new Metadata(this))); + get + { + return _height; + } + set + { + _height = value; + } } - public System.IObservable Generate(System.IObservable source) + public System.IObservable Generate() { - return System.Reactive.Linq.Observable.Select(source, _ => new Metadata(this)); + return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new Rect(this))); + } + + public System.IObservable Generate(System.IObservable source) + { + return System.Reactive.Linq.Observable.Select(source, _ => new Rect(this)); } protected virtual bool PrintMembers(System.Text.StringBuilder stringBuilder) { - stringBuilder.Append("PRewardLeft = " + _pRewardLeft + ", "); - stringBuilder.Append("PRewardRight = " + _pRewardRight + ", "); - stringBuilder.Append("Extra = " + _extra); + stringBuilder.Append("X = " + _x + ", "); + stringBuilder.Append("Y = " + _y + ", "); + stringBuilder.Append("Width = " + _width + ", "); + stringBuilder.Append("Height = " + _height); return true; } @@ -4819,82 +4911,98 @@ public override string ToString() /// - /// Defines the conditions under which a block is extended due to perseveration on minimum probability side. + /// Defines the reward probability structure for a dynamic foraging task. + /// + ///Reward probabilities are defined as pairs (p_left, p_right) normalized by + ///base_reward_sum. Pairs are drawn from a family representing a difficulty level: + /// + /// Family 1: [[8, 1], [6, 1], [3, 1], [1, 1]] + /// Family 2: [[8, 1], [1, 1]] + /// Family 3: [[1.0, 0.0], [0.9, 0.1], [0.8, 0.2], [0.7, 0.3], [0.6, 0.4], [0.5, 0.5]] + /// Family 4: [[6, 1], [3, 1], [1, 1]] /// [System.CodeDom.Compiler.GeneratedCodeAttribute("Bonsai.Sgen", "0.9.0.0 (Newtonsoft.Json v13.0.0.0)")] - [System.ComponentModel.DescriptionAttribute("Defines the conditions under which a block is extended due to perseveration on mi" + - "nimum probability side.")] + [System.ComponentModel.DescriptionAttribute(@"Defines the reward probability structure for a dynamic foraging task. + + Reward probabilities are defined as pairs (p_left, p_right) normalized by + base_reward_sum. Pairs are drawn from a family representing a difficulty level: + + Family 1: [[8, 1], [6, 1], [3, 1], [1, 1]] + Family 2: [[8, 1], [1, 1]] + Family 3: [[1.0, 0.0], [0.9, 0.1], [0.8, 0.2], [0.7, 0.3], [0.6, 0.4], [0.5, 0.5]] + Family 4: [[6, 1], [3, 1], [1, 1]]")] [Bonsai.WorkflowElementCategoryAttribute(Bonsai.ElementCategory.Source)] [Bonsai.CombinatorAttribute(MethodName="Generate")] - public partial class MinimumProbabilityPerseverationConditions + public partial class RewardProbabilityParameters { - private int _choiceStreak; + private double _baseRewardSum; - private int _blockExtension; + private System.Collections.Generic.List> _rewardPairs; - public MinimumProbabilityPerseverationConditions() + public RewardProbabilityParameters() { - _choiceStreak = 4; - _blockExtension = 4; + _baseRewardSum = 0.8D; + _rewardPairs = new System.Collections.Generic.List>(); } - protected MinimumProbabilityPerseverationConditions(MinimumProbabilityPerseverationConditions other) + protected RewardProbabilityParameters(RewardProbabilityParameters other) { - _choiceStreak = other._choiceStreak; - _blockExtension = other._blockExtension; + _baseRewardSum = other._baseRewardSum; + _rewardPairs = other._rewardPairs; } /// - /// Number of consecutive choices on the minimum-probability side required to extend both block lengths. + /// Total reward probability shared between the two sides. Each reward pair is normalized to sum to this value. /// - [Newtonsoft.Json.JsonPropertyAttribute("choice_streak")] - [System.ComponentModel.DescriptionAttribute("Number of consecutive choices on the minimum-probability side required to extend " + - "both block lengths.")] - public int ChoiceStreak + [Newtonsoft.Json.JsonPropertyAttribute("base_reward_sum")] + [System.ComponentModel.DescriptionAttribute("Total reward probability shared between the two sides. Each reward pair is normal" + + "ized to sum to this value.")] + public double BaseRewardSum { get { - return _choiceStreak; + return _baseRewardSum; } set { - _choiceStreak = value; + _baseRewardSum = value; } } /// - /// Number of trials to extend both block lengths when the choice streak condition is met. + /// List of (left, right) reward ratio pairs to sample from during block transitions. /// - [Newtonsoft.Json.JsonPropertyAttribute("block_extension")] - [System.ComponentModel.DescriptionAttribute("Number of trials to extend both block lengths when the choice streak condition is" + - " met.")] - public int BlockExtension + [System.Xml.Serialization.XmlIgnoreAttribute()] + [Newtonsoft.Json.JsonPropertyAttribute("reward_pairs")] + [System.ComponentModel.DescriptionAttribute("List of (left, right) reward ratio pairs to sample from during block transitions." + + " ")] + public System.Collections.Generic.List> RewardPairs { get { - return _blockExtension; + return _rewardPairs; } set { - _blockExtension = value; + _rewardPairs = value; } } - public System.IObservable Generate() + public System.IObservable Generate() { - return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new MinimumProbabilityPerseverationConditions(this))); + return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new RewardProbabilityParameters(this))); } - public System.IObservable Generate(System.IObservable source) + public System.IObservable Generate(System.IObservable source) { - return System.Reactive.Linq.Observable.Select(source, _ => new MinimumProbabilityPerseverationConditions(this)); + return System.Reactive.Linq.Observable.Select(source, _ => new RewardProbabilityParameters(this)); } protected virtual bool PrintMembers(System.Text.StringBuilder stringBuilder) { - stringBuilder.Append("ChoiceStreak = " + _choiceStreak + ", "); - stringBuilder.Append("BlockExtension = " + _blockExtension); + stringBuilder.Append("BaseRewardSum = " + _baseRewardSum + ", "); + stringBuilder.Append("RewardPairs = " + _rewardPairs); return true; } @@ -4913,106 +5021,66 @@ public override string ToString() } - /// - /// Settings for the quick retract feature. - /// [System.CodeDom.Compiler.GeneratedCodeAttribute("Bonsai.Sgen", "0.9.0.0 (Newtonsoft.Json v13.0.0.0)")] - [System.ComponentModel.DescriptionAttribute("Settings for the quick retract feature.")] [Bonsai.WorkflowElementCategoryAttribute(Bonsai.ElementCategory.Source)] [Bonsai.CombinatorAttribute(MethodName="Generate")] - public partial class QuickRetractSettings + public partial class RewardSize { - private bool _enableDuringQuiescence; - - private AllenNeuralDynamics.AindBehaviorServices.Distributions.Distribution _timeToResetDuringQuiescence; - - private bool _enableOnResponse; + private double _right; - public QuickRetractSettings() - { - _enableDuringQuiescence = false; - _timeToResetDuringQuiescence = new AllenNeuralDynamics.AindBehaviorServices.Distributions.Distribution(); - _enableOnResponse = false; - } + private double _left; - protected QuickRetractSettings(QuickRetractSettings other) + public RewardSize() { - _enableDuringQuiescence = other._enableDuringQuiescence; - _timeToResetDuringQuiescence = other._timeToResetDuringQuiescence; - _enableOnResponse = other._enableOnResponse; } - /// - /// If true, the quick retract feature is enabled during the quiescence period. - /// - [Newtonsoft.Json.JsonPropertyAttribute("enable_during_quiescence")] - [System.ComponentModel.DescriptionAttribute("If true, the quick retract feature is enabled during the quiescence period.")] - public bool EnableDuringQuiescence + protected RewardSize(RewardSize other) { - get - { - return _enableDuringQuiescence; - } - set - { - _enableDuringQuiescence = value; - } + _right = other._right; + _left = other._left; } - /// - /// If enable_during_quiescence is true, this is the time the spout will take to reset. If the quiescence period is shorter than this time, the spout will retract at the end of the period. - /// - [System.Xml.Serialization.XmlIgnoreAttribute()] - [Newtonsoft.Json.JsonPropertyAttribute("time_to_reset_during_quiescence")] - [System.ComponentModel.DescriptionAttribute("If enable_during_quiescence is true, this is the time the spout will take to rese" + - "t. If the quiescence period is shorter than this time, the spout will retract at" + - " the end of the period.")] - public AllenNeuralDynamics.AindBehaviorServices.Distributions.Distribution TimeToResetDuringQuiescence + [Newtonsoft.Json.JsonPropertyAttribute("right", Required=Newtonsoft.Json.Required.Always)] + public double Right { get { - return _timeToResetDuringQuiescence; + return _right; } set { - _timeToResetDuringQuiescence = value; + _right = value; } } - /// - /// If true, the quick retract feature is enabled immediately after a response is registered. - /// - [Newtonsoft.Json.JsonPropertyAttribute("enable_on_response")] - [System.ComponentModel.DescriptionAttribute("If true, the quick retract feature is enabled immediately after a response is reg" + - "istered.")] - public bool EnableOnResponse + [Newtonsoft.Json.JsonPropertyAttribute("left", Required=Newtonsoft.Json.Required.Always)] + public double Left { get { - return _enableOnResponse; + return _left; } set { - _enableOnResponse = value; + _left = value; } } - public System.IObservable Generate() + public System.IObservable Generate() { - return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new QuickRetractSettings(this))); + return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new RewardSize(this))); } - public System.IObservable Generate(System.IObservable source) + public System.IObservable Generate(System.IObservable source) { - return System.Reactive.Linq.Observable.Select(source, _ => new QuickRetractSettings(this)); + return System.Reactive.Linq.Observable.Select(source, _ => new RewardSize(this)); } protected virtual bool PrintMembers(System.Text.StringBuilder stringBuilder) { - stringBuilder.Append("EnableDuringQuiescence = " + _enableDuringQuiescence + ", "); - stringBuilder.Append("TimeToResetDuringQuiescence = " + _timeToResetDuringQuiescence + ", "); - stringBuilder.Append("EnableOnResponse = " + _enableOnResponse); + stringBuilder.Append("Right = " + _right + ", "); + stringBuilder.Append("Left = " + _left); return true; } @@ -5032,123 +5100,82 @@ public override string ToString() /// - /// Represents a rectangle defined by its top-left corner, width, and height. + /// Container class for calibration models. In a future release these will be moved to the respective devices /// [System.CodeDom.Compiler.GeneratedCodeAttribute("Bonsai.Sgen", "0.9.0.0 (Newtonsoft.Json v13.0.0.0)")] - [System.ComponentModel.DescriptionAttribute("Represents a rectangle defined by its top-left corner, width, and height.")] + [System.ComponentModel.DescriptionAttribute("Container class for calibration models. In a future release these will be moved t" + + "o the respective devices")] [Bonsai.WorkflowElementCategoryAttribute(Bonsai.ElementCategory.Source)] [Bonsai.CombinatorAttribute(MethodName="Generate")] - public partial class Rect + public partial class RigCalibration { - private int _x; - - private int _y; - - private int _width; - - private int _height; - - public Rect() - { - _x = 0; - _y = 0; - _width = 0; - _height = 0; - } + private WaterValveCalibration _waterValveLeft; - protected Rect(Rect other) - { - _x = other._x; - _y = other._y; - _width = other._width; - _height = other._height; - } + private WaterValveCalibration _waterValveRight; - /// - /// X coordinate of the top-left corner - /// - [Newtonsoft.Json.JsonPropertyAttribute("x")] - [System.ComponentModel.DescriptionAttribute("X coordinate of the top-left corner")] - public int X + public RigCalibration() { - get - { - return _x; - } - set - { - _x = value; - } + _waterValveLeft = new WaterValveCalibration(); + _waterValveRight = new WaterValveCalibration(); } - /// - /// Y coordinate of the top-left corner - /// - [Newtonsoft.Json.JsonPropertyAttribute("y")] - [System.ComponentModel.DescriptionAttribute("Y coordinate of the top-left corner")] - public int Y + protected RigCalibration(RigCalibration other) { - get - { - return _y; - } - set - { - _y = value; - } + _waterValveLeft = other._waterValveLeft; + _waterValveRight = other._waterValveRight; } /// - /// Width of the rectangle + /// Left water valve calibration /// - [Newtonsoft.Json.JsonPropertyAttribute("width")] - [System.ComponentModel.DescriptionAttribute("Width of the rectangle")] - public int Width + [System.Xml.Serialization.XmlIgnoreAttribute()] + [Newtonsoft.Json.JsonPropertyAttribute("water_valve_left", Required=Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DescriptionAttribute("Left water valve calibration")] + public WaterValveCalibration WaterValveLeft { get { - return _width; + return _waterValveLeft; } set { - _width = value; + _waterValveLeft = value; } } /// - /// Height of the rectangle + /// Right water valve calibration /// - [Newtonsoft.Json.JsonPropertyAttribute("height")] - [System.ComponentModel.DescriptionAttribute("Height of the rectangle")] - public int Height + [System.Xml.Serialization.XmlIgnoreAttribute()] + [Newtonsoft.Json.JsonPropertyAttribute("water_valve_right", Required=Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DescriptionAttribute("Right water valve calibration")] + public WaterValveCalibration WaterValveRight { get { - return _height; + return _waterValveRight; } set { - _height = value; + _waterValveRight = value; } } - public System.IObservable Generate() + public System.IObservable Generate() { - return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new Rect(this))); + return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new RigCalibration(this))); } - public System.IObservable Generate(System.IObservable source) + public System.IObservable Generate(System.IObservable source) { - return System.Reactive.Linq.Observable.Select(source, _ => new Rect(this)); + return System.Reactive.Linq.Observable.Select(source, _ => new RigCalibration(this)); } protected virtual bool PrintMembers(System.Text.StringBuilder stringBuilder) { - stringBuilder.Append("X = " + _x + ", "); - stringBuilder.Append("Y = " + _y + ", "); - stringBuilder.Append("Width = " + _width + ", "); - stringBuilder.Append("Height = " + _height); + stringBuilder.Append("WaterValveLeft = " + _waterValveLeft + ", "); + stringBuilder.Append("WaterValveRight = " + _waterValveRight); return true; } @@ -5167,177 +5194,279 @@ public override string ToString() } - /// - /// Defines the reward probability structure for a dynamic foraging task. - /// - ///Reward probabilities are defined as pairs (p_left, p_right) normalized by - ///base_reward_sum. Pairs are drawn from a family representing a difficulty level: - /// - /// Family 1: [[8, 1], [6, 1], [3, 1], [1, 1]] - /// Family 2: [[8, 1], [1, 1]] - /// Family 3: [[1.0, 0.0], [0.9, 0.1], [0.8, 0.2], [0.7, 0.3], [0.6, 0.4], [0.5, 0.5]] - /// Family 4: [[6, 1], [3, 1], [1, 1]] - /// [System.CodeDom.Compiler.GeneratedCodeAttribute("Bonsai.Sgen", "0.9.0.0 (Newtonsoft.Json v13.0.0.0)")] - [System.ComponentModel.DescriptionAttribute(@"Defines the reward probability structure for a dynamic foraging task. - - Reward probabilities are defined as pairs (p_left, p_right) normalized by - base_reward_sum. Pairs are drawn from a family representing a difficulty level: - - Family 1: [[8, 1], [6, 1], [3, 1], [1, 1]] - Family 2: [[8, 1], [1, 1]] - Family 3: [[1.0, 0.0], [0.9, 0.1], [0.8, 0.2], [0.7, 0.3], [0.6, 0.4], [0.5, 0.5]] - Family 4: [[6, 1], [3, 1], [1, 1]]")] [Bonsai.WorkflowElementCategoryAttribute(Bonsai.ElementCategory.Source)] [Bonsai.CombinatorAttribute(MethodName="Generate")] - public partial class RewardProbabilityParameters + public partial class Session { - private double _baseRewardSum; + private string _aindBehaviorServicesPkgVersion; - private System.Collections.Generic.List> _rewardPairs; + private string _version; - public RewardProbabilityParameters() + private string _experiment; + + private System.Collections.Generic.List _experimenter; + + private System.DateTimeOffset _date; + + private string _sessionName; + + private string _subject; + + private string _notes; + + private string _commitHash; + + private bool _allowDirtyRepo; + + private bool _skipHardwareValidation; + + public Session() { - _baseRewardSum = 0.8D; - _rewardPairs = new System.Collections.Generic.List>(); + _aindBehaviorServicesPkgVersion = "0.13.7"; + _version = "0.13.7"; + _experimenter = new System.Collections.Generic.List(); + _allowDirtyRepo = false; + _skipHardwareValidation = false; } - protected RewardProbabilityParameters(RewardProbabilityParameters other) + protected Session(Session other) { - _baseRewardSum = other._baseRewardSum; - _rewardPairs = other._rewardPairs; + _aindBehaviorServicesPkgVersion = other._aindBehaviorServicesPkgVersion; + _version = other._version; + _experiment = other._experiment; + _experimenter = other._experimenter; + _date = other._date; + _sessionName = other._sessionName; + _subject = other._subject; + _notes = other._notes; + _commitHash = other._commitHash; + _allowDirtyRepo = other._allowDirtyRepo; + _skipHardwareValidation = other._skipHardwareValidation; + } + + [Newtonsoft.Json.JsonPropertyAttribute("aind_behavior_services_pkg_version")] + public string AindBehaviorServicesPkgVersion + { + get + { + return _aindBehaviorServicesPkgVersion; + } + set + { + _aindBehaviorServicesPkgVersion = value; + } + } + + [Newtonsoft.Json.JsonPropertyAttribute("version")] + public string Version + { + get + { + return _version; + } + set + { + _version = value; + } } /// - /// Total reward probability shared between the two sides. Each reward pair is normalized to sum to this value. + /// Name of the experiment /// - [Newtonsoft.Json.JsonPropertyAttribute("base_reward_sum")] - [System.ComponentModel.DescriptionAttribute("Total reward probability shared between the two sides. Each reward pair is normal" + - "ized to sum to this value.")] - public double BaseRewardSum + [Newtonsoft.Json.JsonPropertyAttribute("experiment")] + [System.ComponentModel.DescriptionAttribute("Name of the experiment")] + public string Experiment { get { - return _baseRewardSum; + return _experiment; } set { - _baseRewardSum = value; + _experiment = value; } } /// - /// List of (left, right) reward ratio pairs to sample from during block transitions. + /// Name of the experimenter /// [System.Xml.Serialization.XmlIgnoreAttribute()] - [Newtonsoft.Json.JsonPropertyAttribute("reward_pairs")] - [System.ComponentModel.DescriptionAttribute("List of (left, right) reward ratio pairs to sample from during block transitions." + - " ")] - public System.Collections.Generic.List> RewardPairs + [Newtonsoft.Json.JsonPropertyAttribute("experimenter")] + [System.ComponentModel.DescriptionAttribute("Name of the experimenter")] + public System.Collections.Generic.List Experimenter { get { - return _rewardPairs; + return _experimenter; } set { - _rewardPairs = value; + _experimenter = value; } } - public System.IObservable Generate() + /// + /// Date of the experiment + /// + [System.Xml.Serialization.XmlIgnoreAttribute()] + [Newtonsoft.Json.JsonPropertyAttribute("date")] + [System.ComponentModel.DescriptionAttribute("Date of the experiment")] + public System.DateTimeOffset Date { - return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new RewardProbabilityParameters(this))); + get + { + return _date; + } + set + { + _date = value; + } } - public System.IObservable Generate(System.IObservable source) + [Newtonsoft.Json.JsonIgnoreAttribute()] + [System.ComponentModel.BrowsableAttribute(false)] + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + [System.Xml.Serialization.XmlElementAttribute("Date")] + public string DateXml { - return System.Reactive.Linq.Observable.Select(source, _ => new RewardProbabilityParameters(this)); + get + { + return _date.ToString("o"); + } + set + { + _date = System.DateTimeOffset.Parse(value); + } } - protected virtual bool PrintMembers(System.Text.StringBuilder stringBuilder) + /// + /// Name of the session. This will be used to create a folder in the root path. If not provided, it will be generated using subject and date. + /// + [Newtonsoft.Json.JsonPropertyAttribute("session_name")] + [System.ComponentModel.DescriptionAttribute("Name of the session. This will be used to create a folder in the root path. If no" + + "t provided, it will be generated using subject and date.")] + public string SessionName { - stringBuilder.Append("BaseRewardSum = " + _baseRewardSum + ", "); - stringBuilder.Append("RewardPairs = " + _rewardPairs); - return true; + get + { + return _sessionName; + } + set + { + _sessionName = value; + } } - public override string ToString() + /// + /// Name of the subject + /// + [Newtonsoft.Json.JsonPropertyAttribute("subject", Required=Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DescriptionAttribute("Name of the subject")] + public string Subject { - System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); - stringBuilder.Append(GetType().Name); - stringBuilder.Append(" { "); - if (PrintMembers(stringBuilder)) + get { - stringBuilder.Append(" "); + return _subject; + } + set + { + _subject = value; } - stringBuilder.Append("}"); - return stringBuilder.ToString(); } - } - - - [System.CodeDom.Compiler.GeneratedCodeAttribute("Bonsai.Sgen", "0.9.0.0 (Newtonsoft.Json v13.0.0.0)")] - [Bonsai.WorkflowElementCategoryAttribute(Bonsai.ElementCategory.Source)] - [Bonsai.CombinatorAttribute(MethodName="Generate")] - public partial class RewardSize - { - - private double _right; - - private double _left; - public RewardSize() + /// + /// Notes about the experiment + /// + [Newtonsoft.Json.JsonPropertyAttribute("notes")] + [System.ComponentModel.DescriptionAttribute("Notes about the experiment")] + public string Notes { + get + { + return _notes; + } + set + { + _notes = value; + } } - protected RewardSize(RewardSize other) + /// + /// Commit hash of the repository + /// + [Newtonsoft.Json.JsonPropertyAttribute("commit_hash")] + [System.ComponentModel.DescriptionAttribute("Commit hash of the repository")] + public string CommitHash { - _right = other._right; - _left = other._left; + get + { + return _commitHash; + } + set + { + _commitHash = value; + } } - [Newtonsoft.Json.JsonPropertyAttribute("right", Required=Newtonsoft.Json.Required.Always)] - public double Right + /// + /// Allow running from a dirty repository + /// + [Newtonsoft.Json.JsonPropertyAttribute("allow_dirty_repo")] + [System.ComponentModel.DescriptionAttribute("Allow running from a dirty repository")] + public bool AllowDirtyRepo { get { - return _right; + return _allowDirtyRepo; } set { - _right = value; + _allowDirtyRepo = value; } } - [Newtonsoft.Json.JsonPropertyAttribute("left", Required=Newtonsoft.Json.Required.Always)] - public double Left + /// + /// Skip hardware validation + /// + [Newtonsoft.Json.JsonPropertyAttribute("skip_hardware_validation")] + [System.ComponentModel.DescriptionAttribute("Skip hardware validation")] + public bool SkipHardwareValidation { get { - return _left; + return _skipHardwareValidation; } set { - _left = value; + _skipHardwareValidation = value; } } - public System.IObservable Generate() + public System.IObservable Generate() { - return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new RewardSize(this))); + return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new Session(this))); } - public System.IObservable Generate(System.IObservable source) + public System.IObservable Generate(System.IObservable source) { - return System.Reactive.Linq.Observable.Select(source, _ => new RewardSize(this)); + return System.Reactive.Linq.Observable.Select(source, _ => new Session(this)); } protected virtual bool PrintMembers(System.Text.StringBuilder stringBuilder) { - stringBuilder.Append("Right = " + _right + ", "); - stringBuilder.Append("Left = " + _left); + stringBuilder.Append("AindBehaviorServicesPkgVersion = " + _aindBehaviorServicesPkgVersion + ", "); + stringBuilder.Append("Version = " + _version + ", "); + stringBuilder.Append("Experiment = " + _experiment + ", "); + stringBuilder.Append("Experimenter = " + _experimenter + ", "); + stringBuilder.Append("Date = " + _date + ", "); + stringBuilder.Append("SessionName = " + _sessionName + ", "); + stringBuilder.Append("Subject = " + _subject + ", "); + stringBuilder.Append("Notes = " + _notes + ", "); + stringBuilder.Append("CommitHash = " + _commitHash + ", "); + stringBuilder.Append("AllowDirtyRepo = " + _allowDirtyRepo + ", "); + stringBuilder.Append("SkipHardwareValidation = " + _skipHardwareValidation); return true; } @@ -5357,82 +5486,105 @@ public override string ToString() /// - /// Container class for calibration models. In a future release these will be moved to the respective devices + /// Calibration model for the sound card. Contains the waveforms to play for each cue. /// [System.CodeDom.Compiler.GeneratedCodeAttribute("Bonsai.Sgen", "0.9.0.0 (Newtonsoft.Json v13.0.0.0)")] - [System.ComponentModel.DescriptionAttribute("Container class for calibration models. In a future release these will be moved t" + - "o the respective devices")] + [System.ComponentModel.DescriptionAttribute("Calibration model for the sound card. Contains the waveforms to play for each cue" + + ".")] [Bonsai.WorkflowElementCategoryAttribute(Bonsai.ElementCategory.Source)] [Bonsai.CombinatorAttribute(MethodName="Generate")] - public partial class RigCalibration + public partial class SoundCardCalibration { - private WaterValveCalibration _waterValveLeft; + private Waveform _goCue; - private WaterValveCalibration _waterValveRight; + private Waveform _csPlus; + + private Waveform _csMinus; + + public SoundCardCalibration() + { + _goCue = new Waveform(); + _csPlus = new Waveform(); + _csMinus = new Waveform(); + } - public RigCalibration() + protected SoundCardCalibration(SoundCardCalibration other) { - _waterValveLeft = new WaterValveCalibration(); - _waterValveRight = new WaterValveCalibration(); + _goCue = other._goCue; + _csPlus = other._csPlus; + _csMinus = other._csMinus; } - protected RigCalibration(RigCalibration other) + /// + /// Waveform to play for go cue + /// + [System.Xml.Serialization.XmlIgnoreAttribute()] + [Newtonsoft.Json.JsonPropertyAttribute("go_cue")] + [System.ComponentModel.DescriptionAttribute("Waveform to play for go cue")] + public Waveform GoCue { - _waterValveLeft = other._waterValveLeft; - _waterValveRight = other._waterValveRight; + get + { + return _goCue; + } + set + { + _goCue = value; + } } /// - /// Left water valve calibration + /// Waveform to play for CS+ cue /// [System.Xml.Serialization.XmlIgnoreAttribute()] - [Newtonsoft.Json.JsonPropertyAttribute("water_valve_left", Required=Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DescriptionAttribute("Left water valve calibration")] - public WaterValveCalibration WaterValveLeft + [Newtonsoft.Json.JsonPropertyAttribute("cs_plus")] + [System.ComponentModel.DescriptionAttribute("Waveform to play for CS+ cue")] + public Waveform CsPlus { get { - return _waterValveLeft; + return _csPlus; } set { - _waterValveLeft = value; + _csPlus = value; } } /// - /// Right water valve calibration + /// Waveform to play for CS- cue /// [System.Xml.Serialization.XmlIgnoreAttribute()] - [Newtonsoft.Json.JsonPropertyAttribute("water_valve_right", Required=Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DescriptionAttribute("Right water valve calibration")] - public WaterValveCalibration WaterValveRight + [Newtonsoft.Json.JsonPropertyAttribute("cs_minus")] + [System.ComponentModel.DescriptionAttribute("Waveform to play for CS- cue")] + public Waveform CsMinus { get { - return _waterValveRight; + return _csMinus; } set { - _waterValveRight = value; + _csMinus = value; } } - public System.IObservable Generate() + public System.IObservable Generate() { - return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new RigCalibration(this))); + return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new SoundCardCalibration(this))); } - public System.IObservable Generate(System.IObservable source) + public System.IObservable Generate(System.IObservable source) { - return System.Reactive.Linq.Observable.Select(source, _ => new RigCalibration(this)); + return System.Reactive.Linq.Observable.Select(source, _ => new SoundCardCalibration(this)); } protected virtual bool PrintMembers(System.Text.StringBuilder stringBuilder) { - stringBuilder.Append("WaterValveLeft = " + _waterValveLeft + ", "); - stringBuilder.Append("WaterValveRight = " + _waterValveRight); + stringBuilder.Append("GoCue = " + _goCue + ", "); + stringBuilder.Append("CsPlus = " + _csPlus + ", "); + stringBuilder.Append("CsMinus = " + _csMinus); return true; } @@ -5451,397 +5603,295 @@ public override string ToString() } + /// + /// Spinnaker camera device configuration. + /// [System.CodeDom.Compiler.GeneratedCodeAttribute("Bonsai.Sgen", "0.9.0.0 (Newtonsoft.Json v13.0.0.0)")] + [System.ComponentModel.DescriptionAttribute("Spinnaker camera device configuration.")] [Bonsai.WorkflowElementCategoryAttribute(Bonsai.ElementCategory.Source)] [Bonsai.CombinatorAttribute(MethodName="Generate")] - public partial class Session + public partial class SpinnakerCamera { - private string _aindBehaviorServicesPkgVersion; - - private string _version; - - private string _experiment; + private string _deviceType; - private System.Collections.Generic.List _experimenter; + private BaseModel _calibration; - private System.DateTimeOffset _date; + private string _serialNumber; - private string _sessionName; + private int _binning; - private string _subject; + private SpinnakerCameraColorProcessing _colorProcessing; - private string _notes; + private int _exposure; - private string _commitHash; + private double _gain; - private bool _allowDirtyRepo; + private double? _gamma; - private bool _skipHardwareValidation; + private SpinnakerCameraAdcBitDepth? _adcBitDepth; - public Session() - { - _aindBehaviorServicesPkgVersion = "0.13.7"; - _version = "0.13.7"; - _experimenter = new System.Collections.Generic.List(); - _allowDirtyRepo = false; - _skipHardwareValidation = false; - } + private SpinnakerCameraPixelFormat? _pixelFormat; - protected Session(Session other) - { - _aindBehaviorServicesPkgVersion = other._aindBehaviorServicesPkgVersion; - _version = other._version; - _experiment = other._experiment; - _experimenter = other._experimenter; - _date = other._date; - _sessionName = other._sessionName; - _subject = other._subject; - _notes = other._notes; - _commitHash = other._commitHash; - _allowDirtyRepo = other._allowDirtyRepo; - _skipHardwareValidation = other._skipHardwareValidation; - } + private Rect _regionOfInterest; - [Newtonsoft.Json.JsonPropertyAttribute("aind_behavior_services_pkg_version")] - public string AindBehaviorServicesPkgVersion - { - get - { - return _aindBehaviorServicesPkgVersion; - } - set - { - _aindBehaviorServicesPkgVersion = value; - } - } + private VideoWriter _videoWriter; - [Newtonsoft.Json.JsonPropertyAttribute("version")] - public string Version + public SpinnakerCamera() { - get - { - return _version; - } - set - { - _version = value; - } + _deviceType = "SpinnakerCamera"; + _binning = 1; + _colorProcessing = SpinnakerCameraColorProcessing.Default; + _exposure = 1000; + _gain = 0D; + _adcBitDepth = SpinnakerCameraAdcBitDepth.Adc8bit; + _pixelFormat = SpinnakerCameraPixelFormat.Mono8; + _regionOfInterest = new Rect(); } - /// - /// Name of the experiment - /// - [Newtonsoft.Json.JsonPropertyAttribute("experiment")] - [System.ComponentModel.DescriptionAttribute("Name of the experiment")] - public string Experiment + protected SpinnakerCamera(SpinnakerCamera other) { - get - { - return _experiment; - } - set - { - _experiment = value; - } + _deviceType = other._deviceType; + _calibration = other._calibration; + _serialNumber = other._serialNumber; + _binning = other._binning; + _colorProcessing = other._colorProcessing; + _exposure = other._exposure; + _gain = other._gain; + _gamma = other._gamma; + _adcBitDepth = other._adcBitDepth; + _pixelFormat = other._pixelFormat; + _regionOfInterest = other._regionOfInterest; + _videoWriter = other._videoWriter; } - /// - /// Name of the experimenter - /// - [System.Xml.Serialization.XmlIgnoreAttribute()] - [Newtonsoft.Json.JsonPropertyAttribute("experimenter")] - [System.ComponentModel.DescriptionAttribute("Name of the experimenter")] - public System.Collections.Generic.List Experimenter + [Newtonsoft.Json.JsonPropertyAttribute("device_type")] + public string DeviceType { get { - return _experimenter; + return _deviceType; } set { - _experimenter = value; + _deviceType = value; } } /// - /// Date of the experiment + /// Calibration for the device. /// [System.Xml.Serialization.XmlIgnoreAttribute()] - [Newtonsoft.Json.JsonPropertyAttribute("date")] - [System.ComponentModel.DescriptionAttribute("Date of the experiment")] - public System.DateTimeOffset Date - { - get - { - return _date; - } - set - { - _date = value; - } - } - - [Newtonsoft.Json.JsonIgnoreAttribute()] - [System.ComponentModel.BrowsableAttribute(false)] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - [System.Xml.Serialization.XmlElementAttribute("Date")] - public string DateXml + [Newtonsoft.Json.JsonPropertyAttribute("calibration")] + [System.ComponentModel.DescriptionAttribute("Calibration for the device.")] + public BaseModel Calibration { get { - return _date.ToString("o"); + return _calibration; } set { - _date = System.DateTimeOffset.Parse(value); + _calibration = value; } } /// - /// Name of the session. This will be used to create a folder in the root path. If not provided, it will be generated using subject and date. + /// Camera serial number /// - [Newtonsoft.Json.JsonPropertyAttribute("session_name")] - [System.ComponentModel.DescriptionAttribute("Name of the session. This will be used to create a folder in the root path. If no" + - "t provided, it will be generated using subject and date.")] - public string SessionName + [Newtonsoft.Json.JsonPropertyAttribute("serial_number", Required=Newtonsoft.Json.Required.Always)] + [System.ComponentModel.DescriptionAttribute("Camera serial number")] + public string SerialNumber { get { - return _sessionName; + return _serialNumber; } set { - _sessionName = value; + _serialNumber = value; } } /// - /// Name of the subject + /// Binning /// - [Newtonsoft.Json.JsonPropertyAttribute("subject", Required=Newtonsoft.Json.Required.Always)] - [System.ComponentModel.DescriptionAttribute("Name of the subject")] - public string Subject + [Newtonsoft.Json.JsonPropertyAttribute("binning")] + [System.ComponentModel.DescriptionAttribute("Binning")] + public int Binning { get { - return _subject; + return _binning; } set { - _subject = value; + _binning = value; } } /// - /// Notes about the experiment + /// Color processing /// - [Newtonsoft.Json.JsonPropertyAttribute("notes")] - [System.ComponentModel.DescriptionAttribute("Notes about the experiment")] - public string Notes + [Newtonsoft.Json.JsonPropertyAttribute("color_processing")] + [System.ComponentModel.DescriptionAttribute("Color processing")] + public SpinnakerCameraColorProcessing ColorProcessing { get { - return _notes; + return _colorProcessing; } set { - _notes = value; + _colorProcessing = value; } } /// - /// Commit hash of the repository + /// Exposure time /// - [Newtonsoft.Json.JsonPropertyAttribute("commit_hash")] - [System.ComponentModel.DescriptionAttribute("Commit hash of the repository")] - public string CommitHash + [Newtonsoft.Json.JsonPropertyAttribute("exposure")] + [System.ComponentModel.DescriptionAttribute("Exposure time")] + public int Exposure { get { - return _commitHash; + return _exposure; } set { - _commitHash = value; + _exposure = value; } } /// - /// Allow running from a dirty repository + /// Gain /// - [Newtonsoft.Json.JsonPropertyAttribute("allow_dirty_repo")] - [System.ComponentModel.DescriptionAttribute("Allow running from a dirty repository")] - public bool AllowDirtyRepo + [Newtonsoft.Json.JsonPropertyAttribute("gain")] + [System.ComponentModel.DescriptionAttribute("Gain")] + public double Gain { get { - return _allowDirtyRepo; + return _gain; } set { - _allowDirtyRepo = value; + _gain = value; } } /// - /// Skip hardware validation + /// Gamma. If None, will disable gamma correction. /// - [Newtonsoft.Json.JsonPropertyAttribute("skip_hardware_validation")] - [System.ComponentModel.DescriptionAttribute("Skip hardware validation")] - public bool SkipHardwareValidation + [Newtonsoft.Json.JsonPropertyAttribute("gamma")] + [System.ComponentModel.DescriptionAttribute("Gamma. If None, will disable gamma correction.")] + public double? Gamma { get { - return _skipHardwareValidation; + return _gamma; } set { - _skipHardwareValidation = value; + _gamma = value; } } - public System.IObservable Generate() - { - return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new Session(this))); - } - - public System.IObservable Generate(System.IObservable source) - { - return System.Reactive.Linq.Observable.Select(source, _ => new Session(this)); - } - - protected virtual bool PrintMembers(System.Text.StringBuilder stringBuilder) - { - stringBuilder.Append("AindBehaviorServicesPkgVersion = " + _aindBehaviorServicesPkgVersion + ", "); - stringBuilder.Append("Version = " + _version + ", "); - stringBuilder.Append("Experiment = " + _experiment + ", "); - stringBuilder.Append("Experimenter = " + _experimenter + ", "); - stringBuilder.Append("Date = " + _date + ", "); - stringBuilder.Append("SessionName = " + _sessionName + ", "); - stringBuilder.Append("Subject = " + _subject + ", "); - stringBuilder.Append("Notes = " + _notes + ", "); - stringBuilder.Append("CommitHash = " + _commitHash + ", "); - stringBuilder.Append("AllowDirtyRepo = " + _allowDirtyRepo + ", "); - stringBuilder.Append("SkipHardwareValidation = " + _skipHardwareValidation); - return true; - } - - public override string ToString() + /// + /// ADC bit depth. If None will be left as default. + /// + [Newtonsoft.Json.JsonPropertyAttribute("adc_bit_depth")] + [System.ComponentModel.DescriptionAttribute("ADC bit depth. If None will be left as default.")] + public SpinnakerCameraAdcBitDepth? AdcBitDepth { - System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); - stringBuilder.Append(GetType().Name); - stringBuilder.Append(" { "); - if (PrintMembers(stringBuilder)) + get { - stringBuilder.Append(" "); + return _adcBitDepth; + } + set + { + _adcBitDepth = value; } - stringBuilder.Append("}"); - return stringBuilder.ToString(); - } - } - - - /// - /// Calibration model for the sound card. Contains the waveforms to play for each cue. - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("Bonsai.Sgen", "0.9.0.0 (Newtonsoft.Json v13.0.0.0)")] - [System.ComponentModel.DescriptionAttribute("Calibration model for the sound card. Contains the waveforms to play for each cue" + - ".")] - [Bonsai.WorkflowElementCategoryAttribute(Bonsai.ElementCategory.Source)] - [Bonsai.CombinatorAttribute(MethodName="Generate")] - public partial class SoundCardCalibration - { - - private Waveform _goCue; - - private Waveform _csPlus; - - private Waveform _csMinus; - - public SoundCardCalibration() - { - _goCue = new Waveform(); - _csPlus = new Waveform(); - _csMinus = new Waveform(); - } - - protected SoundCardCalibration(SoundCardCalibration other) - { - _goCue = other._goCue; - _csPlus = other._csPlus; - _csMinus = other._csMinus; } /// - /// Waveform to play for go cue + /// Pixel format. If None will be left as default. /// - [System.Xml.Serialization.XmlIgnoreAttribute()] - [Newtonsoft.Json.JsonPropertyAttribute("go_cue")] - [System.ComponentModel.DescriptionAttribute("Waveform to play for go cue")] - public Waveform GoCue + [Newtonsoft.Json.JsonPropertyAttribute("pixel_format")] + [System.ComponentModel.DescriptionAttribute("Pixel format. If None will be left as default.")] + public SpinnakerCameraPixelFormat? PixelFormat { get { - return _goCue; + return _pixelFormat; } set { - _goCue = value; + _pixelFormat = value; } } /// - /// Waveform to play for CS+ cue + /// Region of interest /// [System.Xml.Serialization.XmlIgnoreAttribute()] - [Newtonsoft.Json.JsonPropertyAttribute("cs_plus")] - [System.ComponentModel.DescriptionAttribute("Waveform to play for CS+ cue")] - public Waveform CsPlus + [Newtonsoft.Json.JsonPropertyAttribute("region_of_interest")] + [System.ComponentModel.DescriptionAttribute("Region of interest")] + public Rect RegionOfInterest { get { - return _csPlus; + return _regionOfInterest; } set { - _csPlus = value; + _regionOfInterest = value; } } /// - /// Waveform to play for CS- cue + /// Video writer. If not provided, no video will be saved. /// [System.Xml.Serialization.XmlIgnoreAttribute()] - [Newtonsoft.Json.JsonPropertyAttribute("cs_minus")] - [System.ComponentModel.DescriptionAttribute("Waveform to play for CS- cue")] - public Waveform CsMinus + [Newtonsoft.Json.JsonPropertyAttribute("video_writer")] + [System.ComponentModel.DescriptionAttribute("Video writer. If not provided, no video will be saved.")] + public VideoWriter VideoWriter { get { - return _csMinus; + return _videoWriter; } set { - _csMinus = value; + _videoWriter = value; } } - public System.IObservable Generate() + public System.IObservable Generate() { - return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new SoundCardCalibration(this))); + return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new SpinnakerCamera(this))); } - public System.IObservable Generate(System.IObservable source) + public System.IObservable Generate(System.IObservable source) { - return System.Reactive.Linq.Observable.Select(source, _ => new SoundCardCalibration(this)); + return System.Reactive.Linq.Observable.Select(source, _ => new SpinnakerCamera(this)); } protected virtual bool PrintMembers(System.Text.StringBuilder stringBuilder) { - stringBuilder.Append("GoCue = " + _goCue + ", "); - stringBuilder.Append("CsPlus = " + _csPlus + ", "); - stringBuilder.Append("CsMinus = " + _csMinus); + stringBuilder.Append("DeviceType = " + _deviceType + ", "); + stringBuilder.Append("Calibration = " + _calibration + ", "); + stringBuilder.Append("SerialNumber = " + _serialNumber + ", "); + stringBuilder.Append("Binning = " + _binning + ", "); + stringBuilder.Append("ColorProcessing = " + _colorProcessing + ", "); + stringBuilder.Append("Exposure = " + _exposure + ", "); + stringBuilder.Append("Gain = " + _gain + ", "); + stringBuilder.Append("Gamma = " + _gamma + ", "); + stringBuilder.Append("AdcBitDepth = " + _adcBitDepth + ", "); + stringBuilder.Append("PixelFormat = " + _pixelFormat + ", "); + stringBuilder.Append("RegionOfInterest = " + _regionOfInterest + ", "); + stringBuilder.Append("VideoWriter = " + _videoWriter); return true; } @@ -7789,6 +7839,98 @@ protected override bool PrintMembers(System.Text.StringBuilder stringBuilder) } + /// + /// Visualizer settings for the dynamic foraging rig's camera. This includes camera image rotation and flip state for visualizers. + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("Bonsai.Sgen", "0.9.0.0 (Newtonsoft.Json v13.0.0.0)")] + [System.ComponentModel.DescriptionAttribute("Visualizer settings for the dynamic foraging rig\'s camera. This includes camera i" + + "mage rotation and flip state for visualizers.")] + [Bonsai.WorkflowElementCategoryAttribute(Bonsai.ElementCategory.Source)] + [Bonsai.CombinatorAttribute(MethodName="Generate")] + public partial class VisualizerSettings + { + + private FlipState? _flipState; + + private double _rotation; + + public VisualizerSettings() + { + _rotation = 0D; + } + + protected VisualizerSettings(VisualizerSettings other) + { + _flipState = other._flipState; + _rotation = other._rotation; + } + + /// + /// Camera flip state + /// + [Newtonsoft.Json.JsonPropertyAttribute("flip_state")] + [System.ComponentModel.DescriptionAttribute("Camera flip state")] + public FlipState? FlipState + { + get + { + return _flipState; + } + set + { + _flipState = value; + } + } + + /// + /// Camera rotation angle in radians + /// + [Newtonsoft.Json.JsonPropertyAttribute("rotation")] + [System.ComponentModel.DescriptionAttribute("Camera rotation angle in radians")] + public double Rotation + { + get + { + return _rotation; + } + set + { + _rotation = value; + } + } + + public System.IObservable Generate() + { + return System.Reactive.Linq.Observable.Defer(() => System.Reactive.Linq.Observable.Return(new VisualizerSettings(this))); + } + + public System.IObservable Generate(System.IObservable source) + { + return System.Reactive.Linq.Observable.Select(source, _ => new VisualizerSettings(this)); + } + + protected virtual bool PrintMembers(System.Text.StringBuilder stringBuilder) + { + stringBuilder.Append("FlipState = " + _flipState + ", "); + stringBuilder.Append("Rotation = " + _rotation); + 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(); + } + } + + /// /// Represents a water valve calibration. /// @@ -8315,7 +8457,7 @@ public enum BehaviorStabilityParametersBehaviorEvaluationMode [System.CodeDom.Compiler.GeneratedCodeAttribute("Bonsai.Sgen", "0.9.0.0 (Newtonsoft.Json v13.0.0.0)")] [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] - public enum DynamicForagingSpinnakerCameraColorProcessing + public enum SpinnakerCameraColorProcessing { [System.Runtime.Serialization.EnumMemberAttribute(Value="Default")] @@ -8326,6 +8468,22 @@ public enum DynamicForagingSpinnakerCameraColorProcessing } + [System.CodeDom.Compiler.GeneratedCodeAttribute("Bonsai.Sgen", "0.9.0.0 (Newtonsoft.Json v13.0.0.0)")] + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public enum FlipState + { + + [System.Runtime.Serialization.EnumMemberAttribute(Value="horizontal")] + Horizontal = 0, + + [System.Runtime.Serialization.EnumMemberAttribute(Value="vertical")] + Vertical = 1, + + [System.Runtime.Serialization.EnumMemberAttribute(Value="both")] + Both = 2, + } + + [System.CodeDom.Compiler.GeneratedCodeAttribute("Bonsai.Sgen", "0.9.0.0 (Newtonsoft.Json v13.0.0.0)")] [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public enum WaveformType @@ -8805,6 +8963,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); @@ -8855,6 +9018,11 @@ public System.IObservable Process(System.IObservable return Process(source); } + public System.IObservable Process(System.IObservable source) + { + return Process(source); + } + public System.IObservable Process(System.IObservable source) { return Process(source); @@ -8921,6 +9089,7 @@ 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))] @@ -8931,6 +9100,7 @@ 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))] diff --git a/src/Extensions/Hardware.bonsai b/src/Extensions/Hardware.bonsai index 70a52234..22cac232 100644 --- a/src/Extensions/Hardware.bonsai +++ b/src/Extensions/Hardware.bonsai @@ -376,7 +376,7 @@ ThisCamera - Value + Value.Camera @@ -394,7 +394,7 @@ ThisCamera - Value + Value.Camera RegionOfInterest diff --git a/src/Extensions/HardwareQA.bonsai b/src/Extensions/HardwareQA.bonsai index 4fda0594..fad0c852 100644 --- a/src/Extensions/HardwareQA.bonsai +++ b/src/Extensions/HardwareQA.bonsai @@ -172,7 +172,7 @@ ThisCamera - Value.Exposure + Value.Camera.Exposure TriggeredCameraController diff --git a/src/Extensions/Logging.bonsai b/src/Extensions/Logging.bonsai index fffea67f..771fea50 100644 --- a/src/Extensions/Logging.bonsai +++ b/src/Extensions/Logging.bonsai @@ -1107,7 +1107,7 @@ - Value.VideoWriter + Value.Camera.VideoWriter @@ -1273,7 +1273,7 @@ - Value.VideoWriter + Value.Camera.VideoWriter diff --git a/src/aind_behavior_dynamic_foraging/rig.py b/src/aind_behavior_dynamic_foraging/rig.py index e43660b1..0bd71e60 100644 --- a/src/aind_behavior_dynamic_foraging/rig.py +++ b/src/aind_behavior_dynamic_foraging/rig.py @@ -1,7 +1,8 @@ from typing import Annotated, Literal, Optional import aind_behavior_services.rig as rig -from aind_behavior_services.rig import aind_manipulator, cameras, harp, water_valve +from aind_behavior_services.rig import aind_manipulator, harp, water_valve +from aind_behavior_services.rig.cameras import CameraController, SpinnakerCamera, WebCamera from pydantic import BaseModel, Field, model_validator from aind_behavior_dynamic_foraging import __semver__ @@ -72,19 +73,30 @@ class DynamicForagingAindManipulator(aind_manipulator.AindManipulator): ) -class DynamicForagingSpinnakerCamera(cameras.SpinnakerCamera): - """A SpinnakerCamera for the dynamic foraging rig. This is a subclass of the SpinnakerCamera that includes camera image rotation for visualizers.""" +class VisualizerSettings(BaseModel): + """Visualizer settings for the dynamic foraging rig's camera. This includes camera image rotation and flip state for visualizers.""" - flip_state: float = Field(default=2, gt=0, le=2, description="Camera flip state", validate_default=True) + flip_state: None | Literal["horizontal", "vertical", "both"] = Field( + default=None, description="Camera flip state", validate_default=True + ) rotation: float = Field(default=0, description="Camera rotation angle in radians", validate_default=True) +class DynamicForagingSpinnakerCamera(BaseModel): + """A SpinnakerCamera for the dynamic foraging rig that includes camera image rotation for visualizers.""" + + camera: SpinnakerCamera = Field(description="Spinnaker camera instance") + visualizer_settings: VisualizerSettings = Field( + default=VisualizerSettings(), description="Visualizer settings for the camera", validate_default=True + ) + + class AindDynamicForagingRig(rig.Rig): version: Literal[__semver__] = __semver__ - triggered_camera_controller: cameras.CameraController[DynamicForagingSpinnakerCamera] = Field( + triggered_camera_controller: CameraController[DynamicForagingSpinnakerCamera] = Field( description="Required camera controller to triggered cameras." ) - monitoring_camera_controller: Optional[cameras.CameraController[cameras.WebCamera]] = Field( + monitoring_camera_controller: Optional[CameraController[WebCamera]] = Field( default=None, description="Optional camera controller for monitoring cameras." ) harp_behavior: harp.HarpBehavior = Field(description="Harp behavior") diff --git a/workspace/aind_behavior_dynamic_foraging_metadata_mapper/src/aind_behavior_dynamic_foraging_metadata_mapper/instrument.py b/workspace/aind_behavior_dynamic_foraging_metadata_mapper/src/aind_behavior_dynamic_foraging_metadata_mapper/instrument.py index 96ee90ef..a60744a5 100644 --- a/workspace/aind_behavior_dynamic_foraging_metadata_mapper/src/aind_behavior_dynamic_foraging_metadata_mapper/instrument.py +++ b/workspace/aind_behavior_dynamic_foraging_metadata_mapper/src/aind_behavior_dynamic_foraging_metadata_mapper/instrument.py @@ -146,7 +146,7 @@ def _map(self) -> Instrument: controller = rig.triggered_camera_controller fps = float(controller.frame_rate) if controller.frame_rate else float("nan") for name, cam in rig.triggered_camera_controller.cameras.items(): - additional_settings = cam.model_dump() + additional_settings = cam.camera.model_dump() additional_settings["note"] = ( "The additional_settings values are the input parameters used to initialize the camera. Model found at https://github.com/AllenNeuralDynamics/Aind.Behavior.Services/blob/a6c0f539275f73af87da82a8ea0101836389f1b3/src/aind_behavior_services/rig/cameras.py#L226. Enum clarifications: adc_bit_depth is an " "Spinnaker SDK enum-coded value (0=ADC8BIT, 1=ADC10BIT, 2=ADC12BIT), and pixel_format " @@ -166,12 +166,12 @@ def _map(self) -> Instrument: model="Blackfly S BFS-U3-04S2M", frame_rate=Decimal(str(fps)), frame_rate_unit=FrequencyUnit.HZ, - gain=Decimal(str(cam.gain) if cam.gain is not None else "0"), - serial_number=cam.serial_number, - crop_offset_x=cam.region_of_interest.x if cam.region_of_interest.x > 0 else None, - crop_offset_y=cam.region_of_interest.y if cam.region_of_interest.y > 0 else None, - crop_width=cam.region_of_interest.width if cam.region_of_interest.width > 0 else None, - crop_height=cam.region_of_interest.height if cam.region_of_interest.height > 0 else None, + gain=Decimal(str(cam.camera.gain) if cam.camera.gain is not None else "0"), + serial_number=cam.camera.serial_number, + crop_offset_x=cam.camera.region_of_interest.x if cam.camera.region_of_interest.x > 0 else None, + crop_offset_y=cam.camera.region_of_interest.y if cam.camera.region_of_interest.y > 0 else None, + crop_width=cam.camera.region_of_interest.width if cam.camera.region_of_interest.width > 0 else None, + crop_height=cam.camera.region_of_interest.height if cam.camera.region_of_interest.height > 0 else None, crop_unit=SizeUnit.PX, additional_settings=GenericModel.model_validate(additional_settings), ) From 93e35d32fe5112fe10013df9879808e95b73ae67 Mon Sep 17 00:00:00 2001 From: Micah Woodard Date: Fri, 4 Sep 2026 10:52:43 -0700 Subject: [PATCH 6/7] fixes acquisition mapping --- .../acquisition.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/workspace/aind_behavior_dynamic_foraging_metadata_mapper/src/aind_behavior_dynamic_foraging_metadata_mapper/acquisition.py b/workspace/aind_behavior_dynamic_foraging_metadata_mapper/src/aind_behavior_dynamic_foraging_metadata_mapper/acquisition.py index b315e8da..620025f9 100644 --- a/workspace/aind_behavior_dynamic_foraging_metadata_mapper/src/aind_behavior_dynamic_foraging_metadata_mapper/acquisition.py +++ b/workspace/aind_behavior_dynamic_foraging_metadata_mapper/src/aind_behavior_dynamic_foraging_metadata_mapper/acquisition.py @@ -10,7 +10,7 @@ from aind_behavior_curriculum import TrainerState from aind_behavior_dynamic_foraging.data_contract import dataset as df_foraging_dataset from aind_behavior_dynamic_foraging.data_contract.utils import calculate_consumed_water -from aind_behavior_dynamic_foraging.rig import AindDynamicForagingRig +from aind_behavior_dynamic_foraging.rig import AindDynamicForagingRig, DynamicForagingSpinnakerCamera, CameraController from aind_behavior_dynamic_foraging.task_logic import AindDynamicForagingTaskLogic from aind_behavior_services.rig import Device as AbsDevice from aind_behavior_services.rig import cameras as abs_camera @@ -120,7 +120,11 @@ def _map(self) -> Acquisition: python_code = _get_python_as_code(repository) curriculum_code = _get_curriculum_as_code(repository, trainer_state) - cameras = data_mapper_helpers.get_cameras(rig_model, exclude_without_video_writer=True) + cameras: dict[str, DynamicForagingSpinnakerCamera] = {} + camera_controllers = [x[1] for x in get_fields_of_type(rig_model, CameraController)] + for controller in camera_controllers: + cameras.update({k: v for k, v in controller.cameras.items() if v.camera.video_writer is not None}) + camera_configs = [_get_camera_config(k, v, repository) for k, v in cameras.items()] # construct data stream From 2f52305de094dc8fc17b5ae2f3971a85debaeb66 Mon Sep 17 00:00:00 2001 From: Micah Woodard Date: Fri, 4 Sep 2026 10:57:28 -0700 Subject: [PATCH 7/7] lints --- .../acquisition.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workspace/aind_behavior_dynamic_foraging_metadata_mapper/src/aind_behavior_dynamic_foraging_metadata_mapper/acquisition.py b/workspace/aind_behavior_dynamic_foraging_metadata_mapper/src/aind_behavior_dynamic_foraging_metadata_mapper/acquisition.py index 620025f9..60f4ec91 100644 --- a/workspace/aind_behavior_dynamic_foraging_metadata_mapper/src/aind_behavior_dynamic_foraging_metadata_mapper/acquisition.py +++ b/workspace/aind_behavior_dynamic_foraging_metadata_mapper/src/aind_behavior_dynamic_foraging_metadata_mapper/acquisition.py @@ -10,7 +10,7 @@ from aind_behavior_curriculum import TrainerState from aind_behavior_dynamic_foraging.data_contract import dataset as df_foraging_dataset from aind_behavior_dynamic_foraging.data_contract.utils import calculate_consumed_water -from aind_behavior_dynamic_foraging.rig import AindDynamicForagingRig, DynamicForagingSpinnakerCamera, CameraController +from aind_behavior_dynamic_foraging.rig import AindDynamicForagingRig, CameraController, DynamicForagingSpinnakerCamera from aind_behavior_dynamic_foraging.task_logic import AindDynamicForagingTaskLogic from aind_behavior_services.rig import Device as AbsDevice from aind_behavior_services.rig import cameras as abs_camera