From 934149b05bd941e67c9b93909c52fdd3c56e2c0f Mon Sep 17 00:00:00 2001
From: tiborauer <tibor.auer@gmail.com>
Date: Fri, 13 May 2022 10:38:50 +0100
Subject: [PATCH] ENH - Optional response "?" form (initial changes)

---
 rMtS_multiblock.py | 26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/rMtS_multiblock.py b/rMtS_multiblock.py
index 42466f7..57c04c4 100644
--- a/rMtS_multiblock.py
+++ b/rMtS_multiblock.py
@@ -69,7 +69,7 @@ if __name__ == '__main__':
     nTrialBlock = 3 # number of trial blocks per condition block
 
     # Schedule of trial: sampleJitter -> sample -> matchJitter + filler -> nMatch x [ match (same duration as sample) -> responseJitter -> response ]
-    #     Actual: 0.5 + 0.5 + 1.5 + 1 * ( 0.5 + 0 + 1 ) = 4
+    #     Actual: 0.5 + 0.5 + 1.5 + 1 * ( 1 + 0 + 0 ) = 3.5
 
     nSample = 3 # number of samples per block
     sampleJitterRange = [0.25, 0.75] # jitter before sample
@@ -79,8 +79,9 @@ if __name__ == '__main__':
     matchJitterRange = eval(expInfo['sample retention time']) # delay after sample
     fillerDuration = 0.25
 
+    matchDuration = 1
     responseJitterRange = [0, 0] # jitter between events
-    responseDuration = 1 # maximum duration of response
+    responseDuration = 0 # maximum duration of response on top of matchDuration, 0 for no "?"
 
     stimRamp = 3 # stimulation rampup and rampdown
 
@@ -101,8 +102,8 @@ if __name__ == '__main__':
                         array(responseJitterRange).mean()+
                         responseDuration
                     )
-                ) # 4s is the lenght if a trial (see above)
-            ), # 17.5 is the lenght of the trial block block
+                ) # 3.5 s is the lenght if a trial (see above)
+            ), # 16 s is the lenght of the trial block block
         'rampUp': stimRamp,
         'rampDown': stimRamp,
         'samplingRate': 2000,
@@ -152,12 +153,19 @@ if __name__ == '__main__':
     tTot = (nConditionBlock * (mean(conditionBlockJitter)-mean(trialBlockJitter) + nTrialBlock * 
         (mean(trialBlockJitter)-mean(sampleJitter) + nSample * 
         (mean(sampleJitter) + sampleDuration + mean(matchJitter) + 
-        nMatch * (sampleDuration + mean(responseJitter) + responseDuration)))) +
+        nMatch * (matchDuration + mean(responseJitter) + responseDuration)))) +
         mean(conditionBlockJitter))/60
-    infoStr = [
-        "You will perform a visual-spatial match-to-sample test, which is commonly used to assess spatial working memory.\n\nThe test takes about {:.1f} minute(s) and consists of {} trials. In each trial, first, you will see a sample stimulus: {} dots within a grid. This is followed by a mask stimulus, which is the same grid filled with grey dots.\n\nPress 'Yes' to continue.".format(tTot, nConditionBlock*nTrialBlock*nSample, sampleNum),
-        "Then, after shorter or longer delay, you will be presented with {} set(s) of test. The tests include a test stimulus, appearance of a single dot, followed by a response period of {:.1f} second(s) marked with a question mark.\n\nYou should press 'Yes' or 'No' during the response period indicating whether the location of the dot in the test stimulus matches any of those in the sample stimulus.\n\nPress 'Yes' when ready to start.".format(nMatch,responseDuration)
-    ]
+    if responseDuration > 0:
+        infoStr = [
+            "You will perform a visual-spatial match-to-sample test, which is commonly used to assess spatial working memory.\n\nThe test takes about {:.1f} minute(s) and consists of {} trials. In each trial, first, you will see a sample stimulus: {} dots within a grid. This is followed by a mask stimulus, which is the same grid filled with grey dots.\n\nPress 'Yes' to continue.".format(tTot, nConditionBlock*nTrialBlock*nSample, sampleNum),
+            "Then, after shorter or longer delay, you will be presented with {} set(s) of test. The tests include a test stimulus, appearance of a single dot, followed by a response period of {:.1f} second(s) marked with a question mark.\n\nYou should press 'Yes' or 'No' during the response period indicating whether the location of the dot in the test stimulus matches any of those in the sample stimulus.\n\nPress 'Yes' when ready to start.".format(nMatch,responseDuration)
+        ]
+    else:
+        infoStr = [
+            "You will perform a visual-spatial match-to-sample test, which is commonly used to assess spatial working memory.\n\nThe test takes about {:.1f} minute(s) and consists of {} trials. In each trial, first, you will see a sample stimulus: {} dots within a grid. This is followed by a mask stimulus, which is the same grid filled with grey dots.\n\nPress 'Yes' to continue.".format(tTot, nConditionBlock*nTrialBlock*nSample, sampleNum),
+            "Then, after shorter or longer delay, you will be presented with {} set(s) of test. The tests include a test stimulus, appearance of a single dot\n\nYou will have {:.1f} second(s) to press 'Yes' or 'No' indicating whether the location of the dot in the test stimulus matches any of those in the sample stimulus.\n\nPress 'Yes' when ready to start.".format(nMatch,responseDuration)
+        ]
+
     infoImg = [
         os.path.join(os.getcwd(),'html','resources','flow0.jpg'),
         os.path.join(os.getcwd(),'html','resources','flow1.jpg')
-- 
GitLab