Challenges to conduct the randomized memory trials between the primary task trials.
I have a study which is collecting data in the lab. The flow is as the below picture. The primary task requests participants comprehend sentence in each trial. After 6 to 8 trials, participants will verify if they read the sentence in the latest 3 trials. `Memory loop` manages this memory check. We use python code to control the timing and content of memory check.
Below is the inline python code in our old script:
### codes from http://stackoverflow.com/questions/27276135/python-random-system-time-seed import random from datetime import datetime random.seed(datetime.now()) ### Call empty list for comprehension task probe_list =  ### Select the index of sentences for comprehension task a = range(-1,2)*10 random.shuffle(a) idx_list = [sum(x) for x in zip(range(6,49,4), a)] ### Save the index in the variable var.set('alt_task',idx_list)
### Enqueue the probes into list probe_list.append(self.get("Probe"))
### Randomly select the probe sentence from list import random ### Choose from the past 16 trials; otherwise choose from the past 8 trials #if(self.get('count_Probe_Collect') < 8): # idx = random.choice(range(len(probe_list))) #else: idx = random.choice(range(len(probe_list) - 6, len(probe_list))) ### Export the probe sentence for recognition rectarget = probe_list[idx] var.set('rectarget', rectarget) ### Set up correct_response if(idx > (self.get('count_Probe_Collect') - 3) ): var.set('correct_response', 'j') else: var.set('correct_response', 'f')