From a401ce59538c0f16773dafe972ce35bfabdbcfa8 Mon Sep 17 00:00:00 2001 From: bruno-f-cruz <7049351+bruno-f-cruz@users.noreply.github.com> Date: Tue, 3 Dec 2024 05:33:42 -0800 Subject: [PATCH] Add extension methods --- .../src/bonsai/Extensions/ExtensionMethods.cs | 36 ++++ .../src/bonsai/demo2.bonsai | 176 ++++++++++++++++++ 2 files changed, 212 insertions(+) create mode 100644 _topics/_08_reproducible_research_practices/src/bonsai/Extensions/ExtensionMethods.cs create mode 100644 _topics/_08_reproducible_research_practices/src/bonsai/demo2.bonsai diff --git a/_topics/_08_reproducible_research_practices/src/bonsai/Extensions/ExtensionMethods.cs b/_topics/_08_reproducible_research_practices/src/bonsai/Extensions/ExtensionMethods.cs new file mode 100644 index 0000000..ff551d4 --- /dev/null +++ b/_topics/_08_reproducible_research_practices/src/bonsai/Extensions/ExtensionMethods.cs @@ -0,0 +1,36 @@ +using System; + +namespace Experimentgonogo +{ + public partial class Trial + { + public virtual TimeSpan ToInterTrialInterval() + { + throw new NotImplementedException(); + } + } + + public partial class NoGoTrial + { + public override TimeSpan ToInterTrialInterval() + { + return TimeSpan.FromSeconds(this.InterTrialInterval); + } + } + + public partial class GoTrial + { + public override TimeSpan ToInterTrialInterval() + { + if (this.Cue == "Foo") + { + return TimeSpan.FromSeconds(this.InterTrialInterval + 1); + } + else + { + return TimeSpan.FromSeconds(this.InterTrialInterval); + } + } + } + +} \ No newline at end of file diff --git a/_topics/_08_reproducible_research_practices/src/bonsai/demo2.bonsai b/_topics/_08_reproducible_research_practices/src/bonsai/demo2.bonsai new file mode 100644 index 0000000..591279b --- /dev/null +++ b/_topics/_08_reproducible_research_practices/src/bonsai/demo2.bonsai @@ -0,0 +1,176 @@ + + + + + + + ..\json\experimentgonogo-example.json + + + + + + + + 1 + + + + ThisSession + + + ThisSession + + + Trials + + + + + + + + + NoGoTrial + + + + Source1 + + + + 1 + + + + ThisTrial + + + ThisTrial + + + it.ToInterTrialInterval() + + + + + + + + + PT0.5S + PT0S + + + + + NoGo!!! + + + + + + + + + + + + + + + + + + + + GoTrial + + + + Source1 + + + + 1 + + + + ThisTrial + + + ThisTrial + + + it.ToInterTrialInterval() + + + + + + + + + PT1S + PT0S + + + + + Go!!! + + + + + + + + + + + + + + + + + + + + TrialInfo + + + + TrialInfo + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file