GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — affective task · DiedrichsenLab/MultiTaskBattery@f64d7bc

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • MultiTaskBattery
    • task_blocks.py
    • task_file.py
    • task_table.tsv
  • docs
    • images
      • Slide35.png
    • task_descriptions.rst
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎MultiTaskBattery/task_blocks.py‎

Copy file name to clipboardExpand all lines: MultiTaskBattery/task_blocks.py
+53Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2278,5 +2278,58 @@ def run_trial(self, trial):
22782278
self.display_trial_feedback(trial['display_trial_feedback'], trial['correct'])
22792279
return trial
22802280

2281+
class Affective(Task):
2282+
def __init__(self, info, screen, ttl_clock, const, subj_id):
2283+
super().__init__(info, screen, ttl_clock, const, subj_id)
2284+
self.feedback_type = 'acc+rt'
2285+
2286+
def init_task(self):
2287+
"""
2288+
Initialize task
2289+
"""
2290+
trial_info_file = self.const.task_dir / self.name / self.task_file
2291+
self.trial_info = pd.read_csv(trial_info_file, sep='\t')
2292+
2293+
self.stim = []
2294+
for stim_file in self.trial_info['stim']:
2295+
stim_path = self.const.stim_dir / self.name / stim_file
2296+
self.stim.append(visual.ImageStim(self.window, image=str(stim_path)))
2297+
2298+
def display_instructions(self):
2299+
"""
2300+
Display instructions for the affective task.
2301+
"""
2302+
key_pleasant = self.trial_info['key_pleasant'].iloc[0]
2303+
key_unpleasant = self.trial_info['key_unpleasant'].iloc[0]
2304+
2305+
self.instruction_text = (
2306+
f"{self.descriptive_name} Task\n\n"
2307+
f"Press {key_unpleasant} if the image is UNPLEASANT.\n"
2308+
f"Press {key_pleasant} if the image is PLEASANT."
2309+
)
2310+
instr_visual = visual.TextStim(self.window, text=self.instruction_text, color=[-1, -1, -1], wrapWidth=20)
2311+
instr_visual.draw()
2312+
self.window.flip()
2313+
2314+
def run_trial(self, trial):
2315+
"""
2316+
Run a single trial of the affective task.
2317+
"""
2318+
event.clearEvents()
22812319

2320+
# Display image
2321+
self.stim[trial['trial_num']].draw()
2322+
self.window.flip()
2323+
2324+
# Wait for response
2325+
trial['response'], trial['rt'] = self.wait_response(self.ttl_clock.get_time(), trial['trial_dur'])
2326+
2327+
# Determine correct response
2328+
correct_key = trial['key_pleasant'] if trial['trial_type'] == 2 else trial['key_unpleasant']
2329+
trial['correct'] = (trial['response'] == correct_key)
2330+
2331+
# Show feedback
2332+
self.display_trial_feedback(trial['display_trial_feedback'], trial['correct'])
2333+
2334+
return trial
22822335

Collapse file

‎MultiTaskBattery/task_file.py‎

Copy file name to clipboardExpand all lines: MultiTaskBattery/task_file.py
+58Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1806,3 +1806,61 @@ def make_task_file(self,
18061806
return trial_info
18071807

18081808

1809+
class Affective(TaskFile):
1810+
def __init__(self, const):
1811+
super().__init__(const)
1812+
self.name = 'affective'
1813+
1814+
def make_task_file(self,
1815+
task_dur=30,
1816+
trial_dur=1.6,
1817+
iti_dur=0.4,
1818+
file_name=None,
1819+
run_number=None,
1820+
hand='left',
1821+
responses=[3, 4]):
1822+
1823+
# check how many trials to include
1824+
n_trials = int(np.floor(task_dur / (trial_dur + iti_dur)))
1825+
n_pleasant = n_trials // 2
1826+
n_unpleasant = n_trials - n_pleasant
1827+
1828+
# Randomly sample numbers 1–26 (image name numbers)
1829+
pleasant_nums = random.sample(range(1, 27), n_pleasant)
1830+
unpleasant_nums = random.sample(range(1, 27), n_unpleasant)
1831+
1832+
# Create stim list
1833+
stim = [{'imgName': f'pleasant{n}.jpg', 'trialType': 2} for n in pleasant_nums] + \
1834+
[{'imgName': f'unpleasant{n}.jpg', 'trialType': 1} for n in unpleasant_nums]
1835+
1836+
random.shuffle(stim) # mix trial order
1837+
1838+
# Build trial list
1839+
trial_info = []
1840+
t = 0
1841+
for n in range(n_trials):
1842+
trial = {}
1843+
trial['key_pleasant'] = responses[0]
1844+
trial['key_unpleasant'] = responses[1]
1845+
trial['trial_num'] = n
1846+
trial['stim'] = stim[n]['imgName']
1847+
trial['trial_type'] = stim[n]['trialType']
1848+
trial['hand'] = hand
1849+
trial['trial_dur'] = trial_dur
1850+
trial['iti_dur'] = iti_dur
1851+
trial['key_unpleasant'] = responses[0]
1852+
trial['key_pleasant'] = responses[1]
1853+
trial['display_trial_feedback'] = True
1854+
trial['start_time'] = t
1855+
trial['end_time'] = t + trial_dur + iti_dur
1856+
trial_info.append(trial)
1857+
t = trial['end_time']
1858+
1859+
trial_info = pd.DataFrame(trial_info)
1860+
1861+
if file_name is not None:
1862+
ut.dircheck(self.task_dir / self.name)
1863+
trial_info.to_csv(self.task_dir / self.name / file_name, sep='\t', index=False)
1864+
1865+
return trial_info
1866+
Collapse file

‎MultiTaskBattery/task_table.tsv‎

Copy file name to clipboardExpand all lines: MultiTaskBattery/task_table.tsv
+1-15Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,6 @@ sencoding Sencoding sentence sencod
1919
sencoding_probe SencodingProbe sentence_probe sencodeprob
2020
semantic_prediction SemanticPrediction complete sempred "sentence presented, participants decide if last word makes sense."
2121
visual_search VisualSearch search visrchsml "geometric shapes presented on screen, participants must identify if 'L' is present."
22-
go_no_go Na nogo nogo
23-
affective Na pleasent pleasent
24-
arithmetic Na math math
25-
checkerBoard Na checker chckbrd
26-
emotional Na faces sdfac
27-
interval_timing Na timing inttim
28-
n_back_verbal Na memory_verbal vrbbck
29-
n_back_pic Na memory_object objbck
30-
stroop Na stroop strp
31-
CPRO Na CPRO crpo
32-
motor_imagery Na motor_imagery mtrimg
33-
spatial_map Na spatial_map spatmp
34-
mental_rotation Na rotation mntrlrt
35-
emotionProcess Na motion biomot
36-
respAlt Na response_alternative respalt
3722
rmet RMET eyes rmet "pictures of faces with different emotions presented (eyes only) along with four attribute words, participants must identify which attribute describes person best." "Kim, H.A. et al. (2024) ‘Multiracial Reading the Mind in the Eyes Test (MRMET): An inclusive version of an influential measure’, Behavior Research Methods. Revised from Baron-Cohen, Wheelwright, Hill, Raste, & Plumb, 2001" "age, emotion"
3823
picture_sequence PictureSequence cartoon picture_sequence "4 cartoon pictures are presented, participants must order them chronologically." "Heleven, E., van Dun, K. and Van Overwalle, F. (2019) ‘The posterior Cerebellum is involved in constructing Social Action Sequences: An fMRI Study’, Scientific Reports, 9(1), pp. 1–11. Available at: https://doi.org/10.1038/s41598-019-46962-7." "fbelief,tbelief,control,sscript,mechanical"
3924
story_sequence StorySequence story sequence story_sequence "4 sentences are presented, participants must order them chronologically." "Heleven, E., van Dun, K. and Van Overwalle, F. (2019) ‘The posterior Cerebellum is involved in constructing Social Action Sequences: An fMRI Study’, Scientific Reports, 9(1), pp. 1–11. Available at: https://doi.org/10.1038/s41598-019-46962-7." "fbelief,tbelief,control,sscript,mechanical"
@@ -44,3 +29,4 @@ faux_pas FauxPas faux pas faux_pas "stories of (potential) faux pas situations,
4429
frith_happe FrithHappe triangle frith_happe "video clips of triangle animations, participants must determine whether interaction was random, goal-directed or a mentalizing interaction" "Livingston, L.A. et al. (2021) ‘Further developing the Frith–Happé animations: A quicker, more objective, and web-based test of theory of mind for autistic and neurotypical adults’, Autism Research, 14(9), pp. 1905–1912. Available at: https://doi.org/10.1002/aur.2575.." "random,gd,tom"
4530
liking Liking meeting liking "video clips of people interacting, participants must determine if the interaction was positive or negative" "Heerey, E.A. and Gilder, T.S.E. (2019) ‘The subjective value of a smile alters social behaviour’, PLoS ONE, 14(12), pp. 1–19. Available at: https://doi.org/10.1371/journal.pone.0225284." "like,dislike"
4631
pong Pong pong pomg pong game
32+
affective Affective affective affect 2 choice is the image pleasant or unpleasant
Collapse file

‎docs/images/Slide35.png‎

Copy file name to clipboard
224 KB
  • Display the source diff
  • Display the rich diff
Loading
Collapse file

‎docs/task_descriptions.rst‎

Copy file name to clipboardExpand all lines: docs/task_descriptions.rst
+5-5Lines changed: 5 additions & 5 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ Action Observation
1010

1111
You are not required to make any response (overt or covert) in this task. You will watch two short video clips of 1) a knot being tied and 2) an already tied knot rotating on an axis. We ask that you pay close attention to the knot-tying exercise and the finished product as well as the name of each knot (upper right side of screen) as we will quiz you after the scanning experiment and ask you to tie the knot yourself”.
1212

13-
Arithmetic
14-
^^^^^^^^^^^^^^^^^^^
15-
.. image:: images/Slide34.png
13+
Affective
14+
^^^^^^^^^^^^^^^^^^^^
15+
.. image:: images/35.png
1616
:width: 600
17-
18-
In this task, you will indicate if a simple multiplication equation is correct or incorrect.
17+
18+
In this task, you will be shown a series of emotionally evocative images (e.g., pleasant or unpleasant scenes). Each image will appear on the screen and choose if it's pleasant or unpleasant.
1919

2020
Auditory Narrative
2121
^^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.