├── ClassNotes ├── README.md ├── all_res_class_contextvals.csv ├── names.py ├── python_class_1.ipynb ├── python_class_2.ipynb ├── python_class_3.ipynb ├── python_class_4.py ├── python_class_5.py ├── python_class_6.ipynb ├── python_class_7.ipynb ├── python_class_8.ipynb ├── python_class_9.ipynb ├── python_class_homework_0.md └── python_class_homework_0.pdf ├── ExampleExperiments ├── README.md ├── congview_stim │ ├── congview_stim.ipynb │ ├── congview_stim.osexp │ └── csv │ │ ├── subject-1.csv.csv │ │ ├── subject-2.csv.csv │ │ ├── subject-3.csv.csv │ │ ├── subject-4.csv.csv │ │ └── subject-5.csv.csv ├── facebenefit │ ├── csv │ │ ├── vp_1.csv │ │ ├── vp_2.csv │ │ ├── vp_3.csv │ │ ├── vp_4.csv │ │ └── vp_5.csv │ ├── facebenefit.ipynb │ └── facebenefit.osexp ├── hog2 │ ├── csv │ │ ├── log1.27269886434e-05.csv │ │ ├── log1.31374690682e-05.csv │ │ ├── log1.39586627483e-05.csv │ │ ├── log1.43692595884e-05.csv │ │ └── log1.47797400132e-05.csv │ ├── experiment │ │ ├── Unser experiment.py │ │ ├── error.png │ │ ├── snake.png │ │ └── spider.png │ └── hog2.ipynb ├── hog3 │ ├── csv │ │ ├── AN.csv │ │ ├── AS.csv │ │ ├── BWa.csv │ │ ├── Ben.csv │ │ ├── Bo Red.csv │ │ ├── CM.csv │ │ ├── CS.csv │ │ ├── FGHJK.csv │ │ ├── FloMat.csv │ │ ├── GÅnther (Unicode Encoding Conflict).csv │ │ ├── Hugo.csv │ │ ├── JAAAAAN.csv │ │ ├── JANJöRGES (Unicode Encoding Conflict).csv │ │ ├── JKR.csv │ │ ├── JN.csv │ │ ├── LS.csv │ │ ├── LaPe.csv │ │ ├── Lisa.csv │ │ ├── Lola.csv │ │ ├── Mia Wallace.csv │ │ ├── Mimi.csv │ │ ├── Mr. M. Wallace.csv │ │ ├── Muggel123.csv │ │ ├── NF.csv │ │ ├── NvR.csv │ │ ├── PFE.csv │ │ ├── RM.csv │ │ ├── Sandra.csv │ │ ├── Slo Li.csv │ │ ├── TTTT.csv │ │ ├── ToDe.csv │ │ ├── Ulrike.csv │ │ ├── VV.csv │ │ ├── Zoey.csv │ │ ├── dsghdh.csv │ │ ├── hjrhje.csv │ │ ├── homer.csv │ │ ├── ju548.csv │ │ ├── pe.csv │ │ ├── phantom.csv │ │ ├── pula.csv │ │ ├── tklkl.csv │ │ ├── troll.csv │ │ ├── walter.csv │ │ └── zuzuzu.csv │ ├── experiment │ │ ├── der_pate.jpg │ │ ├── don_corleone.jfif │ │ ├── dot_probe_new.py │ │ ├── fingerloch_left.png │ │ ├── fingerloch_right.png │ │ ├── pulp_fiction.jpg │ │ ├── pulp_fiction_2.jfif │ │ ├── pulp_fiction_2.jpg │ │ ├── pulp_fiction_car.jpg │ │ ├── pulp_fiction_single.jpg │ │ └── pulp_fiction_toilet.jpg │ └── hog3.ipynb ├── hog4 │ ├── csv │ │ ├── AN.csv │ │ ├── AS.csv │ │ ├── BM.csv │ │ ├── BWa.csv │ │ ├── Ben.csv │ │ ├── Bo Red.csv │ │ ├── CM.csv │ │ ├── CS.csv │ │ ├── Carlo.csv │ │ ├── Chris.csv │ │ ├── FGHJK.csv │ │ ├── FloMat.csv │ │ ├── Gilderoy.csv │ │ ├── Gu˘nther.csv │ │ ├── HU.csv │ │ ├── Harry.csv │ │ ├── Hermine.csv │ │ ├── Hugo.csv │ │ ├── JAAAAAN.csv │ │ ├── JANJU˘RGES.csv │ │ ├── JKR.csv │ │ ├── JM.csv │ │ ├── JN.csv │ │ ├── LS.csv │ │ ├── LaPe.csv │ │ ├── Lisa.csv │ │ ├── Lola.csv │ │ ├── Mia Wallace.csv │ │ ├── Mimi.csv │ │ ├── Mr. M. Wallace.csv │ │ ├── Muggel123.csv │ │ ├── NF.csv │ │ ├── Nina.csv │ │ ├── NvR.csv │ │ ├── PFE.csv │ │ ├── Paulina.csv │ │ ├── RM.csv │ │ ├── SL.csv │ │ ├── Sandra.csv │ │ ├── Slo Li.csv │ │ ├── TTTT.csv │ │ ├── Tina.csv │ │ ├── ToDe.csv │ │ ├── Ulrike.csv │ │ ├── VV.csv │ │ ├── Zoey.csv │ │ ├── dsghdh.csv │ │ ├── hjrhje.csv │ │ ├── homer.csv │ │ ├── ju548.csv │ │ ├── pe.csv │ │ ├── phantom.csv │ │ ├── pula.csv │ │ ├── tklkl.csv │ │ ├── troll.csv │ │ ├── walter.csv │ │ └── zuzuzu.csv │ ├── experiment │ │ ├── der_pate.jpg │ │ ├── don_corleone.jfif │ │ ├── dot_probe_new.py │ │ ├── fingerloch_left.png │ │ ├── fingerloch_right.png │ │ ├── pulp_fiction.jpg │ │ ├── pulp_fiction_2.jfif │ │ ├── pulp_fiction_2.jpg │ │ ├── pulp_fiction_car.jpg │ │ ├── pulp_fiction_single.jpg │ │ └── pulp_fiction_toilet.jpg │ └── hog4.ipynb ├── hogwarts │ ├── csv │ │ ├── AN.csv │ │ ├── AS.csv │ │ ├── BWa.csv │ │ ├── Ben.csv │ │ ├── Bo Red.csv │ │ ├── CM.csv │ │ ├── CS.csv │ │ ├── FGHJK.csv │ │ ├── FloMat.csv │ │ ├── Günther (Unicode Encoding Conflict).csv │ │ ├── Hugo.csv │ │ ├── JAAAAAN.csv │ │ ├── JANJÜRGES (Unicode Encoding Conflict).csv │ │ ├── JKR.csv │ │ ├── JN.csv │ │ ├── LS.csv │ │ ├── LaPe.csv │ │ ├── Lisa.csv │ │ ├── Lola.csv │ │ ├── Mia Wallace.csv │ │ ├── Mimi.csv │ │ ├── Mr. M. Wallace.csv │ │ ├── Muggel123.csv │ │ ├── NF.csv │ │ ├── NvR.csv │ │ ├── PFE.csv │ │ ├── RC1.csv │ │ ├── RC2.csv │ │ ├── RC3.csv │ │ ├── RC4.csv │ │ ├── RC5.csv │ │ ├── RM.csv │ │ ├── Sandra.csv │ │ ├── Slo Li.csv │ │ ├── TTTT.csv │ │ ├── ToDe.csv │ │ ├── Ulrike.csv │ │ ├── VV.csv │ │ ├── Zoey.csv │ │ ├── dsghdh.csv │ │ ├── hjrhje.csv │ │ ├── homer.csv │ │ ├── ju548.csv │ │ ├── pe.csv │ │ ├── phantom.csv │ │ ├── pula.csv │ │ ├── tklkl.csv │ │ ├── troll.csv │ │ ├── walter.csv │ │ └── zuzuzu.csv │ ├── experiment │ │ ├── der_pate.jpg │ │ ├── don_corleone.jfif │ │ ├── dot_probe_new.py │ │ ├── fingerloch_left.png │ │ ├── fingerloch_right.png │ │ ├── pulp_fiction.jpg │ │ ├── pulp_fiction_2.jfif │ │ ├── pulp_fiction_2.jpg │ │ ├── pulp_fiction_car.jpg │ │ ├── pulp_fiction_single.jpg │ │ └── pulp_fiction_toilet.jpg │ └── hogwarts.ipynb ├── selfpriorisation │ ├── csv │ │ ├── log1.02629674075e-05.csv │ │ ├── log1.0263043805e-05.csv │ │ ├── log1.06905918074e-05.csv │ │ ├── log1.28287089183e-05.csv │ │ ├── log4.70385930385e-06.csv │ │ ├── log5.55915175937e-06.csv │ │ └── log9.83534346233e-06.csv │ ├── experiment │ │ ├── animals.png │ │ └── matching_task.py │ └── selfpriorisation_analysis.ipynb ├── selfrelevant_recog │ ├── csv │ │ ├── log1.90734863281e-06.csv │ │ ├── log2.86102294922e-06z.csv │ │ ├── log3.09944152832e-06.csv │ │ ├── log4.05311584473e-06n.csv │ │ ├── log5.81469726562e-06p.csv │ │ └── log6.09944152832e-06i.csv │ ├── experiment │ │ ├── dreieck.png │ │ ├── error.png │ │ ├── experiment.py │ │ └── kreis.png │ └── selfrelevant_recog.ipynb └── viewdir_sex │ ├── csv │ ├── subject-1.csv │ ├── subject-2.csv │ ├── subject-3.csv │ ├── subject-4.csv │ └── subject-5.csv │ ├── experiment │ ├── Frau_links (1).png │ ├── Frau_links.png │ ├── Frau_rechts (1).png │ ├── Frau_rechts.png │ ├── Mann_links (1).png │ ├── Mann_links.png │ ├── Mann_rechts (1).png │ ├── Mann_rechts.png │ ├── Python Experiment.osexp │ └── maxresdefault (1).jpg │ └── viewdir_sex.ipynb ├── LICENSE └── README.md /ClassNotes/README.md: -------------------------------------------------------------------------------- 1 | --- tbd --- 2 | -------------------------------------------------------------------------------- /ClassNotes/names.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | #-- coding: UTF-8 -- 3 | from __future__ import unicode_literals, print_function 4 | 5 | from psychopy import event, core, monitors, sound, visual 6 | from random import choice, shuffle, randint 7 | 8 | win = visual.Window(allowGUI=False, #monitor=m, 9 | fullscr=False, winType='pyglet', units='pix', rgb=-.5, 10 | ) 11 | 12 | clock = core.Clock() 13 | 14 | try: 15 | s = sound.Sound(octave=4) 16 | def bad_feedback(): 17 | s.play() 18 | core.wait(2.5) 19 | except: 20 | def bad_feedback(): 21 | for _ in range(10): 22 | visual.TextStim(win, "Fehler!!!").draw() 23 | win.flip() 24 | core.wait(.1) 25 | win.flip() 26 | core.wait(.1) 27 | core.wait(.5) 28 | 29 | keys = ['s', 'l'] 30 | 31 | fname = "names_{}.csv".format(core.getAbsTime()) 32 | with open(fname, 'w') as f: 33 | print("trial_id,word,correct_key,button,rt", file=f) 34 | 35 | umlaut_dict = { 36 | "ß":"ss", 37 | "ü":"ue", 38 | "ä":"ae", 39 | "ö":"oe", 40 | } 41 | def fix_umlaut(w): 42 | try: 43 | return "".join([umlaut_dict.get(c.lower(), c.lower()) for c in w]) 44 | except: 45 | return w 46 | 47 | words = "Jagen,Verfolgen,Angreifen,Verschlingen,Beißen,Mord,Raub,Brandstiftung,Einbruch,Erpressung,Kotzen,Würgen,Husten,Keuchen,Spucken,Lachen,Sprechen,Singen,Sagen,Fragen,Mögen,Lieben,Begehren,Verehren,Hochachten,Demokratie,Diktatur,Monarchie,Kommunismus,Kapitalismus,Börse,Kredit,Schulden,Zinsen,Aktien,Golf,Basketball,Fußball,Tennis,Rugby,Sprinten,Joggen,Laufen,Rennen,Springen,Schleichen,Kriechen,Hüpfen,Gehen,Wandern,Hören,Sehen,Fühlen,Schmecken,Riechen,Methan,Sauerstoff,Helium,Stickstoff,Chlor,Platin,Kupfer,Eisen,Silber,Gold,Diamant,Quarz,Granit,Marmor,Beton,Burg,Haus,Hütte,Halle,Garage,Hammer,Zange,Lötkolben,Feile,Säge,Axt,Beil,Keule,Schwert,Bogen,Geige,Klavier,Flöte,Schlagzeug,Gitarre,Rock,Ledermantel,Jeans,Jacke,Hose,Socken,Pullover,Hemd,Krawatte,Schal,Tee,Kaffee,Wasser,Trinkschokolade,Saft,Bier,Wein,Whisky,Scotch,Rum,Cola,Fanta,Sprite,Pepsi,Mezzo-Mix,Kuchen,Brötchen,Kekse,Waffeln,Windbeutel,Joghurt,Käse,Quark,Sahne,Buttermilch,Steak,Schnitzel,Geflügel,Filet,Braten,Richter,Polizist,Lehrer,Pfarrer,Professor,Chirurg,Psychiater,Urologe,Hausarzt,Notarzt,Tischler,Schreiner,Maurer,Schmied,Steinmetz,Efeu,Algen,Moos,Bambus,Kaktus,Rose,Lilie,Tulpe,Orchidee,Veilchen,Birke,Eiche,Trauerweide,Fichte,Ahorn,Qualle,Lama,Fledermaus,Affe,Gnu,Amsel,Pinguin,Spatz,Adler,Storch,Hai,Karpfen,Goldfisch,Lachs,Forelle,Puma,Löwe,Leopard,Tiger,Panther" 48 | words = words.split(",") 49 | if choice([True, False]): 50 | words = list(reversed(words)) 51 | words2 = [w for w in words] 52 | shuffle(words2) 53 | 54 | names = {"Johannes", "Klaus", "Antonia", "Harald", "Nelly", "Leonie", "Michael", "Katrin", "David", "Jaqueline", "Samson", "Simone", "Zacharias", "Axel", 55 | "Mechtild", "Max", "Moritz", "Nina", "Tim", "Tina", "Agathe", "Ricarda", "Lea", "Louise", "Elisabeth", "Olaf", "Hendrik", "Helmut", 56 | "Ulrike", "Jenny", "Bettina", "Bert", "Matthias", "Ingrid", "Ludwig", "Gert", "Gerhard", "Gesine", "Mohammed", "Friedrich", "Felix", "Aylin", "Helene", 57 | "Katerina", "Jonas", "Michael", "Thomas", "Dietmar", "Ingmar", "Jochen", "Joachim", "Lukas", "Johanna", "Franziska", "Inga", "Ina", 58 | "Hans", "Jakob", "Jasmin", "Sebastian", "Benjamin", "Christian", "Svenja", "Sven"} 59 | 60 | def show_instructions(ant_key, nonant_key, ispause=True): 61 | p = "Kleine Pause. Zur Erinnerung:\n\n" if ispause else ' ' 62 | inst = u""" 63 | {}Wenn das gezeigte Wort der Name einer Person ist, drücke {}. Sonst drücke {}.""".format(p, ant_key.upper(), nonant_key.upper()) 64 | visual.TextStim(win, inst).draw() 65 | win.flip() 66 | event.waitKeys() 67 | win.flip() 68 | core.wait(.5) 69 | 70 | 71 | def trial(ii, w, ant_key, nonant_key, t=.5): 72 | correct_key = ant_key if w in names else nonant_key 73 | res = False 74 | iscorrect = True 75 | visual.TextStim(win, w).draw() 76 | event.clearEvents() 77 | win.callOnFlip(clock.reset) 78 | event.clearEvents() 79 | win.flip() 80 | core.wait(t) 81 | res = event.getKeys(timeStamped=clock) 82 | win.flip() 83 | core.wait(t, hogCPUperiod=t) 84 | if not res: 85 | res = event.getKeys(timeStamped=clock) 86 | core.wait(t, hogCPUperiod=t) 87 | try: 88 | button, rt = res[0] 89 | except: 90 | button, rt = 'miss', 999 91 | if button != correct_key: 92 | iscorrect = False 93 | bad_feedback() 94 | with open(fname, 'a') as f: 95 | fb = [ii, fix_umlaut(word), correct_key, button, rt] 96 | line = ",".join([str(x) for x in fb]) 97 | print(line, file=f) 98 | 99 | 100 | shuffle(keys) 101 | show_instructions(*keys, ispause=False) 102 | ii = 0 103 | 104 | while len(words) > 0 and len(words2) > 0: 105 | was_target = False 106 | if (len(words) + len(words2) < 0) or randint(0, 4) == 0: 107 | word = choice(list(names)) 108 | elif len(words) > 0 and choice((True, False)): 109 | word = words.pop() 110 | else: 111 | word = words2.pop() 112 | trial(ii, word, *keys) 113 | if (ii % 20) == 0: 114 | show_instructions(*keys) 115 | ii += 1 116 | 117 | visual.TextStim(win, "Das war's! Vielen Dank.").draw() 118 | win.flip() 119 | event.waitKeys() 120 | -------------------------------------------------------------------------------- /ClassNotes/python_class_4.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | #-- coding: UTF-8 -- 3 | from __future__ import unicode_literals, print_function # diese 3 Zeilen sind hilfreich, weil Psychopy in Python 2 (nicht 3) programmiert ist 4 | from psychopy import monitors, visual, core, event # Psychopy Basismodule 5 | from numpy import mean 6 | 7 | # Bildschirmsetup 8 | m = monitors.Monitor("name") 9 | win = visual.Window(monitor=m) 10 | 11 | # Generiere einen Instruktionstext 12 | instructions = visual.TextStim(win, "Tiere: Taste 'S'. Pflanzen: Taste 'L'. Taste, um zu starten.") 13 | # Vorbereiten auf Darstellung 14 | instructions.draw() 15 | # Anzeige 16 | win.flip() 17 | # Warten auf Knopfdruck 18 | event.waitKeys() 19 | 20 | tiere = ["Fisch", "Affe", "Schnecke"] 21 | pflanzen = ["Birke", "Palme", "Rose"] 22 | alle_worte = [tiere, pflanzen] # eine liste aus listen - äquivalent zu [["Fisch", "Affe", "Schnecke"], ["Birke", "Palme", "Rose"]] 23 | tiere_rts, pflanzen_rts = [], [] 24 | 25 | clock = core.Clock() # eine Stopuhr 26 | for subliste in alle_worte: 27 | for wort in subliste: 28 | w = visual.TextStim(win, wort) # erstelle einen Textstimulus aus einem String 29 | w.draw() # Textstimulus zeichnen 30 | win.flip() # Zeichnung auf den Bildschirm schieben 31 | clock.reset() # Stopuhr starten 32 | key = event.waitKeys()[0] # waitKeys liefert uns eine Liste von Tasten, die in diesem Fall nur einen Eintrag hat 33 | # 'key' ist jetzt also der Knopf, den die Versuchsperson gedrueckt hat 34 | rt = clock.getTime() # Stopuhr abfragen 35 | # 'rt' hat jetzt die Reaktionszeit (in Sekunden) 36 | 37 | # Reaktionszeit abspeichern 38 | if wort in tiere: 39 | tiere_rts.append(rt) # Die Liste um einen Eintrag erweitern 40 | correct_key = "s" # festlegen, welches die richtige Taste ist 41 | else: 42 | pflanzen_rts.append(rt) 43 | correct_key = "l" 44 | 45 | # Richtiger Knopfdruck? 46 | if correct_key != key: # falscher knopfdruck! 47 | visual.TextStim(win, "Falsch! Weiter mit Taste.").draw() # negatives feedback 48 | win.flip() 49 | event.waitKeys() 50 | 51 | # Anzeige Feedback nach dem Experiment 52 | res = """RT auf Tierworte: {}. RTs auf Pflanzenworte: {}. Taste zum fortfahren.""" # Textschablone 53 | 54 | tiere_mean = round(mean(tiere_rts), 2) 55 | pflanzen_mean = round(mean(pflanzen_rts), 2) 56 | results = visual.TextStim(win, res.format(tiere_mean, pflanzen_mean)) 57 | results.draw() 58 | win.flip() 59 | event.waitKeys() 60 | 61 | 62 | 63 | #Die Hausaufgabe ist: 64 | # 1. Programmieren Sie das Script so um, dass der Versuchsperson nach *jedem 65 | # einzelnen* Durchlauf (jedem Wort) die Reaktionszeit für diesen Durchlauf 66 | # angezeigt wird, nicht erst am Ende des Experiments. (Sie müssen also nicht 67 | # mehr nach Bedingung unterteilen, oder mit einer liste von Reaktionszeiten 68 | # operieren!) 69 | 70 | # 2. Programmieren Sie das Script so um, dass der Versuchsperson angezeigt wird, 71 | # ob die Reaktionszeit größer oder kleiner als .5 Sekunden/500 msec war. 72 | 73 | 74 | # (Sie können die beiden kombinieren, also dass der Versuchsperson nach jedem 75 | # Durchlauf angezeigt wird, ob die Reaktionszeit schneller war als .5 Sekunden.) 76 | 77 | 78 | # Fragen per Email an mich, oder im Repetitorium bei Hern Wallot! Besonders, 79 | # wenn Sie einfach nach einer Stunde nicht weiterkommen, einfach mal nachfragen. 80 | 81 | 82 | # Wenn Sie unbedingt eine Bonusaufgabe wollen: schreiben Sie ein Experiment, bei 83 | # dem die Versuchspersonen als Antworttaste den Buchstaben drücken sollen, der 84 | # an der vorletzten Stelle im angezeigten Wort steht. Für falsche Knopfdrücke 85 | # soll die Versuchsperson getadelt werden. 86 | 87 | # Das Beispielscript zeigt, wie Antworten abgefragt und überprüft werden können. 88 | 89 | # (Sie können gern auch alle 3 Lösungen in einem kombinieren, dann müssen Sie 90 | # die ersten zwei nicht extra machen.) 91 | 92 | 93 | 94 | # Bitte schicken Sie ihre Lösung als Antwort an diese Email, und verwenden Sie 95 | # Dateinamen, aus denen ihr Nachnahme hervorgeht. 96 | 97 | 98 | # !!! Achtung: wenn sie als letzte Zeile event.waitKeys() setzen, bleibt das 99 | # Script hängen !!! 100 | 101 | 102 | # In der nächsten Sitzung schauen wir uns Bilderstimuli und Soundstimuli an und 103 | # üben weiter mit den Dingen, die wir bereits gelernt haben. -------------------------------------------------------------------------------- /ClassNotes/python_class_5.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | #-- coding: UTF-8 -- 3 | from __future__ import unicode_literals, print_function 4 | 5 | # In dieser Sitzung haben wir kennen gelernt: 6 | # - 'x if cond else y' - Syntax 7 | # - , wie man mit Psychopy Bilder anzeigen, Töne abspielen und wie man mit Python in Dateien schreiben kann 8 | # - enumerate 9 | 10 | 11 | # Eine neue Datei erstellen 12 | with open("testfile.csv", "w") as f: # erzeugt eine Datei im Verzeichnis, in dem das Psychopy-Script ist 13 | print("Zeile 1", file=f) # alternativ vollen Dateinamen angeben 14 | 15 | # An eine Datei anhängen - zb. Reaktionszeiten 16 | with open("testfile.csv", "a") as f: 17 | print("Zeile 2", file=f) 18 | 19 | 20 | from psychopy import visual, event, core, sound, monitors 21 | 22 | m = monitors.Monitor("test") 23 | win = visual.Window(monitor=m, units='pix', 24 | fullscr=False 25 | ) 26 | 27 | 28 | visual.TextStim(win, "Es geht los ... \n\n\nMit Knopfdruck anfangen.").draw() 29 | win.flip() 30 | key = event.waitKeys()[0] 31 | 32 | 33 | # If/Else-Conditionals 34 | esc_in_key = "Ja" if "esc" in key else "No" 35 | print(esc_in_key) 36 | 37 | 38 | # enumerate(), um beim iterieren einen laufenden Index zu haben 39 | words = ["Das", "ist", "ein", "Satz"] 40 | 41 | clock = core.Clock() 42 | for index, word in enumerate(words): 43 | visual.TextStim(win, word, height=30, color=(.5, .5, 1)).draw() 44 | win.flip() 45 | clock.reset() 46 | event.waitKeys() 47 | rt = clock.getTime() 48 | visual.TextStim(win, "Das war Wort Nummer " + str(index + 1)).draw() 49 | win.flip() 50 | event.waitKeys() 51 | with open("testfile.csv", "a") as f: 52 | print("rt was: ", + str(rt), file=f) 53 | 54 | 55 | 56 | # Einen nervigen Warnton abspielen 57 | sound.Sound().play() 58 | 59 | 60 | # Ein Bild anzeigen 61 | visual.ImageStim("bild.jpg").draw() # dieses Bild muss natürlich existieren ... 62 | win.flip() 63 | event.waitKeys() 64 | 65 | 66 | 67 | # Today's Homework Assignment: 68 | 69 | # Ihre Aufgabe ist folgende: programmieren Sie ein psychopy-Script, dass der 70 | # Reihe nach drei Stimuli abspielt, auf einen Tastendruck wartet, und die 71 | # Reaktionszeit (Zeit zw. Stimulus und Knopfdruck) jeweils in eine Datei 72 | # schreibt #(natürlich immer die gleiche Datei). 73 | # Als Stimuli können Sie frei kombinieren aus Worten/Text, Bildern und # Tönen/Soundfiles. 74 | 75 | # Fangen Sie auch schon einmal über ein Experiment nachzudenken an. Es kann 76 | # ruhig blödsinnig sein und es gibt keinen Abzug dafür, aber wenn Sie eine echte 77 | # Forschungsfrage haben, geht das auch. In der nächsten Sitzung schließen wir 78 | # mit Psychopy ab, danach geht es an die Datenanalyse. 79 | -------------------------------------------------------------------------------- /ClassNotes/python_class_6.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Bonus\n", 8 | "\n", 9 | "Komplexe Arbeit mit Funktionen!" 10 | ] 11 | }, 12 | { 13 | "cell_type": "markdown", 14 | "metadata": {}, 15 | "source": [ 16 | "In Python können wir genau so über Funktionen loopen, sie in Listen stecken oder sie an Variablen verweisen, wie wir es mit allen anderen Objekten können." 17 | ] 18 | }, 19 | { 20 | "cell_type": "code", 21 | "execution_count": 1, 22 | "metadata": {}, 23 | "outputs": [ 24 | { 25 | "data": { 26 | "text/plain": [ 27 | "(4.428571428571429, 4.0)" 28 | ] 29 | }, 30 | "execution_count": 1, 31 | "metadata": {}, 32 | "output_type": "execute_result" 33 | } 34 | ], 35 | "source": [ 36 | "from numpy import mean, median\n", 37 | "zahlen = [1, 2, 3, 4, 5, 6, 10]\n", 38 | "mean(zahlen), median(zahlen)" 39 | ] 40 | }, 41 | { 42 | "cell_type": "code", 43 | "execution_count": 2, 44 | "metadata": {}, 45 | "outputs": [ 46 | { 47 | "name": "stdout", 48 | "output_type": "stream", 49 | "text": [ 50 | "4.428571428571429\n", 51 | "4.0\n" 52 | ] 53 | } 54 | ], 55 | "source": [ 56 | "for central_tendency_estimator in [mean, median]: # loop over functions\n", 57 | " central_tendency = central_tendency_estimator(zahlen)\n", 58 | " print(central_tendency)" 59 | ] 60 | }, 61 | { 62 | "cell_type": "code", 63 | "execution_count": 3, 64 | "metadata": {}, 65 | "outputs": [], 66 | "source": [ 67 | "central_tendency_dict = {\"mean\":mean, \"median\":median} # dict of functions" 68 | ] 69 | }, 70 | { 71 | "cell_type": "code", 72 | "execution_count": 4, 73 | "metadata": {}, 74 | "outputs": [ 75 | { 76 | "name": "stdout", 77 | "output_type": "stream", 78 | "text": [ 79 | "mean: 4.428571428571429\n", 80 | "median: 4.0\n" 81 | ] 82 | } 83 | ], 84 | "source": [ 85 | "for name in [\"mean\", \"median\"]:\n", 86 | " central_tendency = central_tendency_dict[name](zahlen) # retrieve function from dict\n", 87 | " print(name + \": \" + str(central_tendency))" 88 | ] 89 | }, 90 | { 91 | "cell_type": "code", 92 | "execution_count": 5, 93 | "metadata": {}, 94 | "outputs": [ 95 | { 96 | "name": "stdout", 97 | "output_type": "stream", 98 | "text": [ 99 | "mean: 4.428571428571429\n", 100 | "median: 4.0\n" 101 | ] 102 | } 103 | ], 104 | "source": [ 105 | "for name in [\"mean\", \"median\"]: # same as above, but more explicit\n", 106 | " central_tendency_estimator = central_tendency_dict[name]\n", 107 | " central_tendency = central_tendency_estimator(zahlen)\n", 108 | " print(name + \": \" + str(central_tendency))" 109 | ] 110 | }, 111 | { 112 | "cell_type": "markdown", 113 | "metadata": {}, 114 | "source": [ 115 | "Keyword - Argument für Funktionen:" 116 | ] 117 | }, 118 | { 119 | "cell_type": "code", 120 | "execution_count": 6, 121 | "metadata": {}, 122 | "outputs": [], 123 | "source": [ 124 | "central_tendency_dict = {\"mean\":mean, \"median\":median}\n", 125 | "\n", 126 | "def my_central_tendency(values, method=\"mean\"):\n", 127 | " estimator = central_tendency_dict[method] # 'method' ist immer, was beim Aufruf der Funktion\n", 128 | " return estimator(values) # unter 'method' spezifiziert wurde, oder der default 'mean'" 129 | ] 130 | }, 131 | { 132 | "cell_type": "code", 133 | "execution_count": 7, 134 | "metadata": {}, 135 | "outputs": [ 136 | { 137 | "name": "stdout", 138 | "output_type": "stream", 139 | "text": [ 140 | "4.428571428571429\n", 141 | "4.0\n" 142 | ] 143 | } 144 | ], 145 | "source": [ 146 | "for method in [\"mean\", \"median\"]:\n", 147 | " print(my_central_tendency(zahlen, method=method))" 148 | ] 149 | }, 150 | { 151 | "cell_type": "code", 152 | "execution_count": 8, 153 | "metadata": {}, 154 | "outputs": [ 155 | { 156 | "data": { 157 | "text/plain": [ 158 | "4.428571428571429" 159 | ] 160 | }, 161 | "execution_count": 8, 162 | "metadata": {}, 163 | "output_type": "execute_result" 164 | } 165 | ], 166 | "source": [ 167 | "my_central_tendency(zahlen) # default" 168 | ] 169 | }, 170 | { 171 | "cell_type": "code", 172 | "execution_count": 9, 173 | "metadata": {}, 174 | "outputs": [ 175 | { 176 | "data": { 177 | "text/plain": [ 178 | "4.428571428571429" 179 | ] 180 | }, 181 | "execution_count": 9, 182 | "metadata": {}, 183 | "output_type": "execute_result" 184 | } 185 | ], 186 | "source": [ 187 | "my_central_tendency(zahlen, method=\"mean\") # explizit" 188 | ] 189 | }, 190 | { 191 | "cell_type": "code", 192 | "execution_count": 10, 193 | "metadata": {}, 194 | "outputs": [ 195 | { 196 | "data": { 197 | "text/plain": [ 198 | "4.0" 199 | ] 200 | }, 201 | "execution_count": 10, 202 | "metadata": {}, 203 | "output_type": "execute_result" 204 | } 205 | ], 206 | "source": [ 207 | "my_central_tendency(zahlen, method=\"median\") # explizit" 208 | ] 209 | }, 210 | { 211 | "cell_type": "markdown", 212 | "metadata": {}, 213 | "source": [ 214 | "Eine Möglichkeit, um Stimuluslisten zu generieren, ist `str.format`." 215 | ] 216 | }, 217 | { 218 | "cell_type": "code", 219 | "execution_count": 11, 220 | "metadata": {}, 221 | "outputs": [], 222 | "source": [ 223 | "temp = \"/Users/jona/Downloads/stims/{}_{}.jpg\"\n", 224 | "\n", 225 | "stims = []\n", 226 | "\n", 227 | "occupations = [\"sportler\", \"maler\"]\n", 228 | "sexes = [\"w\", \"m\"]\n", 229 | "for occupation in occupations:\n", 230 | " for sex in sexes:\n", 231 | " stim = temp.format(occupation, sex)\n", 232 | " stims.append(stim)\n" 233 | ] 234 | }, 235 | { 236 | "cell_type": "code", 237 | "execution_count": 12, 238 | "metadata": {}, 239 | "outputs": [ 240 | { 241 | "data": { 242 | "text/plain": [ 243 | "['/Users/jona/Downloads/stims/sportler_w.jpg',\n", 244 | " '/Users/jona/Downloads/stims/sportler_m.jpg',\n", 245 | " '/Users/jona/Downloads/stims/maler_w.jpg',\n", 246 | " '/Users/jona/Downloads/stims/maler_m.jpg']" 247 | ] 248 | }, 249 | "execution_count": 12, 250 | "metadata": {}, 251 | "output_type": "execute_result" 252 | } 253 | ], 254 | "source": [ 255 | "stims" 256 | ] 257 | }, 258 | { 259 | "cell_type": "markdown", 260 | "metadata": {}, 261 | "source": [ 262 | "Im `random`-Modul befinden sich Funktionen, mit denen Zufallsziehungen erledigt werden können." 263 | ] 264 | }, 265 | { 266 | "cell_type": "code", 267 | "execution_count": 13, 268 | "metadata": {}, 269 | "outputs": [], 270 | "source": [ 271 | "import random" 272 | ] 273 | }, 274 | { 275 | "cell_type": "code", 276 | "execution_count": 14, 277 | "metadata": {}, 278 | "outputs": [ 279 | { 280 | "data": { 281 | "text/plain": [ 282 | "'/Users/jona/Downloads/stims/maler_m.jpg'" 283 | ] 284 | }, 285 | "execution_count": 14, 286 | "metadata": {}, 287 | "output_type": "execute_result" 288 | } 289 | ], 290 | "source": [ 291 | "random.choice(stims) # 'choice' wählt einen zufälligen Eintrag aus,\n", 292 | " # er befindet sich dann immer noch in der Liste" 293 | ] 294 | }, 295 | { 296 | "cell_type": "code", 297 | "execution_count": 15, 298 | "metadata": {}, 299 | "outputs": [ 300 | { 301 | "name": "stdout", 302 | "output_type": "stream", 303 | "text": [ 304 | "/Users/jona/Downloads/stims/maler_w.jpg\n", 305 | "/Users/jona/Downloads/stims/maler_w.jpg\n", 306 | "/Users/jona/Downloads/stims/maler_m.jpg\n", 307 | "/Users/jona/Downloads/stims/maler_w.jpg\n", 308 | "/Users/jona/Downloads/stims/maler_m.jpg\n" 309 | ] 310 | } 311 | ], 312 | "source": [ 313 | "for trial in range(5):\n", 314 | " print(random.choice(stims))" 315 | ] 316 | }, 317 | { 318 | "cell_type": "code", 319 | "execution_count": 16, 320 | "metadata": {}, 321 | "outputs": [ 322 | { 323 | "data": { 324 | "text/plain": [ 325 | "['/Users/jona/Downloads/stims/sportler_w.jpg',\n", 326 | " '/Users/jona/Downloads/stims/sportler_m.jpg',\n", 327 | " '/Users/jona/Downloads/stims/maler_w.jpg',\n", 328 | " '/Users/jona/Downloads/stims/maler_m.jpg']" 329 | ] 330 | }, 331 | "execution_count": 16, 332 | "metadata": {}, 333 | "output_type": "execute_result" 334 | } 335 | ], 336 | "source": [ 337 | "stims" 338 | ] 339 | }, 340 | { 341 | "cell_type": "code", 342 | "execution_count": 17, 343 | "metadata": {}, 344 | "outputs": [], 345 | "source": [ 346 | "random.shuffle(stims) # Bringt die Liste in eine neue Reihenfolge" 347 | ] 348 | }, 349 | { 350 | "cell_type": "code", 351 | "execution_count": 18, 352 | "metadata": {}, 353 | "outputs": [ 354 | { 355 | "data": { 356 | "text/plain": [ 357 | "['/Users/jona/Downloads/stims/sportler_w.jpg',\n", 358 | " '/Users/jona/Downloads/stims/maler_m.jpg',\n", 359 | " '/Users/jona/Downloads/stims/sportler_m.jpg',\n", 360 | " '/Users/jona/Downloads/stims/maler_w.jpg']" 361 | ] 362 | }, 363 | "execution_count": 18, 364 | "metadata": {}, 365 | "output_type": "execute_result" 366 | } 367 | ], 368 | "source": [ 369 | "stims" 370 | ] 371 | }, 372 | { 373 | "cell_type": "markdown", 374 | "metadata": {}, 375 | "source": [ 376 | "Mit `zip` kann über mehrere Listen gleichzeitig iteriert werden." 377 | ] 378 | }, 379 | { 380 | "cell_type": "code", 381 | "execution_count": 19, 382 | "metadata": {}, 383 | "outputs": [ 384 | { 385 | "name": "stdout", 386 | "output_type": "stream", 387 | "text": [ 388 | "1 a\n", 389 | "2 b\n", 390 | "3 c\n" 391 | ] 392 | } 393 | ], 394 | "source": [ 395 | "numbers, letters = [1, 2, 3], ['a', 'b', 'c']\n", 396 | "\n", 397 | "for number, letter in zip(numbers, letters):\n", 398 | " print(number, letter)" 399 | ] 400 | }, 401 | { 402 | "cell_type": "code", 403 | "execution_count": null, 404 | "metadata": { 405 | "collapsed": true 406 | }, 407 | "outputs": [], 408 | "source": [] 409 | } 410 | ], 411 | "metadata": { 412 | "kernelspec": { 413 | "display_name": "Python [default]", 414 | "language": "python", 415 | "name": "python3" 416 | }, 417 | "language_info": { 418 | "codemirror_mode": { 419 | "name": "ipython", 420 | "version": 3 421 | }, 422 | "file_extension": ".py", 423 | "mimetype": "text/x-python", 424 | "name": "python", 425 | "nbconvert_exporter": "python", 426 | "pygments_lexer": "ipython3", 427 | "version": "3.6.5" 428 | } 429 | }, 430 | "nbformat": 4, 431 | "nbformat_minor": 1 432 | } 433 | -------------------------------------------------------------------------------- /ClassNotes/python_class_homework_0.md: -------------------------------------------------------------------------------- 1 | % Python Class Session 1 Homework 2 | 3 | # Repetitions 4 | - Open a new and empty iPython notebook 5 | - Create a list of strings that contains the first names of you and your close family members 6 | - Access the third entry in that list 7 | - Create a list of ages of family members 8 | - *Using these two lists (not manually!)*, create a new list containing the names of those family members older than 30 9 | - *With a dict comprehension and the `zip` operator*, construct a dict where keys are family names and values are ages 10 | 11 | ## Something to actually mildly warm up your brains for 12 | - similarly to the list you have created above, and *using the dictionary you have just created*, construct a list of the ages of your family members whose last letter of their first name is an 'a'. 13 | 14 | # Something new 15 | Put some more thought into a simple experiment you want to conduct. It should be as boring and simple as possible, require only very few subjects, and simple stimuli (tip: words are very simple). Note that reaction times or ratings are the easiest to acquire, and in this context almost the only thing that can be made to work 16 | -------------------------------------------------------------------------------- /ClassNotes/python_class_homework_0.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ClassNotes/python_class_homework_0.pdf -------------------------------------------------------------------------------- /ExampleExperiments/README.md: -------------------------------------------------------------------------------- 1 | --- tbd --- 2 | -------------------------------------------------------------------------------- /ExampleExperiments/congview_stim/congview_stim.osexp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ExampleExperiments/congview_stim/congview_stim.osexp -------------------------------------------------------------------------------- /ExampleExperiments/facebenefit/csv/vp_1.csv: -------------------------------------------------------------------------------- 1 | subject_nr,type,correct_response,response,acc,congruency,response_time 2 | 1,face,y,y,1,0,1012.58321194 3 | 1,face,y,y,1,1,648.644576082 4 | 1,face,y,y,1,0,150.911284727 5 | 1,face,y,y,1,0,114.316909516 6 | 1,chair,m,m,1,0,160.282424709 7 | 1,face,y,y,1,0,340.972010163 8 | 1,face,y,y,1,0,552.739243663 9 | 1,chair,m,m,1,0,207.778999466 10 | 1,face,y,y,1,0,599.691001698 11 | 1,chair,m,m,1,0,113.863017876 12 | 1,chair,m,m,1,1,336.17058408 13 | 1,face,y,y,1,0,107.875167334 14 | 1,face,y,y,1,0,145.022791752 15 | 1,chair,m,m,1,0,157.831482997 16 | 1,chair,m,m,1,0,921.272524574 17 | 1,face,y,y,1,0,821.377124987 18 | 1,chair,m,m,1,1,118.204319442 19 | 1,face,y,y,1,0,251.612543711 20 | 1,face,y,y,1,0,1042.81173798 21 | 1,chair,m,m,1,0,170.182616275 22 | 1,face,y,y,1,1,845.501211123 23 | 1,face,y,y,1,0,220.966422639 24 | 1,chair,m,m,1,1,157.58730541 25 | 1,chair,m,m,1,0,257.605527062 26 | 1,face,y,y,1,1,128.795247525 27 | 1,chair,m,m,1,0,0.013932062 28 | 1,chair,m,m,1,0,40.9558416577 29 | 1,face,y,y,1,0,81.0959247174 30 | 1,chair,m,m,1,0,248.333744588 31 | 1,chair,m,m,1,0,216.963156709 32 | 1,face,y,y,1,1,465.50734865 33 | 1,face,y,y,1,0,120.044083917 34 | 1,face,y,y,1,1,437.12188676 35 | 1,face,y,y,1,0,300.488758483 36 | 1,face,y,y,1,0,104.990132037 37 | 1,face,y,y,1,0,77.6657062233 38 | 1,face,y,y,1,1,92.430018005 39 | 1,face,y,y,1,1,123.076505726 40 | 1,face,y,y,1,0,287.072922918 41 | 1,face,y,y,1,0,196.30265265 42 | 1,chair,m,m,1,0,110.860293382 43 | 1,face,y,y,1,0,212.310216972 44 | 1,face,y,y,1,0,142.264611495 45 | 1,chair,m,m,1,0,162.837856915 46 | 1,chair,m,m,1,1,222.254037799 47 | 1,chair,m,m,1,0,191.526890907 48 | 1,face,y,y,1,0,40.8392523532 49 | 1,chair,m,m,1,1,233.574198966 50 | 1,face,y,y,1,0,306.157638261 51 | 1,face,y,y,1,0,78.642416629 52 | 1,face,y,y,1,0,149.39709031 53 | 1,chair,m,m,1,0,0.014298712 54 | 1,chair,m,m,1,1,0.015031954 55 | 1,chair,m,m,1,0,0.015398604 56 | 1,chair,m,m,1,1,0.014665304 57 | 1,face,y,m,0,0,0.014665304 58 | 1,chair,m,m,1,0,229.283492721 59 | 1,chair,m,m,1,0,173.89037594 60 | 1,chair,m,m,1,0,305.006410577 61 | 1,face,y,y,1,1,85.7217335724 62 | 1,face,y,y,1,0,83.7191840401 63 | 1,chair,m,m,1,0,122.411066724 64 | 1,face,y,y,1,0,247.117989464 65 | 1,chair,m,m,1,1,135.760908364 66 | 1,chair,m,m,1,0,340.526917658 67 | 1,face,y,y,1,0,39.5509038935 68 | 1,face,y,y,1,0,127.62385502 69 | 1,face,y,y,1,0,309.121133003 70 | 1,chair,m,m,1,0,58.8830964989 71 | 1,chair,m,m,1,0,291.721463029 72 | 1,face,y,y,1,0,49.5530193439 73 | 1,chair,m,m,1,0,0.015398546 74 | -------------------------------------------------------------------------------- /ExampleExperiments/facebenefit/csv/vp_2.csv: -------------------------------------------------------------------------------- 1 | subject_nr,type,correct_response,response,acc,congruency,response_time 2 | 2,face,y,None,0,0,3000.02016476 3 | 2,chair,m,m,1,0,1127.20039394 4 | 2,face,y,y,1,0,185.216036683 5 | 2,chair,m,m,1,0,204.598091368 6 | 2,chair,m,m,1,0,159.187658515 7 | 2,chair,m,m,1,0,99.1445351392 8 | 2,face,y,y,1,0,121.21510983 9 | 2,chair,m,y,0,1,62.5893897377 10 | 2,chair,m,m,1,0,118.697440834 11 | 2,face,y,y,1,0,219.881922181 12 | 2,chair,m,m,1,0,251.835456584 13 | 2,face,y,y,1,0,219.16148829 14 | 2,chair,m,m,1,0,277.246791287 15 | 2,face,y,y,1,0,139.579024632 16 | 2,chair,m,m,1,0,304.361869697 17 | 2,face,y,y,1,0,229.474875203 18 | 2,chair,m,m,1,0,70.3862075461 19 | 2,face,y,y,1,0,148.169969616 20 | 2,face,y,m,0,0,128.170138225 21 | 2,face,y,y,1,1,237.553267216 22 | 2,chair,m,m,1,0,198.817021912 23 | 2,chair,m,m,1,0,49.4433960994 24 | 2,chair,m,m,1,0,106.211753271 25 | 2,chair,m,m,1,1,264.861561183 26 | 2,chair,m,m,1,1,168.780978187 27 | 2,chair,m,m,1,0,92.1407445567 28 | 2,chair,m,m,1,0,90.8828266547 29 | 2,chair,m,m,1,0,161.583605339 30 | 2,face,y,y,1,1,83.3470515208 31 | 2,chair,m,m,1,0,25.4575305153 32 | 2,chair,m,m,1,0,42.2841531108 33 | 2,face,y,y,1,0,82.2926149704 34 | 2,face,y,y,1,1,49.0602645441 35 | 2,face,y,y,1,0,16.4636558038 36 | 2,face,y,y,1,0,17.9111229954 37 | 2,chair,m,y,0,0,0.015398603864 38 | 2,face,y,y,1,1,204.78324109 39 | 2,face,y,y,1,1,293.901462981 40 | 2,face,y,y,1,0,139.926226111 41 | 2,face,y,y,1,0,71.8685048632 42 | 2,chair,m,m,1,0,135.206925857 43 | 2,face,y,y,1,0,99.9525943771 44 | 2,face,y,y,1,0,169.930739386 45 | 2,face,y,y,1,0,133.337464067 46 | 2,face,y,y,1,0,170.037062897 47 | 2,chair,m,m,1,0,60.6242367066 48 | 2,face,y,y,1,1,52.6987307239 49 | 2,face,y,m,0,0,99.1053053876 50 | 2,face,y,y,1,0,113.278238161 51 | 2,face,y,y,1,0,78.1049325597 52 | 2,chair,m,m,1,1,92.5601727213 53 | 2,face,y,y,1,1,153.441052593 54 | 2,face,y,y,1,0,236.75290728 55 | 2,face,y,y,1,0,75.9846937726 56 | 2,face,y,y,1,0,50.7398104528 57 | 2,chair,m,m,1,1,106.177289796 58 | 2,face,y,y,1,0,120.056549495 59 | 2,chair,m,m,1,1,36.8763159495 60 | 2,chair,m,m,1,0,230.277801515 61 | 2,chair,m,m,1,1,151.433736726 62 | 2,face,y,y,1,0,50.8252359577 63 | 2,face,y,y,1,0,161.578105821 64 | 2,face,y,y,1,0,84.2321036034 65 | 2,chair,m,m,1,0,107.686351344 66 | 2,chair,m,m,1,1,26.343315898 67 | 2,face,y,y,1,0,107.776543067 68 | 2,face,y,y,1,1,65.1305231731 69 | 2,chair,m,y,0,0,87.876802485 70 | 2,face,y,y,1,0,109.857185453 71 | 2,chair,m,m,1,0,27.8740087524 72 | 2,face,y,y,1,0,107.912930544 73 | 2,face,y,y,1,0,113.159082422 74 | -------------------------------------------------------------------------------- /ExampleExperiments/facebenefit/csv/vp_3.csv: -------------------------------------------------------------------------------- 1 | subject_nr,type,correct_response,response,acc,congruency,response_time 2 | 3,chair,m,None,0,1,3000.0257 3 | 3,chair,m,None,0,0,3000.0381 4 | 3,face,y,y,1,0,51.5182 5 | 3,face,y,y,1,0,458.1571 6 | 3,face,y,m,0,0,64.3764 7 | 3,face,y,y,1,0,888.0266 8 | 3,chair,m,m,1,0,1030.2454 9 | 3,chair,m,m,1,0,661.6274 10 | 3,face,y,y,1,0,459.7428 11 | 3,chair,m,m,1,0,484.3259 12 | 3,chair,m,m,1,1,546.0104 13 | 3,chair,m,m,1,0,250.3374 14 | 3,face,y,y,1,0,257.6268 15 | 3,face,y,y,1,0,608.6482 16 | 3,face,y,y,1,0,241.866 17 | 3,chair,m,m,1,1,314.4281 18 | 3,chair,m,m,1,0,327.613 19 | 3,face,y,y,1,1,194.871 20 | 3,chair,m,m,1,1,293.3277 21 | 3,chair,m,m,1,0,275.2886 22 | 3,chair,m,m,1,0,154.6696 23 | 3,face,y,y,1,0,165.7332 24 | 3,face,y,y,1,0,104.6092 25 | 3,chair,m,m,1,0,198.5461 26 | 3,face,y,y,1,0,183.8745 27 | 3,face,y,y,1,1,193.1962 28 | 3,face,y,y,1,0,259.0937 29 | 3,face,y,y,1,1,74.3279 30 | 3,face,y,y,1,0,32.891 31 | 3,face,y,y,1,0,49.8218 32 | 3,chair,m,m,1,0,249.2918 33 | 3,face,y,y,1,0,63.7128 34 | 3,face,y,m,0,0,62.4255 35 | 3,chair,m,m,1,0,229.8903 36 | 3,chair,m,m,1,0,223.0397 37 | 3,face,y,y,1,0,135.061 38 | 3,chair,m,m,1,0,436.3754 39 | 3,chair,m,m,1,1,300.8462 40 | 3,chair,m,m,1,0,242.7987 41 | 3,face,y,y,1,0,50.6936 42 | 3,face,y,y,1,0,273.4191 43 | 3,face,y,y,1,0,159.9066 44 | 3,face,y,y,1,0,35.3038 45 | 3,face,y,y,1,0,84.0121 46 | 3,chair,m,m,1,0,170.5071 47 | 3,chair,m,m,1,0,694.7666 48 | 3,chair,m,m,1,1,236.9546 49 | 3,face,y,y,1,0,157.0388 50 | 3,face,y,y,1,0,144.2745 51 | 3,face,y,y,1,0,83.4926 52 | 3,face,y,y,1,0,120.8811 53 | 3,face,y,y,1,1,61.6336 54 | 3,face,y,y,1,0,140.3171 55 | 3,face,y,y,1,0,104.3221 56 | 3,face,y,y,1,1,117.118 57 | 3,face,y,y,1,0,1.6073 58 | 3,chair,m,m,1,0,235.0059 59 | 3,face,y,y,1,1,0.0979 60 | 3,face,y,y,1,1,40.4198 61 | 3,face,y,y,1,1,40.3729 62 | 3,chair,m,m,1,0,97.1962 63 | 3,chair,m,m,1,0,141.8936 64 | 3,chair,m,m,1,0,98.581 65 | 3,chair,m,m,1,0,80.6648 66 | 3,face,y,y,1,0,86.5632 67 | 3,chair,m,m,1,1,44.5859 68 | 3,chair,m,m,1,1,92.6907 69 | 3,face,y,y,1,0,27.243 70 | 3,chair,m,m,1,0,52.7229 71 | 3,chair,m,y,0,0,533.6307 72 | 3,chair,m,m,1,0,110.156 73 | 3,face,y,y,1,0,122.8683 74 | 75 | -------------------------------------------------------------------------------- /ExampleExperiments/facebenefit/csv/vp_4.csv: -------------------------------------------------------------------------------- 1 | subject_nr,type,correct_response,response,acc,congruency,response_time 2 | 4,face,y,y,1,0,111.1745 3 | 4,face,y,y,1,0,58.3892 4 | 4,chair,m,m,1,0,64.3463 5 | 4,face,y,y,1,0,39.3203 6 | 4,face,y,y,1,1,63.2838 7 | 4,face,y,y,1,0,62.6686 8 | 4,face,y,y,1,0,30.0008 9 | 4,face,y,y,1,0,14.801 10 | 4,face,y,y,1,0,23.5507 11 | 4,chair,m,m,1,1,52.2137 12 | 4,chair,m,y,0,0,20.2495 13 | 4,face,y,y,1,0,53.0203 14 | 4,chair,m,m,1,0,133.839 15 | 4,face,y,y,1,0,98.434 16 | 4,face,y,y,1,0,56.5198 17 | 4,chair,m,m,1,1,144.5421 18 | 4,face,y,m,0,1,132.5639 19 | 4,face,y,y,1,1,33.1238 20 | 4,chair,m,m,1,0,145.954 21 | 4,chair,m,m,1,0,158.6131 22 | 4,chair,m,m,1,0,178.0462 23 | 4,face,y,y,1,0,141.2868 24 | 4,chair,m,m,1,0,209.2408 25 | 4,chair,m,m,1,1,211.2056 26 | 4,face,y,y,1,0,132.4396 27 | 4,face,y,y,1,0,136.5653 28 | 4,chair,m,m,1,0,109.297 29 | 4,chair,m,m,1,0,243.2929 30 | 4,face,y,y,1,0,115.1759 31 | 4,chair,m,m,1,0,303.8977 32 | 4,face,y,y,1,0,104.2679 33 | 4,face,y,y,1,0,222.3043 34 | 4,face,y,y,1,1,87.5622 35 | 4,chair,m,m,1,0,86.9679 36 | 4,chair,m,m,1,0,429.6037 37 | 4,face,y,y,1,0,101.4635 38 | 4,chair,m,m,1,0,266.756 39 | 4,chair,m,m,1,0,362.7335 40 | 4,chair,m,m,1,0,113.8132 41 | 4,face,y,y,1,0,191.858 42 | 4,face,y,y,1,0,506.527 43 | 4,chair,m,m,1,0,224.1866 44 | 4,face,y,y,1,1,272.6866 45 | 4,face,y,y,1,1,183.3304 46 | 4,chair,m,m,1,0,218.088 47 | 4,face,y,y,1,0,82.6684 48 | 4,chair,m,m,1,1,322.0735 49 | 4,chair,m,m,1,1,279.2959 50 | 4,chair,m,m,1,0,174.5459 51 | 4,chair,m,m,1,0,185.8837 52 | 4,face,y,y,1,0,108.4482 53 | 4,face,y,y,1,0,105.8294 54 | 4,face,y,y,1,0,223.0562 55 | 4,face,y,y,1,0,71.6892 56 | 4,face,y,y,1,0,77.9289 57 | 4,chair,m,m,1,0,245.2298 58 | 4,chair,m,m,1,0,277.7993 59 | 4,face,y,y,1,0,92.4135 60 | 4,face,y,y,1,1,122.3788 61 | 4,face,y,y,1,0,79.6488 62 | 4,chair,m,y,0,0,111.224 63 | 4,chair,m,m,1,1,180.5334 64 | 4,face,y,y,1,0,158.4918 65 | 4,chair,m,m,1,1,257.8116 66 | 4,chair,m,m,1,0,161.7387 67 | 4,face,y,y,1,0,205.0373 68 | 4,chair,m,m,1,0,302.9364 69 | 4,face,y,y,1,0,146.8387 70 | 4,face,y,y,1,0,541.9852 71 | 4,face,y,y,1,1,288.5285 72 | 4,chair,m,m,1,1,231.175 73 | 4,face,y,y,1,0,239.6717 74 | -------------------------------------------------------------------------------- /ExampleExperiments/facebenefit/csv/vp_5.csv: -------------------------------------------------------------------------------- 1 | subject_nr,type,correct_response,response,acc,congruency,response_time 2 | 5,chair,m,None,0,1,3000.0158 3 | 5,face,y,y,1,0,145.271 4 | 5,chair,m,y,0,0,197.2555 5 | 5,chair,m,m,1,0,127.2737 6 | 5,face,y,y,1,0,0.0147 7 | 5,face,y,y,1,0,156.7851 8 | 5,face,y,y,1,0,175.9523 9 | 5,face,y,y,1,0,194.5934 10 | 5,face,y,y,1,0,199.6588 11 | 5,face,y,y,1,0,88.4667 12 | 5,face,y,y,1,0,142.5246 13 | 5,chair,m,m,1,0,138.5631 14 | 5,chair,m,m,1,0,215.0435 15 | 5,chair,m,m,1,0,96.2998 16 | 5,chair,m,m,1,0,191.117 17 | 5,chair,m,m,1,0,201.8326 18 | 5,face,y,y,1,1,59.183 19 | 5,chair,m,m,1,0,336.9966 20 | 5,face,y,y,1,1,156.3851 21 | 5,chair,m,m,1,0,303.6055 22 | 5,chair,m,m,1,0,276.8464 23 | 5,face,y,y,1,1,145.3161 24 | 5,face,y,y,1,0,676.6531 25 | 5,face,y,y,1,0,251.0127 26 | 5,chair,m,m,1,0,242.7716 27 | 5,chair,m,m,1,1,291.3849 28 | 5,chair,m,m,1,0,96.7185 29 | 5,face,y,y,1,0,150.6411 30 | 5,chair,m,m,1,0,130.7626 31 | 5,face,y,y,1,0,87.281 32 | 5,face,y,m,0,1,157.4454 33 | 5,face,y,y,1,0,152.802 34 | 5,face,y,y,1,0,140.0413 35 | 5,chair,m,m,1,0,200.7327 36 | 5,face,y,y,1,0,250.0129 37 | 5,face,y,y,1,0,247.7702 38 | 5,face,y,y,1,0,191.0635 39 | 5,face,y,y,1,0,144.9751 40 | 5,chair,m,m,1,0,252.4232 41 | 5,face,y,y,1,1,130.9232 42 | 5,face,y,y,1,0,190.7518 43 | 5,face,y,y,1,0,181.4086 44 | 5,chair,m,m,1,1,184.0076 45 | 5,face,y,y,1,0,226.1308 46 | 5,chair,m,m,1,0,323.2787 47 | 5,chair,m,m,1,1,280.7008 48 | 5,face,y,y,1,1,125.8057 49 | 5,face,y,y,1,0,210.5914 50 | 5,face,y,y,1,0,163.0883 51 | 5,chair,m,y,0,0,199.0561 52 | 5,face,y,y,1,0,120.4815 53 | 5,face,y,y,1,1,180.3391 54 | 5,chair,m,m,1,1,174.9745 55 | 5,chair,m,m,1,0,338.4217 56 | 5,chair,m,m,1,1,206.3425 57 | 5,face,y,y,1,1,167.5066 58 | 5,chair,m,m,1,0,258.8689 59 | 5,chair,m,m,1,0,234.7639 60 | 5,face,y,y,1,0,170.5855 61 | 5,face,y,y,1,0,381.3306 62 | 5,chair,m,m,1,0,255.6286 63 | 5,face,y,y,1,0,141.564 64 | 5,chair,m,m,1,1,434.2878 65 | 5,face,y,y,1,0,249.3171 66 | 5,chair,m,m,1,0,321.3058 67 | 5,face,y,y,1,0,251.7357 68 | 5,chair,m,m,1,0,361.194 69 | 5,face,y,y,1,0,227.6014 70 | 5,chair,m,m,1,0,300.1232 71 | 5,face,y,y,1,0,129.3221 72 | 5,face,y,y,1,0,309.4188 73 | 5,chair,m,m,1,1,144.5931 74 | -------------------------------------------------------------------------------- /ExampleExperiments/facebenefit/facebenefit.osexp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ExampleExperiments/facebenefit/facebenefit.osexp -------------------------------------------------------------------------------- /ExampleExperiments/hog2/csv/log1.27269886434e-05.csv: -------------------------------------------------------------------------------- 1 | block,trial,congruence,label,correct,rt 2 | 0,0,False,Ich,False,1.97635241796 3 | 0,1,False,Stuhl,True,2.48781595286 4 | 0,2,True,Stuhl,False,1.82720514736 5 | 0,3,True,Ich,True,1.22028420609 6 | 0,4,True,Stuhl,False,1.22470622195 7 | 0,5,True,Stuhl,True,2.00346256432 8 | 0,6,False,Stuhl,True,2.07098297984 9 | 0,7,True,Ich,True,2.01133195416 10 | 1,0,False,Ich,True,2.56516694732 11 | 1,1,True,Ich,True,1.71547771199 12 | 1,2,True,Ich,True,1.21937976824 13 | 1,3,False,Ich,False,2.05756913533 14 | 1,4,True,Ich,True,2.18156211171 15 | 1,5,True,Ich,True,1.13716541848 16 | 1,6,True,Ich,True,0.929698530235 17 | 1,7,True,Ich,True,0.595387407695 18 | 2,0,False,Ich,True,1.76980392623 19 | 2,1,True,Ich,True,1.41032003472 20 | 2,2,True,Ich,True,0.956815656042 21 | 2,3,True,Stuhl,False,2.9000840392 22 | 2,4,True,Stuhl,True,1.83103679458 23 | 2,5,True,Stuhl,True,0.819674049271 24 | 2,6,False,Ich,True,2.42096801545 25 | 2,7,True,Stuhl,False,1.76163319394 26 | 3,0,False,Stuhl,False,-999 27 | 3,1,True,Stuhl,False,2.8317909718 28 | 3,2,True,Ich,True,2.24798307894 29 | 3,3,True,Ich,True,2.47813481337 30 | 3,4,True,Ich,True,0.707167803776 31 | 3,5,False,Ich,True,2.22580731241 32 | 3,6,True,Ich,True,0.894483339274 33 | 3,7,True,Ich,True,0.50135829905 34 | -------------------------------------------------------------------------------- /ExampleExperiments/hog2/csv/log1.31374690682e-05.csv: -------------------------------------------------------------------------------- 1 | block,trial,congruence,label,correct,rt 2 | 0,0,False,Ich,True,1.846642146 3 | 0,1,True,Ich,True,1.97008704033 4 | 0,2,False,Ich,True,0.673822660465 5 | 0,3,True,Ich,False,1.45001061272 6 | 0,4,False,Ich,True,1.00367481785 7 | 0,5,False,Stuhl,True,1.08128609997 8 | 0,6,False,Ich,True,1.04880187637 9 | 0,7,True,Stuhl,True,0.824650305207 10 | 1,0,False,Ich,True,1.39161586482 11 | 1,1,False,Ich,True,0.709786280873 12 | 1,2,True,Stuhl,True,0.69965435937 13 | 1,3,False,Ich,True,0.775580340764 14 | 1,4,False,Ich,True,0.62361465604 15 | 1,5,True,Ich,False,1.05606940237 16 | 1,6,False,Stuhl,False,0.715113555663 17 | 1,7,True,Ich,True,1.3339067325 18 | 2,0,False,Ich,True,1.1407876861 19 | 2,1,True,Ich,True,1.775866493 20 | 2,2,True,Ich,True,0.547790080076 21 | 2,3,False,Stuhl,True,0.763566876412 22 | 2,4,False,Ich,True,1.90541624057 23 | 2,5,False,Stuhl,True,2.24139829469 24 | 2,6,True,Stuhl,True,1.15573862358 25 | 2,7,True,Stuhl,True,1.40857109905 26 | 3,0,False,Ich,True,1.00712917116 27 | 3,1,False,Ich,True,0.701411506045 28 | 3,2,True,Ich,True,0.661103874096 29 | 3,3,False,Stuhl,True,1.70154000772 30 | 3,4,True,Ich,True,0.758926038514 31 | 3,5,False,Stuhl,True,0.555798235233 32 | 3,6,True,Stuhl,True,0.72934808617 33 | 3,7,True,Stuhl,True,0.546360140317 34 | -------------------------------------------------------------------------------- /ExampleExperiments/hog2/csv/log1.39586627483e-05.csv: -------------------------------------------------------------------------------- 1 | block,trial,congruence,label,correct,rt 2 | 0,0,False,Stuhl,True,1.66613185906 3 | 0,1,True,Ich,True,0.797477755463 4 | 0,2,False,Ich,True,1.09830989584 5 | 0,3,False,Stuhl,True,1.1421502959 6 | 0,4,False,Stuhl,True,0.534528548946 7 | 0,5,False,Ich,True,1.80198557582 8 | 0,6,True,Stuhl,True,0.908046623576 9 | 0,7,True,Stuhl,True,1.45045687864 10 | 1,0,True,Stuhl,True,1.10896198195 11 | 1,1,False,Ich,True,0.707693716162 12 | 1,2,True,Stuhl,True,1.41636289516 13 | 1,3,False,Stuhl,False,0.583451126469 14 | 1,4,True,Stuhl,True,0.755656842375 15 | 1,5,False,Ich,True,1.25931256975 16 | 1,6,True,Ich,True,1.23623154429 17 | 1,7,False,Ich,True,1.82573907939 18 | 2,0,False,Ich,True,1.85086258256 19 | 2,1,False,Ich,True,0.6700082561 20 | 2,2,False,Stuhl,True,1.39122953871 21 | 2,3,False,Stuhl,True,1.33407752053 22 | 2,4,True,Stuhl,True,0.973124276614 23 | 2,5,False,Stuhl,True,2.05703295919 24 | 2,6,True,Stuhl,False,1.13450752886 25 | 2,7,False,Stuhl,False,-999 26 | 3,0,True,Ich,True,0.738423667033 27 | 3,1,True,Ich,True,0.49219445046 28 | 3,2,False,Stuhl,True,0.875703628524 29 | 3,3,True,Ich,True,0.637865608674 30 | 3,4,False,Stuhl,True,0.963879960706 31 | 3,5,False,Stuhl,True,1.23926590674 32 | 3,6,False,Ich,True,0.895443611895 33 | 3,7,False,Stuhl,True,1.44616952271 34 | -------------------------------------------------------------------------------- /ExampleExperiments/hog2/csv/log1.43692595884e-05.csv: -------------------------------------------------------------------------------- 1 | block,trial,congruence,label,correct,rt 2 | 0,0,False,Stuhl,False,2.87209408777 3 | 0,1,False,Stuhl,True,1.71921329095 4 | 0,2,False,Stuhl,True,0.80384864402 5 | 0,3,True,Ich,True,0.89585949725 6 | 0,4,False,Stuhl,True,0.673168246401 7 | 0,5,True,Ich,False,0.928415566799 8 | 0,6,True,Stuhl,True,1.72159857652 9 | 0,7,False,Ich,True,0.949902022607 10 | 1,0,True,Stuhl,False,0.993105662405 11 | 1,1,False,Stuhl,True,0.844412868726 12 | 1,2,False,Ich,False,-999 13 | 1,3,True,Ich,True,1.62658866798 14 | 1,4,True,Stuhl,False,0.974373985664 15 | 1,5,True,Ich,True,1.18793751625 16 | 1,6,True,Stuhl,False,0.99865175935 17 | 1,7,True,Stuhl,True,0.886153314379 18 | 2,0,True,Ich,True,1.12809065881 19 | 2,1,True,Ich,True,1.03619558027 20 | 2,2,False,Ich,True,1.71773039037 21 | 2,3,True,Ich,True,1.80192440411 22 | 2,4,False,Stuhl,True,1.8129714377 23 | 2,5,False,Ich,True,2.93557511864 24 | 2,6,True,Ich,True,1.03203467338 25 | 2,7,True,Stuhl,True,2.43386169535 26 | 3,0,False,Stuhl,True,1.88062322873 27 | 3,1,False,Stuhl,True,1.39314023056 28 | 3,2,True,Stuhl,True,2.07082450832 29 | 3,3,True,Stuhl,True,1.44196673983 30 | 3,4,False,Ich,True,2.04034252872 31 | 3,5,True,Ich,True,1.07648925367 32 | 3,6,False,Ich,True,1.40294617671 33 | 3,7,True,Stuhl,True,1.2160374946 34 | -------------------------------------------------------------------------------- /ExampleExperiments/hog2/csv/log1.47797400132e-05.csv: -------------------------------------------------------------------------------- 1 | block,trial,congruence,label,correct,rt 2 | 0,0,True,Ich,True,1.19882895204 3 | 0,1,False,Stuhl,False,1.99252432608 4 | 0,2,False,Ich,True,1.96880325582 5 | 0,3,True,Ich,True,1.23913658399 6 | 0,4,False,Ich,True,1.15872330975 7 | 0,5,True,Stuhl,False,1.81035213964 8 | 0,6,True,Ich,True,0.594624198391 9 | 0,7,False,Ich,True,1.40460356022 10 | 1,0,True,Ich,True,0.971302673803 11 | 1,1,False,Ich,True,1.82132322178 12 | 1,2,True,Ich,True,0.805502332631 13 | 1,3,True,Stuhl,False,0.852501080837 14 | 1,4,True,Ich,True,0.856200941955 15 | 1,5,True,Stuhl,False,1.18099309178 16 | 1,6,False,Ich,False,-999 17 | 1,7,False,Stuhl,True,2.9313091113 18 | 2,0,True,Stuhl,False,2.57759260223 19 | 2,1,True,Stuhl,False,-999 20 | 2,2,False,Ich,False,2.93867968488 21 | 2,3,False,Stuhl,True,2.62874609919 22 | 2,4,True,Ich,True,1.04077442549 23 | 2,5,True,Stuhl,False,-999 24 | 2,6,False,Ich,True,2.16281524464 25 | 2,7,True,Ich,True,0.733605472138 26 | 3,0,False,Ich,False,-999 27 | 3,1,True,Ich,True,1.10483761376 28 | 3,2,True,Stuhl,True,2.38384336431 29 | 3,3,False,Ich,False,2.33111869893 30 | 3,4,True,Stuhl,False,-999 31 | 3,5,True,Stuhl,True,1.51107146125 32 | 3,6,True,Ich,False,0.854040636914 33 | 3,7,True,Ich,True,1.28644036967 34 | -------------------------------------------------------------------------------- /ExampleExperiments/hog2/experiment/Unser experiment.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | #-- coding: UTF-8 -- 3 | 4 | from __future__ import unicode_literals, print_function 5 | from psychopy import visual, event, core, monitors 6 | from random import choice 7 | 8 | 9 | m = monitors.Monitor("default", width=28.8, distance=200) 10 | m.setSizePix([800, 600]) 11 | 12 | win = visual.Window( 13 | allowGUI=False, monitor=m, 14 | bitsMode=None, 15 | winType='pyglet', rgb=1, 16 | fullscr=False, 17 | screen=1, units="pix" 18 | ) 19 | 20 | 21 | clock = core.Clock() 22 | 23 | 24 | 25 | logfile = "log" + str(clock.getTime()) + ".csv" 26 | with open(logfile, "w") as f: 27 | print("block,trial,congruence,label,correct,rt", file=f) 28 | 29 | n_experiment_blocks = 4 30 | 31 | def draw_and_wait(stim, time=.495): 32 | "Draw one stimulus, flip, wait." 33 | stim.draw() 34 | win.flip() 35 | core.wait(time) 36 | 37 | 38 | 39 | def one_trial(congruence, label): 40 | "Run one single trial, return RT and if the correct answer was given." 41 | 42 | stim = visual.TextStim(win, text="o", color=(-1, -1, -1)) 43 | draw_and_wait(stim) 44 | 45 | if label == 'Ich': 46 | stim = visual.TextStim(win, text='Ich', pos=(-250,0), color=(-1, -1, -1)) 47 | stim.draw() 48 | if congruence == True: 49 | fname = 'snake.png' 50 | stim = visual.ImageStim(win, fname, pos=(250,0), size=(200,200)) 51 | stim.draw() 52 | else: 53 | fname = 'spider.png' 54 | stim = visual.ImageStim(win, fname, pos=(250,0), size=(200,200)) 55 | stim.draw() 56 | else: 57 | stim = visual.TextStim(win, text='Stuhl', pos=(-250,0), color=(-1, -1, -1)) 58 | stim.draw() 59 | if congruence == True: 60 | fname = 'spider.png' 61 | stim = visual.ImageStim(win, fname, pos=(250,0), size=(200,200)) 62 | stim.draw() 63 | else: 64 | fname = 'snake.png' 65 | stim = visual.ImageStim(win, fname, pos=(250,0), size=(200,200)) 66 | stim.draw() 67 | win.flip() 68 | 69 | 70 | clock.reset() 71 | try: 72 | key, time = event.waitKeys(keyList=['m', 'c', 'q'], maxWait=3, timeStamped=clock)[0] 73 | except TypeError: 74 | key, time = "miss", -999 75 | if key == "q": 76 | win.close() 77 | core.quit() 78 | 79 | if congruence == True: 80 | correct = key == 'm' 81 | else: 82 | correct = key == 'c' 83 | 84 | if not correct: 85 | fname = 'error.png' 86 | stim = visual.ImageStim(win, fname, size=(200,200)) 87 | draw_and_wait(stim) 88 | return time, correct 89 | 90 | def display_text(text): 91 | "Display text and wait for a keypress." 92 | stim = visual.TextStim(win, text= text, color=(-1, -1, -1)) 93 | stim.draw() 94 | win.flip() 95 | event.waitKeys() 96 | win.flip() 97 | core.wait(.495) 98 | 99 | 100 | 101 | def one_block(n, n_trials=8): 102 | labels = ("Ich", "Stuhl") 103 | congruences = (True, False) 104 | for trial in range(n_trials): 105 | label = choice(labels) 106 | congruence = choice(congruences) 107 | time, correct = one_trial(congruence, label) 108 | 109 | with open(logfile, "a") as f: 110 | print(n, trial, str(congruence), label, str(correct), str(time),sep=",", file=f) 111 | if n+1 == n_experiment_blocks: 112 | text = ("Thank you again for your participation. Press any key to finish.") 113 | else: 114 | text = ("This was block" + str(n + 1) + " of " + str(n_experiment_blocks) + " blocks in total. Press any key to continue.") 115 | display_text(text) 116 | 117 | 118 | 119 | text = (""" 120 | Welcome to this experiment and thank you for participation! 121 | 122 | Please, 123 | 124 | - Press 'm' if 'Ich' or 'Stuhl' matches the associated picture. 125 | 126 | - Press 'c' if .'Ich' or 'Stuhl' do not match the associated picture. 127 | 128 | Press any key to continue. 129 | """) 130 | display_text(text) 131 | 132 | 133 | 134 | 135 | for block in range(n_experiment_blocks): 136 | one_block(block) 137 | 138 | 139 | win.close() 140 | core.quit() 141 | -------------------------------------------------------------------------------- /ExampleExperiments/hog2/experiment/error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ExampleExperiments/hog2/experiment/error.png -------------------------------------------------------------------------------- /ExampleExperiments/hog2/experiment/snake.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ExampleExperiments/hog2/experiment/snake.png -------------------------------------------------------------------------------- /ExampleExperiments/hog2/experiment/spider.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ExampleExperiments/hog2/experiment/spider.png -------------------------------------------------------------------------------- /ExampleExperiments/hog3/csv/AS.csv: -------------------------------------------------------------------------------- 1 | subject,age,sex,house,nutella,movie,temperature,block,trial,cue_cond,cue_valence,cue_cond_pos,cue_cond_side,cue_neutral,cue_neutral_pos,cue_neutral_side,target_pos,target_side,duration,fixation,fixation_direction,response,correct,rt 2 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,0,Bereicherung,positive,-200,right,Zeiger,200,right,-200,left,1,cross,None,x,True,0.486207962036 3 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,1,Müll,negative,-200,right,Anzug,200,right,-200,left,0.04,cross,None,x,True,0.655388832092 4 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,2,Kostbarkeit,positive,-200,right,Füller,200,right,-200,left,0.04,cross,None,x,True,0.578408956528 5 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,3,Feind,negative,200,right,Apfel,-200,left,200,right,1,cross,None,m,True,0.512787103653 6 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,4,Wohlstand,positive,-200,right,Finger,200,right,200,right,0.04,cross,None,m,True,0.571825027466 7 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,5,Gesundheit,positive,-200,right,Projektor,200,right,-200,left,1,cross,None,x,True,0.387979030609 8 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,6,Dummheit,negative,-200,right,Wind,200,right,-200,left,0.04,cross,None,x,True,0.366054058075 9 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,7,Anschlag,negative,200,right,Strumpf,-200,left,200,right,1,cross,None,m,True,0.325329065323 10 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,8,Schrott,negative,-200,right,Dienstag,200,right,-200,left,0.04,cross,None,x,True,0.35547709465 11 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,9,Rücksichtnahme,positive,200,right,Apfelsine,-200,left,200,right,0.04,cross,None,m,True,0.411461114883 12 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,10,Stärke,positive,200,right,Fußboden,-200,left,-200,left,0.04,cross,None,x,True,0.449037075043 13 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,11,Terror,negative,200,right,Supermarkt,-200,left,200,right,1,cross,None,m,True,0.289067983627 14 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,12,Treue,positive,-200,right,Geburtstag,200,right,200,right,1,cross,None,m,True,0.307241916656 15 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,13,Frohsinn,positive,200,right,Flughafen,-200,left,200,right,1,cross,None,m,True,0.401762008667 16 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,14,Mord,negative,200,right,Fernseher,-200,left,-200,left,0.04,cross,None,x,True,0.485171079636 17 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,15,Sicherheit,positive,200,right,Zug,-200,left,-200,left,0.04,cross,None,x,True,0.485707044601 18 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,16,Dankbarkeit,positive,-200,right,Septmeber,200,right,200,right,0.04,cross,None,m,True,0.391247987747 19 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,17,Sturz,negative,200,right,Bahnhof,-200,left,-200,left,0.04,cross,None,x,True,0.41061091423 20 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,18,Verletzung,negative,200,right,Mai,-200,left,-200,left,1,cross,None,x,True,0.579967975616 21 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,19,Leidenschaft,positive,200,right,Hafen,-200,left,200,right,1,cross,None,m,True,0.442198991776 22 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,20,Übelkeit,negative,-200,right,Dusche,200,right,-200,left,0.04,cross,None,x,True,0.359862089157 23 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,21,Herzlichkeit,positive,-200,right,Koch,200,right,-200,left,1,cross,None,x,True,0.454195022583 24 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,22,Harmonie,positive,200,right,Marktplatz,-200,left,-200,left,1,cross,None,x,True,0.396909952164 25 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,23,Geschenk,positive,200,right,Dose,-200,left,200,right,1,cross,None,m,True,0.344512939453 26 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,24,Erfolg,positive,-200,right,Park,200,right,200,right,0.04,cross,None,m,True,1.14066314697 27 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,0,Kraft,positive,-200,right,Kaffee,200,right,-200,left,0.04,hole,right,x,True,0.511862039566 28 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,1,Tapferkeit,positive,200,right,Computer,-200,left,200,right,0.04,hole,right,m,True,0.380887985229 29 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,2,Freiheit,positive,200,right,Schinken,-200,left,-200,left,0.04,hole,right,x,True,0.502115011215 30 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,3,Armut,negative,200,right,Bestellung,-200,left,-200,left,0.04,hole,right,x,True,0.632344961166 31 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,4,Entspannung,positive,200,right,Dezember,-200,left,-200,left,1,hole,right,x,True,0.492266893387 32 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,5,Krankheit,negative,200,right,Oktober,-200,left,200,right,1,hole,left,m,True,0.306730031967 33 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,6,Qual,negative,-200,right,RadiergummI,200,right,-200,left,1,hole,left,x,True,0.317496061325 34 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,7,Wunde,negative,200,right,Hut,-200,left,200,right,0.04,hole,left,m,True,0.481845855713 35 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,8,Krieg,negative,200,right,Garten,-200,left,-200,left,1,hole,left,x,True,0.263292074203 36 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,9,Koma,negative,200,right,Kunde,-200,left,200,right,1,hole,left,m,True,0.491541147232 37 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,10,Gefängnis,negative,200,right,Pass,-200,left,200,right,1,hole,left,m,True,0.35630106926 38 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,11,Bewunderung,positive,200,right,Februar,-200,left,200,right,1,hole,left,m,True,0.318450927734 39 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,12,Sucht,negative,-200,right,Berg,200,right,200,right,1,hole,left,m,True,0.345408916473 40 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,13,Gestank,negative,200,right,Rock,-200,left,200,right,1,hole,right,m,True,0.387167930603 41 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,14,Höflichkeit,positive,-200,right,Bluse,200,right,200,right,0.04,hole,left,m,True,0.828853845596 42 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,15,Eleganz,positive,-200,right,Teppich,200,right,-200,left,0.04,hole,right,x,True,0.506526947021 43 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,16,Wut,negative,-200,right,Ausweis,200,right,200,right,0.04,hole,right,m,True,0.283617019653 44 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,17,Wohlbefinden,positive,-200,right,Kellner,200,right,-200,left,1,hole,left,x,True,0.353450059891 45 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,18,Trennung,negative,-200,right,Monitor,200,right,-200,left,1,hole,right,x,True,0.414686918259 46 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,19,Beliebtheit,positive,-200,right,Cola,200,right,200,right,0.04,hole,right,m,True,0.384083032608 47 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,20,Schrei,negative,200,right,Brücke,-200,left,200,right,1,hole,left,m,True,0.346297979355 48 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,21,Unterstützung,positive,-200,right,Juni,200,right,-200,left,0.04,hole,left,x,True,0.438353061676 49 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,22,Schönheit,positive,200,right,Locher,-200,left,-200,left,0.04,hole,left,x,True,0.421597003937 50 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,23,Genuss,positive,200,right,Markt,-200,left,200,right,0.04,hole,left,m,True,0.354162931442 51 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,24,Verehrung,positive,200,right,Balkon,-200,left,200,right,0.04,hole,right,m,True,0.388411045074 52 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,0,Geisel,negative,200,right,Apotheke,-200,left,200,right,0.04,cross,None,miss,False,-999 53 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,1,Optimismus,positive,200,right,Anruf,-200,left,-200,left,0.04,cross,None,x,True,0.39849615097 54 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,2,Zufriedenheit,positive,-200,right,Einwohner,200,right,200,right,0.04,cross,None,m,True,0.315536975861 55 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,3,Leid,negative,200,right,Januar,-200,left,-200,left,0.04,cross,None,x,True,0.45529794693 56 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,4,Schatz,positive,-200,right,Diskette,200,right,-200,left,0.04,cross,None,x,True,0.544214010239 57 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,5,Sympathie,positive,-200,right,Bedienung,200,right,200,right,0.04,cross,None,m,True,0.347724914551 58 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,6,Lachen,positive,200,right,Name,-200,left,200,right,0.04,cross,None,m,True,0.436815023422 59 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,7,Rache,negative,200,right,Eile,-200,left,-200,left,0.04,cross,None,x,True,0.452027082443 60 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,8,Belohnung,positive,200,right,Herr,-200,left,200,right,1,cross,None,m,True,0.688106060028 61 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,9,Verzweiflung,negative,-200,right,Zucker,200,right,200,right,1,cross,None,m,True,0.455520868301 62 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,10,Neid,negative,-200,right,Bibliothek,200,right,-200,left,1,cross,None,x,True,1.7675049305 63 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,11,Liebe,positive,-200,right,Stuhl,200,right,-200,left,0.04,cross,None,x,True,0.388135910034 64 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,12,Horror,negative,-200,right,Drucker,200,right,200,right,0.04,cross,None,m,True,0.288935899734 65 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,13,Reichtum,positive,200,right,März,-200,left,200,right,0.04,cross,None,m,True,0.407790184021 66 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,14,Folter,negative,-200,right,Tag,200,right,200,right,0.04,cross,None,m,True,0.386962175369 67 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,15,Glück,positive,-200,right,Eintrittskarte,200,right,200,right,0.04,cross,None,m,True,0.35391497612 68 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,16,Zuverlässigkeit,positive,200,right,Bank,-200,left,-200,left,1,cross,None,x,True,0.357412099838 69 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,17,Spaß,positive,200,right,Beschreibung,-200,left,200,right,1,cross,None,m,True,0.285811901093 70 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,18,Lebensfreude,positive,200,right,Adresse,-200,left,-200,left,1,cross,None,x,True,0.303652048111 71 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,19,Solidarität,positive,200,right,Schlüssel,-200,left,-200,left,1,cross,None,x,True,0.368345975876 72 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,20,Hässlichkeit,negative,200,right,Pullover,-200,left,200,right,1,cross,None,m,True,0.200365066528 73 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,21,Attraktivität,positive,200,right,Dolmetscherin,-200,left,200,right,0.04,cross,None,m,True,0.341133117676 74 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,22,Waffe,negative,200,right,Brille,-200,left,-200,left,0.04,cross,None,x,True,0.368072032928 75 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,23,Panik,negative,200,right,Kleiderhaken,-200,left,-200,left,0.04,cross,None,x,True,0.386740922928 76 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,24,Freundschaft,positive,200,right,Fahrschein,-200,left,200,right,0.04,cross,None,m,True,0.638628005981 77 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,0,Unglück,negative,200,right,Gast,-200,left,200,right,1,hole,right,m,True,0.374137878418 78 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,1,Ehrlichkeit,positive,200,right,Platz,-200,left,-200,left,1,hole,left,x,True,0.327959060669 79 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,2,Hilfsbereitschaft,positive,200,right,Zuschauer,-200,left,-200,left,0.04,hole,right,x,True,0.542512178421 80 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,3,Anerkennung,positive,-200,right,Bankkarte,200,right,-200,left,1,hole,left,x,True,0.435552120209 81 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,4,Mut,positive,-200,right,Sessel,200,right,200,right,1,hole,right,m,True,0.458434104919 82 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,5,Angst,negative,-200,right,Laden,200,right,200,right,1,hole,right,m,True,0.440799951553 83 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,6,Unfall,negative,-200,right,November,200,right,-200,left,1,hole,right,x,True,0.323976039886 84 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,7,Totschlag,negative,-200,right,Juli,200,right,-200,left,0.04,hole,left,x,True,0.367884874344 85 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,8,Ekel,negative,200,right,Fuß,-200,left,-200,left,0.04,hole,left,x,True,0.41587805748 86 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,9,Frieden,positive,-200,right,Wagen,200,right,200,right,0.04,hole,left,m,True,0.408548116684 87 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,10,Vergnügen,positive,-200,right,Keller,200,right,-200,left,1,hole,right,x,True,0.388988018036 88 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,11,Depression,negative,-200,right,August,200,right,-200,left,1,hole,right,x,True,0.377820014954 89 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,12,Gerechtigkeit,positive,-200,right,Tee,200,right,-200,left,1,hole,right,x,True,0.382625102997 90 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,13,Schmerz,negative,200,right,Flur,-200,left,200,right,0.04,hole,right,m,True,0.985077142715 91 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,14,Pessimismus,negative,-200,right,Schrank,200,right,-200,left,0.04,hole,left,x,True,0.756101846695 92 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,15,Hass,negative,-200,right,Passant,200,right,-200,left,1,hole,left,x,True,1.04689288139 93 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,16,Einsamkeit,negative,200,right,Kakao,-200,left,-200,left,0.04,hole,right,x,True,0.482745885849 94 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,17,Regen,negative,-200,right,Tisch,200,right,-200,left,1,hole,right,x,True,0.369663953781 95 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,18,Droge,negative,-200,right,Decke,200,right,-200,left,0.04,hole,right,x,True,0.3848528862 96 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,19,Trauer,negative,200,right,April,-200,left,200,right,1,hole,left,m,True,0.45135807991 97 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,20,Schock,negative,-200,right,Bus,200,right,200,right,0.04,hole,left,m,True,0.444674015045 98 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,21,Tod,negative,200,right,Löffel,-200,left,200,right,0.04,hole,left,m,True,0.569194078445 99 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,22,Heimweh,negative,-200,right,Baum,200,right,-200,left,1,hole,right,x,True,0.338884115219 100 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,23,Bombe,negative,-200,right,Kugelschrieber,200,right,-200,left,1,hole,left,x,True,0.546581029892 101 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,24,Schleim,negative,200,right,Bildschirm,-200,left,-200,left,1,hole,right,x,True,0.352849006653 102 | -------------------------------------------------------------------------------- /ExampleExperiments/hog3/csv/CM.csv: -------------------------------------------------------------------------------- 1 | subject,age,sex,house,nutella,movie,temperature,block,trial,cue_cond,cue_valence,cue_cond_pos,cue_cond_side,cue_neutral,cue_neutral_pos,cue_neutral_side,target_pos,target_side,duration,fixation,fixation_direction,response,correct,rt 2 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,0,Kostbarkeit,positive,200,right,Eintrittskarte,-200,left,-200,left,0.04,cross,None,miss,False,-999 3 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,1,Schmerz,negative,200,right,Teppich,-200,left,200,right,0.04,cross,None,m,True,1.00885176659 4 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,2,Armut,negative,-200,right,Rock,200,right,200,right,0.04,cross,None,m,True,0.439181089401 5 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,3,Wohlbefinden,positive,200,right,Adresse,-200,left,-200,left,1,cross,None,x,True,1.06246209145 6 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,4,Anschlag,negative,-200,right,Anruf,200,right,200,right,0.04,cross,None,m,True,0.863609075546 7 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,5,Harmonie,positive,200,right,Dose,-200,left,200,right,1,cross,None,m,True,0.393723011017 8 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,6,Schatz,positive,-200,right,Stuhl,200,right,200,right,0.04,cross,None,m,True,0.393811941147 9 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,7,Panik,negative,-200,right,Dienstag,200,right,200,right,0.04,cross,None,m,True,0.369379997253 10 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,8,Zufriedenheit,positive,200,right,Monitor,-200,left,-200,left,0.04,cross,None,x,True,0.398013830185 11 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,9,Glück,positive,-200,right,Wagen,200,right,-200,left,1,cross,None,x,True,0.446720123291 12 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,10,Pessimismus,negative,-200,right,Koch,200,right,-200,left,1,cross,None,x,True,0.460047960281 13 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,11,Waffe,negative,200,right,Flughafen,-200,left,-200,left,0.04,cross,None,x,True,0.925713062286 14 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,12,Horror,negative,200,right,Wind,-200,left,200,right,1,cross,None,m,True,0.348467111588 15 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,13,Frohsinn,positive,-200,right,Berg,200,right,-200,left,0.04,cross,None,x,True,0.397452116013 16 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,14,Sicherheit,positive,-200,right,Markt,200,right,200,right,0.04,cross,None,m,True,0.373203039169 17 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,15,Genuss,positive,-200,right,Bluse,200,right,200,right,1,cross,None,m,True,0.414644956589 18 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,16,Unglück,negative,-200,right,Juni,200,right,-200,left,0.04,cross,None,x,True,0.413449048996 19 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,17,Solidarität,positive,200,right,Kellner,-200,left,200,right,0.04,cross,None,m,True,0.327472925186 20 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,18,Verletzung,negative,200,right,März,-200,left,-200,left,0.04,cross,None,x,True,0.443737983704 21 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,19,Geschenk,positive,200,right,Tag,-200,left,-200,left,1,cross,None,x,True,0.353622913361 22 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,20,Bewunderung,positive,200,right,Keller,-200,left,200,right,0.04,cross,None,m,True,0.412930011749 23 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,21,Hilfsbereitschaft,positive,200,right,Gast,-200,left,200,right,1,cross,None,m,True,0.429290056229 24 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,22,Mord,negative,200,right,Computer,-200,left,-200,left,1,cross,None,x,True,0.435735940933 25 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,23,Frieden,positive,-200,right,Brille,200,right,200,right,1,cross,None,m,True,0.347078084946 26 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,24,Wunde,negative,-200,right,Locher,200,right,200,right,0.04,cross,None,m,True,0.417899847031 27 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,0,Folter,negative,200,right,RadiergummI,-200,left,-200,left,0.04,hole,left,x,True,0.567094802856 28 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,1,Droge,negative,-200,right,Anzug,200,right,-200,left,0.04,hole,right,m,False,0.835239171982 29 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,2,Krieg,negative,200,right,Marktplatz,-200,left,-200,left,1,hole,right,x,True,0.511179924011 30 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,3,Depression,negative,200,right,Tisch,-200,left,200,right,1,hole,left,m,True,0.413212060928 31 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,4,Vergnügen,positive,-200,right,Bestellung,200,right,-200,left,0.04,hole,right,m,False,0.632125139236 32 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,5,Koma,negative,200,right,Flur,-200,left,-200,left,1,hole,left,m,False,0.53478717804 33 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,6,Schönheit,positive,200,right,Fuß,-200,left,200,right,0.04,hole,right,m,True,0.774570941925 34 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,7,Stärke,positive,-200,right,Pass,200,right,200,right,1,hole,right,m,True,0.351526021957 35 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,8,Anerkennung,positive,200,right,Bildschirm,-200,left,200,right,0.04,hole,right,m,True,0.798306941986 36 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,9,Angst,negative,200,right,Garten,-200,left,-200,left,0.04,hole,left,x,True,0.442151069641 37 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,10,Trauer,negative,-200,right,April,200,right,200,right,0.04,hole,right,m,True,0.498654842377 38 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,11,Terror,negative,200,right,Apfel,-200,left,200,right,0.04,hole,left,m,True,0.405672073364 39 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,12,Übelkeit,negative,200,right,Zuschauer,-200,left,200,right,0.04,hole,right,m,True,0.472065210342 40 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,13,Tapferkeit,positive,-200,right,Supermarkt,200,right,-200,left,1,hole,left,x,True,0.410528898239 41 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,14,Schleim,negative,-200,right,Ausweis,200,right,-200,left,0.04,hole,left,x,True,0.359519958496 42 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,15,Rücksichtnahme,positive,-200,right,Schrank,200,right,200,right,1,hole,left,m,True,0.303122997284 43 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,16,Reichtum,positive,-200,right,Zeiger,200,right,-200,left,0.04,hole,right,x,True,0.485352039337 44 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,17,Rache,negative,200,right,Bank,-200,left,-200,left,0.04,hole,left,x,True,0.492990016937 45 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,18,Leidenschaft,positive,-200,right,Apfelsine,200,right,-200,left,0.04,hole,left,miss,False,-999 46 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,19,Eleganz,positive,200,right,Sessel,-200,left,200,right,0.04,hole,right,miss,False,-999 47 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,20,Ekel,negative,200,right,Hafen,-200,left,-200,left,0.04,hole,left,x,True,1.52466797829 48 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,21,Einsamkeit,negative,-200,right,Bankkarte,200,right,200,right,0.04,hole,left,miss,False,-999 49 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,22,Bombe,negative,200,right,Apotheke,-200,left,-200,left,1,hole,left,miss,False,-999 50 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,23,Gesundheit,positive,-200,right,Februar,200,right,200,right,1,hole,right,miss,False,-999 51 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,24,Höflichkeit,positive,-200,right,Name,200,right,-200,left,0.04,hole,left,miss,False,-999 52 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,0,Wut,negative,-200,right,Bedienung,200,right,-200,left,0.04,cross,None,x,True,0.479216098785 53 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,1,Lachen,positive,-200,right,Balkon,200,right,200,right,1,cross,None,m,True,0.90656709671 54 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,2,Sucht,negative,-200,right,Kakao,200,right,-200,left,0.04,cross,None,x,True,0.55303311348 55 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,3,Müll,negative,-200,right,Geburtstag,200,right,200,right,1,cross,None,m,True,0.386737823486 56 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,4,Leid,negative,200,right,Oktober,-200,left,200,right,0.04,cross,None,m,True,0.289903879166 57 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,5,Dummheit,negative,-200,right,Schlüssel,200,right,-200,left,0.04,cross,None,x,True,0.321068048477 58 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,6,Schrott,negative,200,right,Dolmetscherin,-200,left,-200,left,1,cross,None,x,True,0.504285097122 59 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,7,Wohlstand,positive,-200,right,Bibliothek,200,right,-200,left,0.04,cross,None,x,True,0.378205776215 60 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,8,Sympathie,positive,-200,right,Schinken,200,right,200,right,1,cross,None,m,True,0.327483892441 61 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,9,Tod,negative,-200,right,Löffel,200,right,200,right,0.04,cross,None,m,True,0.349638938904 62 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,10,Heimweh,negative,200,right,Juli,-200,left,-200,left,1,cross,None,x,True,0.442924976349 63 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,11,Kraft,positive,200,right,Projektor,-200,left,-200,left,0.04,cross,None,x,True,0.409273862839 64 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,12,Unterstützung,positive,200,right,Zug,-200,left,-200,left,0.04,cross,None,x,True,0.379004955292 65 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,13,Dankbarkeit,positive,-200,right,Mai,200,right,200,right,0.04,cross,None,m,True,0.3792719841 66 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,14,Spaß,positive,-200,right,Decke,200,right,-200,left,0.04,cross,None,x,True,0.424951076508 67 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,15,Qual,negative,-200,right,Fahrschein,200,right,200,right,1,cross,None,m,True,0.388605117798 68 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,16,Gestank,negative,200,right,Füller,-200,left,200,right,1,cross,None,m,True,0.325475931168 69 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,17,Erfolg,positive,200,right,Januar,-200,left,200,right,1,cross,None,m,True,0.383054018021 70 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,18,Entspannung,positive,-200,right,Fußboden,200,right,200,right,0.04,cross,None,m,True,0.371932983398 71 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,19,Gerechtigkeit,positive,200,right,Fernseher,-200,left,200,right,0.04,cross,None,m,True,0.446336984634 72 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,20,Sturz,negative,200,right,Diskette,-200,left,200,right,1,cross,None,m,True,0.564458847046 73 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,21,Lebensfreude,positive,200,right,November,-200,left,200,right,1,cross,None,m,True,0.336798191071 74 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,22,Hass,negative,-200,right,Dusche,200,right,-200,left,0.04,cross,None,x,True,0.382565021515 75 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,23,Herzlichkeit,positive,-200,right,Kleiderhaken,200,right,200,right,0.04,cross,None,m,True,0.490936994553 76 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,24,Totschlag,negative,200,right,Kunde,-200,left,-200,left,1,cross,None,m,False,0.240520954132 77 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,0,Gefängnis,negative,200,right,Pullover,-200,left,200,right,1,hole,left,m,True,0.340106964111 78 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,1,Schock,negative,-200,right,Dezember,200,right,200,right,0.04,hole,left,m,True,0.320808172226 79 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,2,Schrei,negative,-200,right,Platz,200,right,200,right,1,hole,left,m,True,0.302872896194 80 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,3,Ehrlichkeit,positive,-200,right,Herr,200,right,-200,left,0.04,hole,left,x,True,0.395108938217 81 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,4,Beliebtheit,positive,-200,right,Baum,200,right,200,right,1,hole,left,m,True,0.311517953873 82 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,5,Liebe,positive,200,right,Strumpf,-200,left,200,right,0.04,hole,left,m,True,0.338933944702 83 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,6,Unfall,negative,-200,right,Tee,200,right,-200,left,0.04,hole,right,x,True,0.47004699707 84 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,7,Neid,negative,-200,right,Brücke,200,right,200,right,1,hole,left,m,True,0.272204875946 85 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,8,Geisel,negative,200,right,Drucker,-200,left,200,right,1,hole,left,m,True,0.277760982513 86 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,9,Freundschaft,positive,-200,right,Park,200,right,200,right,0.04,hole,left,m,True,0.338291168213 87 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,10,Bereicherung,positive,-200,right,Bahnhof,200,right,200,right,1,hole,right,m,True,0.336519002914 88 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,11,Regen,negative,200,right,Kugelschrieber,-200,left,200,right,0.04,hole,right,m,True,0.567709922791 89 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,12,Attraktivität,positive,-200,right,Laden,200,right,-200,left,1,hole,right,x,True,0.4016289711 90 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,13,Treue,positive,200,right,August,-200,left,-200,left,1,hole,left,x,True,0.489666938782 91 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,14,Hässlichkeit,negative,200,right,Hut,-200,left,200,right,1,hole,left,m,True,0.43345618248 92 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,15,Trennung,negative,200,right,Kaffee,-200,left,200,right,1,hole,left,m,True,0.424556970596 93 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,16,Zuverlässigkeit,positive,-200,right,Beschreibung,200,right,-200,left,0.04,hole,right,x,True,0.41254401207 94 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,17,Verzweiflung,negative,200,right,Passant,-200,left,-200,left,0.04,hole,left,x,True,0.42169213295 95 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,18,Feind,negative,200,right,Einwohner,-200,left,-200,left,1,hole,left,x,True,0.533508062363 96 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,19,Freiheit,positive,-200,right,Finger,200,right,200,right,1,hole,left,m,True,0.325438976288 97 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,20,Verehrung,positive,-200,right,Eile,200,right,200,right,0.04,hole,right,m,True,0.470000982285 98 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,21,Krankheit,negative,200,right,Septmeber,-200,left,-200,left,0.04,hole,left,x,True,0.341910123825 99 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,22,Belohnung,positive,200,right,Cola,-200,left,-200,left,0.04,hole,right,x,True,0.377681016922 100 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,23,Mut,positive,-200,right,Zucker,200,right,-200,left,0.04,hole,right,m,False,0.305406093597 101 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,24,Optimismus,positive,200,right,Bus,-200,left,-200,left,0.04,hole,left,x,True,0.377147912979 102 | -------------------------------------------------------------------------------- /ExampleExperiments/hog3/experiment/der_pate.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ExampleExperiments/hog3/experiment/der_pate.jpg -------------------------------------------------------------------------------- /ExampleExperiments/hog3/experiment/don_corleone.jfif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ExampleExperiments/hog3/experiment/don_corleone.jfif -------------------------------------------------------------------------------- /ExampleExperiments/hog3/experiment/dot_probe_new.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | 5 | from __future__ import unicode_literals, print_function 6 | from psychopy import visual, event, core, sound, monitors, gui 7 | from random import choice, shuffle 8 | 9 | import sys 10 | reload(sys) 11 | sys.setdefaultencoding('utf8') 12 | 13 | 14 | def draw_and_wait(stim, time=.9): 15 | "Draw one stimulus, flip, wait." 16 | stim.draw() 17 | win.flip() 18 | core.wait(.9) 19 | 20 | def draw_and_wait_cues(stim_cue, stim_cond, duration): 21 | "Draw one stimulus, flip, wait." 22 | stim_cue.draw() 23 | stim_cond.draw() 24 | win.flip() 25 | core.wait(duration) 26 | 27 | 28 | # Define functions for functionality that will be repeatedly accessed later 29 | def display_text(text): 30 | "Display text and wait for a keypress." 31 | stim = visual.TextStim(win, text= text, color=(0, 0, 0)) # construct the stimulus 32 | stim.draw() # draw it 33 | win.flip() # put it on the screen 34 | event.waitKeys() # wait until a key press 35 | win.flip() # clear the screen 36 | core.wait(.5) # the wait period is in seconds (i.e., 500 msec) 37 | 38 | def display_text_and_image(text, image, duration): 39 | "Display text and wait for a keypress." 40 | text_ = visual.TextStim(win, text= text,pos=(0.0, -250), color="red") # construct the stimulus 41 | text_.draw() # draw it 42 | stim = visual.ImageStim(win, image) # construct the stimulus 43 | stim.draw() 44 | win.flip() # clear the screen 45 | core.wait(duration) # the wait period is in seconds (i.e., 500 msec) 46 | 47 | def one_trial(cue_cond,cue_cond_pos, cue_neutral, cue_neutral_pos, target_pos, target_side, cue_duration): 48 | "Run one single trial, return RT and if the correct answer was given." 49 | correct_response = "x" if target_side == "left" else "m" # Für target pos noch definieren, dass wenn target_pos = -500 target side = left 50 | fixation_directions = ("left", "right") 51 | 52 | # Fixation sign 53 | if (block % 2): 54 | fixation_dir = choice(fixation_directions) 55 | if (fixation_dir == "left"): 56 | fname = 'fingerloch_left.png' # the files are expected to exist in the same directory as this script 57 | else: 58 | fname = 'fingerloch_right.png' # the files are expected to exist in the same directory as this script 59 | stim = visual.ImageStim(win, fname) # create the image stimulus 60 | fixation = "hole" 61 | 62 | else: 63 | stim = visual.TextStim(win, text= "+", height = 60, color=(0, 0, 0)) 64 | fixation = "cross" 65 | fixation_dir = None 66 | 67 | draw_and_wait(stim) 68 | 69 | stim_cond = visual.TextStim(win, text= cue_cond,pos=(cue_cond_pos, 0),height = 45, color=(0, 0, 0))# eine funktion schreiben, die zwei cues auf einmal zeigt 70 | stim_neutral = visual.TextStim(win, text= cue_neutral,pos=(cue_neutral_pos, 0), height = 45, color=(0, 0, 0)) 71 | draw_and_wait_cues(stim_neutral, stim_cond, cue_duration) 72 | 73 | 74 | target = visual.TextStim(win, text= "O", pos=(target_pos, 0), height = 45, color=(0, 0, 0)) 75 | target.draw() 76 | win.flip() 77 | 78 | # Collect response 79 | clock.reset() # response time will be in reference to this time point 80 | try: 81 | key, time = event.waitKeys(keyList=['x', 'm', 'q'], maxWait=2, timeStamped=clock)[0] 82 | except TypeError: 83 | key, time = "miss", -999 # for misses 84 | if key == "q": 85 | win.close() 86 | core.quit() 87 | # Was the response correct? 88 | correct = key == correct_response # i.e., does it equal the correct_response key? 89 | #if not correct: 90 | #error.play() 91 | return time, correct, key, fixation, fixation_dir 92 | 93 | 94 | def one_block(n, n_trials=25, training=False): 95 | "Picking random factor settings, run n_trials trials, then display a message." 96 | cue_positions = (200,-200) # set the possible options for each trial 97 | neutral_cues = list_neutral_cues 98 | cue_conditions = ("positive", "negative") 99 | target_positions = (200, -200) 100 | cue_durations = (.04, 1) 101 | for trial in range(n_trials): # the loop will be run n_trials times 102 | if list_negative_cues and list_positive_cues: 103 | cue_condition = choice(cue_conditions) # damit Experiment nicht abgebrochen wird, weil eine der Listen schon leer 104 | elif not list_negative_cues: 105 | cue_condition = "positive" 106 | elif not list_positive_cues: 107 | cue_condition = "negative" 108 | 109 | cue_cond = list_positive_cues.pop() if cue_condition == "positive" else list_negative_cues.pop() 110 | cue_cond_pos = choice(cue_positions) # select factor settings 111 | cue_cond_side = "right" if cue_cond_pos == 200 else "right" 112 | cue_neutral = list_neutral_cues.pop() 113 | cue_neutral_pos = -cue_cond_pos 114 | cue_neutral_side = "right" if cue_cond_pos == -200 else "left" 115 | target_pos = choice(target_positions) 116 | target_side = "right" if target_pos == 200 else "left" 117 | cue_duration = choice(cue_durations) 118 | time, correct, key, fixation, fixation_dir = one_trial(cue_cond, cue_cond_pos, cue_neutral,cue_neutral_pos, target_pos, target_side, cue_duration) # run one trial with the randomly drawn parameters 119 | if not training: # write the result to the file 120 | with open(logfile, "a") as f: # the 'a' means we append to the file - with a 'w', it would be overwritten! 121 | print(subj_id, age, sex, house, nutella, movie, temp, block, trial, cue_cond, cue_condition, cue_cond_pos, cue_cond_side, cue_neutral,cue_neutral_pos, cue_neutral_side, target_pos, target_side, cue_duration, fixation, fixation_dir, str(key), str(correct), str(time), 122 | sep=",", file=f) # this "sep" separates the columns by a comma 123 | text = ("This was " + ("training " if training else " ") + 124 | "block " + str(n + 1) + ". Any key to continue.") 125 | display_text(text) 126 | 127 | # gui for subject information like code or age 128 | 129 | subj_info = gui.Dlg(title="**Dot-probe**") 130 | subj_info.addText('Probandendaten') 131 | subj_info.addField('Kürzel') 132 | subj_info.addField('Alter:') 133 | subj_info.addField('Geschlecht:', choices=["weiblich", "männlich"]) 134 | subj_info.addField('Welchem Haus Hogwarts ordnest du dich selbst zu?:', choices=["Hufflepuff", "Slytherin", "Ravenclaw", "Gryffindor"]) 135 | subj_info.addField('DIE Nutella oder DAS Nutella ?', choices=["die", "das"]) 136 | subj_info.addField('Der Pate oder Pulp Fiction ?', choices=["Der Pate", "Pulp Fiction"]) 137 | subj_info.addField('Präferierte Duschtemperatur (Grad Celsius):') 138 | 139 | ok_data = subj_info.show() # show dialog and wait for OK or Cancel 140 | 141 | 142 | complete = len(subj_info.data) == len([True for x in subj_info.data if len(x) != 0]) #true, wenn Maske vollständig ausgefüllt 143 | 144 | pictures = ['pulp_fiction.jpeg', 'pulp_fiction_2.jfif', 'pulp_fiction_car.jpeg','pulp_fiction_single.jpeg'] 145 | texts = ["Letzter Versuch...", "Auf jetzt...", "Und noch einmal...", "Versuchs nochmal..."] 146 | 147 | if subj_info.OK and complete: # or if ok_data is not None 148 | print(ok_data) 149 | elif subj_info.OK and not complete: # wenn nicht vollständig ausgefüllt, wird schleife eingeleitet, in der Pbn immer wieder aufgefordert wird, alles auszufüllen 150 | subj_info.addText('Bitte alles ausfüllen!', color = "red") 151 | counter = 0 152 | while subj_info.OK and not complete: 153 | m = monitors.Monitor("default", width=28.8, distance=200) 154 | m.setSizePix([800, 600]) 155 | win = visual.Window( 156 | allowGUI=False, monitor=m, 157 | bitsMode=None, 158 | winType='pyglet', rgb=1, 159 | fullscr=False, 160 | screen=1, units="pix" 161 | ) 162 | fname = choice(pictures) # the files are expected to exist in the same directory as this script 163 | text = texts.pop() 164 | display_text_and_image(text,fname,.8) 165 | win.close() 166 | ok_data = subj_info.show() # show dialog and wait for OK or Cancel 167 | complete = len(subj_info.data) == len([True for x in subj_info.data if len(x) != 0]) 168 | counter += 1 169 | print(ok_data) 170 | if not subj_info.OK or counter >= 4: 171 | core.quit() 172 | 173 | else: 174 | print('Experiment abgebrochen') 175 | core.quit() 176 | 177 | subj_id = subj_info.data[0] 178 | age = subj_info.data[1] 179 | sex = subj_info.data[2] 180 | house = subj_info.data[3] 181 | nutella = subj_info.data[4] 182 | movie = subj_info.data[5] 183 | temp = subj_info.data[6] 184 | 185 | 186 | # With Psychopy, we have to manually create a monitor 187 | m = monitors.Monitor("default", width=28.8, distance=200) 188 | m.setSizePix([800, 600]) 189 | 190 | win = visual.Window( 191 | allowGUI=False, monitor=m, 192 | bitsMode=None, 193 | winType='pyglet', rgb=1, 194 | fullscr=True, 195 | screen=1, units="pix" 196 | ) 197 | 198 | clock = core.Clock() 199 | 200 | # We write to a comma-separated log file - as the name, we chose the current date. 201 | # For now, we just write the header column to the file. 202 | logfile = str(subj_id) + ".csv" # the 'str' converts the numeric time into a string 203 | with open(logfile, "w") as f: # note the 'w': it means a new file will be created 204 | print("subject,age,sex,house,nutella,movie,temperature,block,trial,cue_cond,cue_valence,cue_cond_pos,cue_cond_side,cue_neutral,cue_neutral_pos,cue_neutral_side,target_pos,target_side,duration,fixation,fixation_direction,response,correct,rt", file=f) 205 | # eichtig, dass keine Leerzeichen zwischen spaltennamen, da sonst teil des namens 206 | 207 | n_experiment_blocks = 4 208 | n_training_blocks = 0 209 | 210 | 211 | list_neutral_cues = ["Anruf", "Anzug", "Apfel", "August", "April", "Ausweis", "Bahnhof", "Balkon", "Baum", "Berg", "Bildschirm", "Bus", "Computer", "Dezember", "Dienstag", "Drucker", 212 | "Eintrittskarte", "Einwohner", "Fahrschein", "Februar", "Fernseher", "Finger", "Flughafen", "Flur", "Füller", "Fuß", "Fußboden", "Garten", "Gast", "Geburtstag", 213 | "Hafen", "Herr", "Hut", "Januar", "Juli", "Juni", "Kaffee", "Kakao", "Keller", "Kellner", "Kleiderhaken", "Koch", "Kugelschrieber", "Kunde", "Laden", "Locher", 214 | "Löffel", "Mai", "März", "Markt", "Marktplatz", "Monitor", "Name", "November", "Oktober", "Park", "Pass", "Passant", "Platz", "Projektor", "Pullover", 215 | "RadiergummI", "Rock", "Schinken", "Schlüssel", "Schrank", "Septmeber", "Sessel", "Strumpf", "Stuhl", "Supermarkt", "Tag", "Tee", "Teppich", "Tisch", "Wagen", 216 | "Wind", "Zeiger", "Zucker", "Zug", "Zuschauer", "Adresse", "Apfelsine", "Apotheke", "Bank", "Bankkarte", "Bedienung", "Beschreibung", "Bestellung", 217 | "Bibliothek", "Bluse", "Brille", "Brücke", "Cola", "Decke", "Diskette", "Dolmetscherin", "Dose", "Dusche", "Eile"] 218 | 219 | list_positive_cues = ["Attraktivität", "Anerkennung", "Belohnung", "Bereicherung", "Bewunderung", "Beliebtheit", "Dankbarkeit", "Ehrlichkeit", "Eleganz", "Entspannung", "Erfolg", 220 | "Frieden", "Freundschaft", "Frohsinn", "Freiheit", "Genuss", "Gerechtigkeit", "Gesundheit", "Glück", "Geschenk", "Harmonie", "Herzlichkeit", "Höflichkeit", "Hilfsbereitschaft", 221 | "Kraft", "Kostbarkeit", "Lachen", "Lebensfreude", "Liebe", "Leidenschaft", "Mut", "Optimismus", "Reichtum", "Rücksichtnahme", "Schönheit", "Schatz", "Sicherheit", "Solidarität", 222 | "Spaß", "Stärke", "Sympathie", "Treue", "Tapferkeit", "Unterstützung", "Vergnügen", "Verehrung", "Wohlstand", "Wohlbefinden", "Zufriedenheit", "Zuverlässigkeit"] #Umlaute v.a. ä machen manchmal Probleme 223 | 224 | list_negative_cues = ["Mord", "Totschlag", "Schmerz", "Leid", "Waffe", "Tod", "Wunde", "Trauer", "Trennung", "Heimweh", "Gefängnis", "Einsamkeit", "Regen", "Depression", "Krankheit", 225 | "Angst", "Verletzung", "Hass", "Wut", "Panik", "Rache", "Gestank", "Folter", "Krieg", "Bombe", "Droge", "Sucht", "Verzweiflung", "Unfall", "Qual", "Neid", "Ekel", "Terror", "Unglück", 226 | "Anschlag", "Koma", "Hässlichkeit", "Dummheit", "Sturz", "Schleim", "Übelkeit", "Schock", "Schrei", "Armut", "Pessimismus", "Schrott", "Geisel", "Müll", "Feind", "Horror"] 227 | 228 | shuffle(list_neutral_cues) 229 | shuffle(list_positive_cues) 230 | shuffle(list_negative_cues) 231 | 232 | 233 | 234 | # Show the instruction screen 235 | text = (""" 236 | Press "x" if the O appears on the left and "m" if it appears on the right. 237 | Each dot is preceded by a fixation sign and two words. 238 | We begin with 2 training blocks. 239 | 240 | Any key to continue. Press "q" instead of "x"/"m" to quit. 241 | """) 242 | display_text(text) 243 | 244 | # Run the training 245 | for block in range(n_training_blocks): # ? = anzahl der triningsblöcke /zahl eintragen 246 | one_block(block, training=True) # ? = anzahl der trials pro block /zahl eintragen 247 | 248 | text = (""" 249 | Training finished. The actual experiment begins. 250 | Any key to continue. 251 | """) 252 | display_text(text) 253 | 254 | # Run the actual experiment 255 | for block in range(n_experiment_blocks): # anzahl der blöcke /zahl 256 | one_block(block) # anzahl der trials pro block /zahl 257 | 258 | # Finish 259 | text = """Experiment finished. Thank you!""" 260 | fname = "der_pate.jpg" 261 | display_text_and_image(text, fname, 2) 262 | 263 | win.close() 264 | core.quit() -------------------------------------------------------------------------------- /ExampleExperiments/hog3/experiment/fingerloch_left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ExampleExperiments/hog3/experiment/fingerloch_left.png -------------------------------------------------------------------------------- /ExampleExperiments/hog3/experiment/fingerloch_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ExampleExperiments/hog3/experiment/fingerloch_right.png -------------------------------------------------------------------------------- /ExampleExperiments/hog3/experiment/pulp_fiction.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ExampleExperiments/hog3/experiment/pulp_fiction.jpg -------------------------------------------------------------------------------- /ExampleExperiments/hog3/experiment/pulp_fiction_2.jfif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ExampleExperiments/hog3/experiment/pulp_fiction_2.jfif -------------------------------------------------------------------------------- /ExampleExperiments/hog3/experiment/pulp_fiction_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ExampleExperiments/hog3/experiment/pulp_fiction_2.jpg -------------------------------------------------------------------------------- /ExampleExperiments/hog3/experiment/pulp_fiction_car.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ExampleExperiments/hog3/experiment/pulp_fiction_car.jpg -------------------------------------------------------------------------------- /ExampleExperiments/hog3/experiment/pulp_fiction_single.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ExampleExperiments/hog3/experiment/pulp_fiction_single.jpg -------------------------------------------------------------------------------- /ExampleExperiments/hog3/experiment/pulp_fiction_toilet.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ExampleExperiments/hog3/experiment/pulp_fiction_toilet.jpg -------------------------------------------------------------------------------- /ExampleExperiments/hog4/csv/AS.csv: -------------------------------------------------------------------------------- 1 | subject,age,sex,house,nutella,movie,temperature,block,trial,cue_cond,cue_valence,cue_cond_pos,cue_cond_side,cue_neutral,cue_neutral_pos,cue_neutral_side,target_pos,target_side,duration,fixation,fixation_direction,response,correct,rt 2 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,0,Bereicherung,positive,-200,right,Zeiger,200,right,-200,left,1,cross,None,x,True,0.486207962036 3 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,1,Müll,negative,-200,right,Anzug,200,right,-200,left,0.04,cross,None,x,True,0.655388832092 4 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,2,Kostbarkeit,positive,-200,right,Füller,200,right,-200,left,0.04,cross,None,x,True,0.578408956528 5 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,3,Feind,negative,200,right,Apfel,-200,left,200,right,1,cross,None,m,True,0.512787103653 6 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,4,Wohlstand,positive,-200,right,Finger,200,right,200,right,0.04,cross,None,m,True,0.571825027466 7 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,5,Gesundheit,positive,-200,right,Projektor,200,right,-200,left,1,cross,None,x,True,0.387979030609 8 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,6,Dummheit,negative,-200,right,Wind,200,right,-200,left,0.04,cross,None,x,True,0.366054058075 9 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,7,Anschlag,negative,200,right,Strumpf,-200,left,200,right,1,cross,None,m,True,0.325329065323 10 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,8,Schrott,negative,-200,right,Dienstag,200,right,-200,left,0.04,cross,None,x,True,0.35547709465 11 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,9,Rücksichtnahme,positive,200,right,Apfelsine,-200,left,200,right,0.04,cross,None,m,True,0.411461114883 12 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,10,Stärke,positive,200,right,Fußboden,-200,left,-200,left,0.04,cross,None,x,True,0.449037075043 13 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,11,Terror,negative,200,right,Supermarkt,-200,left,200,right,1,cross,None,m,True,0.289067983627 14 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,12,Treue,positive,-200,right,Geburtstag,200,right,200,right,1,cross,None,m,True,0.307241916656 15 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,13,Frohsinn,positive,200,right,Flughafen,-200,left,200,right,1,cross,None,m,True,0.401762008667 16 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,14,Mord,negative,200,right,Fernseher,-200,left,-200,left,0.04,cross,None,x,True,0.485171079636 17 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,15,Sicherheit,positive,200,right,Zug,-200,left,-200,left,0.04,cross,None,x,True,0.485707044601 18 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,16,Dankbarkeit,positive,-200,right,Septmeber,200,right,200,right,0.04,cross,None,m,True,0.391247987747 19 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,17,Sturz,negative,200,right,Bahnhof,-200,left,-200,left,0.04,cross,None,x,True,0.41061091423 20 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,18,Verletzung,negative,200,right,Mai,-200,left,-200,left,1,cross,None,x,True,0.579967975616 21 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,19,Leidenschaft,positive,200,right,Hafen,-200,left,200,right,1,cross,None,m,True,0.442198991776 22 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,20,Übelkeit,negative,-200,right,Dusche,200,right,-200,left,0.04,cross,None,x,True,0.359862089157 23 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,21,Herzlichkeit,positive,-200,right,Koch,200,right,-200,left,1,cross,None,x,True,0.454195022583 24 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,22,Harmonie,positive,200,right,Marktplatz,-200,left,-200,left,1,cross,None,x,True,0.396909952164 25 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,23,Geschenk,positive,200,right,Dose,-200,left,200,right,1,cross,None,m,True,0.344512939453 26 | AS,22,männlich,Gryffindor,das,Der Pate,38,0,24,Erfolg,positive,-200,right,Park,200,right,200,right,0.04,cross,None,m,True,1.14066314697 27 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,0,Kraft,positive,-200,right,Kaffee,200,right,-200,left,0.04,hole,right,x,True,0.511862039566 28 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,1,Tapferkeit,positive,200,right,Computer,-200,left,200,right,0.04,hole,right,m,True,0.380887985229 29 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,2,Freiheit,positive,200,right,Schinken,-200,left,-200,left,0.04,hole,right,x,True,0.502115011215 30 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,3,Armut,negative,200,right,Bestellung,-200,left,-200,left,0.04,hole,right,x,True,0.632344961166 31 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,4,Entspannung,positive,200,right,Dezember,-200,left,-200,left,1,hole,right,x,True,0.492266893387 32 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,5,Krankheit,negative,200,right,Oktober,-200,left,200,right,1,hole,left,m,True,0.306730031967 33 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,6,Qual,negative,-200,right,RadiergummI,200,right,-200,left,1,hole,left,x,True,0.317496061325 34 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,7,Wunde,negative,200,right,Hut,-200,left,200,right,0.04,hole,left,m,True,0.481845855713 35 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,8,Krieg,negative,200,right,Garten,-200,left,-200,left,1,hole,left,x,True,0.263292074203 36 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,9,Koma,negative,200,right,Kunde,-200,left,200,right,1,hole,left,m,True,0.491541147232 37 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,10,Gefängnis,negative,200,right,Pass,-200,left,200,right,1,hole,left,m,True,0.35630106926 38 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,11,Bewunderung,positive,200,right,Februar,-200,left,200,right,1,hole,left,m,True,0.318450927734 39 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,12,Sucht,negative,-200,right,Berg,200,right,200,right,1,hole,left,m,True,0.345408916473 40 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,13,Gestank,negative,200,right,Rock,-200,left,200,right,1,hole,right,m,True,0.387167930603 41 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,14,Höflichkeit,positive,-200,right,Bluse,200,right,200,right,0.04,hole,left,m,True,0.828853845596 42 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,15,Eleganz,positive,-200,right,Teppich,200,right,-200,left,0.04,hole,right,x,True,0.506526947021 43 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,16,Wut,negative,-200,right,Ausweis,200,right,200,right,0.04,hole,right,m,True,0.283617019653 44 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,17,Wohlbefinden,positive,-200,right,Kellner,200,right,-200,left,1,hole,left,x,True,0.353450059891 45 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,18,Trennung,negative,-200,right,Monitor,200,right,-200,left,1,hole,right,x,True,0.414686918259 46 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,19,Beliebtheit,positive,-200,right,Cola,200,right,200,right,0.04,hole,right,m,True,0.384083032608 47 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,20,Schrei,negative,200,right,Brücke,-200,left,200,right,1,hole,left,m,True,0.346297979355 48 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,21,Unterstützung,positive,-200,right,Juni,200,right,-200,left,0.04,hole,left,x,True,0.438353061676 49 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,22,Schönheit,positive,200,right,Locher,-200,left,-200,left,0.04,hole,left,x,True,0.421597003937 50 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,23,Genuss,positive,200,right,Markt,-200,left,200,right,0.04,hole,left,m,True,0.354162931442 51 | AS,22,männlich,Gryffindor,das,Der Pate,38,1,24,Verehrung,positive,200,right,Balkon,-200,left,200,right,0.04,hole,right,m,True,0.388411045074 52 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,0,Geisel,negative,200,right,Apotheke,-200,left,200,right,0.04,cross,None,miss,False,-999 53 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,1,Optimismus,positive,200,right,Anruf,-200,left,-200,left,0.04,cross,None,x,True,0.39849615097 54 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,2,Zufriedenheit,positive,-200,right,Einwohner,200,right,200,right,0.04,cross,None,m,True,0.315536975861 55 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,3,Leid,negative,200,right,Januar,-200,left,-200,left,0.04,cross,None,x,True,0.45529794693 56 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,4,Schatz,positive,-200,right,Diskette,200,right,-200,left,0.04,cross,None,x,True,0.544214010239 57 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,5,Sympathie,positive,-200,right,Bedienung,200,right,200,right,0.04,cross,None,m,True,0.347724914551 58 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,6,Lachen,positive,200,right,Name,-200,left,200,right,0.04,cross,None,m,True,0.436815023422 59 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,7,Rache,negative,200,right,Eile,-200,left,-200,left,0.04,cross,None,x,True,0.452027082443 60 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,8,Belohnung,positive,200,right,Herr,-200,left,200,right,1,cross,None,m,True,0.688106060028 61 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,9,Verzweiflung,negative,-200,right,Zucker,200,right,200,right,1,cross,None,m,True,0.455520868301 62 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,10,Neid,negative,-200,right,Bibliothek,200,right,-200,left,1,cross,None,x,True,1.7675049305 63 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,11,Liebe,positive,-200,right,Stuhl,200,right,-200,left,0.04,cross,None,x,True,0.388135910034 64 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,12,Horror,negative,-200,right,Drucker,200,right,200,right,0.04,cross,None,m,True,0.288935899734 65 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,13,Reichtum,positive,200,right,März,-200,left,200,right,0.04,cross,None,m,True,0.407790184021 66 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,14,Folter,negative,-200,right,Tag,200,right,200,right,0.04,cross,None,m,True,0.386962175369 67 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,15,Glück,positive,-200,right,Eintrittskarte,200,right,200,right,0.04,cross,None,m,True,0.35391497612 68 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,16,Zuverlässigkeit,positive,200,right,Bank,-200,left,-200,left,1,cross,None,x,True,0.357412099838 69 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,17,Spaß,positive,200,right,Beschreibung,-200,left,200,right,1,cross,None,m,True,0.285811901093 70 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,18,Lebensfreude,positive,200,right,Adresse,-200,left,-200,left,1,cross,None,x,True,0.303652048111 71 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,19,Solidarität,positive,200,right,Schlüssel,-200,left,-200,left,1,cross,None,x,True,0.368345975876 72 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,20,Hässlichkeit,negative,200,right,Pullover,-200,left,200,right,1,cross,None,m,True,0.200365066528 73 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,21,Attraktivität,positive,200,right,Dolmetscherin,-200,left,200,right,0.04,cross,None,m,True,0.341133117676 74 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,22,Waffe,negative,200,right,Brille,-200,left,-200,left,0.04,cross,None,x,True,0.368072032928 75 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,23,Panik,negative,200,right,Kleiderhaken,-200,left,-200,left,0.04,cross,None,x,True,0.386740922928 76 | AS,22,männlich,Gryffindor,das,Der Pate,38,2,24,Freundschaft,positive,200,right,Fahrschein,-200,left,200,right,0.04,cross,None,m,True,0.638628005981 77 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,0,Unglück,negative,200,right,Gast,-200,left,200,right,1,hole,right,m,True,0.374137878418 78 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,1,Ehrlichkeit,positive,200,right,Platz,-200,left,-200,left,1,hole,left,x,True,0.327959060669 79 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,2,Hilfsbereitschaft,positive,200,right,Zuschauer,-200,left,-200,left,0.04,hole,right,x,True,0.542512178421 80 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,3,Anerkennung,positive,-200,right,Bankkarte,200,right,-200,left,1,hole,left,x,True,0.435552120209 81 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,4,Mut,positive,-200,right,Sessel,200,right,200,right,1,hole,right,m,True,0.458434104919 82 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,5,Angst,negative,-200,right,Laden,200,right,200,right,1,hole,right,m,True,0.440799951553 83 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,6,Unfall,negative,-200,right,November,200,right,-200,left,1,hole,right,x,True,0.323976039886 84 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,7,Totschlag,negative,-200,right,Juli,200,right,-200,left,0.04,hole,left,x,True,0.367884874344 85 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,8,Ekel,negative,200,right,Fuß,-200,left,-200,left,0.04,hole,left,x,True,0.41587805748 86 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,9,Frieden,positive,-200,right,Wagen,200,right,200,right,0.04,hole,left,m,True,0.408548116684 87 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,10,Vergnügen,positive,-200,right,Keller,200,right,-200,left,1,hole,right,x,True,0.388988018036 88 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,11,Depression,negative,-200,right,August,200,right,-200,left,1,hole,right,x,True,0.377820014954 89 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,12,Gerechtigkeit,positive,-200,right,Tee,200,right,-200,left,1,hole,right,x,True,0.382625102997 90 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,13,Schmerz,negative,200,right,Flur,-200,left,200,right,0.04,hole,right,m,True,0.985077142715 91 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,14,Pessimismus,negative,-200,right,Schrank,200,right,-200,left,0.04,hole,left,x,True,0.756101846695 92 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,15,Hass,negative,-200,right,Passant,200,right,-200,left,1,hole,left,x,True,1.04689288139 93 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,16,Einsamkeit,negative,200,right,Kakao,-200,left,-200,left,0.04,hole,right,x,True,0.482745885849 94 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,17,Regen,negative,-200,right,Tisch,200,right,-200,left,1,hole,right,x,True,0.369663953781 95 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,18,Droge,negative,-200,right,Decke,200,right,-200,left,0.04,hole,right,x,True,0.3848528862 96 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,19,Trauer,negative,200,right,April,-200,left,200,right,1,hole,left,m,True,0.45135807991 97 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,20,Schock,negative,-200,right,Bus,200,right,200,right,0.04,hole,left,m,True,0.444674015045 98 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,21,Tod,negative,200,right,Löffel,-200,left,200,right,0.04,hole,left,m,True,0.569194078445 99 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,22,Heimweh,negative,-200,right,Baum,200,right,-200,left,1,hole,right,x,True,0.338884115219 100 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,23,Bombe,negative,-200,right,Kugelschrieber,200,right,-200,left,1,hole,left,x,True,0.546581029892 101 | AS,22,männlich,Gryffindor,das,Der Pate,38,3,24,Schleim,negative,200,right,Bildschirm,-200,left,-200,left,1,hole,right,x,True,0.352849006653 102 | -------------------------------------------------------------------------------- /ExampleExperiments/hog4/csv/CM.csv: -------------------------------------------------------------------------------- 1 | subject,age,sex,house,nutella,movie,temperature,block,trial,cue_cond,cue_valence,cue_cond_pos,cue_cond_side,cue_neutral,cue_neutral_pos,cue_neutral_side,target_pos,target_side,duration,fixation,fixation_direction,response,correct,rt 2 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,0,Kostbarkeit,positive,200,right,Eintrittskarte,-200,left,-200,left,0.04,cross,None,miss,False,-999 3 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,1,Schmerz,negative,200,right,Teppich,-200,left,200,right,0.04,cross,None,m,True,1.00885176659 4 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,2,Armut,negative,-200,right,Rock,200,right,200,right,0.04,cross,None,m,True,0.439181089401 5 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,3,Wohlbefinden,positive,200,right,Adresse,-200,left,-200,left,1,cross,None,x,True,1.06246209145 6 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,4,Anschlag,negative,-200,right,Anruf,200,right,200,right,0.04,cross,None,m,True,0.863609075546 7 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,5,Harmonie,positive,200,right,Dose,-200,left,200,right,1,cross,None,m,True,0.393723011017 8 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,6,Schatz,positive,-200,right,Stuhl,200,right,200,right,0.04,cross,None,m,True,0.393811941147 9 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,7,Panik,negative,-200,right,Dienstag,200,right,200,right,0.04,cross,None,m,True,0.369379997253 10 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,8,Zufriedenheit,positive,200,right,Monitor,-200,left,-200,left,0.04,cross,None,x,True,0.398013830185 11 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,9,Glück,positive,-200,right,Wagen,200,right,-200,left,1,cross,None,x,True,0.446720123291 12 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,10,Pessimismus,negative,-200,right,Koch,200,right,-200,left,1,cross,None,x,True,0.460047960281 13 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,11,Waffe,negative,200,right,Flughafen,-200,left,-200,left,0.04,cross,None,x,True,0.925713062286 14 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,12,Horror,negative,200,right,Wind,-200,left,200,right,1,cross,None,m,True,0.348467111588 15 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,13,Frohsinn,positive,-200,right,Berg,200,right,-200,left,0.04,cross,None,x,True,0.397452116013 16 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,14,Sicherheit,positive,-200,right,Markt,200,right,200,right,0.04,cross,None,m,True,0.373203039169 17 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,15,Genuss,positive,-200,right,Bluse,200,right,200,right,1,cross,None,m,True,0.414644956589 18 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,16,Unglück,negative,-200,right,Juni,200,right,-200,left,0.04,cross,None,x,True,0.413449048996 19 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,17,Solidarität,positive,200,right,Kellner,-200,left,200,right,0.04,cross,None,m,True,0.327472925186 20 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,18,Verletzung,negative,200,right,März,-200,left,-200,left,0.04,cross,None,x,True,0.443737983704 21 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,19,Geschenk,positive,200,right,Tag,-200,left,-200,left,1,cross,None,x,True,0.353622913361 22 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,20,Bewunderung,positive,200,right,Keller,-200,left,200,right,0.04,cross,None,m,True,0.412930011749 23 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,21,Hilfsbereitschaft,positive,200,right,Gast,-200,left,200,right,1,cross,None,m,True,0.429290056229 24 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,22,Mord,negative,200,right,Computer,-200,left,-200,left,1,cross,None,x,True,0.435735940933 25 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,23,Frieden,positive,-200,right,Brille,200,right,200,right,1,cross,None,m,True,0.347078084946 26 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,24,Wunde,negative,-200,right,Locher,200,right,200,right,0.04,cross,None,m,True,0.417899847031 27 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,0,Folter,negative,200,right,RadiergummI,-200,left,-200,left,0.04,hole,left,x,True,0.567094802856 28 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,1,Droge,negative,-200,right,Anzug,200,right,-200,left,0.04,hole,right,m,False,0.835239171982 29 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,2,Krieg,negative,200,right,Marktplatz,-200,left,-200,left,1,hole,right,x,True,0.511179924011 30 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,3,Depression,negative,200,right,Tisch,-200,left,200,right,1,hole,left,m,True,0.413212060928 31 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,4,Vergnügen,positive,-200,right,Bestellung,200,right,-200,left,0.04,hole,right,m,False,0.632125139236 32 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,5,Koma,negative,200,right,Flur,-200,left,-200,left,1,hole,left,m,False,0.53478717804 33 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,6,Schönheit,positive,200,right,Fuß,-200,left,200,right,0.04,hole,right,m,True,0.774570941925 34 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,7,Stärke,positive,-200,right,Pass,200,right,200,right,1,hole,right,m,True,0.351526021957 35 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,8,Anerkennung,positive,200,right,Bildschirm,-200,left,200,right,0.04,hole,right,m,True,0.798306941986 36 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,9,Angst,negative,200,right,Garten,-200,left,-200,left,0.04,hole,left,x,True,0.442151069641 37 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,10,Trauer,negative,-200,right,April,200,right,200,right,0.04,hole,right,m,True,0.498654842377 38 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,11,Terror,negative,200,right,Apfel,-200,left,200,right,0.04,hole,left,m,True,0.405672073364 39 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,12,Übelkeit,negative,200,right,Zuschauer,-200,left,200,right,0.04,hole,right,m,True,0.472065210342 40 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,13,Tapferkeit,positive,-200,right,Supermarkt,200,right,-200,left,1,hole,left,x,True,0.410528898239 41 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,14,Schleim,negative,-200,right,Ausweis,200,right,-200,left,0.04,hole,left,x,True,0.359519958496 42 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,15,Rücksichtnahme,positive,-200,right,Schrank,200,right,200,right,1,hole,left,m,True,0.303122997284 43 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,16,Reichtum,positive,-200,right,Zeiger,200,right,-200,left,0.04,hole,right,x,True,0.485352039337 44 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,17,Rache,negative,200,right,Bank,-200,left,-200,left,0.04,hole,left,x,True,0.492990016937 45 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,18,Leidenschaft,positive,-200,right,Apfelsine,200,right,-200,left,0.04,hole,left,miss,False,-999 46 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,19,Eleganz,positive,200,right,Sessel,-200,left,200,right,0.04,hole,right,miss,False,-999 47 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,20,Ekel,negative,200,right,Hafen,-200,left,-200,left,0.04,hole,left,x,True,1.52466797829 48 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,21,Einsamkeit,negative,-200,right,Bankkarte,200,right,200,right,0.04,hole,left,miss,False,-999 49 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,22,Bombe,negative,200,right,Apotheke,-200,left,-200,left,1,hole,left,miss,False,-999 50 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,23,Gesundheit,positive,-200,right,Februar,200,right,200,right,1,hole,right,miss,False,-999 51 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,24,Höflichkeit,positive,-200,right,Name,200,right,-200,left,0.04,hole,left,miss,False,-999 52 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,0,Wut,negative,-200,right,Bedienung,200,right,-200,left,0.04,cross,None,x,True,0.479216098785 53 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,1,Lachen,positive,-200,right,Balkon,200,right,200,right,1,cross,None,m,True,0.90656709671 54 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,2,Sucht,negative,-200,right,Kakao,200,right,-200,left,0.04,cross,None,x,True,0.55303311348 55 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,3,Müll,negative,-200,right,Geburtstag,200,right,200,right,1,cross,None,m,True,0.386737823486 56 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,4,Leid,negative,200,right,Oktober,-200,left,200,right,0.04,cross,None,m,True,0.289903879166 57 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,5,Dummheit,negative,-200,right,Schlüssel,200,right,-200,left,0.04,cross,None,x,True,0.321068048477 58 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,6,Schrott,negative,200,right,Dolmetscherin,-200,left,-200,left,1,cross,None,x,True,0.504285097122 59 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,7,Wohlstand,positive,-200,right,Bibliothek,200,right,-200,left,0.04,cross,None,x,True,0.378205776215 60 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,8,Sympathie,positive,-200,right,Schinken,200,right,200,right,1,cross,None,m,True,0.327483892441 61 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,9,Tod,negative,-200,right,Löffel,200,right,200,right,0.04,cross,None,m,True,0.349638938904 62 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,10,Heimweh,negative,200,right,Juli,-200,left,-200,left,1,cross,None,x,True,0.442924976349 63 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,11,Kraft,positive,200,right,Projektor,-200,left,-200,left,0.04,cross,None,x,True,0.409273862839 64 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,12,Unterstützung,positive,200,right,Zug,-200,left,-200,left,0.04,cross,None,x,True,0.379004955292 65 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,13,Dankbarkeit,positive,-200,right,Mai,200,right,200,right,0.04,cross,None,m,True,0.3792719841 66 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,14,Spaß,positive,-200,right,Decke,200,right,-200,left,0.04,cross,None,x,True,0.424951076508 67 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,15,Qual,negative,-200,right,Fahrschein,200,right,200,right,1,cross,None,m,True,0.388605117798 68 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,16,Gestank,negative,200,right,Füller,-200,left,200,right,1,cross,None,m,True,0.325475931168 69 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,17,Erfolg,positive,200,right,Januar,-200,left,200,right,1,cross,None,m,True,0.383054018021 70 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,18,Entspannung,positive,-200,right,Fußboden,200,right,200,right,0.04,cross,None,m,True,0.371932983398 71 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,19,Gerechtigkeit,positive,200,right,Fernseher,-200,left,200,right,0.04,cross,None,m,True,0.446336984634 72 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,20,Sturz,negative,200,right,Diskette,-200,left,200,right,1,cross,None,m,True,0.564458847046 73 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,21,Lebensfreude,positive,200,right,November,-200,left,200,right,1,cross,None,m,True,0.336798191071 74 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,22,Hass,negative,-200,right,Dusche,200,right,-200,left,0.04,cross,None,x,True,0.382565021515 75 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,23,Herzlichkeit,positive,-200,right,Kleiderhaken,200,right,200,right,0.04,cross,None,m,True,0.490936994553 76 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,24,Totschlag,negative,200,right,Kunde,-200,left,-200,left,1,cross,None,m,False,0.240520954132 77 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,0,Gefängnis,negative,200,right,Pullover,-200,left,200,right,1,hole,left,m,True,0.340106964111 78 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,1,Schock,negative,-200,right,Dezember,200,right,200,right,0.04,hole,left,m,True,0.320808172226 79 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,2,Schrei,negative,-200,right,Platz,200,right,200,right,1,hole,left,m,True,0.302872896194 80 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,3,Ehrlichkeit,positive,-200,right,Herr,200,right,-200,left,0.04,hole,left,x,True,0.395108938217 81 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,4,Beliebtheit,positive,-200,right,Baum,200,right,200,right,1,hole,left,m,True,0.311517953873 82 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,5,Liebe,positive,200,right,Strumpf,-200,left,200,right,0.04,hole,left,m,True,0.338933944702 83 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,6,Unfall,negative,-200,right,Tee,200,right,-200,left,0.04,hole,right,x,True,0.47004699707 84 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,7,Neid,negative,-200,right,Brücke,200,right,200,right,1,hole,left,m,True,0.272204875946 85 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,8,Geisel,negative,200,right,Drucker,-200,left,200,right,1,hole,left,m,True,0.277760982513 86 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,9,Freundschaft,positive,-200,right,Park,200,right,200,right,0.04,hole,left,m,True,0.338291168213 87 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,10,Bereicherung,positive,-200,right,Bahnhof,200,right,200,right,1,hole,right,m,True,0.336519002914 88 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,11,Regen,negative,200,right,Kugelschrieber,-200,left,200,right,0.04,hole,right,m,True,0.567709922791 89 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,12,Attraktivität,positive,-200,right,Laden,200,right,-200,left,1,hole,right,x,True,0.4016289711 90 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,13,Treue,positive,200,right,August,-200,left,-200,left,1,hole,left,x,True,0.489666938782 91 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,14,Hässlichkeit,negative,200,right,Hut,-200,left,200,right,1,hole,left,m,True,0.43345618248 92 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,15,Trennung,negative,200,right,Kaffee,-200,left,200,right,1,hole,left,m,True,0.424556970596 93 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,16,Zuverlässigkeit,positive,-200,right,Beschreibung,200,right,-200,left,0.04,hole,right,x,True,0.41254401207 94 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,17,Verzweiflung,negative,200,right,Passant,-200,left,-200,left,0.04,hole,left,x,True,0.42169213295 95 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,18,Feind,negative,200,right,Einwohner,-200,left,-200,left,1,hole,left,x,True,0.533508062363 96 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,19,Freiheit,positive,-200,right,Finger,200,right,200,right,1,hole,left,m,True,0.325438976288 97 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,20,Verehrung,positive,-200,right,Eile,200,right,200,right,0.04,hole,right,m,True,0.470000982285 98 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,21,Krankheit,negative,200,right,Septmeber,-200,left,-200,left,0.04,hole,left,x,True,0.341910123825 99 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,22,Belohnung,positive,200,right,Cola,-200,left,-200,left,0.04,hole,right,x,True,0.377681016922 100 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,23,Mut,positive,-200,right,Zucker,200,right,-200,left,0.04,hole,right,m,False,0.305406093597 101 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,24,Optimismus,positive,200,right,Bus,-200,left,-200,left,0.04,hole,left,x,True,0.377147912979 102 | -------------------------------------------------------------------------------- /ExampleExperiments/hog4/csv/HU.csv: -------------------------------------------------------------------------------- 1 | subject,age,sex,house,nutella,movie,temperature,block,trial,cue_cond,cue_valence,cue_cond_pos,cue_cond_side,cue_neutral,cue_neutral_pos,cue_neutral_side,target_pos,target_side,duration,fixation,fixation_direction,response,correct,rt 2 | HU,28,männlich,Gryffindor,das,Der Pate,38,0,0,Sympathie,positive,200,right,Januar,-200,left,-200,left,0.04,cross,None,x,True,0.374180078506 3 | HU,28,männlich,Gryffindor,das,Der Pate,38,0,1,Glück,positive,-200,right,Zucker,200,right,200,right,0.04,cross,None,m,True,0.374566078186 4 | HU,28,männlich,Gryffindor,das,Der Pate,38,0,2,Ekel,negative,200,right,Platz,-200,left,-200,left,1,cross,None,x,True,0.320434093475 5 | HU,28,männlich,Gryffindor,das,Der Pate,38,0,3,Vergnügen,positive,200,right,Bluse,-200,left,-200,left,0.04,cross,None,x,True,0.427438020706 6 | HU,28,männlich,Gryffindor,das,Der Pate,38,0,4,Solidarität,positive,-200,right,Laden,200,right,200,right,0.04,cross,None,m,True,0.368706941605 7 | HU,28,männlich,Gryffindor,das,Der Pate,38,0,5,Hass,negative,200,right,Schinken,-200,left,200,right,1,cross,None,m,True,0.3054459095 8 | HU,28,männlich,Gryffindor,das,Der Pate,38,0,6,Schrei,negative,200,right,Herr,-200,left,200,right,1,cross,None,m,True,0.315004110336 9 | HU,28,männlich,Gryffindor,das,Der Pate,38,0,7,Übelkeit,negative,-200,right,Decke,200,right,200,right,0.04,cross,None,m,True,0.375699996948 10 | HU,28,männlich,Gryffindor,das,Der Pate,38,0,8,Qual,negative,-200,right,Dusche,200,right,200,right,1,cross,None,m,True,0.290134906769 11 | HU,28,männlich,Gryffindor,das,Der Pate,38,0,9,Tapferkeit,positive,200,right,Markt,-200,left,-200,left,0.04,cross,None,x,True,0.372627019882 12 | HU,28,männlich,Gryffindor,das,Der Pate,38,0,10,Droge,negative,-200,right,Berg,200,right,-200,left,1,cross,None,x,True,0.33758687973 13 | HU,28,männlich,Gryffindor,das,Der Pate,38,0,11,Freiheit,positive,200,right,Flughafen,-200,left,-200,left,0.04,cross,None,x,True,0.364691972733 14 | HU,28,männlich,Gryffindor,das,Der Pate,38,0,12,Frohsinn,positive,200,right,Bildschirm,-200,left,200,right,1,cross,None,m,True,0.277091026306 15 | HU,28,männlich,Gryffindor,das,Der Pate,38,0,13,Einsamkeit,negative,-200,right,Kunde,200,right,-200,left,1,cross,None,x,True,0.320903778076 16 | HU,28,männlich,Gryffindor,das,Der Pate,38,0,14,Unterstützung,positive,-200,right,Juli,200,right,-200,left,0.04,cross,None,x,True,0.337805986404 17 | HU,28,männlich,Gryffindor,das,Der Pate,38,0,15,Reichtum,positive,200,right,Hut,-200,left,-200,left,1,cross,None,x,True,0.303241968155 18 | HU,28,männlich,Gryffindor,das,Der Pate,38,0,16,Schock,negative,200,right,Anruf,-200,left,200,right,1,cross,None,m,True,0.280985116959 19 | HU,28,männlich,Gryffindor,das,Der Pate,38,0,17,Bombe,negative,200,right,Einwohner,-200,left,200,right,1,cross,None,m,True,0.252400875092 20 | HU,28,männlich,Gryffindor,das,Der Pate,38,0,18,Lebensfreude,positive,-200,right,Dezember,200,right,200,right,0.04,cross,None,m,True,0.300980091095 21 | HU,28,männlich,Gryffindor,das,Der Pate,38,0,19,Dankbarkeit,positive,-200,right,Koch,200,right,200,right,1,cross,None,m,True,0.29425406456 22 | HU,28,männlich,Gryffindor,das,Der Pate,38,0,20,Schleim,negative,200,right,Brille,-200,left,200,right,1,cross,None,m,True,0.315742015839 23 | HU,28,männlich,Gryffindor,das,Der Pate,38,0,21,Höflichkeit,positive,200,right,Füller,-200,left,200,right,1,cross,None,m,True,0.298266887665 24 | HU,28,männlich,Gryffindor,das,Der Pate,38,0,22,Neid,negative,-200,right,Balkon,200,right,200,right,0.04,cross,None,m,True,0.266939163208 25 | HU,28,männlich,Gryffindor,das,Der Pate,38,0,23,Belohnung,positive,200,right,Flur,-200,left,-200,left,1,cross,None,x,True,0.355933904648 26 | HU,28,männlich,Gryffindor,das,Der Pate,38,0,24,Hässlichkeit,negative,200,right,Mai,-200,left,200,right,0.04,cross,None,m,True,0.286645889282 27 | HU,28,männlich,Gryffindor,das,Der Pate,38,1,0,Gerechtigkeit,positive,-200,right,Marktplatz,200,right,-200,left,1,hole,right,x,True,0.322962999344 28 | HU,28,männlich,Gryffindor,das,Der Pate,38,1,1,Gestank,negative,200,right,Baum,-200,left,200,right,1,hole,right,m,True,0.31290602684 29 | HU,28,männlich,Gryffindor,das,Der Pate,38,1,2,Trennung,negative,200,right,Supermarkt,-200,left,200,right,1,hole,right,m,True,0.276728153229 30 | HU,28,männlich,Gryffindor,das,Der Pate,38,1,3,Kostbarkeit,positive,200,right,Finger,-200,left,200,right,1,hole,right,m,True,0.280852079391 31 | HU,28,männlich,Gryffindor,das,Der Pate,38,1,4,Gefängnis,negative,-200,right,Eile,200,right,-200,left,0.04,hole,left,x,True,0.330091953278 32 | HU,28,männlich,Gryffindor,das,Der Pate,38,1,5,Ehrlichkeit,positive,-200,right,Stuhl,200,right,200,right,1,hole,left,m,True,0.275521993637 33 | HU,28,männlich,Gryffindor,das,Der Pate,38,1,6,Bereicherung,positive,200,right,Bestellung,-200,left,-200,left,1,hole,left,x,True,0.336426019669 34 | HU,28,männlich,Gryffindor,das,Der Pate,38,1,7,Wohlstand,positive,-200,right,Wagen,200,right,-200,left,1,hole,left,x,True,0.322844028473 35 | HU,28,männlich,Gryffindor,das,Der Pate,38,1,8,Frieden,positive,200,right,Geburtstag,-200,left,200,right,0.04,hole,right,m,True,0.315559864044 36 | HU,28,männlich,Gryffindor,das,Der Pate,38,1,9,Krieg,negative,-200,right,Fuß,200,right,-200,left,0.04,hole,right,x,True,0.329480171204 37 | HU,28,männlich,Gryffindor,das,Der Pate,38,1,10,Terror,negative,-200,right,Tee,200,right,-200,left,1,hole,right,x,True,0.328400850296 38 | HU,28,männlich,Gryffindor,das,Der Pate,38,1,11,Mord,negative,-200,right,Name,200,right,-200,left,1,hole,right,x,True,0.313040971756 39 | HU,28,männlich,Gryffindor,das,Der Pate,38,1,12,Sturz,negative,200,right,Bank,-200,left,-200,left,0.04,hole,right,x,True,0.463374137878 40 | HU,28,männlich,Gryffindor,das,Der Pate,38,1,13,Geschenk,positive,-200,right,August,200,right,200,right,1,hole,right,m,True,0.285091876984 41 | HU,28,männlich,Gryffindor,das,Der Pate,38,1,14,Schatz,positive,200,right,Locher,-200,left,200,right,0.04,hole,right,m,True,0.328249931335 42 | HU,28,männlich,Gryffindor,das,Der Pate,38,1,15,Angst,negative,200,right,Apfelsine,-200,left,-200,left,1,hole,right,x,True,0.289236068726 43 | HU,28,männlich,Gryffindor,das,Der Pate,38,1,16,Müll,negative,-200,right,Dienstag,200,right,-200,left,1,hole,right,x,True,0.32936000824 44 | HU,28,männlich,Gryffindor,das,Der Pate,38,1,17,Stärke,positive,-200,right,Gast,200,right,-200,left,0.04,hole,left,x,True,0.300309896469 45 | HU,28,männlich,Gryffindor,das,Der Pate,38,1,18,Optimismus,positive,200,right,Tag,-200,left,200,right,0.04,hole,right,m,True,0.333848953247 46 | HU,28,männlich,Gryffindor,das,Der Pate,38,1,19,Unglück,negative,200,right,Eintrittskarte,-200,left,200,right,0.04,hole,left,m,True,0.289823055267 47 | HU,28,männlich,Gryffindor,das,Der Pate,38,1,20,Anerkennung,positive,200,right,November,-200,left,-200,left,1,hole,left,x,True,0.30535697937 48 | HU,28,männlich,Gryffindor,das,Der Pate,38,1,21,Leidenschaft,positive,200,right,Kleiderhaken,-200,left,-200,left,1,hole,left,x,True,0.306453943253 49 | HU,28,männlich,Gryffindor,das,Der Pate,38,1,22,Liebe,positive,200,right,Fernseher,-200,left,-200,left,1,hole,right,x,True,0.356412172318 50 | HU,28,männlich,Gryffindor,das,Der Pate,38,1,23,Entspannung,positive,-200,right,Cola,200,right,200,right,1,hole,left,m,True,0.300554990768 51 | HU,28,männlich,Gryffindor,das,Der Pate,38,1,24,Attraktivität,positive,-200,right,Fahrschein,200,right,-200,left,1,hole,left,x,True,0.287025928497 52 | HU,28,männlich,Gryffindor,das,Der Pate,38,2,0,Herzlichkeit,positive,200,right,März,-200,left,-200,left,0.04,cross,None,x,True,0.307260990143 53 | HU,28,männlich,Gryffindor,das,Der Pate,38,2,1,Mut,positive,-200,right,Teppich,200,right,200,right,1,cross,None,m,True,0.259219884872 54 | HU,28,männlich,Gryffindor,das,Der Pate,38,2,2,Rache,negative,-200,right,Tisch,200,right,-200,left,1,cross,None,x,True,0.336658000946 55 | HU,28,männlich,Gryffindor,das,Der Pate,38,2,3,Geisel,negative,200,right,April,-200,left,-200,left,0.04,cross,None,x,True,0.329514026642 56 | HU,28,männlich,Gryffindor,das,Der Pate,38,2,4,Bewunderung,positive,-200,right,Diskette,200,right,-200,left,1,cross,None,x,True,0.310795068741 57 | HU,28,männlich,Gryffindor,das,Der Pate,38,2,5,Koma,negative,-200,right,Strumpf,200,right,-200,left,1,cross,None,x,True,0.30300283432 58 | HU,28,männlich,Gryffindor,das,Der Pate,38,2,6,Armut,negative,200,right,Bedienung,-200,left,200,right,1,cross,None,m,True,0.272139072418 59 | HU,28,männlich,Gryffindor,das,Der Pate,38,2,7,Depression,negative,-200,right,Fußboden,200,right,-200,left,0.04,cross,None,x,True,0.335475921631 60 | HU,28,männlich,Gryffindor,das,Der Pate,38,2,8,Eleganz,positive,-200,right,Oktober,200,right,-200,left,1,cross,None,x,True,0.304673910141 61 | HU,28,männlich,Gryffindor,das,Der Pate,38,2,9,Hilfsbereitschaft,positive,200,right,Kellner,-200,left,-200,left,1,cross,None,x,True,0.338954925537 62 | HU,28,männlich,Gryffindor,das,Der Pate,38,2,10,Folter,negative,200,right,RadiergummI,-200,left,-200,left,0.04,cross,None,x,True,0.324398040771 63 | HU,28,männlich,Gryffindor,das,Der Pate,38,2,11,Wut,negative,-200,right,Bahnhof,200,right,-200,left,1,cross,None,x,True,0.35148692131 64 | HU,28,männlich,Gryffindor,das,Der Pate,38,2,12,Krankheit,negative,200,right,Beschreibung,-200,left,-200,left,0.04,cross,None,x,True,0.364534854889 65 | HU,28,männlich,Gryffindor,das,Der Pate,38,2,13,Dummheit,negative,200,right,Bibliothek,-200,left,-200,left,0.04,cross,None,x,True,0.291062116623 66 | HU,28,männlich,Gryffindor,das,Der Pate,38,2,14,Sicherheit,positive,-200,right,Apfel,200,right,200,right,1,cross,None,m,True,0.298218011856 67 | HU,28,männlich,Gryffindor,das,Der Pate,38,2,15,Kraft,positive,200,right,Pullover,-200,left,200,right,0.04,cross,None,m,True,0.293482065201 68 | HU,28,männlich,Gryffindor,das,Der Pate,38,2,16,Genuss,positive,200,right,Hafen,-200,left,200,right,0.04,cross,None,m,True,0.275703907013 69 | HU,28,männlich,Gryffindor,das,Der Pate,38,2,17,Zuverlässigkeit,positive,200,right,Dolmetscherin,-200,left,200,right,1,cross,None,m,True,0.363148927689 70 | HU,28,männlich,Gryffindor,das,Der Pate,38,2,18,Wohlbefinden,positive,-200,right,Septmeber,200,right,200,right,1,cross,None,m,True,0.295610904694 71 | HU,28,männlich,Gryffindor,das,Der Pate,38,2,19,Pessimismus,negative,-200,right,Passant,200,right,-200,left,0.04,cross,None,x,True,0.328697919846 72 | HU,28,männlich,Gryffindor,das,Der Pate,38,2,20,Verletzung,negative,-200,right,Dose,200,right,-200,left,0.04,cross,None,x,True,0.368410110474 73 | HU,28,männlich,Gryffindor,das,Der Pate,38,2,21,Regen,negative,200,right,Drucker,-200,left,-200,left,0.04,cross,None,x,True,0.818088054657 74 | HU,28,männlich,Gryffindor,das,Der Pate,38,2,22,Sucht,negative,200,right,Ausweis,-200,left,-200,left,1,cross,None,x,True,0.34207201004 75 | HU,28,männlich,Gryffindor,das,Der Pate,38,2,23,Freundschaft,positive,-200,right,Adresse,200,right,-200,left,1,cross,None,x,True,0.35435295105 76 | HU,28,männlich,Gryffindor,das,Der Pate,38,2,24,Harmonie,positive,-200,right,Schlüssel,200,right,200,right,0.04,cross,None,m,True,0.32634305954 77 | HU,28,männlich,Gryffindor,das,Der Pate,38,3,0,Totschlag,negative,-200,right,Sessel,200,right,-200,left,0.04,hole,right,x,True,0.299287080765 78 | HU,28,männlich,Gryffindor,das,Der Pate,38,3,1,Rücksichtnahme,positive,200,right,Kakao,-200,left,200,right,1,hole,right,m,True,0.281125068665 79 | HU,28,männlich,Gryffindor,das,Der Pate,38,3,2,Horror,negative,200,right,Kugelschrieber,-200,left,200,right,1,hole,left,m,True,0.315223932266 80 | HU,28,männlich,Gryffindor,das,Der Pate,38,3,3,Trauer,negative,-200,right,Bankkarte,200,right,200,right,1,hole,left,m,True,0.276337146759 81 | HU,28,männlich,Gryffindor,das,Der Pate,38,3,4,Wunde,negative,200,right,Bus,-200,left,200,right,1,hole,right,m,True,0.274477958679 82 | HU,28,männlich,Gryffindor,das,Der Pate,38,3,5,Erfolg,positive,-200,right,Brücke,200,right,200,right,1,hole,right,m,True,0.278382062912 83 | HU,28,männlich,Gryffindor,das,Der Pate,38,3,6,Spaß,positive,200,right,Keller,-200,left,200,right,0.04,hole,left,m,True,0.329777002335 84 | HU,28,männlich,Gryffindor,das,Der Pate,38,3,7,Beliebtheit,positive,-200,right,Schrank,200,right,-200,left,0.04,hole,left,x,True,0.32083106041 85 | HU,28,männlich,Gryffindor,das,Der Pate,38,3,8,Verehrung,positive,-200,right,Zug,200,right,-200,left,1,hole,right,x,True,0.309551000595 86 | HU,28,männlich,Gryffindor,das,Der Pate,38,3,9,Gesundheit,positive,200,right,Zeiger,-200,left,-200,left,1,hole,left,x,True,0.388943195343 87 | HU,28,männlich,Gryffindor,das,Der Pate,38,3,10,Lachen,positive,200,right,Apotheke,-200,left,-200,left,1,hole,right,x,True,0.374225854874 88 | HU,28,männlich,Gryffindor,das,Der Pate,38,3,11,Treue,positive,-200,right,Projektor,200,right,-200,left,0.04,hole,right,x,True,0.378000974655 89 | HU,28,männlich,Gryffindor,das,Der Pate,38,3,12,Schrott,negative,-200,right,Juni,200,right,-200,left,0.04,hole,left,x,True,0.343127965927 90 | HU,28,männlich,Gryffindor,das,Der Pate,38,3,13,Feind,negative,200,right,Garten,-200,left,-200,left,0.04,hole,right,x,True,0.352157115936 91 | HU,28,männlich,Gryffindor,das,Der Pate,38,3,14,Zufriedenheit,positive,-200,right,Löffel,200,right,-200,left,0.04,hole,right,x,True,0.368632078171 92 | HU,28,männlich,Gryffindor,das,Der Pate,38,3,15,Schönheit,positive,-200,right,Zuschauer,200,right,200,right,1,hole,left,m,True,0.31464600563 93 | HU,28,männlich,Gryffindor,das,Der Pate,38,3,16,Unfall,negative,-200,right,Rock,200,right,-200,left,0.04,hole,right,x,True,0.370563030243 94 | HU,28,männlich,Gryffindor,das,Der Pate,38,3,17,Waffe,negative,-200,right,Pass,200,right,-200,left,0.04,hole,right,x,True,0.312918901443 95 | HU,28,männlich,Gryffindor,das,Der Pate,38,3,18,Heimweh,negative,-200,right,Anzug,200,right,-200,left,0.04,hole,right,x,True,0.320195913315 96 | HU,28,männlich,Gryffindor,das,Der Pate,38,3,19,Anschlag,negative,-200,right,Computer,200,right,200,right,1,hole,right,m,True,0.301343917847 97 | HU,28,männlich,Gryffindor,das,Der Pate,38,3,20,Verzweiflung,negative,200,right,Park,-200,left,-200,left,1,hole,left,x,True,0.31040096283 98 | HU,28,männlich,Gryffindor,das,Der Pate,38,3,21,Tod,negative,-200,right,Februar,200,right,-200,left,1,hole,right,x,True,0.315072059631 99 | HU,28,männlich,Gryffindor,das,Der Pate,38,3,22,Panik,negative,200,right,Kaffee,-200,left,200,right,0.04,hole,left,m,True,0.333904981613 100 | HU,28,männlich,Gryffindor,das,Der Pate,38,3,23,Schmerz,negative,200,right,Monitor,-200,left,200,right,0.04,hole,right,m,True,0.316057920456 101 | HU,28,männlich,Gryffindor,das,Der Pate,38,3,24,Leid,negative,-200,right,Wind,200,right,-200,left,0.04,hole,left,x,True,0.306860923767 102 | -------------------------------------------------------------------------------- /ExampleExperiments/hog4/experiment/der_pate.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ExampleExperiments/hog4/experiment/der_pate.jpg -------------------------------------------------------------------------------- /ExampleExperiments/hog4/experiment/don_corleone.jfif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ExampleExperiments/hog4/experiment/don_corleone.jfif -------------------------------------------------------------------------------- /ExampleExperiments/hog4/experiment/dot_probe_new.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | 5 | from __future__ import unicode_literals, print_function 6 | from psychopy import visual, event, core, sound, monitors, gui 7 | from random import choice, shuffle 8 | 9 | import sys 10 | reload(sys) 11 | sys.setdefaultencoding('utf8') 12 | 13 | 14 | def draw_and_wait(stim, time=.9): 15 | "Draw one stimulus, flip, wait." 16 | stim.draw() 17 | win.flip() 18 | core.wait(.9) 19 | 20 | def draw_and_wait_cues(stim_cue, stim_cond, duration): 21 | "Draw one stimulus, flip, wait." 22 | stim_cue.draw() 23 | stim_cond.draw() 24 | win.flip() 25 | core.wait(duration) 26 | 27 | 28 | # Define functions for functionality that will be repeatedly accessed later 29 | def display_text(text): 30 | "Display text and wait for a keypress." 31 | stim = visual.TextStim(win, text= text, color=(0, 0, 0)) # construct the stimulus 32 | stim.draw() # draw it 33 | win.flip() # put it on the screen 34 | event.waitKeys() # wait until a key press 35 | win.flip() # clear the screen 36 | core.wait(.5) # the wait period is in seconds (i.e., 500 msec) 37 | 38 | def display_text_and_image(text, image, duration): 39 | "Display text and wait for a keypress." 40 | text_ = visual.TextStim(win, text= text,pos=(0.0, -250), color="red") # construct the stimulus 41 | text_.draw() # draw it 42 | stim = visual.ImageStim(win, image) # construct the stimulus 43 | stim.draw() 44 | win.flip() # clear the screen 45 | core.wait(duration) # the wait period is in seconds (i.e., 500 msec) 46 | 47 | def one_trial(cue_cond,cue_cond_pos, cue_neutral, cue_neutral_pos, target_pos, target_side, cue_duration): 48 | "Run one single trial, return RT and if the correct answer was given." 49 | correct_response = "x" if target_side == "left" else "m" # Für target pos noch definieren, dass wenn target_pos = -500 target side = left 50 | fixation_directions = ("left", "right") 51 | 52 | # Fixation sign 53 | if (block % 2): 54 | fixation_dir = choice(fixation_directions) 55 | if (fixation_dir == "left"): 56 | fname = 'fingerloch_left.png' # the files are expected to exist in the same directory as this script 57 | else: 58 | fname = 'fingerloch_right.png' # the files are expected to exist in the same directory as this script 59 | stim = visual.ImageStim(win, fname) # create the image stimulus 60 | fixation = "hole" 61 | 62 | else: 63 | stim = visual.TextStim(win, text= "+", height = 60, color=(0, 0, 0)) 64 | fixation = "cross" 65 | fixation_dir = None 66 | 67 | draw_and_wait(stim) 68 | 69 | stim_cond = visual.TextStim(win, text= cue_cond,pos=(cue_cond_pos, 0),height = 45, color=(0, 0, 0))# eine funktion schreiben, die zwei cues auf einmal zeigt 70 | stim_neutral = visual.TextStim(win, text= cue_neutral,pos=(cue_neutral_pos, 0), height = 45, color=(0, 0, 0)) 71 | draw_and_wait_cues(stim_neutral, stim_cond, cue_duration) 72 | 73 | 74 | target = visual.TextStim(win, text= "O", pos=(target_pos, 0), height = 45, color=(0, 0, 0)) 75 | target.draw() 76 | win.flip() 77 | 78 | # Collect response 79 | clock.reset() # response time will be in reference to this time point 80 | try: 81 | key, time = event.waitKeys(keyList=['x', 'm', 'q'], maxWait=2, timeStamped=clock)[0] 82 | except TypeError: 83 | key, time = "miss", -999 # for misses 84 | if key == "q": 85 | win.close() 86 | core.quit() 87 | # Was the response correct? 88 | correct = key == correct_response # i.e., does it equal the correct_response key? 89 | #if not correct: 90 | #error.play() 91 | return time, correct, key, fixation, fixation_dir 92 | 93 | 94 | def one_block(n, n_trials=25, training=False): 95 | "Picking random factor settings, run n_trials trials, then display a message." 96 | cue_positions = (200,-200) # set the possible options for each trial 97 | neutral_cues = list_neutral_cues 98 | cue_conditions = ("positive", "negative") 99 | target_positions = (200, -200) 100 | cue_durations = (.04, 1) 101 | for trial in range(n_trials): # the loop will be run n_trials times 102 | if list_negative_cues and list_positive_cues: 103 | cue_condition = choice(cue_conditions) # damit Experiment nicht abgebrochen wird, weil eine der Listen schon leer 104 | elif not list_negative_cues: 105 | cue_condition = "positive" 106 | elif not list_positive_cues: 107 | cue_condition = "negative" 108 | 109 | cue_cond = list_positive_cues.pop() if cue_condition == "positive" else list_negative_cues.pop() 110 | cue_cond_pos = choice(cue_positions) # select factor settings 111 | cue_cond_side = "right" if cue_cond_pos == 200 else "right" 112 | cue_neutral = list_neutral_cues.pop() 113 | cue_neutral_pos = -cue_cond_pos 114 | cue_neutral_side = "right" if cue_cond_pos == -200 else "left" 115 | target_pos = choice(target_positions) 116 | target_side = "right" if target_pos == 200 else "left" 117 | cue_duration = choice(cue_durations) 118 | time, correct, key, fixation, fixation_dir = one_trial(cue_cond, cue_cond_pos, cue_neutral,cue_neutral_pos, target_pos, target_side, cue_duration) # run one trial with the randomly drawn parameters 119 | if not training: # write the result to the file 120 | with open(logfile, "a") as f: # the 'a' means we append to the file - with a 'w', it would be overwritten! 121 | print(subj_id, age, sex, house, nutella, movie, temp, block, trial, cue_cond, cue_condition, cue_cond_pos, cue_cond_side, cue_neutral,cue_neutral_pos, cue_neutral_side, target_pos, target_side, cue_duration, fixation, fixation_dir, str(key), str(correct), str(time), 122 | sep=",", file=f) # this "sep" separates the columns by a comma 123 | text = ("This was " + ("training " if training else " ") + 124 | "block " + str(n + 1) + ". Any key to continue.") 125 | display_text(text) 126 | 127 | # gui for subject information like code or age 128 | 129 | subj_info = gui.Dlg(title="**Dot-probe**") 130 | subj_info.addText('Probandendaten') 131 | subj_info.addField('Kürzel') 132 | subj_info.addField('Alter:') 133 | subj_info.addField('Geschlecht:', choices=["weiblich", "männlich"]) 134 | subj_info.addField('Welchem Haus Hogwarts ordnest du dich selbst zu?:', choices=["Hufflepuff", "Slytherin", "Ravenclaw", "Gryffindor"]) 135 | subj_info.addField('DIE Nutella oder DAS Nutella ?', choices=["die", "das"]) 136 | subj_info.addField('Der Pate oder Pulp Fiction ?', choices=["Der Pate", "Pulp Fiction"]) 137 | subj_info.addField('Präferierte Duschtemperatur (Grad Celsius):') 138 | 139 | ok_data = subj_info.show() # show dialog and wait for OK or Cancel 140 | 141 | 142 | complete = len(subj_info.data) == len([True for x in subj_info.data if len(x) != 0]) #true, wenn Maske vollständig ausgefüllt 143 | 144 | pictures = ['pulp_fiction.jpeg', 'pulp_fiction_2.jfif', 'pulp_fiction_car.jpeg','pulp_fiction_single.jpeg'] 145 | texts = ["Letzter Versuch...", "Auf jetzt...", "Und noch einmal...", "Versuchs nochmal..."] 146 | 147 | if subj_info.OK and complete: # or if ok_data is not None 148 | print(ok_data) 149 | elif subj_info.OK and not complete: # wenn nicht vollständig ausgefüllt, wird schleife eingeleitet, in der Pbn immer wieder aufgefordert wird, alles auszufüllen 150 | subj_info.addText('Bitte alles ausfüllen!', color = "red") 151 | counter = 0 152 | while subj_info.OK and not complete: 153 | m = monitors.Monitor("default", width=28.8, distance=200) 154 | m.setSizePix([800, 600]) 155 | win = visual.Window( 156 | allowGUI=False, monitor=m, 157 | bitsMode=None, 158 | winType='pyglet', rgb=1, 159 | fullscr=False, 160 | screen=1, units="pix" 161 | ) 162 | fname = choice(pictures) # the files are expected to exist in the same directory as this script 163 | text = texts.pop() 164 | display_text_and_image(text,fname,.8) 165 | win.close() 166 | ok_data = subj_info.show() # show dialog and wait for OK or Cancel 167 | complete = len(subj_info.data) == len([True for x in subj_info.data if len(x) != 0]) 168 | counter += 1 169 | print(ok_data) 170 | if not subj_info.OK or counter >= 4: 171 | core.quit() 172 | 173 | else: 174 | print('Experiment abgebrochen') 175 | core.quit() 176 | 177 | subj_id = subj_info.data[0] 178 | age = subj_info.data[1] 179 | sex = subj_info.data[2] 180 | house = subj_info.data[3] 181 | nutella = subj_info.data[4] 182 | movie = subj_info.data[5] 183 | temp = subj_info.data[6] 184 | 185 | 186 | # With Psychopy, we have to manually create a monitor 187 | m = monitors.Monitor("default", width=28.8, distance=200) 188 | m.setSizePix([800, 600]) 189 | 190 | win = visual.Window( 191 | allowGUI=False, monitor=m, 192 | bitsMode=None, 193 | winType='pyglet', rgb=1, 194 | fullscr=True, 195 | screen=1, units="pix" 196 | ) 197 | 198 | clock = core.Clock() 199 | 200 | # We write to a comma-separated log file - as the name, we chose the current date. 201 | # For now, we just write the header column to the file. 202 | logfile = str(subj_id) + ".csv" # the 'str' converts the numeric time into a string 203 | with open(logfile, "w") as f: # note the 'w': it means a new file will be created 204 | print("subject,age,sex,house,nutella,movie,temperature,block,trial,cue_cond,cue_valence,cue_cond_pos,cue_cond_side,cue_neutral,cue_neutral_pos,cue_neutral_side,target_pos,target_side,duration,fixation,fixation_direction,response,correct,rt", file=f) 205 | # eichtig, dass keine Leerzeichen zwischen spaltennamen, da sonst teil des namens 206 | 207 | n_experiment_blocks = 4 208 | n_training_blocks = 0 209 | 210 | 211 | list_neutral_cues = ["Anruf", "Anzug", "Apfel", "August", "April", "Ausweis", "Bahnhof", "Balkon", "Baum", "Berg", "Bildschirm", "Bus", "Computer", "Dezember", "Dienstag", "Drucker", 212 | "Eintrittskarte", "Einwohner", "Fahrschein", "Februar", "Fernseher", "Finger", "Flughafen", "Flur", "Füller", "Fuß", "Fußboden", "Garten", "Gast", "Geburtstag", 213 | "Hafen", "Herr", "Hut", "Januar", "Juli", "Juni", "Kaffee", "Kakao", "Keller", "Kellner", "Kleiderhaken", "Koch", "Kugelschrieber", "Kunde", "Laden", "Locher", 214 | "Löffel", "Mai", "März", "Markt", "Marktplatz", "Monitor", "Name", "November", "Oktober", "Park", "Pass", "Passant", "Platz", "Projektor", "Pullover", 215 | "RadiergummI", "Rock", "Schinken", "Schlüssel", "Schrank", "Septmeber", "Sessel", "Strumpf", "Stuhl", "Supermarkt", "Tag", "Tee", "Teppich", "Tisch", "Wagen", 216 | "Wind", "Zeiger", "Zucker", "Zug", "Zuschauer", "Adresse", "Apfelsine", "Apotheke", "Bank", "Bankkarte", "Bedienung", "Beschreibung", "Bestellung", 217 | "Bibliothek", "Bluse", "Brille", "Brücke", "Cola", "Decke", "Diskette", "Dolmetscherin", "Dose", "Dusche", "Eile"] 218 | 219 | list_positive_cues = ["Attraktivität", "Anerkennung", "Belohnung", "Bereicherung", "Bewunderung", "Beliebtheit", "Dankbarkeit", "Ehrlichkeit", "Eleganz", "Entspannung", "Erfolg", 220 | "Frieden", "Freundschaft", "Frohsinn", "Freiheit", "Genuss", "Gerechtigkeit", "Gesundheit", "Glück", "Geschenk", "Harmonie", "Herzlichkeit", "Höflichkeit", "Hilfsbereitschaft", 221 | "Kraft", "Kostbarkeit", "Lachen", "Lebensfreude", "Liebe", "Leidenschaft", "Mut", "Optimismus", "Reichtum", "Rücksichtnahme", "Schönheit", "Schatz", "Sicherheit", "Solidarität", 222 | "Spaß", "Stärke", "Sympathie", "Treue", "Tapferkeit", "Unterstützung", "Vergnügen", "Verehrung", "Wohlstand", "Wohlbefinden", "Zufriedenheit", "Zuverlässigkeit"] #Umlaute v.a. ä machen manchmal Probleme 223 | 224 | list_negative_cues = ["Mord", "Totschlag", "Schmerz", "Leid", "Waffe", "Tod", "Wunde", "Trauer", "Trennung", "Heimweh", "Gefängnis", "Einsamkeit", "Regen", "Depression", "Krankheit", 225 | "Angst", "Verletzung", "Hass", "Wut", "Panik", "Rache", "Gestank", "Folter", "Krieg", "Bombe", "Droge", "Sucht", "Verzweiflung", "Unfall", "Qual", "Neid", "Ekel", "Terror", "Unglück", 226 | "Anschlag", "Koma", "Hässlichkeit", "Dummheit", "Sturz", "Schleim", "Übelkeit", "Schock", "Schrei", "Armut", "Pessimismus", "Schrott", "Geisel", "Müll", "Feind", "Horror"] 227 | 228 | shuffle(list_neutral_cues) 229 | shuffle(list_positive_cues) 230 | shuffle(list_negative_cues) 231 | 232 | 233 | 234 | # Show the instruction screen 235 | text = (""" 236 | Press "x" if the O appears on the left and "m" if it appears on the right. 237 | Each dot is preceded by a fixation sign and two words. 238 | We begin with 2 training blocks. 239 | 240 | Any key to continue. Press "q" instead of "x"/"m" to quit. 241 | """) 242 | display_text(text) 243 | 244 | # Run the training 245 | for block in range(n_training_blocks): # ? = anzahl der triningsblöcke /zahl eintragen 246 | one_block(block, training=True) # ? = anzahl der trials pro block /zahl eintragen 247 | 248 | text = (""" 249 | Training finished. The actual experiment begins. 250 | Any key to continue. 251 | """) 252 | display_text(text) 253 | 254 | # Run the actual experiment 255 | for block in range(n_experiment_blocks): # anzahl der blöcke /zahl 256 | one_block(block) # anzahl der trials pro block /zahl 257 | 258 | # Finish 259 | text = """Experiment finished. Thank you!""" 260 | fname = "der_pate.jpg" 261 | display_text_and_image(text, fname, 2) 262 | 263 | win.close() 264 | core.quit() -------------------------------------------------------------------------------- /ExampleExperiments/hog4/experiment/fingerloch_left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ExampleExperiments/hog4/experiment/fingerloch_left.png -------------------------------------------------------------------------------- /ExampleExperiments/hog4/experiment/fingerloch_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ExampleExperiments/hog4/experiment/fingerloch_right.png -------------------------------------------------------------------------------- /ExampleExperiments/hog4/experiment/pulp_fiction.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ExampleExperiments/hog4/experiment/pulp_fiction.jpg -------------------------------------------------------------------------------- /ExampleExperiments/hog4/experiment/pulp_fiction_2.jfif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ExampleExperiments/hog4/experiment/pulp_fiction_2.jfif -------------------------------------------------------------------------------- /ExampleExperiments/hog4/experiment/pulp_fiction_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ExampleExperiments/hog4/experiment/pulp_fiction_2.jpg -------------------------------------------------------------------------------- /ExampleExperiments/hog4/experiment/pulp_fiction_car.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ExampleExperiments/hog4/experiment/pulp_fiction_car.jpg -------------------------------------------------------------------------------- /ExampleExperiments/hog4/experiment/pulp_fiction_single.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ExampleExperiments/hog4/experiment/pulp_fiction_single.jpg -------------------------------------------------------------------------------- /ExampleExperiments/hog4/experiment/pulp_fiction_toilet.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ExampleExperiments/hog4/experiment/pulp_fiction_toilet.jpg -------------------------------------------------------------------------------- /ExampleExperiments/hogwarts/csv/CM.csv: -------------------------------------------------------------------------------- 1 | subject,age,sex,house,nutella,movie,temperature,block,trial,cue_cond,cue_valence,cue_cond_pos,cue_cond_side,cue_neutral,cue_neutral_pos,cue_neutral_side,target_pos,target_side,duration,fixation,fixation_direction,response,correct,rt 2 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,0,Kostbarkeit,positive,200,right,Eintrittskarte,-200,left,-200,left,0.04,cross,None,miss,False,-999 3 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,1,Schmerz,negative,200,right,Teppich,-200,left,200,right,0.04,cross,None,m,True,1.00885176659 4 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,2,Armut,negative,-200,right,Rock,200,right,200,right,0.04,cross,None,m,True,0.439181089401 5 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,3,Wohlbefinden,positive,200,right,Adresse,-200,left,-200,left,1,cross,None,x,True,1.06246209145 6 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,4,Anschlag,negative,-200,right,Anruf,200,right,200,right,0.04,cross,None,m,True,0.863609075546 7 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,5,Harmonie,positive,200,right,Dose,-200,left,200,right,1,cross,None,m,True,0.393723011017 8 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,6,Schatz,positive,-200,right,Stuhl,200,right,200,right,0.04,cross,None,m,True,0.393811941147 9 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,7,Panik,negative,-200,right,Dienstag,200,right,200,right,0.04,cross,None,m,True,0.369379997253 10 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,8,Zufriedenheit,positive,200,right,Monitor,-200,left,-200,left,0.04,cross,None,x,True,0.398013830185 11 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,9,Glück,positive,-200,right,Wagen,200,right,-200,left,1,cross,None,x,True,0.446720123291 12 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,10,Pessimismus,negative,-200,right,Koch,200,right,-200,left,1,cross,None,x,True,0.460047960281 13 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,11,Waffe,negative,200,right,Flughafen,-200,left,-200,left,0.04,cross,None,x,True,0.925713062286 14 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,12,Horror,negative,200,right,Wind,-200,left,200,right,1,cross,None,m,True,0.348467111588 15 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,13,Frohsinn,positive,-200,right,Berg,200,right,-200,left,0.04,cross,None,x,True,0.397452116013 16 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,14,Sicherheit,positive,-200,right,Markt,200,right,200,right,0.04,cross,None,m,True,0.373203039169 17 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,15,Genuss,positive,-200,right,Bluse,200,right,200,right,1,cross,None,m,True,0.414644956589 18 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,16,Unglück,negative,-200,right,Juni,200,right,-200,left,0.04,cross,None,x,True,0.413449048996 19 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,17,Solidarität,positive,200,right,Kellner,-200,left,200,right,0.04,cross,None,m,True,0.327472925186 20 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,18,Verletzung,negative,200,right,März,-200,left,-200,left,0.04,cross,None,x,True,0.443737983704 21 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,19,Geschenk,positive,200,right,Tag,-200,left,-200,left,1,cross,None,x,True,0.353622913361 22 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,20,Bewunderung,positive,200,right,Keller,-200,left,200,right,0.04,cross,None,m,True,0.412930011749 23 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,21,Hilfsbereitschaft,positive,200,right,Gast,-200,left,200,right,1,cross,None,m,True,0.429290056229 24 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,22,Mord,negative,200,right,Computer,-200,left,-200,left,1,cross,None,x,True,0.435735940933 25 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,23,Frieden,positive,-200,right,Brille,200,right,200,right,1,cross,None,m,True,0.347078084946 26 | CM,30,männlich,Ravenclaw,das,Der Pate,35,0,24,Wunde,negative,-200,right,Locher,200,right,200,right,0.04,cross,None,m,True,0.417899847031 27 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,0,Folter,negative,200,right,RadiergummI,-200,left,-200,left,0.04,hole,left,x,True,0.567094802856 28 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,1,Droge,negative,-200,right,Anzug,200,right,-200,left,0.04,hole,right,m,False,0.835239171982 29 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,2,Krieg,negative,200,right,Marktplatz,-200,left,-200,left,1,hole,right,x,True,0.511179924011 30 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,3,Depression,negative,200,right,Tisch,-200,left,200,right,1,hole,left,m,True,0.413212060928 31 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,4,Vergnügen,positive,-200,right,Bestellung,200,right,-200,left,0.04,hole,right,m,False,0.632125139236 32 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,5,Koma,negative,200,right,Flur,-200,left,-200,left,1,hole,left,m,False,0.53478717804 33 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,6,Schönheit,positive,200,right,Fuß,-200,left,200,right,0.04,hole,right,m,True,0.774570941925 34 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,7,Stärke,positive,-200,right,Pass,200,right,200,right,1,hole,right,m,True,0.351526021957 35 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,8,Anerkennung,positive,200,right,Bildschirm,-200,left,200,right,0.04,hole,right,m,True,0.798306941986 36 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,9,Angst,negative,200,right,Garten,-200,left,-200,left,0.04,hole,left,x,True,0.442151069641 37 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,10,Trauer,negative,-200,right,April,200,right,200,right,0.04,hole,right,m,True,0.498654842377 38 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,11,Terror,negative,200,right,Apfel,-200,left,200,right,0.04,hole,left,m,True,0.405672073364 39 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,12,Übelkeit,negative,200,right,Zuschauer,-200,left,200,right,0.04,hole,right,m,True,0.472065210342 40 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,13,Tapferkeit,positive,-200,right,Supermarkt,200,right,-200,left,1,hole,left,x,True,0.410528898239 41 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,14,Schleim,negative,-200,right,Ausweis,200,right,-200,left,0.04,hole,left,x,True,0.359519958496 42 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,15,Rücksichtnahme,positive,-200,right,Schrank,200,right,200,right,1,hole,left,m,True,0.303122997284 43 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,16,Reichtum,positive,-200,right,Zeiger,200,right,-200,left,0.04,hole,right,x,True,0.485352039337 44 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,17,Rache,negative,200,right,Bank,-200,left,-200,left,0.04,hole,left,x,True,0.492990016937 45 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,18,Leidenschaft,positive,-200,right,Apfelsine,200,right,-200,left,0.04,hole,left,miss,False,-999 46 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,19,Eleganz,positive,200,right,Sessel,-200,left,200,right,0.04,hole,right,miss,False,-999 47 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,20,Ekel,negative,200,right,Hafen,-200,left,-200,left,0.04,hole,left,x,True,1.52466797829 48 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,21,Einsamkeit,negative,-200,right,Bankkarte,200,right,200,right,0.04,hole,left,miss,False,-999 49 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,22,Bombe,negative,200,right,Apotheke,-200,left,-200,left,1,hole,left,miss,False,-999 50 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,23,Gesundheit,positive,-200,right,Februar,200,right,200,right,1,hole,right,miss,False,-999 51 | CM,30,männlich,Ravenclaw,das,Der Pate,35,1,24,Höflichkeit,positive,-200,right,Name,200,right,-200,left,0.04,hole,left,miss,False,-999 52 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,0,Wut,negative,-200,right,Bedienung,200,right,-200,left,0.04,cross,None,x,True,0.479216098785 53 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,1,Lachen,positive,-200,right,Balkon,200,right,200,right,1,cross,None,m,True,0.90656709671 54 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,2,Sucht,negative,-200,right,Kakao,200,right,-200,left,0.04,cross,None,x,True,0.55303311348 55 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,3,Müll,negative,-200,right,Geburtstag,200,right,200,right,1,cross,None,m,True,0.386737823486 56 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,4,Leid,negative,200,right,Oktober,-200,left,200,right,0.04,cross,None,m,True,0.289903879166 57 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,5,Dummheit,negative,-200,right,Schlüssel,200,right,-200,left,0.04,cross,None,x,True,0.321068048477 58 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,6,Schrott,negative,200,right,Dolmetscherin,-200,left,-200,left,1,cross,None,x,True,0.504285097122 59 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,7,Wohlstand,positive,-200,right,Bibliothek,200,right,-200,left,0.04,cross,None,x,True,0.378205776215 60 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,8,Sympathie,positive,-200,right,Schinken,200,right,200,right,1,cross,None,m,True,0.327483892441 61 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,9,Tod,negative,-200,right,Löffel,200,right,200,right,0.04,cross,None,m,True,0.349638938904 62 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,10,Heimweh,negative,200,right,Juli,-200,left,-200,left,1,cross,None,x,True,0.442924976349 63 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,11,Kraft,positive,200,right,Projektor,-200,left,-200,left,0.04,cross,None,x,True,0.409273862839 64 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,12,Unterstützung,positive,200,right,Zug,-200,left,-200,left,0.04,cross,None,x,True,0.379004955292 65 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,13,Dankbarkeit,positive,-200,right,Mai,200,right,200,right,0.04,cross,None,m,True,0.3792719841 66 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,14,Spaß,positive,-200,right,Decke,200,right,-200,left,0.04,cross,None,x,True,0.424951076508 67 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,15,Qual,negative,-200,right,Fahrschein,200,right,200,right,1,cross,None,m,True,0.388605117798 68 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,16,Gestank,negative,200,right,Füller,-200,left,200,right,1,cross,None,m,True,0.325475931168 69 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,17,Erfolg,positive,200,right,Januar,-200,left,200,right,1,cross,None,m,True,0.383054018021 70 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,18,Entspannung,positive,-200,right,Fußboden,200,right,200,right,0.04,cross,None,m,True,0.371932983398 71 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,19,Gerechtigkeit,positive,200,right,Fernseher,-200,left,200,right,0.04,cross,None,m,True,0.446336984634 72 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,20,Sturz,negative,200,right,Diskette,-200,left,200,right,1,cross,None,m,True,0.564458847046 73 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,21,Lebensfreude,positive,200,right,November,-200,left,200,right,1,cross,None,m,True,0.336798191071 74 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,22,Hass,negative,-200,right,Dusche,200,right,-200,left,0.04,cross,None,x,True,0.382565021515 75 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,23,Herzlichkeit,positive,-200,right,Kleiderhaken,200,right,200,right,0.04,cross,None,m,True,0.490936994553 76 | CM,30,männlich,Ravenclaw,das,Der Pate,35,2,24,Totschlag,negative,200,right,Kunde,-200,left,-200,left,1,cross,None,m,False,0.240520954132 77 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,0,Gefängnis,negative,200,right,Pullover,-200,left,200,right,1,hole,left,m,True,0.340106964111 78 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,1,Schock,negative,-200,right,Dezember,200,right,200,right,0.04,hole,left,m,True,0.320808172226 79 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,2,Schrei,negative,-200,right,Platz,200,right,200,right,1,hole,left,m,True,0.302872896194 80 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,3,Ehrlichkeit,positive,-200,right,Herr,200,right,-200,left,0.04,hole,left,x,True,0.395108938217 81 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,4,Beliebtheit,positive,-200,right,Baum,200,right,200,right,1,hole,left,m,True,0.311517953873 82 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,5,Liebe,positive,200,right,Strumpf,-200,left,200,right,0.04,hole,left,m,True,0.338933944702 83 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,6,Unfall,negative,-200,right,Tee,200,right,-200,left,0.04,hole,right,x,True,0.47004699707 84 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,7,Neid,negative,-200,right,Brücke,200,right,200,right,1,hole,left,m,True,0.272204875946 85 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,8,Geisel,negative,200,right,Drucker,-200,left,200,right,1,hole,left,m,True,0.277760982513 86 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,9,Freundschaft,positive,-200,right,Park,200,right,200,right,0.04,hole,left,m,True,0.338291168213 87 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,10,Bereicherung,positive,-200,right,Bahnhof,200,right,200,right,1,hole,right,m,True,0.336519002914 88 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,11,Regen,negative,200,right,Kugelschrieber,-200,left,200,right,0.04,hole,right,m,True,0.567709922791 89 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,12,Attraktivität,positive,-200,right,Laden,200,right,-200,left,1,hole,right,x,True,0.4016289711 90 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,13,Treue,positive,200,right,August,-200,left,-200,left,1,hole,left,x,True,0.489666938782 91 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,14,Hässlichkeit,negative,200,right,Hut,-200,left,200,right,1,hole,left,m,True,0.43345618248 92 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,15,Trennung,negative,200,right,Kaffee,-200,left,200,right,1,hole,left,m,True,0.424556970596 93 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,16,Zuverlässigkeit,positive,-200,right,Beschreibung,200,right,-200,left,0.04,hole,right,x,True,0.41254401207 94 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,17,Verzweiflung,negative,200,right,Passant,-200,left,-200,left,0.04,hole,left,x,True,0.42169213295 95 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,18,Feind,negative,200,right,Einwohner,-200,left,-200,left,1,hole,left,x,True,0.533508062363 96 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,19,Freiheit,positive,-200,right,Finger,200,right,200,right,1,hole,left,m,True,0.325438976288 97 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,20,Verehrung,positive,-200,right,Eile,200,right,200,right,0.04,hole,right,m,True,0.470000982285 98 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,21,Krankheit,negative,200,right,Septmeber,-200,left,-200,left,0.04,hole,left,x,True,0.341910123825 99 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,22,Belohnung,positive,200,right,Cola,-200,left,-200,left,0.04,hole,right,x,True,0.377681016922 100 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,23,Mut,positive,-200,right,Zucker,200,right,-200,left,0.04,hole,right,m,False,0.305406093597 101 | CM,30,männlich,Ravenclaw,das,Der Pate,35,3,24,Optimismus,positive,200,right,Bus,-200,left,-200,left,0.04,hole,left,x,True,0.377147912979 102 | -------------------------------------------------------------------------------- /ExampleExperiments/hogwarts/experiment/der_pate.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ExampleExperiments/hogwarts/experiment/der_pate.jpg -------------------------------------------------------------------------------- /ExampleExperiments/hogwarts/experiment/don_corleone.jfif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ExampleExperiments/hogwarts/experiment/don_corleone.jfif -------------------------------------------------------------------------------- /ExampleExperiments/hogwarts/experiment/dot_probe_new.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | 5 | from __future__ import unicode_literals, print_function 6 | from psychopy import visual, event, core, sound, monitors, gui 7 | from random import choice, shuffle 8 | 9 | import sys 10 | reload(sys) 11 | sys.setdefaultencoding('utf8') 12 | 13 | 14 | def draw_and_wait(stim, time=.9): 15 | "Draw one stimulus, flip, wait." 16 | stim.draw() 17 | win.flip() 18 | core.wait(.9) 19 | 20 | def draw_and_wait_cues(stim_cue, stim_cond, duration): 21 | "Draw one stimulus, flip, wait." 22 | stim_cue.draw() 23 | stim_cond.draw() 24 | win.flip() 25 | core.wait(duration) 26 | 27 | 28 | # Define functions for functionality that will be repeatedly accessed later 29 | def display_text(text): 30 | "Display text and wait for a keypress." 31 | stim = visual.TextStim(win, text= text, color=(0, 0, 0)) # construct the stimulus 32 | stim.draw() # draw it 33 | win.flip() # put it on the screen 34 | event.waitKeys() # wait until a key press 35 | win.flip() # clear the screen 36 | core.wait(.5) # the wait period is in seconds (i.e., 500 msec) 37 | 38 | def display_text_and_image(text, image, duration): 39 | "Display text and wait for a keypress." 40 | text_ = visual.TextStim(win, text= text,pos=(0.0, -250), color="red") # construct the stimulus 41 | text_.draw() # draw it 42 | stim = visual.ImageStim(win, image) # construct the stimulus 43 | stim.draw() 44 | win.flip() # clear the screen 45 | core.wait(duration) # the wait period is in seconds (i.e., 500 msec) 46 | 47 | def one_trial(cue_cond,cue_cond_pos, cue_neutral, cue_neutral_pos, target_pos, target_side, cue_duration): 48 | "Run one single trial, return RT and if the correct answer was given." 49 | correct_response = "x" if target_side == "left" else "m" # Für target pos noch definieren, dass wenn target_pos = -500 target side = left 50 | fixation_directions = ("left", "right") 51 | 52 | # Fixation sign 53 | if (block % 2): 54 | fixation_dir = choice(fixation_directions) 55 | if (fixation_dir == "left"): 56 | fname = 'fingerloch_left.png' # the files are expected to exist in the same directory as this script 57 | else: 58 | fname = 'fingerloch_right.png' # the files are expected to exist in the same directory as this script 59 | stim = visual.ImageStim(win, fname) # create the image stimulus 60 | fixation = "hole" 61 | 62 | else: 63 | stim = visual.TextStim(win, text= "+", height = 60, color=(0, 0, 0)) 64 | fixation = "cross" 65 | fixation_dir = None 66 | 67 | draw_and_wait(stim) 68 | 69 | stim_cond = visual.TextStim(win, text= cue_cond,pos=(cue_cond_pos, 0),height = 45, color=(0, 0, 0))# eine funktion schreiben, die zwei cues auf einmal zeigt 70 | stim_neutral = visual.TextStim(win, text= cue_neutral,pos=(cue_neutral_pos, 0), height = 45, color=(0, 0, 0)) 71 | draw_and_wait_cues(stim_neutral, stim_cond, cue_duration) 72 | 73 | 74 | target = visual.TextStim(win, text= "O", pos=(target_pos, 0), height = 45, color=(0, 0, 0)) 75 | target.draw() 76 | win.flip() 77 | 78 | # Collect response 79 | clock.reset() # response time will be in reference to this time point 80 | try: 81 | key, time = event.waitKeys(keyList=['x', 'm', 'q'], maxWait=2, timeStamped=clock)[0] 82 | except TypeError: 83 | key, time = "miss", -999 # for misses 84 | if key == "q": 85 | win.close() 86 | core.quit() 87 | # Was the response correct? 88 | correct = key == correct_response # i.e., does it equal the correct_response key? 89 | #if not correct: 90 | #error.play() 91 | return time, correct, key, fixation, fixation_dir 92 | 93 | 94 | def one_block(n, n_trials=25, training=False): 95 | "Picking random factor settings, run n_trials trials, then display a message." 96 | cue_positions = (200,-200) # set the possible options for each trial 97 | neutral_cues = list_neutral_cues 98 | cue_conditions = ("positive", "negative") 99 | target_positions = (200, -200) 100 | cue_durations = (.04, 1) 101 | for trial in range(n_trials): # the loop will be run n_trials times 102 | if list_negative_cues and list_positive_cues: 103 | cue_condition = choice(cue_conditions) # damit Experiment nicht abgebrochen wird, weil eine der Listen schon leer 104 | elif not list_negative_cues: 105 | cue_condition = "positive" 106 | elif not list_positive_cues: 107 | cue_condition = "negative" 108 | 109 | cue_cond = list_positive_cues.pop() if cue_condition == "positive" else list_negative_cues.pop() 110 | cue_cond_pos = choice(cue_positions) # select factor settings 111 | cue_cond_side = "right" if cue_cond_pos == 200 else "right" 112 | cue_neutral = list_neutral_cues.pop() 113 | cue_neutral_pos = -cue_cond_pos 114 | cue_neutral_side = "right" if cue_cond_pos == -200 else "left" 115 | target_pos = choice(target_positions) 116 | target_side = "right" if target_pos == 200 else "left" 117 | cue_duration = choice(cue_durations) 118 | time, correct, key, fixation, fixation_dir = one_trial(cue_cond, cue_cond_pos, cue_neutral,cue_neutral_pos, target_pos, target_side, cue_duration) # run one trial with the randomly drawn parameters 119 | if not training: # write the result to the file 120 | with open(logfile, "a") as f: # the 'a' means we append to the file - with a 'w', it would be overwritten! 121 | print(subj_id, age, sex, house, nutella, movie, temp, block, trial, cue_cond, cue_condition, cue_cond_pos, cue_cond_side, cue_neutral,cue_neutral_pos, cue_neutral_side, target_pos, target_side, cue_duration, fixation, fixation_dir, str(key), str(correct), str(time), 122 | sep=",", file=f) # this "sep" separates the columns by a comma 123 | text = ("This was " + ("training " if training else " ") + 124 | "block " + str(n + 1) + ". Any key to continue.") 125 | display_text(text) 126 | 127 | # gui for subject information like code or age 128 | 129 | subj_info = gui.Dlg(title="**Dot-probe**") 130 | subj_info.addText('Probandendaten') 131 | subj_info.addField('Kürzel') 132 | subj_info.addField('Alter:') 133 | subj_info.addField('Geschlecht:', choices=["weiblich", "männlich"]) 134 | subj_info.addField('Welchem Haus Hogwarts ordnest du dich selbst zu?:', choices=["Hufflepuff", "Slytherin", "Ravenclaw", "Gryffindor"]) 135 | subj_info.addField('DIE Nutella oder DAS Nutella ?', choices=["die", "das"]) 136 | subj_info.addField('Der Pate oder Pulp Fiction ?', choices=["Der Pate", "Pulp Fiction"]) 137 | subj_info.addField('Präferierte Duschtemperatur (Grad Celsius):') 138 | 139 | ok_data = subj_info.show() # show dialog and wait for OK or Cancel 140 | 141 | 142 | complete = len(subj_info.data) == len([True for x in subj_info.data if len(x) != 0]) #true, wenn Maske vollständig ausgefüllt 143 | 144 | pictures = ['pulp_fiction.jpeg', 'pulp_fiction_2.jfif', 'pulp_fiction_car.jpeg','pulp_fiction_single.jpeg'] 145 | texts = ["Letzter Versuch...", "Auf jetzt...", "Und noch einmal...", "Versuchs nochmal..."] 146 | 147 | if subj_info.OK and complete: # or if ok_data is not None 148 | print(ok_data) 149 | elif subj_info.OK and not complete: # wenn nicht vollständig ausgefüllt, wird schleife eingeleitet, in der Pbn immer wieder aufgefordert wird, alles auszufüllen 150 | subj_info.addText('Bitte alles ausfüllen!', color = "red") 151 | counter = 0 152 | while subj_info.OK and not complete: 153 | m = monitors.Monitor("default", width=28.8, distance=200) 154 | m.setSizePix([800, 600]) 155 | win = visual.Window( 156 | allowGUI=False, monitor=m, 157 | bitsMode=None, 158 | winType='pyglet', rgb=1, 159 | fullscr=False, 160 | screen=1, units="pix" 161 | ) 162 | fname = choice(pictures) # the files are expected to exist in the same directory as this script 163 | text = texts.pop() 164 | display_text_and_image(text,fname,.8) 165 | win.close() 166 | ok_data = subj_info.show() # show dialog and wait for OK or Cancel 167 | complete = len(subj_info.data) == len([True for x in subj_info.data if len(x) != 0]) 168 | counter += 1 169 | print(ok_data) 170 | if not subj_info.OK or counter >= 4: 171 | core.quit() 172 | 173 | else: 174 | print('Experiment abgebrochen') 175 | core.quit() 176 | 177 | subj_id = subj_info.data[0] 178 | age = subj_info.data[1] 179 | sex = subj_info.data[2] 180 | house = subj_info.data[3] 181 | nutella = subj_info.data[4] 182 | movie = subj_info.data[5] 183 | temp = subj_info.data[6] 184 | 185 | 186 | # With Psychopy, we have to manually create a monitor 187 | m = monitors.Monitor("default", width=28.8, distance=200) 188 | m.setSizePix([800, 600]) 189 | 190 | win = visual.Window( 191 | allowGUI=False, monitor=m, 192 | bitsMode=None, 193 | winType='pyglet', rgb=1, 194 | fullscr=True, 195 | screen=1, units="pix" 196 | ) 197 | 198 | clock = core.Clock() 199 | 200 | # We write to a comma-separated log file - as the name, we chose the current date. 201 | # For now, we just write the header column to the file. 202 | logfile = str(subj_id) + ".csv" # the 'str' converts the numeric time into a string 203 | with open(logfile, "w") as f: # note the 'w': it means a new file will be created 204 | print("subject,age,sex,house,nutella,movie,temperature,block,trial,cue_cond,cue_valence,cue_cond_pos,cue_cond_side,cue_neutral,cue_neutral_pos,cue_neutral_side,target_pos,target_side,duration,fixation,fixation_direction,response,correct,rt", file=f) 205 | # eichtig, dass keine Leerzeichen zwischen spaltennamen, da sonst teil des namens 206 | 207 | n_experiment_blocks = 4 208 | n_training_blocks = 0 209 | 210 | 211 | list_neutral_cues = ["Anruf", "Anzug", "Apfel", "August", "April", "Ausweis", "Bahnhof", "Balkon", "Baum", "Berg", "Bildschirm", "Bus", "Computer", "Dezember", "Dienstag", "Drucker", 212 | "Eintrittskarte", "Einwohner", "Fahrschein", "Februar", "Fernseher", "Finger", "Flughafen", "Flur", "Füller", "Fuß", "Fußboden", "Garten", "Gast", "Geburtstag", 213 | "Hafen", "Herr", "Hut", "Januar", "Juli", "Juni", "Kaffee", "Kakao", "Keller", "Kellner", "Kleiderhaken", "Koch", "Kugelschrieber", "Kunde", "Laden", "Locher", 214 | "Löffel", "Mai", "März", "Markt", "Marktplatz", "Monitor", "Name", "November", "Oktober", "Park", "Pass", "Passant", "Platz", "Projektor", "Pullover", 215 | "RadiergummI", "Rock", "Schinken", "Schlüssel", "Schrank", "Septmeber", "Sessel", "Strumpf", "Stuhl", "Supermarkt", "Tag", "Tee", "Teppich", "Tisch", "Wagen", 216 | "Wind", "Zeiger", "Zucker", "Zug", "Zuschauer", "Adresse", "Apfelsine", "Apotheke", "Bank", "Bankkarte", "Bedienung", "Beschreibung", "Bestellung", 217 | "Bibliothek", "Bluse", "Brille", "Brücke", "Cola", "Decke", "Diskette", "Dolmetscherin", "Dose", "Dusche", "Eile"] 218 | 219 | list_positive_cues = ["Attraktivität", "Anerkennung", "Belohnung", "Bereicherung", "Bewunderung", "Beliebtheit", "Dankbarkeit", "Ehrlichkeit", "Eleganz", "Entspannung", "Erfolg", 220 | "Frieden", "Freundschaft", "Frohsinn", "Freiheit", "Genuss", "Gerechtigkeit", "Gesundheit", "Glück", "Geschenk", "Harmonie", "Herzlichkeit", "Höflichkeit", "Hilfsbereitschaft", 221 | "Kraft", "Kostbarkeit", "Lachen", "Lebensfreude", "Liebe", "Leidenschaft", "Mut", "Optimismus", "Reichtum", "Rücksichtnahme", "Schönheit", "Schatz", "Sicherheit", "Solidarität", 222 | "Spaß", "Stärke", "Sympathie", "Treue", "Tapferkeit", "Unterstützung", "Vergnügen", "Verehrung", "Wohlstand", "Wohlbefinden", "Zufriedenheit", "Zuverlässigkeit"] #Umlaute v.a. ä machen manchmal Probleme 223 | 224 | list_negative_cues = ["Mord", "Totschlag", "Schmerz", "Leid", "Waffe", "Tod", "Wunde", "Trauer", "Trennung", "Heimweh", "Gefängnis", "Einsamkeit", "Regen", "Depression", "Krankheit", 225 | "Angst", "Verletzung", "Hass", "Wut", "Panik", "Rache", "Gestank", "Folter", "Krieg", "Bombe", "Droge", "Sucht", "Verzweiflung", "Unfall", "Qual", "Neid", "Ekel", "Terror", "Unglück", 226 | "Anschlag", "Koma", "Hässlichkeit", "Dummheit", "Sturz", "Schleim", "Übelkeit", "Schock", "Schrei", "Armut", "Pessimismus", "Schrott", "Geisel", "Müll", "Feind", "Horror"] 227 | 228 | shuffle(list_neutral_cues) 229 | shuffle(list_positive_cues) 230 | shuffle(list_negative_cues) 231 | 232 | 233 | 234 | # Show the instruction screen 235 | text = (""" 236 | Press "x" if the O appears on the left and "m" if it appears on the right. 237 | Each dot is preceded by a fixation sign and two words. 238 | We begin with 2 training blocks. 239 | 240 | Any key to continue. Press "q" instead of "x"/"m" to quit. 241 | """) 242 | display_text(text) 243 | 244 | # Run the training 245 | for block in range(n_training_blocks): # ? = anzahl der triningsblöcke /zahl eintragen 246 | one_block(block, training=True) # ? = anzahl der trials pro block /zahl eintragen 247 | 248 | text = (""" 249 | Training finished. The actual experiment begins. 250 | Any key to continue. 251 | """) 252 | display_text(text) 253 | 254 | # Run the actual experiment 255 | for block in range(n_experiment_blocks): # anzahl der blöcke /zahl 256 | one_block(block) # anzahl der trials pro block /zahl 257 | 258 | # Finish 259 | text = """Experiment finished. Thank you!""" 260 | fname = "der_pate.jpg" 261 | display_text_and_image(text, fname, 2) 262 | 263 | win.close() 264 | core.quit() -------------------------------------------------------------------------------- /ExampleExperiments/hogwarts/experiment/fingerloch_left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ExampleExperiments/hogwarts/experiment/fingerloch_left.png -------------------------------------------------------------------------------- /ExampleExperiments/hogwarts/experiment/fingerloch_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ExampleExperiments/hogwarts/experiment/fingerloch_right.png -------------------------------------------------------------------------------- /ExampleExperiments/hogwarts/experiment/pulp_fiction.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ExampleExperiments/hogwarts/experiment/pulp_fiction.jpg -------------------------------------------------------------------------------- /ExampleExperiments/hogwarts/experiment/pulp_fiction_2.jfif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ExampleExperiments/hogwarts/experiment/pulp_fiction_2.jfif -------------------------------------------------------------------------------- /ExampleExperiments/hogwarts/experiment/pulp_fiction_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ExampleExperiments/hogwarts/experiment/pulp_fiction_2.jpg -------------------------------------------------------------------------------- /ExampleExperiments/hogwarts/experiment/pulp_fiction_car.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ExampleExperiments/hogwarts/experiment/pulp_fiction_car.jpg -------------------------------------------------------------------------------- /ExampleExperiments/hogwarts/experiment/pulp_fiction_single.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ExampleExperiments/hogwarts/experiment/pulp_fiction_single.jpg -------------------------------------------------------------------------------- /ExampleExperiments/hogwarts/experiment/pulp_fiction_toilet.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ExampleExperiments/hogwarts/experiment/pulp_fiction_toilet.jpg -------------------------------------------------------------------------------- /ExampleExperiments/selfpriorisation/csv/log1.02629674075e-05.csv: -------------------------------------------------------------------------------- 1 | block,trial,label,congruence,correct,rt 2 | 1,1,Stuhl,False,True,1.33794454149 3 | 1,2,Stuhl,False,True,0.822817141721 4 | 1,3,Ich,False,False,1.08498549287 5 | 1,4,Stuhl,False,True,1.09551572479 6 | 1,5,Stuhl,False,True,0.85642451053 7 | 1,6,Ich,True,True,1.14138391836 8 | 1,7,Stuhl,False,True,1.0151678102 9 | 1,8,Stuhl,True,True,1.24689021405 10 | 1,9,Stuhl,False,True,1.05285770182 11 | 1,10,Ich,True,True,1.3153848292 12 | 2,1,Stuhl,False,True,1.11655780082 13 | 2,2,Ich,True,True,0.961932944339 14 | 2,3,Stuhl,False,False,1.34515641403 15 | 2,4,Stuhl,True,False,1.4803752825 16 | 2,5,Ich,True,False,1.16667999427 17 | 2,6,Stuhl,False,True,1.67951917999 18 | 2,7,Stuhl,False,True,0.796295068858 19 | 2,8,Stuhl,True,True,1.27454249617 20 | 2,9,Stuhl,False,True,0.991427856687 21 | 2,10,Ich,True,True,1.22127384803 22 | 3,1,Ich,True,True,0.867240822663 23 | 3,2,Stuhl,False,True,0.85044462167 24 | 3,3,Stuhl,False,True,1.03206749611 25 | 3,4,Ich,False,True,1.15821689498 26 | 3,5,Ich,False,True,0.945005462892 27 | 3,6,Ich,False,True,0.674413353832 28 | 3,7,Stuhl,True,True,1.24816239435 29 | 3,8,Ich,True,True,1.11431748061 30 | 3,9,Stuhl,False,True,0.8571369315 31 | 3,10,Stuhl,True,True,1.00378062052 32 | 4,1,Stuhl,False,True,0.98412703843 33 | 4,2,Stuhl,False,True,1.19337953094 34 | 4,3,Stuhl,True,True,0.86646212003 35 | 4,4,Stuhl,True,True,1.43166424703 36 | 4,5,Ich,False,True,0.947345847026 37 | 4,6,Ich,False,True,0.802193281605 38 | 4,7,Ich,False,True,1.33895116752 39 | 4,8,Stuhl,True,False,0.989045565437 40 | 4,9,Ich,True,True,1.07528613366 41 | 4,10,Ich,True,True,0.983270080671 42 | -------------------------------------------------------------------------------- /ExampleExperiments/selfpriorisation/csv/log1.0263043805e-05.csv: -------------------------------------------------------------------------------- 1 | block,trial,label,congruence,correct,rt 2 | 1,1,Stuhl,False,True,0.756487317005 3 | 1,2,Ich,False,False,0.569091711484 4 | 1,3,Ich,False,False,0.482897481532 5 | 1,4,Stuhl,False,True,0.560217166159 6 | 1,5,Stuhl,False,True,0.85737823532 7 | 1,6,Stuhl,True,False,0.470731062742 8 | 1,7,Ich,True,True,0.584666318304 9 | 1,8,Stuhl,False,True,0.78618388137 10 | 1,9,Ich,True,True,0.603604639924 11 | 1,10,Stuhl,True,False,0.67751741939 12 | 2,1,Stuhl,False,True,0.767581247012 13 | 2,2,Stuhl,False,True,0.422260813197 14 | 2,3,Stuhl,True,False,0.976131137839 15 | 2,4,Ich,False,False,0.622563915284 16 | 2,5,Stuhl,True,True,1.0223944039 17 | 2,6,Ich,True,True,0.619452928091 18 | 2,7,Stuhl,True,False,0.736567163549 19 | 2,8,Stuhl,True,True,0.959862064599 20 | 2,9,Ich,True,True,0.663237239816 21 | 2,10,Ich,True,True,0.52609808225 22 | 3,1,Ich,True,True,0.521581484776 23 | 3,2,Ich,False,False,0.553595360412 24 | 3,3,Ich,False,False,0.528586872024 25 | 3,4,Stuhl,False,True,1.08458677966 26 | 3,5,Stuhl,False,True,1.0279317473 27 | 3,6,Stuhl,False,True,0.624150839474 28 | 3,7,Stuhl,True,True,0.768787155452 29 | 3,8,Stuhl,False,True,1.04645227724 30 | 3,9,Stuhl,False,True,0.958891351067 31 | 3,10,Stuhl,True,True,0.760372309276 32 | 4,1,Ich,True,True,0.695042861073 33 | 4,2,Ich,False,True,0.788298925036 34 | 4,3,Stuhl,True,False,0.807539579022 35 | 4,4,Ich,False,True,0.963368179247 36 | 4,5,Stuhl,False,True,0.824215325643 37 | 4,6,Ich,False,True,0.82308681772 38 | 4,7,Stuhl,False,True,1.06674275578 39 | 4,8,Stuhl,False,True,0.771383279614 40 | 4,9,Stuhl,True,True,0.787288869818 41 | 4,10,Ich,True,True,0.699481630421 42 | -------------------------------------------------------------------------------- /ExampleExperiments/selfpriorisation/csv/log1.06905918074e-05.csv: -------------------------------------------------------------------------------- 1 | block,trial,label,congruence,correct,rt 2 | 1,1,Stuhl,False,True,0.543778610694 3 | 1,2,Stuhl,True,False,0.704075039395 4 | 1,3,Ich,True,True,0.54414080791 5 | 1,4,Stuhl,True,True,0.923699543084 6 | 1,5,Ich,True,True,0.543741407439 7 | 1,6,Stuhl,False,True,0.811384196315 8 | 1,7,Ich,False,True,0.676114013013 9 | 1,8,Ich,True,True,0.626568256215 10 | 1,9,Ich,True,True,0.64684702406 11 | 1,10,Stuhl,False,True,0.68697351513 12 | 2,1,Ich,True,True,0.549145714891 13 | 2,2,Stuhl,False,True,0.785079356254 14 | 2,3,Stuhl,True,True,0.709633291355 15 | 2,4,Ich,False,True,0.807159274837 16 | 2,5,Ich,True,True,0.480899121447 17 | 2,6,Stuhl,True,True,0.764888251255 18 | 2,7,Stuhl,False,True,0.623152826272 19 | 2,8,Ich,True,True,0.58365836293 20 | 2,9,Ich,False,True,0.988350677035 21 | 2,10,Ich,True,True,0.630707225342 22 | 3,1,Stuhl,True,True,1.05187545034 23 | 3,2,Stuhl,False,True,1.07565688335 24 | 3,3,Ich,False,False,0.472987229021 25 | 3,4,Ich,False,True,0.816953566489 26 | 3,5,Stuhl,False,True,1.11557341122 27 | 3,6,Ich,True,True,0.811095122739 28 | 3,7,Ich,True,True,0.717362160869 29 | 3,8,Ich,True,True,0.75912816094 30 | 3,9,Ich,True,True,0.414719660637 31 | 3,10,Stuhl,True,True,0.732849405924 32 | 4,1,Stuhl,False,True,0.55127228721 33 | 4,2,Stuhl,True,True,0.932194714143 34 | 4,3,Ich,True,True,0.502934139548 35 | 4,4,Stuhl,True,True,0.953828193655 36 | 4,5,Ich,True,True,0.427845140379 37 | 4,6,Stuhl,True,False,0.575803344444 38 | 4,7,Stuhl,False,True,0.597394061591 39 | 4,8,Ich,True,True,0.616900113533 40 | 4,9,Ich,False,False,0.866791817851 41 | 4,10,Stuhl,False,True,1.45337769216 42 | -------------------------------------------------------------------------------- /ExampleExperiments/selfpriorisation/csv/log1.28287089183e-05.csv: -------------------------------------------------------------------------------- 1 | block,trial,label,congruence,correct,rt 2 | 1,1,Stuhl,True,True,3.1650374919 3 | 1,2,Ich,False,True,2.31173805487 4 | 1,3,Stuhl,False,True,1.50114710039 5 | 1,4,Stuhl,True,True,1.51000233055 6 | 1,5,Ich,True,True,1.88409004898 7 | 1,6,Ich,False,True,2.02155479676 8 | 1,7,Ich,False,True,1.50502094287 9 | 1,8,Stuhl,False,False,0.937288139217 10 | 1,9,Ich,False,True,1.92736213949 11 | 1,10,Ich,True,True,1.34617116491 12 | 2,1,Ich,False,True,1.38418434 13 | 2,2,Ich,False,True,2.23410341222 14 | 2,3,Ich,False,True,0.835110893498 15 | 2,4,Ich,False,True,0.789716506914 16 | 2,5,Stuhl,False,False,1.19619543255 17 | 2,6,Stuhl,False,True,1.83303563602 18 | 2,7,Ich,False,True,1.79385633129 19 | 2,8,Stuhl,False,True,1.67903040618 20 | 2,9,Stuhl,False,True,1.13199458628 21 | 2,10,Ich,True,False,1.11509960423 22 | 3,1,Stuhl,False,True,2.19101562751 23 | 3,2,Stuhl,True,True,1.73562938715 24 | 3,3,Ich,True,True,1.19137782472 25 | 3,4,Ich,True,True,0.954056544673 26 | 3,5,Stuhl,False,True,1.6276338943 27 | 3,6,Ich,True,True,0.926980699207 28 | 3,7,Stuhl,True,False,1.20689500343 29 | 3,8,Stuhl,False,True,2.49912871685 30 | 3,9,Stuhl,True,True,1.98040799571 31 | 3,10,Stuhl,True,True,2.76600776992 32 | 4,1,Ich,False,True,1.75462100787 33 | 4,2,Stuhl,True,True,1.30649581677 34 | 4,3,Stuhl,True,True,1.18650847443 35 | 4,4,Ich,False,True,1.55267788609 36 | 4,5,Ich,True,True,1.22852720007 37 | 4,6,Stuhl,False,True,1.3021062602 38 | 4,7,Ich,False,True,1.15621433352 39 | 4,8,Ich,True,True,1.07294318379 40 | 4,9,Ich,True,True,0.663391782357 41 | 4,10,Ich,False,True,1.0785946577 42 | -------------------------------------------------------------------------------- /ExampleExperiments/selfpriorisation/csv/log4.70385930385e-06.csv: -------------------------------------------------------------------------------- 1 | block,trial,label,congruence,correct,rt 2 | 1,1,Ich,False,True,1.66254038371 3 | 1,2,Stuhl,True,True,1.78829380309 4 | 1,3,Stuhl,False,True,1.17377341507 5 | 1,4,Ich,False,True,1.32125310829 6 | 1,5,Stuhl,True,True,1.54864411237 7 | 1,6,Ich,False,True,2.42011627087 8 | 1,7,Stuhl,False,True,1.30519455806 9 | 1,8,Ich,False,True,1.75629387151 10 | 1,9,Ich,True,True,0.906415423528 11 | 1,10,Ich,False,True,0.865154019341 12 | 2,1,Ich,False,True,0.959989394933 13 | 2,2,Stuhl,True,True,1.55091650435 14 | 2,3,Ich,False,True,0.882421889199 15 | 2,4,Ich,False,True,1.22106474008 16 | 2,5,Ich,False,True,0.717787218757 17 | 2,6,Ich,True,True,1.85887137295 18 | 2,7,Stuhl,True,True,1.07692051118 19 | 2,8,Ich,False,True,1.44019491085 20 | 2,9,Stuhl,True,True,0.953937237679 21 | 2,10,Ich,True,True,0.925002939913 22 | 3,1,Stuhl,False,True,1.03828642658 23 | 3,2,Ich,True,True,0.984903602943 24 | 3,3,Ich,True,True,1.11235810913 25 | 3,4,Ich,True,True,0.675585470204 26 | 3,5,Ich,False,True,0.92687978003 27 | 3,6,Stuhl,True,True,0.925654638327 28 | 3,7,Stuhl,False,True,1.02674614765 29 | 3,8,Stuhl,True,True,1.56098105414 30 | 3,9,Stuhl,False,True,1.36225580018 31 | 3,10,Stuhl,False,True,1.63384298943 32 | 4,1,Stuhl,True,True,0.979614326247 33 | 4,2,Stuhl,True,True,0.814864197426 34 | 4,3,Ich,False,True,1.06779288477 35 | 4,4,Stuhl,True,True,1.06691625633 36 | 4,5,Ich,False,True,1.50317061542 37 | 4,6,Stuhl,False,True,0.945113651671 38 | 4,7,Ich,False,True,0.910054500632 39 | 4,8,Stuhl,True,True,1.1339436948 40 | 4,9,Stuhl,False,True,1.36026008069 41 | 4,10,Stuhl,True,True,1.5259364423 42 | -------------------------------------------------------------------------------- /ExampleExperiments/selfpriorisation/csv/log5.55915175937e-06.csv: -------------------------------------------------------------------------------- 1 | block,trial,label,congruence,correct,rt 2 | 1,1,Ich,True,True,0.681989543664 3 | 1,2,Stuhl,False,True,0.616305592601 4 | 1,3,Stuhl,True,True,0.788640599087 5 | 1,4,Stuhl,True,True,0.769345208813 6 | 1,5,Ich,True,True,0.608238834859 7 | 1,6,Ich,False,True,0.654193781782 8 | 1,7,Stuhl,True,True,0.675256554881 9 | 1,8,Ich,False,False,0.779110929027 10 | 1,9,Stuhl,True,True,0.693771098056 11 | 1,10,Ich,False,True,0.773560756832 12 | 2,1,Stuhl,True,True,0.611605543076 13 | 2,2,Stuhl,True,True,0.579722521332 14 | 2,3,Stuhl,False,True,0.886203295639 15 | 2,4,Stuhl,False,True,0.678347443594 16 | 2,5,Stuhl,True,True,0.681649580118 17 | 2,6,Ich,False,True,0.809050813215 18 | 2,7,Stuhl,False,False,0.60557172462 19 | 2,8,Stuhl,False,True,0.943618221369 20 | 2,9,Ich,True,True,0.884114764849 21 | 2,10,Ich,True,True,0.721318836208 22 | 3,1,Stuhl,False,True,0.723215790043 23 | 3,2,Ich,False,True,1.28218770606 24 | 3,3,Stuhl,True,True,1.37824472756 25 | 3,4,Ich,True,True,0.602393172332 26 | 3,5,Stuhl,False,True,0.755562359584 27 | 3,6,Stuhl,False,True,0.79787135779 28 | 3,7,Stuhl,False,True,0.577594221206 29 | 3,8,Ich,False,True,1.03110474042 30 | 3,9,Ich,True,False,1.02545792449 31 | 3,10,Stuhl,False,True,0.613324176418 32 | 4,1,Ich,True,True,0.82007076373 33 | 4,2,Stuhl,False,True,0.719613886933 34 | 4,3,Stuhl,True,True,0.955300993897 35 | 4,4,Stuhl,True,True,0.944627848949 36 | 4,5,Ich,True,True,0.736644136414 37 | 4,6,Stuhl,True,True,0.886489378172 38 | 4,7,Ich,True,True,0.737830801634 39 | 4,8,Stuhl,True,True,0.665196627218 40 | 4,9,Ich,False,True,1.02298709507 41 | 4,10,Stuhl,True,True,0.852367728512 42 | -------------------------------------------------------------------------------- /ExampleExperiments/selfpriorisation/csv/log9.83534346233e-06.csv: -------------------------------------------------------------------------------- 1 | block,trial,label,congruence,correct,rt 2 | 1,1,Ich,True,False,1.95404628171 3 | 1,2,Ich,False,True,2.84423210555 4 | 1,3,Ich,False,True,4.05416323677 5 | 1,4,Stuhl,True,True,1.80523753424 6 | 1,5,Ich,False,True,1.70885886496 7 | 1,6,Ich,True,True,1.19764678716 8 | 1,7,Ich,False,True,1.25769198697 9 | 1,8,Stuhl,True,False,1.22426935157 10 | 1,9,Stuhl,True,True,1.34998514008 11 | 1,10,Stuhl,True,True,1.52198947618 12 | 2,1,Ich,False,True,1.61218513538 13 | 2,2,Ich,False,True,1.53216093188 14 | 2,3,Ich,False,True,0.963347095687 15 | 2,4,Stuhl,False,True,1.52097857392 16 | 2,5,Stuhl,True,True,1.93419984135 17 | 2,6,Ich,False,True,1.07912106239 18 | 2,7,Stuhl,True,True,1.78682577117 19 | 2,8,Stuhl,False,True,1.15772384494 20 | 2,9,Ich,True,True,1.68453563281 21 | 2,10,Ich,True,True,0.962765099925 22 | 3,1,Stuhl,True,False,1.22514170378 23 | 3,2,Ich,True,True,0.731629823327 24 | 3,3,Stuhl,True,True,1.56724445746 25 | 3,4,Stuhl,True,True,2.35377944456 26 | 3,5,Ich,False,True,1.25094323082 27 | 3,6,Ich,False,True,1.40720759631 28 | 3,7,Stuhl,False,True,1.16855255815 29 | 3,8,Stuhl,False,True,1.14235847261 30 | 3,9,Stuhl,True,True,1.21747056346 31 | 3,10,Ich,False,False,0.985758422582 32 | 4,1,Stuhl,True,True,1.6430693969 33 | 4,2,Stuhl,False,True,1.31835895155 34 | 4,3,Stuhl,False,True,1.24072687465 35 | 4,4,Ich,True,True,0.84320709171 36 | 4,5,Stuhl,False,True,1.25358209625 37 | 4,6,Ich,False,True,1.2778454611 38 | 4,7,Stuhl,True,True,1.06063147182 39 | 4,8,Ich,True,True,0.949456169647 40 | 4,9,Ich,True,True,0.937922305062 41 | 4,10,Stuhl,True,False,0.943783742177 42 | -------------------------------------------------------------------------------- /ExampleExperiments/selfpriorisation/experiment/animals.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ExampleExperiments/selfpriorisation/experiment/animals.png -------------------------------------------------------------------------------- /ExampleExperiments/selfpriorisation/experiment/matching_task.py: -------------------------------------------------------------------------------- 1 | # imports 2 | 3 | from __future__ import unicode_literals, print_function 4 | 5 | from psychopy import visual, event, core, monitors 6 | 7 | from random import choice 8 | 9 | 10 | 11 | # With Psychopy, we have to manually create a monitor 12 | 13 | m = monitors.Monitor("default", width=28.8, distance=200) 14 | 15 | m.setSizePix([800, 600]) 16 | 17 | 18 | 19 | win = visual.Window( 20 | 21 | allowGUI=False, monitor=m, 22 | 23 | bitsMode=None, 24 | 25 | winType='pyglet', rgb=1, 26 | 27 | fullscr=False, 28 | 29 | screen=1, units="pix" 30 | 31 | ) 32 | 33 | 34 | 35 | # We need to create a Clock object to check response times 36 | 37 | clock = core.Clock() 38 | 39 | 40 | 41 | # We write to a comma-separated log file - as the name, we chose the current date. 42 | 43 | # For now, we just write the header column to the file. 44 | 45 | logfile = "log" + str(clock.getTime()) + ".csv" # the 'str' converts the numeric time into a string 46 | 47 | with open(logfile, "w") as f: # note the 'w': it means a new file will be created 48 | 49 | print("block,trial,label,congruence,correct,rt", file=f) 50 | 51 | 52 | 53 | n_experiment_blocks = 4 54 | 55 | n_trials = 10 56 | 57 | size_pic_x = 200 58 | 59 | size_pic_y = size_pic_x 60 | 61 | pos_label = -250 62 | 63 | pos_animal = -pos_label 64 | 65 | 66 | 67 | # Define functions for functionality that will be repeatedly accessed later 68 | 69 | def draw_and_wait(stim, time=.745): 70 | 71 | "Draw one stimulus, flip, wait." 72 | 73 | stim.draw() 74 | 75 | win.flip() 76 | 77 | core.wait(.495) 78 | 79 | 80 | 81 | def display_text(text): 82 | 83 | "Display text and wait for a keypress." 84 | 85 | stim = visual.TextStim(win, text=text, color=(0, 0, 0)) # construct the stimulus 86 | 87 | stim.draw() # draw it 88 | 89 | win.flip() # put it on the screen 90 | 91 | event.waitKeys() # wait until a key press 92 | 93 | win.flip() # clear the screen 94 | 95 | core.wait(.5) # the wait period is in seconds (i.e., 500 msec) 96 | 97 | 98 | 99 | 100 | 101 | def one_trial(label, congruence): 102 | 103 | "Run one trial" 104 | 105 | #fixation cross 106 | 107 | stim = visual.TextStim(win, text='+', color=(0, 0, 0)) 108 | 109 | draw_and_wait(stim) 110 | 111 | 112 | 113 | #show the label 114 | 115 | stim = visual.TextStim(win, text=label, pos=(pos_label, 0), color=(-1, -1, -1)) #Label steht immer links 116 | 117 | stim.draw() 118 | 119 | congruent = "owl.jpg" if label == "Ich" else "bug.jpg" 120 | 121 | incongruent = "owl.jpg" if label == "Stuhl" else "bug.jpg" 122 | 123 | fname = congruent if congruence else incongruent 124 | 125 | stim = visual.ImageStim(win, fname, size=(size_pic_x,size_pic_y), pos=(pos_animal, 0)) 126 | 127 | stim.draw() 128 | 129 | win.flip() #jetzt wird das ganze angezeigt 130 | 131 | 132 | 133 | # Collect response 134 | 135 | clock.reset() # response time will be in reference to this time point 136 | 137 | try: 138 | 139 | key, time = event.waitKeys(keyList=['c', 'm', 'q'], maxWait=5, timeStamped=clock)[0] #wartet 5s 140 | 141 | except TypeError: 142 | 143 | key, time = "miss", -999 # for misses 144 | 145 | if key == "q": 146 | 147 | win.close() 148 | 149 | core.quit() 150 | 151 | if congruence == True: 152 | 153 | correct = key == 'c' 154 | 155 | else: 156 | 157 | correct = key == 'm' 158 | 159 | # Falls eine falsche Antwort gegeben wurde, Signal: 160 | 161 | if not correct: 162 | 163 | fname = 'falsch.jpg' 164 | 165 | stim = visual.ImageStim(win, fname, size=(size_pic_x,size_pic_y)) 166 | 167 | draw_and_wait(stim) 168 | 169 | return time, correct 170 | 171 | 172 | 173 | 174 | 175 | def one_block(n, n_trials): 176 | 177 | "Picking random factor settings, run n_trials trials, then display a message." 178 | 179 | labels = ("Ich", "Stuhl")# labels, damit man die randomisieren kann 180 | 181 | congruences = (True, False) 182 | 183 | for trial in range(n_trials): # the loop will be run n_trials times 184 | 185 | label = choice(labels) # select factor settings 186 | 187 | congruence = choice(congruences) 188 | 189 | time, correct = one_trial(label, congruence) # run one trial with the randomly drawn parameters 190 | 191 | with open(logfile, "a") as f: # the 'a' means we append to the file - with a 'w', it would be overwritten! 192 | 193 | print(n+1, trial+1, label, str(congruence), str(correct), str(time), # checken, ob bei cong wirklich ein str hin muss 194 | 195 | sep=",", file=f) # Werte durch Kommata trennen. Wenn man nicht n+1 schreibt, steht im logfile 0 fuer Block1 196 | 197 | if n+1 == n_experiment_blocks: 198 | 199 | text= ("Danke fuer Ihre Teilnahme. Druecken Sie eine Taste um das Experiment zu beenden.") 200 | 201 | else: 202 | 203 | text = ("Das war Block " + str(n + 1) + " von " + str(n_experiment_blocks) + ". Druecken Sie eine Taste zum Fortfahren.") 204 | 205 | display_text(text) 206 | 207 | 208 | 209 | # Display mit der Instruktion 210 | 211 | text = (""" 212 | 213 | In diesem Experiment sollen Sie sich zwei Woerter mit jeweils einem zugehoerigen Tier merken und darauf reagieren. 214 | Dabei gehoert immer das Wort Ich zur Eule und das Wort Stuhl zum Marienkaefer. 215 | 216 | Ihre Aufgabe ist es, per Tastendruck anzugeben, ob dies die Kombination ist, die Sie zu Beginn gelernt haben. 217 | Wenn Ja, druecken Sie die Taste "C", wenn Nein, druecken Sie die Taste "M". 218 | Vor jedem Durchgang erscheint ein Kreuz, das Sie zunaechst anschauen sollen. 219 | 220 | Bitte praegen Sie sich die Zuordnung jetzt ein und druecken Sie dann eine der beiden Tasten. 221 | 222 | """) 223 | 224 | display_text(text) 225 | 226 | 227 | 228 | 229 | 230 | # Run experiment 231 | 232 | for block in range(n_experiment_blocks): 233 | 234 | one_block(block,n_trials) 235 | 236 | 237 | 238 | win.close() 239 | 240 | core.quit() 241 | 242 | 243 | 244 | -------------------------------------------------------------------------------- /ExampleExperiments/selfrelevant_recog/csv/log1.90734863281e-06.csv: -------------------------------------------------------------------------------- 1 | block,trial,congruence,label,correct,rt 2 | 1,0,False,Ich,True,0.695123910904 3 | 1,1,True,Ich,True,0.483476877213 4 | 1,2,True,Stuhl,False,0.569391012192 5 | 1,3,False,Stuhl,True,0.641884088516 6 | 1,4,True,Stuhl,True,0.529757022858 7 | 1,5,True,Stuhl,True,0.521322011948 8 | 1,6,False,Stuhl,True,0.700714826584 9 | 1,7,False,Stuhl,True,0.680178165436 10 | 1,8,False,Ich,True,0.599258899689 11 | 1,9,False,Ich,True,0.404756069183 12 | 2,0,True,Ich,True,0.692988872528 13 | 2,1,True,Stuhl,True,0.635121822357 14 | 2,2,True,Stuhl,True,0.528324127197 15 | 2,3,False,Ich,True,0.612591028214 16 | 2,4,False,Stuhl,False,0.586966991425 17 | 2,5,True,Ich,True,0.722654104233 18 | 2,6,False,Ich,True,0.743427038193 19 | 2,7,True,Stuhl,True,0.885281801224 20 | 2,8,False,Stuhl,True,0.71652507782 21 | 2,9,True,Ich,True,0.542777061462 22 | 3,0,True,Stuhl,True,0.867996931076 23 | 3,1,True,Stuhl,True,0.591325998306 24 | 3,2,False,Stuhl,True,0.72000002861 25 | 3,3,True,Ich,True,0.659965991974 26 | 3,4,False,Ich,True,0.508322954178 27 | 3,5,False,Ich,True,0.63366985321 28 | 3,6,False,Ich,True,0.404680967331 29 | 3,7,True,Ich,True,0.633337974548 30 | 3,8,False,Stuhl,True,0.731882095337 31 | 3,9,False,Ich,True,0.699079990387 32 | 4,0,False,Stuhl,True,0.792791843414 33 | 4,1,True,Ich,True,0.620434045792 34 | 4,2,True,Stuhl,True,0.744031906128 35 | 4,3,True,Ich,True,0.636481046677 36 | 4,4,False,Stuhl,True,0.802936792374 37 | 4,5,True,Stuhl,True,0.645729064941 38 | 4,6,False,Stuhl,True,0.509248971939 39 | 4,7,True,Stuhl,False,0.612579107285 40 | 4,8,True,Ich,True,0.627246856689 41 | 4,9,False,Stuhl,True,0.689544200897 42 | -------------------------------------------------------------------------------- /ExampleExperiments/selfrelevant_recog/csv/log2.86102294922e-06z.csv: -------------------------------------------------------------------------------- 1 | block,trial,congruence,label,correct,rt 2 | 1,0,True,Stuhl,True,0.576032876968 3 | 1,1,False,Ich,True,0.699803113937 4 | 1,2,True,Ich,True,0.82356595993 5 | 1,3,True,Stuhl,True,1.02355408669 6 | 1,4,False,Stuhl,True,0.772870063782 7 | 1,5,False,Stuhl,True,1.22581982613 8 | 1,6,False,Stuhl,True,0.639858007431 9 | 1,7,True,Stuhl,True,0.808001041412 10 | 1,8,False,Stuhl,True,0.896702051163 11 | 1,9,False,Stuhl,True,0.64860200882 12 | 2,0,False,Ich,True,0.97261095047 13 | 2,1,True,Stuhl,True,0.766065835953 14 | 2,2,False,Ich,True,0.537072896957 15 | 2,3,True,Stuhl,True,0.645870923996 16 | 2,4,False,Stuhl,True,1.06143093109 17 | 2,5,True,Stuhl,True,0.61944103241 18 | 2,6,True,Stuhl,True,1.2188270092 19 | 2,7,False,Stuhl,True,0.626883983612 20 | 2,8,True,Ich,True,0.866666078568 21 | 2,9,True,Stuhl,False,0.917616128922 22 | 3,0,False,Ich,True,0.810284137726 23 | 3,1,False,Stuhl,True,0.795827150345 24 | 3,2,True,Stuhl,True,0.566890954971 25 | 3,3,True,Ich,True,0.547525882721 26 | 3,4,False,Ich,True,0.732247114182 27 | 3,5,False,Stuhl,True,0.921537160873 28 | 3,6,True,Stuhl,True,0.577594041824 29 | 3,7,True,Ich,True,0.970270872116 30 | 3,8,False,Stuhl,True,0.665624856949 31 | 3,9,False,Stuhl,True,0.873327970505 32 | 4,0,False,Ich,False,0.73427605629 33 | 4,1,False,Ich,True,0.647109985352 34 | 4,2,True,Stuhl,True,0.668728113174 35 | 4,3,False,Stuhl,True,0.887549877167 36 | 4,4,False,Stuhl,True,0.623984098434 37 | 4,5,False,Stuhl,True,0.635190010071 38 | 4,6,False,Stuhl,True,0.55698800087 39 | 4,7,False,Stuhl,True,0.613433837891 40 | 4,8,True,Ich,True,0.68508887291 41 | 4,9,False,Stuhl,True,0.680564880371 42 | -------------------------------------------------------------------------------- /ExampleExperiments/selfrelevant_recog/csv/log3.09944152832e-06.csv: -------------------------------------------------------------------------------- 1 | block,trial,congruence,label,correct,rt 2 | 1,0,True,Stuhl,False,0.727463006973 3 | 1,1,True,Stuhl,True,0.724633216858 4 | 1,2,False,Stuhl,True,0.759459018707 5 | 1,3,True,Stuhl,True,1.25826907158 6 | 1,4,True,Stuhl,True,0.743416070938 7 | 1,5,False,Ich,True,0.697366952896 8 | 1,6,False,Stuhl,True,1.12903904915 9 | 1,7,True,Ich,True,0.589520931244 10 | 1,8,True,Ich,True,0.644934177399 11 | 1,9,True,Stuhl,True,0.665581941605 12 | 2,0,False,Stuhl,False,0.692262887955 13 | 2,1,False,Stuhl,True,0.767223834991 14 | 2,2,False,Stuhl,True,0.901767015457 15 | 2,3,True,Stuhl,True,1.12311816216 16 | 2,4,False,Stuhl,True,0.74679517746 17 | 2,5,True,Ich,True,0.675998926163 18 | 2,6,True,Ich,True,0.601577997208 19 | 2,7,False,Stuhl,True,0.741964101791 20 | 2,8,False,Ich,True,0.752902030945 21 | 2,9,False,Ich,True,0.88338303566 22 | 3,0,True,Stuhl,True,1.01981520653 23 | 3,1,False,Stuhl,True,0.687057971954 24 | 3,2,False,Stuhl,True,0.583389997482 25 | 3,3,True,Ich,True,0.444416046143 26 | 3,4,True,Ich,True,0.602515935898 27 | 3,5,False,Ich,True,1.24196910858 28 | 3,6,False,Ich,True,0.847153186798 29 | 3,7,False,Stuhl,True,0.762666940689 30 | 3,8,False,Stuhl,True,0.585833072662 31 | 3,9,True,Ich,True,0.683613061905 32 | 4,0,True,Ich,True,0.416773796082 33 | 4,1,False,Ich,True,0.639375925064 34 | 4,2,False,Stuhl,True,0.570940971375 35 | 4,3,False,Ich,True,0.727569103241 36 | 4,4,True,Stuhl,False,0.830850839615 37 | 4,5,False,Stuhl,True,0.784208059311 38 | 4,6,False,Stuhl,True,0.570741176605 39 | 4,7,True,Stuhl,True,0.73101401329 40 | 4,8,False,Ich,True,0.655691862106 41 | 4,9,True,Stuhl,False,0.506042957306 42 | -------------------------------------------------------------------------------- /ExampleExperiments/selfrelevant_recog/csv/log4.05311584473e-06n.csv: -------------------------------------------------------------------------------- 1 | block,trial,congruence,label,correct,rt 2 | 1,0,True,Stuhl,True,0.825749158859 3 | 1,1,False,Stuhl,True,0.886350154877 4 | 1,2,False,Stuhl,True,0.725383043289 5 | 1,3,False,Stuhl,True,0.663120031357 6 | 1,4,True,Stuhl,True,0.807287931442 7 | 1,5,True,Stuhl,True,0.694948196411 8 | 1,6,False,Stuhl,True,0.712467908859 9 | 1,7,True,Ich,True,1.23238492012 10 | 1,8,True,Ich,True,0.697705984116 11 | 1,9,False,Stuhl,True,1.11086702347 12 | 2,0,True,Ich,True,0.740061044693 13 | 2,1,False,Stuhl,True,0.893190145493 14 | 2,2,True,Stuhl,True,1.00320506096 15 | 2,3,True,Ich,True,0.807111978531 16 | 2,4,False,Stuhl,False,0.614541053772 17 | 2,5,False,Ich,True,0.992254972458 18 | 2,6,False,Stuhl,False,0.857616186142 19 | 2,7,True,Stuhl,True,0.594183206558 20 | 2,8,True,Ich,True,0.76095700264 21 | 2,9,True,Stuhl,True,0.769815206528 22 | 3,0,True,Stuhl,True,1.04698300362 23 | 3,1,True,Stuhl,False,0.578177213669 24 | 3,2,False,Ich,True,0.740608930588 25 | 3,3,False,Stuhl,True,0.853186130524 26 | 3,4,False,Stuhl,True,0.715031147003 27 | 3,5,True,Stuhl,True,0.708338022232 28 | 3,6,True,Stuhl,True,0.611207962036 29 | 3,7,False,Stuhl,True,0.86268901825 30 | 3,8,True,Ich,True,0.922208070755 31 | 3,9,True,Ich,True,0.544065952301 32 | 4,0,False,Stuhl,True,0.631860971451 33 | 4,1,False,Ich,False,0.648061990738 34 | 4,2,False,Stuhl,False,0.854140043259 35 | 4,3,True,Stuhl,True,0.56950211525 36 | 4,4,False,Ich,True,0.671323060989 37 | 4,5,True,Stuhl,True,0.746761798859 38 | 4,6,False,Ich,True,0.672044992447 39 | 4,7,True,Stuhl,True,0.643986940384 40 | 4,8,False,Ich,True,0.553941965103 41 | 4,9,True,Stuhl,True,0.76272892952 42 | -------------------------------------------------------------------------------- /ExampleExperiments/selfrelevant_recog/csv/log5.81469726562e-06p.csv: -------------------------------------------------------------------------------- 1 | block,trial,congruence,label,correct,rt 2 | 1,0,False,Stuhl,False,-999 3 | 1,1,False,Ich,False,2.86539006233 4 | 1,2,True,Ich,True,0.967366933823 5 | 1,3,False,Ich,True,1.14620494843 6 | 1,4,True,Ich,True,1.11255002022 7 | 1,5,True,Ich,True,1.05632901192 8 | 1,6,True,Ich,True,0.634177923203 9 | 1,7,False,Stuhl,True,1.3880341053 10 | 1,8,True,Stuhl,True,1.17336893082 11 | 1,9,True,Stuhl,True,1.48076486588 12 | 2,0,True,Ich,True,0.802308797836 13 | 2,1,False,Stuhl,True,0.632749795914 14 | 2,2,False,Stuhl,True,1.02161097527 15 | 2,3,False,Stuhl,True,0.399363994598 16 | 2,4,False,Ich,False,0.465888977051 17 | 2,5,True,Ich,True,0.95298409462 18 | 2,6,False,Stuhl,True,1.0192592144 19 | 2,7,True,Stuhl,True,1.03884887695 20 | 2,8,False,Ich,True,1.29991412163 21 | 2,9,True,Ich,True,0.747090816498 22 | 3,0,False,Ich,True,0.808989048004 23 | 3,1,False,Ich,False,1.45958209038 24 | 3,2,False,Ich,True,0.829262971878 25 | 3,3,False,Stuhl,True,1.2744641304 26 | 3,4,True,Stuhl,True,0.909385919571 27 | 3,5,False,Ich,True,0.875191926956 28 | 3,6,False,Ich,True,0.668096065521 29 | 3,7,False,Ich,True,0.751194953918 30 | 3,8,True,Ich,True,0.759135007858 31 | 3,9,False,Ich,True,0.606815099716 32 | 4,0,False,Ich,True,1.11331987381 33 | 4,1,True,Ich,True,0.774317979813 34 | 4,2,False,Ich,True,0.588439941406 35 | 4,3,False,Stuhl,False,1.07344317436 36 | 4,4,False,Stuhl,True,0.873764038086 37 | 4,5,True,Stuhl,True,0.668695926666 38 | 4,6,True,Stuhl,False,0.601524114609 39 | 4,7,False,Stuhl,True,0.859754085541 40 | 4,8,True,Stuhl,True,0.934324026108 41 | 4,9,False,Ich,True,0.696485996246 42 | -------------------------------------------------------------------------------- /ExampleExperiments/selfrelevant_recog/csv/log6.09944152832e-06i.csv: -------------------------------------------------------------------------------- 1 | block,trial,congruence,label,correct,rt 2 | 1,0,True,Stuhl,True,0.75417804718 3 | 1,1,True,Stuhl,True,0.583061933517 4 | 1,2,True,Ich,True,0.517405033112 5 | 1,3,True,Ich,True,0.446446895599 6 | 1,4,True,Ich,True,0.441229104996 7 | 1,5,False,Stuhl,True,0.630918979645 8 | 1,6,False,Stuhl,True,0.412994861603 9 | 1,7,True,Ich,True,0.597571134567 10 | 1,8,True,Stuhl,True,0.651477813721 11 | 1,9,True,Ich,False,0.585075855255 12 | 2,0,True,Stuhl,True,0.585035085678 13 | 2,1,False,Stuhl,True,0.711750984192 14 | 2,2,False,Stuhl,True,0.476164102554 15 | 2,3,False,Ich,True,0.703254938126 16 | 2,4,True,Stuhl,True,0.637227058411 17 | 2,5,True,Stuhl,True,0.854204893112 18 | 2,6,False,Stuhl,False,0.41353392601 19 | 2,7,False,Ich,True,0.766571998596 20 | 2,8,True,Stuhl,True,0.662603139877 21 | 2,9,False,Ich,True,0.684592962265 22 | 3,0,True,Stuhl,True,0.656774044037 23 | 3,1,True,Ich,True,0.720757961273 24 | 3,2,True,Ich,True,0.646140813828 25 | 3,3,False,Ich,True,0.621360063553 26 | 3,4,False,Ich,True,0.638864040375 27 | 3,5,True,Ich,True,0.636147975922 28 | 3,6,True,Stuhl,True,0.620063066483 29 | 3,7,True,Ich,True,0.661518096924 30 | 3,8,False,Stuhl,True,0.556236982346 31 | 3,9,False,Stuhl,True,0.773772001266 32 | 4,0,True,Stuhl,True,0.725886821747 33 | 4,1,False,Ich,True,0.555371999741 34 | 4,2,False,Ich,True,0.685307979584 35 | 4,3,True,Stuhl,False,0.374183893204 36 | 4,4,True,Stuhl,True,0.742551088333 37 | 4,5,True,Stuhl,True,0.51630282402 38 | 4,6,True,Ich,True,0.62073302269 39 | 4,7,False,Stuhl,True,0.653620004654 40 | 4,8,True,Stuhl,True,0.577395915985 41 | 4,9,False,Ich,True,0.808139801025 42 | -------------------------------------------------------------------------------- /ExampleExperiments/selfrelevant_recog/experiment/dreieck.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ExampleExperiments/selfrelevant_recog/experiment/dreieck.png -------------------------------------------------------------------------------- /ExampleExperiments/selfrelevant_recog/experiment/error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ExampleExperiments/selfrelevant_recog/experiment/error.png -------------------------------------------------------------------------------- /ExampleExperiments/selfrelevant_recog/experiment/experiment.py: -------------------------------------------------------------------------------- 1 | # imports 2 | from __future__ import unicode_literals, print_function 3 | from psychopy import visual, event, core, monitors 4 | from random import choice 5 | 6 | # creating a monitor 7 | m = monitors.Monitor("default", width=28.8, distance=200) 8 | m.setSizePix([800, 600]) 9 | win = visual.Window(allowGUI=False, monitor=m, bitsMode=None, winType='pyglet', color=(1,1,1), fullscr=False, screen=1, units="pix") 10 | 11 | clock = core.Clock() 12 | 13 | # creating a logfile 14 | logfile = "log" + str(clock.getTime()) + choice('abcdefghijklmnopqrstuvwxyz') + ".csv" 15 | with open(logfile, "w") as f: 16 | print("block,trial,congruence,label,correct,rt", file=f) 17 | 18 | n_experiment_blocks = 4 19 | 20 | def draw_and_wait(stim, time=.495): 21 | "Draw one stimulus, flip, wait." 22 | stim.draw() 23 | win.flip() 24 | core.wait(time) 25 | 26 | def display_text(text): 27 | "Display text and wait for a keypress." 28 | stim = visual.TextStim(win, text=text, color=(-1, -1, -1)) #construct the stimulus 29 | stim.draw() # draw it 30 | win.flip() # put it on the screen 31 | event.waitKeys() # wait until a key press 32 | win.flip() # clear the screen 33 | core.wait(.5) # wait a specific period 34 | 35 | 36 | def one_trial(congruence, label): 37 | 38 | # define the fixation cross 39 | stim = visual.TextStim(win, text="+", color=(-1, -1, -1)) 40 | draw_and_wait(stim) 41 | 42 | if label == "Ich": 43 | stim = visual.TextStim(win, text="Ich", color=(-1, -1, -1), pos=(-150, 0)) #show "Ich"-label 44 | stim.draw() 45 | if congruence == True: # conruence = Ich + Dreieck 46 | fname = 'dreieck.png' 47 | stim = visual.ImageStim(win, fname, pos=(150, 0), size=(100, 100)) 48 | stim.draw() 49 | else: 50 | fname = 'kreis.png' 51 | stim = visual.ImageStim(win, fname, pos=(150, 0), size=(50, 50)) 52 | stim.draw() 53 | else: 54 | stim = visual.TextStim(win, text="Stuhl", color=(-1, -1, -1), pos=(-150, 0)) #show "Stuhl"-label 55 | stim.draw() 56 | if congruence == True: # conruence = Stuhl + Kreis 57 | fname = 'kreis.png' 58 | stim = visual.ImageStim(win, fname, pos=(150, 0), size=(50, 50)) 59 | stim.draw() 60 | else: 61 | fname = 'dreieck.png' 62 | stim = visual.ImageStim(win, fname, pos=(150, 0), size=(100, 100)) 63 | stim.draw() 64 | win.flip() 65 | 66 | # collect response 67 | clock.reset() 68 | try: 69 | key, time = event.waitKeys(keyList=['c', 'm', 'q'], maxWait=3, timeStamped=clock)[0] 70 | except TypeError: 71 | key, time = "miss", -999 72 | if key == "q": 73 | win.close() 74 | core.quit() 75 | 76 | # response: correct = "m", incorrect = "c" + error 77 | if congruence == True: 78 | correct = key == 'm' 79 | else: 80 | correct = key == 'c' 81 | if not correct: 82 | fname = 'error.png' 83 | stim = visual.ImageStim(win, fname, size=(150, 150)) 84 | draw_and_wait(stim) 85 | return time, correct 86 | 87 | def one_block(n, n_trials=10): 88 | "Picking factor settings, run n_trials trials and display a message afterwards." 89 | labels = ("Ich", "Stuhl") # possible options for labels for each trial 90 | congruences = (True, False) 91 | for trial in range(n_trials): # the loop will be run n_trials times 92 | label = choice(labels) 93 | congruence = choice(congruences) 94 | time, correct = one_trial(congruence, label) # run one trial with the randomly drawn parameters 95 | with open(logfile, "a") as f: # the 'a' means we append to the file - with a 'w', it would be overwritten! 96 | print(n+1, trial, str(congruence), label, str(correct), str(time), sep=",", file=f) 97 | if n+1 == n_experiment_blocks: 98 | text = ("Thank you for your participation. Press any key to finish.") 99 | else: 100 | text = ("This was block " + str(n + 1) + " of " + str(n_experiment_blocks) + " blocks in total. Press any key to continue.") 101 | display_text(text) 102 | 103 | # First: Show the instruction screen 104 | text = ("""Before starting the experiment, you need to learn the following associations: 105 | 106 | The word Ich is associated with a triangle. 107 | The word Stuhl is associated with a circle. 108 | 109 | Please remember these associations well. 110 | 111 | In the following experiment you will be shown a word and a geometric figure (circle or triangle) at the same time. 112 | 113 | Press 'm' when you have learned the shown combination. 114 | Otherwise press 'c'. 115 | 116 | Press any key to continue.""") 117 | display_text(text) 118 | 119 | # Second: Run the experiment and quit afterwards 120 | for block in range(n_experiment_blocks): 121 | one_block(block) 122 | win.close() 123 | core.quit() 124 | -------------------------------------------------------------------------------- /ExampleExperiments/selfrelevant_recog/experiment/kreis.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ExampleExperiments/selfrelevant_recog/experiment/kreis.png -------------------------------------------------------------------------------- /ExampleExperiments/viewdir_sex/experiment/Frau_links (1).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ExampleExperiments/viewdir_sex/experiment/Frau_links (1).png -------------------------------------------------------------------------------- /ExampleExperiments/viewdir_sex/experiment/Frau_links.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ExampleExperiments/viewdir_sex/experiment/Frau_links.png -------------------------------------------------------------------------------- /ExampleExperiments/viewdir_sex/experiment/Frau_rechts (1).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ExampleExperiments/viewdir_sex/experiment/Frau_rechts (1).png -------------------------------------------------------------------------------- /ExampleExperiments/viewdir_sex/experiment/Frau_rechts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ExampleExperiments/viewdir_sex/experiment/Frau_rechts.png -------------------------------------------------------------------------------- /ExampleExperiments/viewdir_sex/experiment/Mann_links (1).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ExampleExperiments/viewdir_sex/experiment/Mann_links (1).png -------------------------------------------------------------------------------- /ExampleExperiments/viewdir_sex/experiment/Mann_links.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ExampleExperiments/viewdir_sex/experiment/Mann_links.png -------------------------------------------------------------------------------- /ExampleExperiments/viewdir_sex/experiment/Mann_rechts (1).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ExampleExperiments/viewdir_sex/experiment/Mann_rechts (1).png -------------------------------------------------------------------------------- /ExampleExperiments/viewdir_sex/experiment/Mann_rechts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ExampleExperiments/viewdir_sex/experiment/Mann_rechts.png -------------------------------------------------------------------------------- /ExampleExperiments/viewdir_sex/experiment/Python Experiment.osexp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ExampleExperiments/viewdir_sex/experiment/Python Experiment.osexp -------------------------------------------------------------------------------- /ExampleExperiments/viewdir_sex/experiment/maxresdefault (1).jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jona-sassenhagen/python_for_psychologists/0604ff5c6382ae02ffeb2e078853b835dab03860/ExampleExperiments/viewdir_sex/experiment/maxresdefault (1).jpg -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2018, jona-sassenhagen 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | * Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Python for Psychologists 2 | 3 | This repo contains an introduction to Open and reproducible scientific programming for 4 | psychologists in Python. It stems from a series of seminars held at the 5 | University of Frankfurt, Department of Psychology. 6 | Materials include: 7 | 8 | - Class material: a series of notebooks, each corresponding to one in-class session, 9 | introducing material and providing exercises 10 | 11 | - Homework assignments: Students conducted experiments. The experimental programs themselves 12 | (in [OpenSesame](http://osdoc.cogsci.nl/) or [Psychopy](http://www.psychopy.org)), the resulting data, and the 13 | analysis in the form of Jupyter Notebooks are presented. 14 | 15 | ## Aim of the course 16 | 17 | - learn to program for non-programmers (in particular, though not exclusively, experimental psychologists) 18 | - [Open Science](https://how-to-open.science) conforming scientific coding 19 | - reproducible 20 | - open for reuse 21 | - Contemporary coding practice conforming 22 | - learning [literate programming](https://en.wikipedia.org/wiki/Literate_programming) 23 | 24 | ## How you can use this resource 25 | 26 | If you have not yet done so: [Download and install Anaconda](https://www.anaconda.com/download/#macos), a scientific Python distribution. 27 | Anaconda comes with many or most of the Python packages a researcher needs. It also comes with the [Jupyter Notebook](http://jupyter.org), 28 | a great starting point for learning and using Python for conducting research. Most of the resources here are Jupyter Notebooks, which you 29 | can download and run on your own computer. 30 | 31 | For example, the folder [ExampleAnalyses](https://github.com/jona-sassenhagen/python_for_psychologists/tree/master/ExampleExperiments) 32 | contains experiments conducted by students as final assignments of a Python for Psychologists class. 33 | The Notebooks (*.ipynb files) containing the analyses -- for an example, check out [this 34 | one](https://github.com/jona-sassenhagen/python_for_psychologists/blob/master/ExampleExperiments/selfpriorisation/selfpriorisation_analysis.ipynb) -- of the results 35 | are complete, and fully reproducible. To reproduce one, download the notebook and the corresponding data files, store them in the correct file structure, 36 | for example, by [downloading this entire repository](https://github.com/jona-sassenhagen/python_for_psychologists/archive/master.zip), 37 | and open and run them in a Jupyter Notebook. 38 | 39 | 40 | # Supported by 41 | 42 | ![eLearning Förderfonds der Goethe-Universität Frankfurt](https://blog.studiumdigitale.uni-frankfurt.de/elf/files/2016/03/cropped-eLF_logo-1.png) ![AG 43 | Fiebach](http://static1.squarespace.com/static/55a04efee4b06ad275768c2b/t/592898a520099e2f4bf7470b/1521543233985/?format=300w) ![Goethe-Universität 44 | Frankfurt](http://www.uni-frankfurt.de/assets/ci/head_logo-3f4b9591169c7a3095f77eb21e4d00649f1ed7bdc00ace2e4eb2c9b5285e07ea.svg) 45 | --------------------------------------------------------------------------------