def buffer_mod(name, buffer, spec): actr.schedule_mod_buffer_chunk(buffer, spec, 0, module='goal', priority=20) actr.schedule_event_now('release-chunk-spec-id', params=[spec], module='goal', priority=19, maintenance=True)
def request(name, buffer, spec): chunk_desc = actr.chunk_spec_to_chunk_def(spec) actr.release_chunk_spec(spec) if chunk_desc: actr.schedule_event_now('create-goal-buffer-chunk', params=[buffer, chunk_desc], module='goal', priority=-100) else: actr.print_warning('Invalid request made to the goal buffer.')
def create_goal_buffer_chunk(buffer, chunk_desc): name = actr.define_chunks(chunk_desc)[0] actr.schedule_set_buffer_chunk(buffer, name, 0, module='goal', priority=-1000) actr.schedule_event_now("purge-chunk", params=[name], module='goal', priority=':min', maintenance=True)
def next(self): """Moves on in th task progression""" if self.phase == "fixation": self.phase = "stimulus" self.current_trial.onset = actr.mp_time() elif self.phase == "stimulus": self.current_trial.offset = actr.mp_time() self.index += 1 self.log.append(self.current_trial) if self.index >= len(self.stimuli): self.phase = "done" else: self.current_trial = StroopTrial(self.stimuli[self.index]) self.phase = "fixation" actr.schedule_event_relative(1, "stroop-next") actr.schedule_event_now("stroop-update-window")
def accept_response(self, model, response): """A valid response is a key pressed during the 'stimulus' phase""" if self.phase == "stimulus": self.current_trial.response = response actr.schedule_event_now("stroop-next")
def respond_to_key_press(model, key): global current_pick current_pick = key global total_picks global reward global decka_counter global deckb_counter global deckc_counter global deckd_counter global trace global tracedeckA global tracedeckB global tracedeckC global tracedeckD global tracepicksA global tracepicksB global tracepicksC global tracepicksD if current_pick == "a": reward = (100 - decka_penalties[decka_counter]) decka_counter = decka_counter + 1 total_picks = total_picks + 1 actr.schedule_event_now("load_reward") trace.append(total_picks) trace.append(current_pick) trace.append(decka_penalties[decka_counter - 1]) trace.append(reward) tracedeckA.append(1) tracedeckB.append(0) tracedeckC.append(0) tracedeckD.append(0) tracepicksA.append(total_picks) if current_pick == "b": reward = (100 - deckb_penalties[deckb_counter]) deckb_counter = deckb_counter + 1 total_picks = total_picks + 1 actr.schedule_event_now("load_reward") trace.append(total_picks) trace.append(current_pick) trace.append(deckb_penalties[deckb_counter - 1]) trace.append(reward) tracedeckA.append(0) tracedeckB.append(1) tracedeckC.append(0) tracedeckD.append(0) tracepicksB.append(total_picks) if current_pick == "c": reward = (50 - deckc_penalties[deckc_counter]) deckc_counter = deckc_counter + 1 total_picks = total_picks + 1 actr.schedule_event_now("load_reward") trace.append(total_picks) trace.append(current_pick) trace.append(deckc_penalties[deckc_counter - 1]) trace.append(reward) tracedeckA.append(0) tracedeckB.append(0) tracedeckC.append(1) tracedeckD.append(0) tracepicksC.append(total_picks) if current_pick == "d": reward = (50 - deckd_penalties[deckd_counter]) deckd_counter = deckd_counter + 1 total_picks = total_picks + 1 actr.schedule_event_now("load_reward") trace.append(total_picks) trace.append(current_pick) trace.append(deckd_penalties[deckd_counter - 1]) trace.append(reward) tracedeckA.append(0) tracedeckB.append(0) tracedeckC.append(0) tracedeckD.append(1) tracepicksD.append(total_picks)