diff --git a/.bonsai/Bonsai.config b/.bonsai/Bonsai.config index e5893024..7e42dc58 100644 --- a/.bonsai/Bonsai.config +++ b/.bonsai/Bonsai.config @@ -11,6 +11,7 @@ + @@ -50,6 +51,8 @@ + + @@ -87,6 +90,7 @@ + @@ -130,6 +134,7 @@ + @@ -166,6 +171,7 @@ + @@ -211,6 +217,9 @@ + + + diff --git a/src/Extensions/HardwareQA.bonsai b/src/Extensions/HardwareQA.bonsai new file mode 100644 index 00000000..4fda0594 --- /dev/null +++ b/src/Extensions/HardwareQA.bonsai @@ -0,0 +1,659 @@ + + + + + + HardwareChecks + + + + ProtocolValidation + + + + PreSession + + + + + Cameras + + + + TriggeredCamerasStream + + + CheckDroppedFrames + + + + Source1 + + + + 1 + + + + InputSequence + + + InputSequence + + + + + + Value.ChunkData + + + FrameID + + + + 1 + + + + + 1 + + + + + 0 + + + + + + + Source1 + + + + + + + + + + InputSequence + + + Key + + + + + + Item2 + + + + + + + + + + + + + + + + + + + + + + + + + + Camera {0} dropped frame detected during pre-session! + it + + + + + + it + + + + Dropped frame detected during pre-session! + + + + StartExperiment + + + + + + TriggeredCameraController + + + Cameras + + + + + + CheckCameraSettings + + + + Source1 + + + + 1 + + + + ThisCamera + + + ThisCamera + + + Value.Exposure + + + TriggeredCameraController + + + FrameRate + + + Value + + + + + + ((1.0 / Item2) * 1000000) < double(Item1) + 1000 + + + + + + Source1 + + + + + + + + + + + 1 + + + + ThisCamera + + + Key + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Camera {0} exposure setting not compatible with requested frame rate! + it + + + + + + it + + + + + + + + TriggeredCameraController + + + FrameRate.HasValue + + + + + + + Source1 + + + + + + + + + + + TriggeredCameraControl must specify a valid FrameRate property! + + + + + + + + + + + + + + + + + + + + + + + + + + + GitRepository + + + + + ../. + + + + + false + + + + + SessionSchema + + + AllowDirtyRepo + + + + + + AllowDirty? + Item2 ? False : Item1 + + + + + + Source1 + + + + + + + + + + + Repository is not clean! Please discard all local changes. + + + + + + + + + + + + + + + + + + + + + + + CameraChecks + + + + TriggeredCamerasStream + + + OnlineQC + + + + Source1 + + + + 1 + + + + InputSequence + + + InputSequence + + + + + + Value.ChunkData + + + Timestamp + + + + 1 + + + + + 1E-09 + + + + Seconds + + + + 1 + + + + + + + + + + + + + + + 0.0005 + + + + + + + Source1 + + + + + + + + + + + TaskPoolScheduler + + + + + + + + PT0S + PT10S + + + + + + + MakeUI + + + + InputSequence + + + Key + + + Camera {0} out-of-alignment qc was triggered. + it + + + + + + + + + + Warning + Exclamation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SessionSchema + + + SkipHardwareValidation + + + + + + + Source1 + + + + + + + + + + + + + + PT2S + + + + + + + FilterErrors + + + + Source1 + + + Kind + + + + OnError + + + + + + + + + + + + + Exception + + + + + + + + Error + Hand + + + + CloseWorkflow + + + + Source1 + + + + EndExperiment + + + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Extensions/MessageBox.cs b/src/Extensions/MessageBox.cs new file mode 100644 index 00000000..854f3d20 --- /dev/null +++ b/src/Extensions/MessageBox.cs @@ -0,0 +1,76 @@ +using Bonsai; +using System; +using System.ComponentModel; +using System.Reactive.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +[Combinator] +[Description("Creates a custom message box dialog window.")] +[WorkflowElementCategory(ElementCategory.Sink)] +public class MessageBox +{ + private string text = ""; + public string Text + { + get { return text; } + set { text = value; } + } + + private string title = "Warning"; + public string Title + { + get { return title; } + set { title = value; } + } + + private MessageBoxIcon messageBoxIcon = MessageBoxIcon.Warning; + public MessageBoxIcon MessageBoxIcon + { + get { return messageBoxIcon; } + set { messageBoxIcon = value; } + } + + private class Win32Window : IWin32Window + { + private readonly IntPtr handle; + public Win32Window(IntPtr handle) { this.handle = handle; } + public IntPtr Handle { get { return handle; } } + } + + public IObservable Process(IObservable source) + { + var hwnd = System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle; + var owner = new Win32Window(hwnd); + + var capturedText = text; + var capturedTitle = title; + var capturedIcon = messageBoxIcon; + + return source.Select(value => + { + var task = new Task(() => + System.Windows.Forms.MessageBox.Show(owner, capturedText, capturedTitle, MessageBoxButtons.OK, capturedIcon)); + task.Start(); + return value; + }); + } + + public IObservable Process(IObservable source) + { + var hwnd = System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle; + var owner = new Win32Window(hwnd); + + var capturedText = text; + var capturedTitle = title; + var capturedIcon = messageBoxIcon; + + return source.Select(ex => + { + var task = new Task(() => + System.Windows.Forms.MessageBox.Show(owner, ex.ToString(), capturedTitle, MessageBoxButtons.OK, capturedIcon)); + task.Start(); + return ex; + }); + } +} diff --git a/src/Extensions/ValidateClkOutput.bonsai b/src/Extensions/ValidateClkOutput.bonsai new file mode 100644 index 00000000..8fb7b47c --- /dev/null +++ b/src/Extensions/ValidateClkOutput.bonsai @@ -0,0 +1,141 @@ + + + + + + ValidateClkOutput + + + + RigSchema + + + HarpClockGenerator.ConnectedClockOutputs + + + + + + OutputChannel + TargetDevice + + + + 1 + + + + ExpectedDevices + + + HarpWhiteRabbitEvents + + + + + + Read + + None + + + + HarpWhiteRabbitCommands + + + + + + Item1 + + + ExpectedDevices + + + + + + + + + + + + + + Source1 + + + MissingChannels + + + Count + + + + 0 + + + + + + + + + + + + + + Error raised while validating the Harp Clock Output: +{0} + it + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main.bonsai b/src/main.bonsai index 579c4274..e5825026 100644 --- a/src/main.bonsai +++ b/src/main.bonsai @@ -395,6 +395,7 @@ + @@ -462,22 +463,22 @@ - - + - - - - - - - - + + + + + + + + + \ No newline at end of file