jalauer commited on
Commit
227148b
·
verified ·
1 Parent(s): 0c960dc

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +16 -0
  2. BV_Chanlocs_60.mat +0 -0
  3. LICENSE.txt +208 -0
  4. MEASURES.xlsx +0 -0
  5. ONOFF.mat +0 -0
  6. PD_RewP_Script.m +301 -0
  7. README.md +67 -0
  8. data/8010_Session_1_PDDys_VV_withcueinfo.mat +3 -0
  9. data/801_Session_1_PDDys_VV_withcueinfo.mat +3 -0
  10. data/801_Session_2_PDDys_VV_withcueinfo.mat +3 -0
  11. data/802_Session_1_PDDys_VV_withcueinfo.mat +3 -0
  12. data/802_Session_2_PDDys_VV_withcueinfo.mat +3 -0
  13. data/803_Session_1_PDDys_VV_withcueinfo.mat +3 -0
  14. data/803_Session_2_PDDys_VV_withcueinfo.mat +3 -0
  15. data/804_Session_1_PDDys_VV_withcueinfo.mat +3 -0
  16. data/804_Session_2_PDDys_VV_withcueinfo.mat +3 -0
  17. data/805_Session_1_PDDys_VV_withcueinfo.mat +3 -0
  18. data/805_Session_2_PDDys_VV_withcueinfo.mat +3 -0
  19. data/8060_Session_1_PDDys_VV_withcueinfo.mat +3 -0
  20. data/806_Session_1_PDDys_VV_withcueinfo.mat +3 -0
  21. data/8070_Session_1_PDDys_VV_withcueinfo.mat +3 -0
  22. data/913_Session_1_PDDys_VV_withcueinfo.mat +3 -0
  23. data/914_Session_1_PDDys_VV_withcueinfo.mat +3 -0
  24. images/Examples.pptx +0 -0
  25. scripts/BEH README.docx +0 -0
  26. scripts/BEH_VV.m +702 -0
  27. scripts/BEH_VV_CTL.m +320 -0
  28. scripts/VV_Behavior.mat +0 -0
  29. scripts/VV_Behavior_CTL.mat +0 -0
  30. scripts/VV_Main.m +177 -0
  31. scripts/VV_Triggers.xlsx +0 -0
  32. scripts/buildTestTrials.m +24 -0
  33. scripts/buildTrainTrials.m +71 -0
  34. scripts/runChoice.m +210 -0
  35. scripts/runConditionNotice.m +28 -0
  36. scripts/runFeedback.m +99 -0
  37. scripts/runPractice.m +24 -0
  38. scripts/runTestTrial.m +16 -0
  39. scripts/runTrainTrial.m +15 -0
  40. scripts/taskDone.m +33 -0
  41. scripts/taskInit.m +83 -0
  42. scripts/test_Inst1.m +39 -0
  43. scripts/trainBreak.m +33 -0
  44. scripts/train_Inst1.m +35 -0
  45. scripts/train_Inst2.m +35 -0
  46. scripts/train_Inst3.m +35 -0
  47. scripts/train_Inst4.m +35 -0
  48. scripts/train_Inst5.m +37 -0
  49. scripts/train_Inst6.m +35 -0
  50. scripts/train_Inst_Xtra.m +35 -0
.gitattributes CHANGED
@@ -57,3 +57,19 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
57
  # Video files - compressed
58
  *.mp4 filter=lfs diff=lfs merge=lfs -text
59
  *.webm filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  # Video files - compressed
58
  *.mp4 filter=lfs diff=lfs merge=lfs -text
59
  *.webm filter=lfs diff=lfs merge=lfs -text
60
+ data/914_Session_1_PDDys_VV_withcueinfo.mat filter=lfs diff=lfs merge=lfs -text
61
+ data/913_Session_1_PDDys_VV_withcueinfo.mat filter=lfs diff=lfs merge=lfs -text
62
+ data/801_Session_2_PDDys_VV_withcueinfo.mat filter=lfs diff=lfs merge=lfs -text
63
+ data/802_Session_1_PDDys_VV_withcueinfo.mat filter=lfs diff=lfs merge=lfs -text
64
+ data/8010_Session_1_PDDys_VV_withcueinfo.mat filter=lfs diff=lfs merge=lfs -text
65
+ data/802_Session_2_PDDys_VV_withcueinfo.mat filter=lfs diff=lfs merge=lfs -text
66
+ data/803_Session_1_PDDys_VV_withcueinfo.mat filter=lfs diff=lfs merge=lfs -text
67
+ data/801_Session_1_PDDys_VV_withcueinfo.mat filter=lfs diff=lfs merge=lfs -text
68
+ data/803_Session_2_PDDys_VV_withcueinfo.mat filter=lfs diff=lfs merge=lfs -text
69
+ data/804_Session_1_PDDys_VV_withcueinfo.mat filter=lfs diff=lfs merge=lfs -text
70
+ data/804_Session_2_PDDys_VV_withcueinfo.mat filter=lfs diff=lfs merge=lfs -text
71
+ data/805_Session_1_PDDys_VV_withcueinfo.mat filter=lfs diff=lfs merge=lfs -text
72
+ data/805_Session_2_PDDys_VV_withcueinfo.mat filter=lfs diff=lfs merge=lfs -text
73
+ data/8060_Session_1_PDDys_VV_withcueinfo.mat filter=lfs diff=lfs merge=lfs -text
74
+ data/806_Session_1_PDDys_VV_withcueinfo.mat filter=lfs diff=lfs merge=lfs -text
75
+ data/8070_Session_1_PDDys_VV_withcueinfo.mat filter=lfs diff=lfs merge=lfs -text
BV_Chanlocs_60.mat ADDED
Binary file (4.82 kB). View file
 
LICENSE.txt ADDED
@@ -0,0 +1,208 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Public Domain Dedication and License (PDDL)
2
+
3
+
4
+ Preamble
5
+
6
+
7
+ The Open Data Commons – Public Domain Dedication and Licence is a document intended to allow you to freely share, modify, and use this work for any purpose and without any restrictions. This licence is intended for use on databases or their contents (“data”), either together or individually.
8
+
9
+
10
+ Many databases are covered by copyright. Some jurisdictions, mainly in Europe, have specific special rights that cover databases called the “sui generis” database right. Both of these sets of rights, as well as other legal rights used to protect databases and data, can create uncertainty or practical difficulty for those wishing to share databases and their underlying data but retain a limited amount of rights under a “some rights reserved” approach to licensing as outlined in the Science Commons Protocol for Implementing Open Access Data. As a result, this waiver and licence tries to the fullest extent possible to eliminate or fully license any rights that cover this database and data. Any Community Norms or similar statements of use of the database or data do not form a part of this document, and do not act as a contract for access or other terms of use for the database or data.
11
+
12
+
13
+ The position of the recipient of the work
14
+
15
+
16
+ Because this document places the database and its contents in or as close as possible within the public domain, there are no restrictions or requirements placed on the recipient by this document. Recipients may use this work commercially, use technical protection measures, combine this data or database with other databases or data, and share their changes and additions or keep them secret. It is not a requirement that recipients provide further users with a copy of this licence or attribute the original creator of the data or database as a source. The goal is to eliminate restrictions held by the original creator of the data and database on the use of it by others.
17
+
18
+
19
+ The position of the dedicator of the work
20
+
21
+
22
+ Copyright law, as with most other law under the banner of “intellectual property”, is inherently national law. This means that there exists several differences in how copyright and other IP rights can be relinquished, waived or licensed in the many legal jurisdictions of the world. This is despite much harmonisation of minimum levels of protection. The internet and other communication technologies span these many disparate legal jurisdictions and thus pose special difficulties for a document relinquishing and waiving intellectual property rights, including copyright and database rights, for use by the global community. Because of this feature of intellectual property law, this document first relinquishes the rights and waives the relevant rights and claims. It then goes on to license these same rights for jurisdictions or areas of law that may make it difficult to relinquish or waive rights or claims.
23
+
24
+
25
+ The purpose of this document is to enable rightsholders to place their work into the public domain. Unlike licences for free and open source software, free cultural works, or open content licences, rightsholders will not be able to “dual license” their work by releasing the same work under different licences. This is because they have allowed anyone to use the work in whatever way they choose. Rightsholders therefore can’t re-license it under copyright or database rights on different terms because they have nothing left to license. Doing so creates truly accessible data to build rich applications and advance the progress of science and the arts.
26
+
27
+
28
+ This document can cover either or both of the database and its contents (the data). Because databases can have a wide variety of content – not just factual data – rightsholders should use the Open Data Commons – Public Domain Dedication & Licence for an entire database and its contents only if everything can be placed under the terms of this document. Because even factual data can sometimes have intellectual property rights, rightsholders should use this licence to cover both the database and its factual data when making material available under this document; even if it is likely that the data would not be covered by copyright or database rights.
29
+
30
+
31
+ Rightsholders can also use this document to cover any copyright or database rights claims over only a database, and leave the contents to be covered by other licences or documents. They can do this because this document refers to the “Work”, which can be either – or both – the database and its contents. As a result, rightsholders need to clearly state what they are dedicating under this document when they dedicate it.
32
+
33
+
34
+ Just like any licence or other document dealing with intellectual property, rightsholders should be aware that one can only license what one owns. Please ensure that the rights have been cleared to make this material available under this document.
35
+
36
+
37
+ This document permanently and irrevocably makes the Work available to the public for any use of any kind, and it should not be used unless the rightsholder is prepared for this to happen.
38
+
39
+
40
+ Part I: Introduction
41
+
42
+
43
+ The Rightsholder (the Person holding rights or claims over the Work) agrees as follows:
44
+
45
+
46
+ 1.0 Definitions of Capitalised Words
47
+
48
+
49
+ “Copyright” – Includes rights under copyright and under neighbouring rights and similarly related sets of rights under the law of the relevant jurisdiction under Section 6.4.
50
+
51
+
52
+ “Data” – The contents of the Database, which includes the information, independent works, or other material collected into the Database offered under the terms of this Document.
53
+
54
+
55
+ “Database” – A collection of Data arranged in a systematic or methodical way and individually accessible by electronic or other means offered under the terms of this Document.
56
+
57
+
58
+ “Database Right” – Means rights over Data resulting from the Chapter III (“sui generis”) rights in the Database Directive (Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases) and any future updates as well as any similar rights available in the relevant jurisdiction under Section 6.4.
59
+
60
+
61
+ “Document” – means this relinquishment and waiver of rights and claims and back up licence agreement.
62
+
63
+
64
+ “Person” – Means a natural or legal person or a body of persons corporate or incorporate.
65
+
66
+
67
+ “Use” – As a verb, means doing any act that is restricted by Copyright or Database Rights whether in the original medium or any other; and includes modifying the Work as may be technically necessary to use it in a different mode or format. This includes the right to sublicense the Work.
68
+
69
+
70
+ “Work” – Means either or both of the Database and Data offered under the terms of this Document.
71
+
72
+
73
+ “You” – the Person acquiring rights under the licence elements of this Document.
74
+
75
+
76
+ Words in the singular include the plural and vice versa.
77
+
78
+
79
+ 2.0 What this document covers
80
+
81
+
82
+ 2.1. Legal effect of this Document. This Document is:
83
+
84
+
85
+ a. A dedication to the public domain and waiver of Copyright and Database Rights over the Work; and
86
+
87
+
88
+ b. A licence of Copyright and Database Rights over the Work in jurisdictions that do not allow for relinquishment or waiver.
89
+
90
+
91
+ 2.2. Legal rights covered.
92
+
93
+
94
+ a. Copyright. Any copyright or neighbouring rights in the Work. Copyright law varies between jurisdictions, but is likely to cover: the Database model or schema, which is the structure, arrangement, and organisation of the Database, and can also include the Database tables and table indexes; the data entry and output sheets; and the Field names of Data stored in the Database. Copyright may also cover the Data depending on the jurisdiction and type of Data; and
95
+
96
+
97
+ b. Database Rights. Database Rights only extend to the extraction and re-utilisation of the whole or a substantial part of the Data. Database Rights can apply even when there is no copyright over the Database. Database Rights can also apply when the Data is removed from the Database and is selected and arranged in a way that would not infringe any applicable copyright.
98
+
99
+
100
+ 2.2 Rights not covered.
101
+
102
+
103
+ a. This Document does not apply to computer programs used in the making or operation of the Database;
104
+
105
+
106
+ b. This Document does not cover any patents over the Data or the Database. Please see Section 4.2 later in this Document for further details; and
107
+
108
+
109
+ c. This Document does not cover any trade marks associated with the Database. Please see Section 4.3 later in this Document for further details.
110
+
111
+
112
+ Users of this Database are cautioned that they may have to clear other rights or consult other licences.
113
+
114
+
115
+ 2.3 Facts are free. The Rightsholder takes the position that factual information is not covered by Copyright. This Document however covers the Work in jurisdictions that may protect the factual information in the Work by Copyright, and to cover any information protected by Copyright that is contained in the Work.
116
+
117
+
118
+ Part II: Dedication to the public domain
119
+
120
+
121
+ 3.0 Dedication, waiver, and licence of Copyright and Database Rights
122
+
123
+
124
+ 3.1 Dedication of Copyright and Database Rights to the public domain. The Rightsholder by using this Document, dedicates the Work to the public domain for the benefit of the public and relinquishes all rights in Copyright and Database Rights over the Work.
125
+
126
+
127
+ a. The Rightsholder realises that once these rights are relinquished, that the Rightsholder has no further rights in Copyright and Database Rights over the Work, and that the Work is free and open for others to Use.
128
+
129
+
130
+ b. The Rightsholder intends for their relinquishment to cover all present and future rights in the Work under Copyright and Database Rights, whether they are vested or contingent rights, and that this relinquishment of rights covers all their heirs and successors.
131
+
132
+
133
+ The above relinquishment of rights applies worldwide and includes media and formats now known or created in the future.
134
+
135
+
136
+ 3.2 Waiver of rights and claims in Copyright and Database Rights when Section 3.1 dedication inapplicable. If the dedication in Section 3.1 does not apply in the relevant jurisdiction under Section 6.4, the Rightsholder waives any rights and claims that the Rightsholder may have or acquire in the future over the Work in:
137
+
138
+
139
+ a. Copyright; and
140
+
141
+
142
+ b. Database Rights.
143
+
144
+
145
+ To the extent possible in the relevant jurisdiction, the above waiver of rights and claims applies worldwide and includes media and formats now known or created in the future. The Rightsholder agrees not to assert the above rights and waives the right to enforce them over the Work.
146
+
147
+
148
+ 3.3 Licence of Copyright and Database Rights when Sections 3.1 and 3.2 inapplicable. If the dedication and waiver in Sections 3.1 and 3.2 does not apply in the relevant jurisdiction under Section 6.4, the Rightsholder and You agree as follows:
149
+
150
+
151
+ a. The Licensor grants to You a worldwide, royalty-free, non-exclusive, licence to Use the Work for the duration of any applicable Copyright and Database Rights. These rights explicitly include commercial use, and do not exclude any field of endeavour. To the extent possible in the relevant jurisdiction, these rights may be exercised in all media and formats whether now known or created in the future.
152
+
153
+
154
+ 3.4 Moral rights. This section covers moral rights, including the right to be identified as the author of the Work or to object to treatment that would otherwise prejudice the author’s honour and reputation, or any other derogatory treatment:
155
+
156
+
157
+ a. For jurisdictions allowing waiver of moral rights, Licensor waives all moral rights that Licensor may have in the Work to the fullest extent possible by the law of the relevant jurisdiction under Section 6.4;
158
+
159
+
160
+ b. If waiver of moral rights under Section 3.4 a in the relevant jurisdiction is not possible, Licensor agrees not to assert any moral rights over the Work and waives all claims in moral rights to the fullest extent possible by the law of the relevant jurisdiction under Section 6.4; and
161
+
162
+
163
+ c. For jurisdictions not allowing waiver or an agreement not to assert moral rights under Section 3.4 a and b, the author may retain their moral rights over the copyrighted aspects of the Work.
164
+
165
+
166
+ Please note that some jurisdictions do not allow for the waiver of moral rights, and so moral rights may still subsist over the work in some jurisdictions.
167
+
168
+
169
+ 4.0 Relationship to other rights
170
+
171
+
172
+ 4.1 No other contractual conditions. The Rightsholder makes this Work available to You without any other contractual obligations, either express or implied. Any Community Norms statement associated with the Work is not a contract and does not form part of this Document.
173
+
174
+
175
+ 4.2 Relationship to patents. This Document does not grant You a licence for any patents that the Rightsholder may own. Users of this Database are cautioned that they may have to clear other rights or consult other licences.
176
+
177
+
178
+ 4.3 Relationship to trade marks. This Document does not grant You a licence for any trade marks that the Rightsholder may own or that the Rightsholder may use to cover the Work. Users of this Database are cautioned that they may have to clear other rights or consult other licences.
179
+
180
+
181
+ Part III: General provisions
182
+
183
+
184
+ 5.0 Warranties, disclaimer, and limitation of liability
185
+
186
+
187
+ 5.1 The Work is provided by the Rightsholder “as is” and without any warranty of any kind, either express or implied, whether of title, of accuracy or completeness, of the presence of absence of errors, of fitness for purpose, or otherwise. Some jurisdictions do not allow the exclusion of implied warranties, so this exclusion may not apply to You.
188
+
189
+
190
+ 5.2 Subject to any liability that may not be excluded or limited by law, the Rightsholder is not liable for, and expressly excludes, all liability for loss or damage however and whenever caused to anyone by any use under this Document, whether by You or by anyone else, and whether caused by any fault on the part of the Rightsholder or not. This exclusion of liability includes, but is not limited to, any special, incidental, consequential, punitive, or exemplary damages. This exclusion applies even if the Rightsholder has been advised of the possibility of such damages.
191
+
192
+
193
+ 5.3 If liability may not be excluded by law, it is limited to actual and direct financial loss to the extent it is caused by proved negligence on the part of the Rightsholder.
194
+
195
+
196
+ 6.0 General
197
+
198
+
199
+ 6.1 If any provision of this Document is held to be invalid or unenforceable, that must not affect the validity or enforceability of the remainder of the terms of this Document.
200
+
201
+
202
+ 6.2 This Document is the entire agreement between the parties with respect to the Work covered here. It replaces any earlier understandings, agreements or representations with respect to the Work not specified here.
203
+
204
+
205
+ 6.3 This Document does not affect any rights that You or anyone else may independently have under any applicable law to make any use of this Work, including (for jurisdictions where this Document is a licence) fair dealing, fair use, database exceptions, or any other legally recognised limitation or exception to infringement of copyright or other applicable laws.
206
+
207
+
208
+ 6.4 This Document takes effect in the relevant jurisdiction in which the Document terms are sought to be enforced. If the rights waived or granted under applicable law in the relevant jurisdiction includes additional rights not waived or granted under this Document, these additional rights are included in this Document in order to meet the intent of this Document.
MEASURES.xlsx ADDED
Binary file (9.63 kB). View file
 
ONOFF.mat ADDED
Binary file (265 Bytes). View file
 
PD_RewP_Script.m ADDED
@@ -0,0 +1,301 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ %%
2
+
3
+ % N=28 Parkinson's patients and N=28 matched controls
4
+ % PD patients came in for 2 sessions 1 week apart: ON or OFF meds (counterbalanced).
5
+ % EEG files are labeled with session #, see ONOFF.mat for which session was ON or OFF.
6
+ % Note that controls DID NOT have 2 sessions.
7
+
8
+
9
+ clear all; clc
10
+ homedir='Y:\EEG_Data\PDDys\PD 4 PREDICT\';
11
+ datalocation=[homedir,'\PROCESSED EEG DATA\']; % Data are here
12
+ savepath = [datalocation,'CLEAN\'];
13
+ cd(datalocation);
14
+
15
+ load([homedir,'VV_Behavior.mat']); % Aggregate behavior files output from Matlab Psychtoolbox
16
+ load([homedir,'ONOFF.mat']); % 3 columns: subject, session, [ON=1 OFF=0]
17
+ load([homedir,'BV_Chanlocs_60.mat']);
18
+ %*************************************
19
+
20
+ MEASURES = xlsread([homedir,'MEASURES']); % Subj symptom measures taken in ON session
21
+ %************************
22
+ % COLUMN LABELS
23
+ % MEASURES(:,1) = PD IDx
24
+ % MEASURES(:,2) = NAART Scores
25
+ % MEASURES(:,3) = BDI Ratings
26
+ % MEASURES(:,4) = MMSE Scores
27
+ % MEASURES(:,5) = UPDRS Ratings
28
+ % MEASURES(:,6) = Years Since Diagnosis (Rank Ordered)
29
+ % MEASURES(:,7) = Levadopa Equivalent Dose (LED)
30
+ % MEASURES(:,8) = Accelerometer hand placement: 1 = Left Hand // 2 = Right hand
31
+ %************************
32
+
33
+ % Subject Numbers
34
+ PDsx=[801:811,813:829];
35
+ CTLsx=[8010,8070,8060,890:914];
36
+
37
+
38
+ %% MAKE ERPs
39
+ for subj=[PDsx,CTLsx]
40
+ for session=1:2;
41
+ if (subj>850 && session==1) || subj<850 % If not CTL, do session 2 (CTL did not have a session 2)
42
+
43
+ load([num2str(subj),'_Session_',num2str(session),'_PDDys_VV_withcueinfo.mat'],'EEG','bad_chans','bad_epochs','bad_ICAs');
44
+
45
+ for ai=1:size(EEG.epoch,2)
46
+ VECTOR(ai,1)=EEG.epoch(ai).FB;
47
+ VECTOR(ai,2)=EEG.epoch(ai).Resp;
48
+ VECTOR(ai,3)=EEG.epoch(ai).Resptime;
49
+ VECTOR(ai,4)=EEG.epoch(ai).Stim;
50
+ VECTOR(ai,5)=EEG.epoch(ai).Stimtime;
51
+ VECTOR(ai,6)=EEG.epoch(ai).Cie;
52
+ VECTOR(ai,7)=EEG.epoch(ai).Cuetime;
53
+ VECTOR(ai,8)=EEG.epoch(ai).RT;
54
+ VECTOR(ai,9)=EEG.epoch(ai).BEHCondi;
55
+ VECTOR(ai,10)=EEG.epoch(ai).BEHOptimal;
56
+ VECTOR(ai,11)=EEG.epoch(ai).BEHRT;
57
+ VECTOR(ai,12)=EEG.epoch(ai).BEHFB;
58
+ end
59
+ % Remove practice trials
60
+ VECTOR(isnan(VECTOR(:,9)),:)=NaN;
61
+ % Add this for later: FB-parsed by condi
62
+ for vvi=1:length(VECTOR),
63
+ if VECTOR(vvi,1)==0, VECTOR(vvi,13)=VECTOR(vvi,9);
64
+ elseif VECTOR(vvi,1)==1, VECTOR(vvi,13)=4+VECTOR(vvi,9);
65
+ end
66
+ end
67
+
68
+ % Remove the bad ICAs identified by APPLE:
69
+ bad_ICAs_To_Remove=bad_ICAs{2};
70
+ EEG = pop_subcomp( EEG, bad_ICAs_To_Remove, 0);
71
+
72
+ % low-pass filter for display
73
+ dims=size(EEG.data);
74
+ EEG.data=eegfilt(EEG.data,500,[],20);
75
+ EEG.data=reshape(EEG.data,dims(1),dims(2),dims(3));
76
+
77
+ % Set times
78
+ tx=-6000:2:1998;
79
+ b1=find(tx==-200); b2=find(tx==0);
80
+ t1=find(tx==-500); t2=find(tx==1000); % For ERPs
81
+ r1=find(tx==250); r2=find(tx==450); % For Topos
82
+ tx2disp=-500:2:1000;
83
+
84
+ % Accelerometer was worn on the non-dominant hand
85
+ % Aggregate accelerometer data
86
+ EEG.X=EEG.X-repmat(mean(EEG.X),4000,1);
87
+ EEG.Y=EEG.Y-repmat(mean(EEG.Y),4000,1);
88
+ EEG.Z=EEG.Z-repmat(mean(EEG.Z),4000,1);
89
+ % Add to EEG.data as 61st channel - but not the rejected trials
90
+ EEG.data(61,:,:)=(EEG.X(:,bad_epochs{1}~=1).^2)+(EEG.Y(:,bad_epochs{1}~=1).^2)+(EEG.Z(:,bad_epochs{1}~=1).^2);
91
+ dims=size(EEG.data);
92
+
93
+ % Basecor your ERPs here so they are pretty.
94
+ BASE1=squeeze( mean(EEG.data(:,b1:b2,:),2) );
95
+ for chani=1:dims(1)-1 % don't basecor the tremor data
96
+ DATA(chani,:,:)=squeeze(EEG.data(chani,:,:))-repmat( BASE1(chani,:),dims(2),1 );
97
+ end
98
+
99
+ % Parse by condition
100
+ %************************
101
+ % CONDITIONS
102
+ % 1 = CHOOSE EASY LOSE
103
+ % 2 = CHOOSE HARD LOSE
104
+ % 3 = MATCH EASY LOSE
105
+ % 4 = MATCH HARD LOSE
106
+ % 5 = CHOOSE EASY WIN
107
+ % 6 = CHOOSE HARD WIN
108
+ % 7 = MATCH EASY WIN
109
+ % 8 = MATCH HARD WIN
110
+ %************************
111
+ for ai=1:8 % all FB
112
+ ERP(:,ai,:)=mean(DATA(:,t1:t2,VECTOR(:,13)==ai),3); % DATA(ELECTRODE, TIME , CONDITION)
113
+ TOPO(:,ai) = squeeze(mean(mean(DATA(:,r1:r2,VECTOR(:,13)==ai),2),3));
114
+ end
115
+
116
+ % Save and move on to next
117
+ save([savepath,num2str(subj),'_Session_',num2str(session),'_PDDys_VV_withcueinfo_ALL_THE_GOODS.mat'],'ERP','TOPO','VECTOR');
118
+
119
+ clc;
120
+ disp(['AND PARTICPANT ',num2str(subj),' HAS BEEN SAVED']);
121
+
122
+ clearvars -except datalocation ONOFF VV_Behavior BV_Chanlocs_60 PDsx CTLsx session subj savepath;
123
+ close all;
124
+
125
+ end
126
+ end
127
+ end
128
+
129
+ %% COMBINE ERPS
130
+
131
+ site = [21,36];% Cz FCz
132
+ tx=-500:2:1000;
133
+ time1 = 250; time2 = 450;
134
+ t1=find(tx==time1); t2=find(tx==time2); % FOR REW-P
135
+ TIME = time2-time1;
136
+ tx2disp=-500:2:1000;
137
+ COLS={'r','b','g','k'};
138
+
139
+ BigN=size(ONOFF,1)./2;
140
+
141
+ row=1;
142
+ for mi=1:size(ONOFF,1)
143
+ disp([num2str(ONOFF(mi,1)),'_Session_',num2str(ONOFF(mi,2)),'_PDDys_VV_withcueinfo_ALL_THE_GOODS.mat']);
144
+ load([savepath,num2str(ONOFF(mi,1)),'_Session_',num2str(ONOFF(mi,2)),'_PDDys_VV_withcueinfo_ALL_THE_GOODS.mat']);
145
+
146
+ if ONOFF(mi,3)==1 % ON
147
+ ON.ID(floor(row))=ONOFF(mi,1);
148
+ ON.Session(floor(row))=ONOFF(mi,2);
149
+ ON.VECTOR=VECTOR;
150
+ ON.ERPs(floor(row),:,:)=squeeze(mean(ERP(site,:,:),1));
151
+ ON.Topos(floor(row),:,:)=TOPO(:,:);
152
+ elseif ONOFF(mi,3)==0 % OFF
153
+ OFF.ID(floor(row))=ONOFF(mi,1);
154
+ OFF.Session(floor(row))=ONOFF(mi,2);
155
+ OFF.VECTOR=VECTOR;
156
+ OFF.ERPs(floor(row),:,:)=squeeze(mean(ERP(site,:,:),1));
157
+ OFF.Topos(floor(row),:,:)=TOPO(:,:);
158
+ end
159
+ row=row+.5;
160
+ clear ERPs VECTOR;
161
+ end
162
+
163
+ row=1;
164
+ for CTLi=[8010,8060,8070,890:914];
165
+ disp([num2str(CTLi),'_Session_1_PDDys_VV_withcueinfo_ALL_THE_GOODS.mat']);
166
+ load([savepath,num2str(CTLi),'_Session_1_PDDys_VV_withcueinfo_ALL_THE_GOODS.mat']);
167
+ CTL.ID(floor(row))=CTLi;
168
+ CTL.Session(floor(row))=1;
169
+ CTL.VECTOR=VECTOR;
170
+ CTL.ERPs(floor(row),:,:)=squeeze(mean(ERP(site,:,:),1));
171
+ CTL.Topos(floor(row),:,:)=TOPO(:,:);
172
+
173
+ row=row+1;
174
+ clear ERPs VECTOR;
175
+ end
176
+ CtlN=row-1;
177
+
178
+ %************************
179
+ % TOPOS
180
+ %************************
181
+ TOPO_CON = (CTL.Topos(:,:,5)+CTL.Topos(:,:,6)+CTL.Topos(:,:,7)+CTL.Topos(:,:,8) )/4;
182
+ TOPO_ON = (ON.Topos(:,:,5)+ON.Topos(:,:,6)+ON.Topos(:,:,7)+ON.Topos(:,:,8) )/4;
183
+ TOPO_OFF = (OFF.Topos(:,:,5)+OFF.Topos(:,:,6)+OFF.Topos(:,:,7)+OFF.Topos(:,:,8) )/4;
184
+
185
+ figure; hold on
186
+
187
+ % CONTROL TOPO
188
+ subplot(1,3,1)
189
+ topoplot(mean(TOPO_CON,1),BV_Chanlocs_60);
190
+ title('CONTROL');
191
+ set(gca,'clim',[-3 3]);
192
+
193
+ % ON TOPO
194
+ subplot(1,3,2)
195
+ topoplot(mean(TOPO_ON,1),BV_Chanlocs_60);
196
+ title('ON');
197
+ set(gca,'clim',[-3 3]);
198
+
199
+ % OFF TOPO
200
+ subplot(1,3,3)
201
+ topoplot(mean(TOPO_OFF,1),BV_Chanlocs_60);
202
+ title('OFF');
203
+ set(gca,'clim',[-3 3]);
204
+ cbar
205
+
206
+
207
+ %************************
208
+ % ERP
209
+ %************************
210
+ win_CON = (CTL.ERPs(:,5,:)+CTL.ERPs(:,6,:)+CTL.ERPs(:,7,:)+CTL.ERPs(:,8,:))/4;
211
+ win_ON = (ON.ERPs(:,5,:)+ON.ERPs(:,6,:)+ON.ERPs(:,7,:)+ON.ERPs(:,8,:))/4;
212
+ win_OFF = (OFF.ERPs(:,5,:)+OFF.ERPs(:,6,:)+OFF.ERPs(:,7,:)+OFF.ERPs(:,8,:))/4;
213
+
214
+ lose_CON = (CTL.ERPs(:,:,1)+CTL.ERPs(:,:,2)+CTL.ERPs(:,:,3)+CTL.ERPs(:,:,4))/4;
215
+ lose_ON = (ON.ERPs(:,:,1)+ON.ERPs(:,:,2)+ON.ERPs(:,:,3)+ON.ERPs(:,:,4))/4;
216
+ lose_OFF = (OFF.ERPs(:,:,1)+OFF.ERPs(:,:,2)+OFF.ERPs(:,:,3)+OFF.ERPs(:,:,4))/4;
217
+
218
+ figure;hold on;
219
+ rectangle('Position',[time1,0,TIME,3],'Curvature',0.1,'FaceColor',[.9 .9 .9])% ON WIN
220
+ plot(tx2disp,squeeze(nanmean(win_CON,1)),COLS{1});
221
+ plot(tx2disp,squeeze(nanmean(win_ON,1)),COLS{2});
222
+ plot(tx2disp,squeeze(nanmean(win_OFF,1)),COLS{3});
223
+ shadedErrorBar(tx2disp, squeeze(nanmean(win_CON,1)), nanstd(squeeze(win_CON)) ./sqrt(28),COLS{1})
224
+ shadedErrorBar(tx2disp, squeeze(nanmean(win_ON,1)), nanstd(squeeze(win_ON)) ./sqrt(28),COLS{2})
225
+ shadedErrorBar(tx2disp, squeeze(nanmean(win_OFF,1)), nanstd(squeeze(win_OFF)) ./sqrt(28),COLS{3})
226
+ plot(tx2disp,squeeze(nanmean(win_CON,1)),COLS{1},'LineWidth',4);
227
+ plot(tx2disp,squeeze(nanmean(win_ON,1)),COLS{2},'LineWidth',4);
228
+ plot(tx2disp,squeeze(nanmean(win_OFF,1)),COLS{3},'LineWidth',4);
229
+
230
+ title('ERPs FOR WINS');
231
+ h_legend=legend({'HC','ON','OFF'});
232
+ set(h_legend,'FontSize',12);
233
+ plot([0 0],[-6 6],'k:');
234
+ set(gca,'ylim',[-1 4],'xlim',[-100 1000])
235
+ pcrit=.05;
236
+ [H,P,CI,STATS]=ttest(win_CON,win_ON);
237
+ P(P>pcrit)=NaN; P(P<=pcrit)=1;
238
+ plot(tx2disp,-.5*squeeze(P),'k','linewidth',3); clear H P CI STATS;
239
+ [H,P,CI,STATS]=ttest(win_CON,win_OFF);
240
+ P(P>pcrit)=NaN; P(P<=pcrit)=1;
241
+ plot(tx2disp,-.7*squeeze(P),'r','linewidth',3); clear H P CI STATS;
242
+
243
+ CONTROL_ERP = squeeze(mean(win_CON(:,:,t1:t2),3));
244
+ ON_ERP = squeeze(mean(win_ON(:,:,t1:t2),3));
245
+ OFF_ERP = squeeze(mean(win_OFF(:,:,t1:t2),3));
246
+
247
+ [H,P,CI,STATS]=ttest(CONTROL_ERP,ON_ERP)
248
+ text(.7,3.5,['CONTROL v. ON t= ',num2str(STATS.tstat),' p= ',num2str(P)])
249
+ [H,P,CI,STATS]=ttest(CONTROL_ERP,OFF_ERP)
250
+ text(.7,3.3,['CONTROL v. OFF t= ',num2str(STATS.tstat),' p= ',num2str(P)])
251
+ [H,P,CI,STATS]=ttest(ON_ERP,OFF_ERP)
252
+ text(.7,3.1,['ON v. OFF t= ',num2str(STATS.tstat),' p= ',num2str(P)])
253
+
254
+ %************************
255
+ % FOR ANALYSIS
256
+ %************************
257
+ % Run these in SPSS to determine that there's no interaction between group
258
+ % and volition / difficulty
259
+ for condi=1:8
260
+ SPSS_CONT(:,condi)= squeeze(nanmean(CTL.ERPs(:,condi,t1:t2),3));
261
+ SPSS_ON(:,condi)= squeeze(nanmean(ON.ERPs(:,condi,t1:t2),3));
262
+ SPSS_OFF(:,condi)= squeeze(nanmean(OFF.ERPs(:,condi,t1:t2),3));
263
+ end
264
+
265
+ % So then combine all rewards across volition and difficulty conditions
266
+ REWP_ON = [SPSS_ON(:,5),SPSS_ON(:,6),SPSS_ON(:,7),SPSS_ON(:,8)];
267
+ REWP_OFF = [SPSS_OFF(:,5),SPSS_OFF(:,6),SPSS_OFF(:,7),SPSS_OFF(:,8)];
268
+
269
+ ALL_REWP_ON = mean(REWP_ON,2);
270
+ ALL_REWP_OFF = mean(REWP_OFF,2);
271
+
272
+ %************************
273
+ % CORRELATIONS
274
+ %************************
275
+ YrsDx=tiedrank(MEASURES(:,6),1);
276
+
277
+ figure;
278
+ hold on;
279
+ subplot(2,1,1)
280
+ scatter(YrsDx,ALL_REWP_ON,'MarkerEdgeColor',[0 .5 .5],...
281
+ 'MarkerFaceColor',[0 .7 .7],...
282
+ 'LineWidth',1.5)
283
+ lsline
284
+ title('ON: REW-P v. YRS DIAGNOSED ')
285
+ set(gca,'ylim',[-2 5])
286
+ [RHO,PVAL] = corr(ALL_REWP_ON,MEASURES(:,6),'TYPE','Spearman');
287
+ text(.7,4,['r= ',num2str(RHO),' p= ',num2str(PVAL)])
288
+
289
+ subplot(2,1,2)
290
+ hold on;
291
+ scatter(YrsDx,ALL_REWP_OFF,'MarkerEdgeColor',[0 .5 .5],...
292
+ 'MarkerFaceColor',[0 .7 .7],...
293
+ 'LineWidth',1.5)
294
+ lsline
295
+ title('OFF: REW-P v. YRS DIAGNOSED ')
296
+ set(gca,'ylim',[-2 5])
297
+ [RHO,PVAL] = corr(ALL_REWP_OFF,MEASURES(:,6),'TYPE','Spearman');
298
+ text(.7,4,['r= ',num2str(RHO),' p= ',num2str(PVAL)])
299
+
300
+ %%
301
+
README.md ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: pddl
3
+ tags:
4
+ - eeg
5
+ - medical
6
+ - clinical
7
+ - classification
8
+ - parkinson
9
+ - reward processing
10
+ ---
11
+ # Brown2020: EEG Parkinson's Classification Dataset with Reward Processing Task
12
+ The Brown2020 dataset comprises EEG recordings from a reinforcement learning task aimed at assessing reward processing in individuals with Parkinson's disease (PD) and healthy controls. A total of 56 participants took part: 28 individuals diagnosed with PD and 28 age- and sex-matched control participants. Each PD participant completed two sessions (ON and OFF dopaminergic medication), spaced one week apart. Control participants completed a single session.
13
+
14
+ Participants performed a reinforcement learning task involving probabilistic feedback. On each trial, a pair of colored stimuli was presented, with each stimulus associated with a predefined probability of reward. Conditions were manipulated along two dimensions: difficulty (90/10% vs. 70/30% reward probability) and volition (free choice vs. instructed choice). The EEG was time-locked to the feedback screen, allowing for the measurement of reward-related event-related potentials (ERPs).
15
+
16
+ EEG data were recorded using a 64-channel Brain Vision system at a sampling rate of 500 Hz.
17
+ ## Paper
18
+ Brown, D. R., Richardson, S. P., & Cavanagh, J. F. (2020). **An EEG marker of reward processing is diminished in Parkinson’s disease**. _Brain research_, 1727, 146541.
19
+
20
+ DISCLAIMER: We (DISCO) are NOT the owners or creators of this dataset, but we merely uploaded it here, to support our's ("EEG-Bench") and other's work on EEG benchmarking.
21
+ ## Dataset Structure
22
+ - `data/` contains the annotated experiment EEG data.
23
+ - `MEASURES.xlsx` and `ONOFF.mat` contain subject-specific information like NAART test results, BDI and whether they were ON or OFF medication at their first visit (`ONOFF.mat`). See `PD_RewP_Script.m` for information on how to decode these files.
24
+ - `scripts/` contains the MATLAB files used to execute the experiment.
25
+ - `images/` contains the stimuli and visuals presented to the patients.
26
+
27
+ ### Filename Format
28
+ ```
29
+ [PID]_Session_[SESSION]_PDDys_VV_withcueinfo.mat
30
+ ```
31
+ PID is the patient ID (e.g. `801`), while SESSION distinguishes different days of recording (can be `1` or `2` for patients with PD and is always `1` for patients without PD). All patients with PID <= 829 have Parkinson's Disease and all patients with PID >= 890 do NOT have Parkinson's Disease and hence belong to the control group.
32
+
33
+ ### Fields in each File
34
+ A `.mat` file can be read in python as follows:
35
+ ```python
36
+ from scipy.io import loadmat
37
+ filename = "801_Session_2_PDDys_VV_withcueinfo.mat"
38
+ mat = loadmat(filename, simplify_cells=True)
39
+ ```
40
+ (A field "fieldname" can be read from `mat` as `mat["fieldname"]`.)
41
+
42
+ Then `mat` contains (among others) the following fields and subfields
43
+ - `EEG`
44
+ - `data`: EEG data of shape `(#channels, trial_len, #trials)`. E.g. a recording of 119 trials/epochs with 60 channels, each trial having a duration of 8 seconds and a sampling rate of 500 Hz will have shape `(60, 4000, 119)`.
45
+ - `event`: Contains a list of dictionaries, each entry (each event) having the following description:
46
+ - `latency`: The onset of the event, measured as the index in the merged time-dimension `#trials x trial_len` (note `#trials` being the _outer_ and `trial_len` being the _inner_ array when merging).
47
+ - `type`: The type of event. It can be either:
48
+ - `"S 1"`: An instruction to freely choose a stimulus is shown
49
+ - `"S 2"`: An instruction to select the stimulus with a box around it is shown
50
+ - `"S 3"`: A stimulus pair is shown on the screen
51
+ - `"S 4"`: The patient presses the left button
52
+ - `"S 5"`: The patient presses the right button
53
+ - `"S 6"`: A message is shown that the button pressed by the patient did not match the stimulus with a box around it (perhaps this event is also shown when the button is pressed too early)
54
+ - `"S 7"`: A message is shown that the patient did not press any button in the required time-interval (4 seconds)
55
+ - `"S 10"`: A red `0` (representing "no reward") is shown on the screen
56
+ - `"S 11"`: A green `1` (representing "a reward of 1 point") is shown on the screen
57
+
58
+ Typically, a trial starts with an instruction (`S 1` or `S 2`), followed by a pair of stimuli shown on the screen (`S 3`), a button being pressed by the patient (`S 4` or `S 5`) and a reward being displayed (`S 10` or `S 11`).
59
+ - `chanlocs`: A list of channel descriptors
60
+ - `nbchan`: Number of channels
61
+ - `trials`: Number of trials/epochs in this recording
62
+ - `srate`: Sampling Rate (Hz)
63
+
64
+ Additionally, the field and `bad_chans` lists bad channels of this recording.
65
+
66
+ ## License
67
+ By the original authors of this work, this work has been licensed under the PDDL v1.0 license (see LICENSE.txt).
data/8010_Session_1_PDDys_VV_withcueinfo.mat ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:638799eee50920e257400315d55b0a5c08d4c45e9a184d04cd57397844354261
3
+ size 200582802
data/801_Session_1_PDDys_VV_withcueinfo.mat ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0c947b61a939cded729c79800d82d856bf2dea7a73534793189493e6c49d030a
3
+ size 335257113
data/801_Session_2_PDDys_VV_withcueinfo.mat ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ea347d0285f8d62b3338b32812204c817f58d4b5bc83f396ba824d6e389ee3fd
3
+ size 175853993
data/802_Session_1_PDDys_VV_withcueinfo.mat ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1190627744f50d293385918f259b4698c359d875f09343f8955098b2ded0ea74
3
+ size 206037682
data/802_Session_2_PDDys_VV_withcueinfo.mat ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9a5d0e4405401b222e32f17ac15f941bebf7b8ec04f9499fe558ff1e47685864
3
+ size 203584993
data/803_Session_1_PDDys_VV_withcueinfo.mat ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d627dba9d61950c8a14e073b6850c05b889467fec976e730416099e4ee998cb3
3
+ size 213434858
data/803_Session_2_PDDys_VV_withcueinfo.mat ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:65ac4781082928fe1a70a30371cf3d1ec203476b86a1eb9d8d2c3758297b00eb
3
+ size 203329761
data/804_Session_1_PDDys_VV_withcueinfo.mat ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6afcdefa35d32f8ad78f744c993aa6fd75122d6c6683f2ce5611892aeeea7ac6
3
+ size 207272937
data/804_Session_2_PDDys_VV_withcueinfo.mat ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4de34c587bbe3e40208550b50374ae9df2eef4149d9a81fde90639083e217ab2
3
+ size 208358302
data/805_Session_1_PDDys_VV_withcueinfo.mat ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a6495ac4196107c2d2c1053752d438865a50c9d276cfc34d516ab0a90c5c724e
3
+ size 196260010
data/805_Session_2_PDDys_VV_withcueinfo.mat ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d6de2ca7c1930e5d97357a35fdc821f8f992905370d81a83c5bce814d861caba
3
+ size 200302582
data/8060_Session_1_PDDys_VV_withcueinfo.mat ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fb175064580d4491e85c6e775295275b55d3403ecb0337c7313c3dcc2e2d9634
3
+ size 206291628
data/806_Session_1_PDDys_VV_withcueinfo.mat ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5d7aeb8b8ce0b75dd7d80e620650624190c88f4c57c06aa26815397cd23f2bca
3
+ size 204693118
data/8070_Session_1_PDDys_VV_withcueinfo.mat ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:eda6245418186cc2d311144ba546f6eed139f683e271a6b83a6a6cae028f7637
3
+ size 204065655
data/913_Session_1_PDDys_VV_withcueinfo.mat ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1d1de255ef86afe0f7f0d83d6ba7523262ea519f1d3508a5b087116d8318eba8
3
+ size 267161855
data/914_Session_1_PDDys_VV_withcueinfo.mat ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5db1c89171d97d120a41ff8145575620e02bf7368c999837e854fe47c7362978
3
+ size 202186485
images/Examples.pptx ADDED
Binary file (51.3 kB). View file
 
scripts/BEH README.docx ADDED
Binary file (13 kB). View file
 
scripts/BEH_VV.m ADDED
@@ -0,0 +1,702 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ %% Calculate Data
2
+ clear all; clc
3
+ datapath=('Y:\EEG_Data\PDDys\BEH\');
4
+ cd(datapath);
5
+
6
+ SUBJS=[801:811,813:829]; % Only include here if they have BOTH sessions done!
7
+
8
+ for subno=SUBJS
9
+ for session=1:2
10
+
11
+ disp(['VV Beh --- Subno: ',num2str(subno),' Session: ',num2str(session)]); disp(' ');
12
+
13
+ % TRAIN
14
+ fileID=dir([num2str(subno),'_S',num2str(session),'*']);
15
+ load(fileID.name); clear fileID
16
+
17
+ % ----- Columns are: -----
18
+ % 1 = block
19
+ % 2 = trial
20
+ % 3 = (cTrialID)
21
+ % 4 = Forced choice
22
+ % 6 = S1
23
+ % 8 = S2
24
+ % 10 = S1 is left
25
+ % 11 = Stim Selected
26
+ % 13 = Reward (1 or 0)
27
+ % 14 = RT
28
+
29
+ % ----------- Re-make With More Simpleness
30
+ ABchoose=[1,2]; CDchoose=[3,4]; WXmatch=[5,6]; YZmatch=[7,8];
31
+ for ai=1:length(task_struct.trainTrials)
32
+ if any(task_struct.trainTrials(ai,6)==ABchoose)
33
+ CONDI=1;
34
+ elseif any(task_struct.trainTrials(ai,6)==CDchoose)
35
+ CONDI=2;
36
+ elseif any(task_struct.trainTrials(ai,6)==WXmatch)
37
+ CONDI=3;
38
+ elseif any(task_struct.trainTrials(ai,6)==YZmatch)
39
+ CONDI=4;
40
+ end
41
+ TRAIN(ai,1)=CONDI; clear CONDI; % Condi: 1=ABchoose 2=CDchoose 3=ABmatch 4=CDmatch
42
+ TRAIN(ai,2)=mod(task_struct.trainTrials(ai,11),2); % Optimal choice (odd num are optimal: 1,3,5,7)
43
+ TRAIN(ai,3)=task_struct.trainTrials(ai,14); % RT
44
+ TRAIN(ai,4)=task_struct.trainTrials(ai,13); % was rewarded or not
45
+ end
46
+
47
+ % ----------- Re-make With More Simpleness
48
+
49
+ for ai=1:length(task_struct.testTrials)
50
+ ThisSet=task_struct.testTrials(ai,[6,8]);
51
+ ThisSet=str2num(cat(2,num2str(ThisSet(1)),num2str(ThisSet(2))));
52
+ ThisChoice=task_struct.testTrials(ai,11);
53
+
54
+ if any(ThisSet==[12,21]), CONDI='AB';
55
+ elseif any(ThisSet==[13,31]), CONDI='AC';
56
+ elseif any(ThisSet==[14,41]), CONDI='AD';
57
+ elseif any(ThisSet==[15,51]), CONDI='AW';
58
+ elseif any(ThisSet==[16,61]), CONDI='AX';
59
+ elseif any(ThisSet==[17,71]), CONDI='AY';
60
+ elseif any(ThisSet==[18,81]), CONDI='AZ';
61
+ elseif any(ThisSet==[23,32]), CONDI='BC';
62
+ elseif any(ThisSet==[24,42]), CONDI='BD';
63
+ elseif any(ThisSet==[25,52]), CONDI='BW';
64
+ elseif any(ThisSet==[26,62]), CONDI='BX';
65
+ elseif any(ThisSet==[27,72]), CONDI='BY';
66
+ elseif any(ThisSet==[28,82]), CONDI='BZ';
67
+ elseif any(ThisSet==[34,43]), CONDI='CD';
68
+ elseif any(ThisSet==[35,53]), CONDI='CW';
69
+ elseif any(ThisSet==[36,63]), CONDI='CX';
70
+ elseif any(ThisSet==[37,73]), CONDI='CY';
71
+ elseif any(ThisSet==[38,83]), CONDI='CZ';
72
+ elseif any(ThisSet==[45,54]), CONDI='DW';
73
+ elseif any(ThisSet==[46,64]), CONDI='DX';
74
+ elseif any(ThisSet==[47,74]), CONDI='DY';
75
+ elseif any(ThisSet==[48,84]), CONDI='DZ';
76
+ elseif any(ThisSet==[56,65]), CONDI='WX';
77
+ elseif any(ThisSet==[57,75]), CONDI='WY';
78
+ elseif any(ThisSet==[58,85]), CONDI='WZ';
79
+ elseif any(ThisSet==[67,76]), CONDI='XY';
80
+ elseif any(ThisSet==[68,86]), CONDI='XZ';
81
+ elseif any(ThisSet==[78,87]), CONDI='YZ';
82
+ end
83
+
84
+ TEST(ai).condi=CONDI; % Condi
85
+ TEST(ai).choice=ThisChoice; % This Choice
86
+ TEST(ai).RT=task_struct.testTrials(ai,14); % RT
87
+ clear ThisSet ThisChoice CONDI;
88
+ end
89
+
90
+ save([num2str(subno),'_sess',num2str(session),'_VVbeh.mat'],'TRAIN','TEST');
91
+
92
+ clear task_struct disp_struct AB* CD* TRAIN TEST
93
+ end
94
+ end
95
+
96
+ load('Y:\EEG_Data\PDDys\ONOFF.mat','ONOFF')
97
+
98
+ row=0;
99
+ for subno=SUBJS
100
+ for session=1:2;
101
+ row=row+1;
102
+
103
+ if subno~=ONOFF(row,1) || session~=ONOFF(row,2), BOOM; end % Kills it if mismatch in ON/OFF Matrix!
104
+
105
+ load([num2str(subno),'_sess',num2str(session),'_VVbeh.mat'],'TRAIN','TEST');
106
+
107
+ MEGA(row).ID=subno;
108
+ MEGA(row).session=session;
109
+ MEGA(row).ONOFF=ONOFF(row,3);
110
+ MEGA(row).TRN_blocks=size(TRAIN,1)./40;
111
+ MEGA(row).TRN_ACC=mean(TRAIN(:,2));
112
+ MEGA(row).TRN_RT=mean(TRAIN(:,3));
113
+ for bi=1:4 % Condi: 1=ABchoose 2=CDchoose 3=ABmatch 4=CDmatch
114
+ MINISET=TRAIN(TRAIN(:,1)==bi,:);
115
+ MINISET(:,[5,6])=[MINISET(2:end,[2,3]);[NaN,NaN]];
116
+ MINISET(:,6)=MINISET(:,6)-MINISET(:,3); % RT diff
117
+ % --------
118
+ WINS=MINISET(MINISET(:,4)==1,[2,5,6]);
119
+ LOSSES=MINISET(MINISET(:,4)==0,[2,5,6]);
120
+ % --------
121
+ WinStay(bi)=mean(WINS(:,1)==WINS(:,2));
122
+ LoseSwitch(bi)=mean(LOSSES(:,1)~=LOSSES(:,2));
123
+ WinSpeed(bi)=mean(WINS(WINS(:,1)==WINS(:,2),3));
124
+ % --------
125
+ clear MINISET WINS LOSSES
126
+ end
127
+
128
+ MEGA(row).WinStay=WinStay;
129
+ MEGA(row).LoseSwitch=LoseSwitch;
130
+ MEGA(row).WinSpeed=WinSpeed;
131
+
132
+ % ********************************************************
133
+ for ci=1:128
134
+ RT(ci,1)=TEST(ci).RT;
135
+ % ^^^^ General Accuracy A,B,C,D == W,X,Y,Z - 4 of each set
136
+ ACC=NaN; PARSE=NaN;
137
+ if strmatch(TEST(ci).condi,'AB');
138
+ if TEST(ci).choice==1, ACC=1; elseif TEST(ci).choice==2, ACC=0; end; PARSE=1;
139
+ elseif strmatch(TEST(ci).condi,'WX');
140
+ if TEST(ci).choice==5, ACC=1; elseif TEST(ci).choice==6, ACC=0; end; PARSE=2;
141
+ elseif strmatch(TEST(ci).condi,'CD');
142
+ if TEST(ci).choice==3, ACC=1; elseif TEST(ci).choice==4, ACC=0; end; PARSE=3;
143
+ elseif strmatch(TEST(ci).condi,'YZ');
144
+ if TEST(ci).choice==7, ACC=1; elseif TEST(ci).choice==8, ACC=0; end; PARSE=4;
145
+ end
146
+ % ^^^^ free vs. forced A,B,C,D == W,X,Y,Z - 8 of each set
147
+ BIAS=NaN;
148
+ if strmatch(TEST(ci).condi,'AW');
149
+ if TEST(ci).choice==1, BIAS=1; elseif TEST(ci).choice==5, BIAS=0; end; PARSE=5;
150
+ elseif strmatch(TEST(ci).condi,'CY');
151
+ if TEST(ci).choice==3, BIAS=1; elseif TEST(ci).choice==7, BIAS=0; end; PARSE=6;
152
+ elseif strmatch(TEST(ci).condi,'DZ');
153
+ if TEST(ci).choice==4, BIAS=1; elseif TEST(ci).choice==8, BIAS=0; end; PARSE=7;
154
+ elseif strmatch(TEST(ci).condi,'BX');
155
+ if TEST(ci).choice==2, BIAS=1; elseif TEST(ci).choice==6, BIAS=0; end; PARSE=8;
156
+ end
157
+ % ^^^^
158
+ WITHINSET=NaN;
159
+ if strmatch(TEST(ci).condi,'AC');
160
+ if TEST(ci).choice==1, WITHINSET=1; elseif TEST(ci).choice==3, WITHINSET=0; end; PARSE=9;
161
+ elseif strmatch(TEST(ci).condi,'AD');
162
+ if TEST(ci).choice==1, WITHINSET=1; elseif TEST(ci).choice==4, WITHINSET=0; end; PARSE=10;
163
+ elseif strmatch(TEST(ci).condi,'BC');
164
+ if TEST(ci).choice==3, WITHINSET=1; elseif TEST(ci).choice==2, WITHINSET=0; end; PARSE=11;
165
+ elseif strmatch(TEST(ci).condi,'BD');
166
+ if TEST(ci).choice==4, WITHINSET=1; elseif TEST(ci).choice==2, WITHINSET=0; end; PARSE=12;
167
+ elseif strmatch(TEST(ci).condi,'WY');
168
+ if TEST(ci).choice==5, WITHINSET=1; elseif TEST(ci).choice==7, WITHINSET=0; end; PARSE=13;
169
+ elseif strmatch(TEST(ci).condi,'WZ');
170
+ if TEST(ci).choice==5, WITHINSET=1; elseif TEST(ci).choice==8, WITHINSET=0; end; PARSE=14;
171
+ elseif strmatch(TEST(ci).condi,'XY');
172
+ if TEST(ci).choice==7, WITHINSET=1; elseif TEST(ci).choice==6, WITHINSET=0; end; PARSE=15;
173
+ elseif strmatch(TEST(ci).condi,'XZ');
174
+ if TEST(ci).choice==8, WITHINSET=1; elseif TEST(ci).choice==6, WITHINSET=0; end; PARSE=16;
175
+ end
176
+ % ^^^^
177
+ EASY=NaN;
178
+ if strmatch(TEST(ci).condi,'AX');
179
+ if TEST(ci).choice==1, EASY=1; elseif TEST(ci).choice==5, EASY=0; end; PARSE=17;
180
+ elseif strmatch(TEST(ci).condi,'AY');
181
+ if TEST(ci).choice==1, EASY=1; elseif TEST(ci).choice==7, EASY=0; end; PARSE=18;
182
+ elseif strmatch(TEST(ci).condi,'AZ');
183
+ if TEST(ci).choice==1, EASY=1; elseif TEST(ci).choice==8, EASY=0; end; PARSE=19;
184
+ elseif strmatch(TEST(ci).condi,'BW');
185
+ if TEST(ci).choice==5, EASY=1; elseif TEST(ci).choice==2, EASY=0; end; PARSE=20;
186
+ elseif strmatch(TEST(ci).condi,'CW');
187
+ if TEST(ci).choice==5, EASY=1; elseif TEST(ci).choice==3, EASY=0; end; PARSE=21;
188
+ elseif strmatch(TEST(ci).condi,'DW');
189
+ if TEST(ci).choice==5, EASY=1; elseif TEST(ci).choice==4, EASY=0; end; PARSE=22;
190
+ end
191
+ % ^^^^
192
+ MEDIUM=NaN;
193
+ if strmatch(TEST(ci).condi,'CX');
194
+ if TEST(ci).choice==3, MEDIUM=1; elseif TEST(ci).choice==6, MEDIUM=0; end; PARSE=23;
195
+ elseif strmatch(TEST(ci).condi,'CZ');
196
+ if TEST(ci).choice==3, MEDIUM=1; elseif TEST(ci).choice==8, MEDIUM=0; end; PARSE=24;
197
+ elseif strmatch(TEST(ci).condi,'BY');
198
+ if TEST(ci).choice==7, MEDIUM=1; elseif TEST(ci).choice==2, MEDIUM=0; end; PARSE=25;
199
+ elseif strmatch(TEST(ci).condi,'DY');
200
+ if TEST(ci).choice==7, MEDIUM=1; elseif TEST(ci).choice==4, MEDIUM=0; end; PARSE=26;
201
+ end
202
+ % ^^^^
203
+ HARD=NaN;
204
+ if strmatch(TEST(ci).condi,'BZ');
205
+ if TEST(ci).choice==8, HARD=1; elseif TEST(ci).choice==2, HARD=0; end; PARSE=27;
206
+ elseif strmatch(TEST(ci).condi,'DX');
207
+ if TEST(ci).choice==4, HARD=1; elseif TEST(ci).choice==6, HARD=0; end; PARSE=28;
208
+ end
209
+ % ^^^^
210
+ TST_ACC(ci,1)=ACC;
211
+ TST_BIAS(ci,1)=BIAS;
212
+ TST_WITHINSET(ci,1)=WITHINSET;
213
+ TST_EASY(ci,1)=EASY;
214
+ TST_MEDIUM(ci,1)=MEDIUM;
215
+ TST_HARD(ci,1)=HARD;
216
+ TST_PARSE(ci,1)=PARSE;
217
+ clear ACC BIAS WITHINSET EASY MEDIUM HARD PARSE;
218
+ end
219
+
220
+ for di=1:4
221
+ ACCURACIES(di)=nanmean(TST_ACC(TST_PARSE==di));
222
+ end
223
+ for di=5:8
224
+ BIASES(di-4)=nanmean(TST_BIAS(TST_PARSE==di));
225
+ end
226
+ for di=9:16
227
+ WITHINSETS(di-8)=nanmean(TST_WITHINSET(TST_PARSE==di));
228
+ end
229
+ for di=17:22
230
+ EASYS(di-16)=nanmean(TST_EASY(TST_PARSE==di));
231
+ end
232
+ for di=23:26
233
+ MEDIUMS(di-22)=nanmean(TST_MEDIUM(TST_PARSE==di));
234
+ end
235
+ for di=27:28
236
+ HARDS(di-26)=nanmean(TST_HARD(TST_PARSE==di));
237
+ end
238
+
239
+
240
+ MEGA(row).TST_ACC=ACCURACIES;
241
+ MEGA(row).TST_BIAS=BIASES;
242
+ MEGA(row).TST_WITHINSET=WITHINSETS;
243
+ MEGA(row).TST_EASY=EASYS;
244
+ MEGA(row).TST_MEDIUM=MEDIUMS;
245
+ MEGA(row).TST_HARD=HARDS;
246
+ MEGA(row).TST_RT=mean(RT);
247
+
248
+ clearvars -except MEGA subjcount subno session RT row ONOFF SUBJS;
249
+ end
250
+ end
251
+ save('VV_Behavior.mat','MEGA');
252
+
253
+ clear ONOFF RT row session subno
254
+
255
+ %%
256
+ clear all; clc
257
+ datapath=('Y:\EEG_Data\PDDys\BEH\');
258
+ cd(datapath);
259
+ SUBJS=[801:811,813:829]; % Only include here if they have BOTH sessions done!
260
+
261
+ load('Y:\EEG_Data\PDDys\PD_Moderators.mat','Mods','Mods_Hdr')
262
+
263
+ load('VV_Behavior.mat','MEGA');
264
+
265
+ row=0;
266
+ for subno=SUBJS
267
+ row=row+1;
268
+ for mi=1:size(MEGA,2)
269
+ if MEGA(mi).ID==subno && MEGA(mi).ONOFF==1
270
+ ON.ID(row,:)=MEGA(mi).ID;
271
+ ON.session(row,:)=MEGA(mi).session;
272
+ ON.TRN_ACC(row,:)=MEGA(mi).TRN_ACC;
273
+ ON.TRN_RT(row,:)=MEGA(mi).TRN_RT;
274
+ ON.WinStay(row,:)=MEGA(mi).WinStay;
275
+ ON.LoseSwitch(row,:)=MEGA(mi).LoseSwitch;
276
+ ON.WinSpeed(row,:)=MEGA(mi).WinSpeed;
277
+ ON.TST_ACC(row,:)=MEGA(mi).TST_ACC;
278
+ ON.TST_BIAS(row,:)=MEGA(mi).TST_BIAS;
279
+ ON.TST_WITHINSET(row,:)=MEGA(mi).TST_WITHINSET;
280
+ ON.TST_EASY(row,:)=MEGA(mi).TST_EASY;
281
+ ON.TST_MEDIUM(row,:)=MEGA(mi).TST_MEDIUM;
282
+ ON.TST_HARD(row,:)=MEGA(mi).TST_HARD;
283
+ ON.TST_RT(row,:)=MEGA(mi).TST_RT;
284
+ ON.Blocks(row,:)=MEGA(mi).TRN_blocks;
285
+ elseif MEGA(mi).ID==subno && MEGA(mi).ONOFF==0
286
+ OFF.ID(row,:)=MEGA(mi).ID;
287
+ OFF.session(row,:)=MEGA(mi).session;
288
+ OFF.TRN_ACC(row,:)=MEGA(mi).TRN_ACC;
289
+ OFF.TRN_RT(row,:)=MEGA(mi).TRN_RT;
290
+ OFF.WinStay(row,:)=MEGA(mi).WinStay;
291
+ OFF.LoseSwitch(row,:)=MEGA(mi).LoseSwitch;
292
+ OFF.WinSpeed(row,:)=MEGA(mi).WinSpeed;
293
+ OFF.TST_ACC(row,:)=MEGA(mi).TST_ACC;
294
+ OFF.TST_BIAS(row,:)=MEGA(mi).TST_BIAS;
295
+ OFF.TST_WITHINSET(row,:)=MEGA(mi).TST_WITHINSET;
296
+ OFF.TST_EASY(row,:)=MEGA(mi).TST_EASY;
297
+ OFF.TST_MEDIUM(row,:)=MEGA(mi).TST_MEDIUM;
298
+ OFF.TST_HARD(row,:)=MEGA(mi).TST_HARD;
299
+ OFF.TST_RT(row,:)=MEGA(mi).TST_RT;
300
+ OFF.Blocks(row,:)=MEGA(mi).TRN_blocks;
301
+ end
302
+ end
303
+ end
304
+
305
+ save('BEH_VV_PD','ON','OFF');
306
+
307
+ BigN=length(SUBJS);
308
+ jitter=rand(1,BigN)./2.5; jitter=jitter-mean(jitter);
309
+
310
+
311
+ % % SOMESX=double(repmat((Mods(:,9)>nanmedian(Mods(:,9))),1,4));
312
+ % % SOMESX(SOMESX==0)=NaN;
313
+ % % ON.TST_BIAS=ON.TST_BIAS.*SOMESX;
314
+ % % OFF.TST_BIAS=OFF.TST_BIAS.*SOMESX;
315
+
316
+
317
+ %%
318
+ figure;
319
+ subplot(1,3,1); hold on
320
+ bar(1:4,mean(ON.WinStay),.25,'w');
321
+ bar(1.25:4.25,mean(OFF.WinStay),.25,'r');
322
+ errorbar(1:4,mean(ON.WinStay),std(ON.WinStay)./sqrt(BigN),'k.');
323
+ errorbar(1.25:4.25,mean(OFF.WinStay),std(OFF.WinStay)./sqrt(BigN),'k.');
324
+ set(gca,'xlim',[0 5],'xtick',[1:1:4],'xticklabel',{'AB','CD','WY','XZ'},'ylim',[.5 1]);
325
+ title('TRN WinStay');
326
+ subplot(1,3,2); hold on
327
+ bar(1:4,nanmean(ON.LoseSwitch),.25,'w');
328
+ bar(1.25:4.25,nanmean(OFF.LoseSwitch),.25,'r');
329
+ errorbar(1:4,nanmean(ON.LoseSwitch),nanstd(ON.LoseSwitch)./sqrt(BigN),'k.');
330
+ errorbar(1.25:4.25,nanmean(OFF.LoseSwitch),nanstd(OFF.LoseSwitch)./sqrt(BigN),'k.');
331
+ set(gca,'xlim',[0 5],'xtick',[1:1:4],'xticklabel',{'AB','CD','WY','XZ'});
332
+ title('TRN LoseSwitch');
333
+ subplot(1,3,3); hold on
334
+ bar(1:4,nanmean(ON.WinSpeed),.25,'w');
335
+ bar(1.25:4.25,nanmean(OFF.WinSpeed),.25,'r');
336
+ errorbar(1:4,nanmean(ON.WinSpeed),nanstd(ON.WinSpeed)./sqrt(BigN),'k.');
337
+ errorbar(1.25:4.25,nanmean(OFF.WinSpeed),nanstd(OFF.WinSpeed)./sqrt(BigN),'k.');
338
+ set(gca,'xlim',[0 5],'xtick',[1:1:4],'xticklabel',{'AB','CD','WY','XZ'});
339
+ title('TRN WinSpeed');
340
+
341
+
342
+ %%
343
+ figure;
344
+ subplot(2,5,1); hold on
345
+ bar(1,mean(ON.TRN_ACC),'w');
346
+ bar(2,mean(OFF.TRN_ACC),'r');
347
+ errorbar(1,mean(ON.TRN_ACC),std(ON.TRN_ACC)./sqrt(BigN),'k.');
348
+ errorbar(2,mean(OFF.TRN_ACC),std(OFF.TRN_ACC)./sqrt(BigN),'k.');
349
+ % plot(1,ON.TRN_ACC,'b.'); plot(2,OFF.TRN_ACC,'b.');
350
+ % plot([1 2],[ON.TRN_ACC OFF.TRN_ACC],'b-');
351
+ set(gca,'xlim',[0 3],'xtick',[1:1:2],'xticklabel',{'ON','OFF'},'ylim',[.5 1]);
352
+ title('TRN Acc');
353
+
354
+ subplot(2,5,2:3); hold on
355
+ bar(1:4,mean(ON.TST_ACC),.25,'w');
356
+ bar(1.25:1:4.25,mean(OFF.TST_ACC),.25,'r');
357
+ errorbar(1:4,mean(ON.TST_ACC),std(ON.TST_ACC)./sqrt(BigN),'k.');
358
+ errorbar(1.25:1:4.25,mean(OFF.TST_ACC),std(OFF.TST_ACC)./sqrt(BigN),'k.');
359
+ % plot(1:4,ON.TST_ACC,'b.'); plot(1.25:1:4.25,OFF.TST_ACC,'b.');
360
+ % plot([1 1.25],[ON.TST_ACC(:,1) OFF.TST_ACC(:,1)],'b-');
361
+ % plot([2 2.25],[ON.TST_ACC(:,2) OFF.TST_ACC(:,2)],'b-');
362
+ % plot([3 3.25],[ON.TST_ACC(:,3) OFF.TST_ACC(:,3)],'b-');
363
+ % plot([4 4.25],[ON.TST_ACC(:,4) OFF.TST_ACC(:,4)],'b-');
364
+ set(gca,'xlim',[0 5],'xtick',[1:1:4],'xticklabel',{'AB','WX','CD','YZ'});
365
+ title('TST Acc');
366
+
367
+ subplot(2,5,4:5); hold on
368
+ bar(1:4,nanmean(ON.TST_BIAS),.25,'w');
369
+ bar(1.25:1:4.25,nanmean(OFF.TST_BIAS),.25,'r');
370
+ errorbar(1:4,nanmean(ON.TST_BIAS),nanstd(ON.TST_BIAS)./sqrt(BigN),'k.');
371
+ errorbar(1.25:1:4.25,nanmean(OFF.TST_BIAS),nanstd(OFF.TST_BIAS)./sqrt(BigN),'k.');
372
+ % plot(1:4,ON.TST_BIAS,'b.'); plot(1.25:1:4.25,OFF.TST_BIAS,'b.');
373
+ % plot([1 1.25],[ON.TST_BIAS(:,1) OFF.TST_BIAS(:,1)],'b-');
374
+ % plot([2 2.25],[ON.TST_BIAS(:,2) OFF.TST_BIAS(:,2)],'b-');
375
+ % plot([3 3.25],[ON.TST_BIAS(:,3) OFF.TST_BIAS(:,3)],'b-');
376
+ % plot([4 4.25],[ON.TST_BIAS(:,4) OFF.TST_BIAS(:,4)],'b-');
377
+ set(gca,'xlim',[0 5],'xtick',[1:1:4],'xticklabel',{'AW','CY','DZ','BX'});
378
+ title('TST BIAS');
379
+
380
+
381
+
382
+ subplot(2,5,6); hold on
383
+ bar(1,mean(ON.TRN_ACC-OFF.TRN_ACC),'b');
384
+ errorbar(1,mean(ON.TRN_ACC-OFF.TRN_ACC),std(ON.TRN_ACC-OFF.TRN_ACC)./sqrt(BigN),'k.');
385
+ set(gca,'xlim',[0 2],'xtick',[1:1:1]);
386
+ title('TRN Acc DIFF');
387
+
388
+ subplot(2,5,7:8); hold on
389
+ bar(1:4,mean(ON.TST_ACC-OFF.TST_ACC),.25,'b');
390
+ errorbar(1:4,mean(ON.TST_ACC-OFF.TST_ACC),std(ON.TST_ACC-OFF.TST_ACC)./sqrt(BigN),'k.');
391
+ set(gca,'xlim',[0 5],'xtick',[1:1:4],'xticklabel',{'AB','WX','CD','YZ'});
392
+ title('TST Acc');
393
+
394
+
395
+ subplot(2,5,9:10); hold on
396
+ bar(1:4,nanmean( ON.TST_BIAS-OFF.TST_BIAS ),.25,'w');
397
+ errorbar(1:4,nanmean(ON.TST_BIAS-OFF.TST_BIAS ),std(ON.TST_BIAS-OFF.TST_BIAS )./sqrt(BigN),'k.');
398
+ % for plotdiffi=1:4
399
+ % plot(plotdiffi+jitter',(ON.TST_BIAS(:,plotdiffi)-OFF.TST_BIAS(:,plotdiffi)),'mo');
400
+ % end
401
+ set(gca,'xlim',[0 5],'xtick',[1:1:4],'xticklabel',{'AW','CY','DZ','BX'});
402
+ title('TST BIAS');
403
+
404
+ %%
405
+ MODS=9;
406
+
407
+ BigDiff=ON.TST_BIAS-OFF.TST_BIAS;
408
+ for polyi=1:BigN
409
+ POLY{1}(polyi)=corr(ON.TST_BIAS(polyi,:)',(1:4)');
410
+ POLY{2}(polyi)=corr(OFF.TST_BIAS(polyi,:)',(1:4)');
411
+ POLY{3}(polyi)=corr(BigDiff(polyi,:)',(1:4)');
412
+ end
413
+
414
+ dispidx=3;
415
+ figure;
416
+ subplot(1,2,1); hold on
417
+ bar(mean(POLY{dispidx}),'w');
418
+ plot(.86:.01:1.13,POLY{dispidx},'bd');
419
+ errorbar(mean(POLY{dispidx}),std(POLY{dispidx})./sqrt(BigN),'k.')
420
+ set(gca,'xlim',[0 2],'xtick',[1:1:2])
421
+ ylabel('Slope in Accuracy Difference');
422
+ [H,P,CI,STATS]=ttest(POLY{dispidx})
423
+ title(['BIAS t=',num2str(STATS.tstat),' p=',num2str(P)]);
424
+ subplot(1,2,2); hold on
425
+ scatter( Mods(:,MODS) , POLY{dispidx}' ,'k'); lsline
426
+ [rho,p]=corr( Mods(:,MODS) , POLY{dispidx}' ,'type','Spearman','rows','complete' );
427
+ text(.4,.1,['r=',num2str(rho),' p=',num2str(p)],'sc')
428
+ title(['POLY & ',Mods_Hdr{MODS}])
429
+
430
+ FORSPSS=[BigDiff,POLY{3}'];
431
+
432
+ for slopei=1:4
433
+ if slopei==1, X=ON.TST_BIAS;
434
+ elseif slopei==2, X=OFF.TST_BIAS;
435
+ elseif slopei==3, X=CTL.TST_BIAS;
436
+ elseif slopei==4, X=ON.TST_BIAS-OFF.TST_BIAS;
437
+ end
438
+ for polyi=1:length(X)
439
+ SLOPES{slopei}(polyi)=corr(X(polyi,:)',(1:4)');
440
+ end
441
+ end
442
+
443
+ figure;
444
+ subplot(2,2,1); hold on
445
+ bar(1,mean(SLOPES{1}),'w');
446
+ bar(2,mean(SLOPES{2}),'r');
447
+ bar(3,mean(SLOPES{3}),'g');
448
+ errorbar(1,mean(SLOPES{1}),std(SLOPES{1})./sqrt(BigN),'k.');
449
+ errorbar(2,mean(SLOPES{2}),std(SLOPES{2})./sqrt(BigN),'k.');
450
+ errorbar(3,mean(SLOPES{3}),std(SLOPES{3})./sqrt(BigN_ctl),'k.');
451
+ ylabel('Slope in Accuracy Difference');
452
+ subplot(2,2,2); hold on
453
+ scatter( Mods(:,MODS) , SLOPES{4} ,'b'); lsline
454
+ [rho,p]=corr( Mods(:,MODS) , SLOPES{4}' ,'type','Spearman','rows','complete' );
455
+ text(.4,.1,['r=',num2str(rho),' p=',num2str(p)],'sc')
456
+ title(['ON-OFF & ',Mods_Hdr{MODS}])
457
+ subplot(2,2,3); hold on
458
+ scatter( Mods(:,MODS) , SLOPES{1} ,'k'); lsline
459
+ [rho,p]=corr( Mods(:,MODS) , SLOPES{1}' ,'type','Spearman','rows','complete' );
460
+ text(.4,.1,['r=',num2str(rho),' p=',num2str(p)],'sc')
461
+ title(['ON & ',Mods_Hdr{MODS}])
462
+ subplot(2,2,4); hold on
463
+ scatter( Mods(:,MODS) , SLOPES{2} ,'r'); lsline
464
+ [rho,p]=corr( Mods(:,MODS) , SLOPES{2}' ,'type','Spearman','rows','complete' );
465
+ text(.4,.1,['r=',num2str(rho),' p=',num2str(p)],'sc')
466
+ title(['OFF & ',Mods_Hdr{MODS}])
467
+
468
+
469
+ %%
470
+
471
+ % LED & win-speed diff
472
+ % LED & BX bias diff
473
+
474
+ MOD_IDX=2;
475
+
476
+ A1=sum(OFF.TST_BIAS(:,1),2)
477
+ A2=sum(ON.TST_BIAS(:,1),2)
478
+ A3=A1-A2;
479
+
480
+ figure;
481
+ subplot(1,3,1); hold on
482
+ scatter( Mods(:,MOD_IDX) , A1 ,'k'); lsline
483
+ [rho,p]=corr( Mods(:,MOD_IDX) , A1 ,'type','Spearman','rows','complete' );
484
+ text(.4,.1,['r=',num2str(rho),' p=',num2str(p)],'sc')
485
+ title(['OFF & ',Mods_Hdr{MOD_IDX}])
486
+ subplot(1,3,2); hold on
487
+ scatter( Mods(:,MOD_IDX) ,A2 ,'k' ); lsline
488
+ [rho,p]=corr( Mods(:,MOD_IDX) , A2 ,'type','Spearman','rows','complete' );
489
+ text(.4,.1,['r=',num2str(rho),' p=',num2str(p)],'sc')
490
+ title(['ON & ',Mods_Hdr{MOD_IDX}])
491
+ subplot(1,3,3); hold on
492
+ scatter( Mods(:,MOD_IDX) , A3 ,'k' ); lsline
493
+ [rho,p]=corr( Mods(:,MOD_IDX) , A3 ,'type','Spearman','rows','complete' );
494
+ text(.4,.1,['r=',num2str(rho),' p=',num2str(p)],'sc')
495
+ title(['OFF-ON & ',Mods_Hdr{MOD_IDX}])
496
+
497
+ %%
498
+ load('VV_Behavior_CTL.mat','CTL');
499
+
500
+ BigN=length(SUBJS);
501
+ jitter=rand(1,BigN)./2.5; jitter=jitter-mean(jitter);
502
+ BigN_ctl=size(CTL.ID,1);
503
+ noise_ctl=rand(1,BigN_ctl)./100;
504
+
505
+ figure;
506
+ subplot(2,5,1); hold on
507
+ bar(1,mean(ON.TRN_ACC),'w');
508
+ bar(2,mean(OFF.TRN_ACC),'r');
509
+ bar(3,mean(CTL.TRN_ACC),'g');
510
+ errorbar(1,mean(ON.TRN_ACC),std(ON.TRN_ACC)./sqrt(BigN),'k.');
511
+ errorbar(2,mean(OFF.TRN_ACC),std(OFF.TRN_ACC)./sqrt(BigN),'k.');
512
+ errorbar(3,mean(CTL.TRN_ACC),std(CTL.TRN_ACC)./sqrt(BigN_ctl),'k.');
513
+ set(gca,'xlim',[0 4],'xtick',[1:1:3],'xticklabel',{'ON','OFF','CTL'},'ylim',[.5 1]);
514
+ title('TRN Acc');
515
+
516
+ subplot(2,5,2:3); hold on
517
+ bar(1-.25:4-.25,mean(ON.TST_ACC),.25,'w');
518
+ bar(1:1:4,mean(OFF.TST_ACC),.25,'r');
519
+ bar(1.25:1:4.25,mean(CTL.TST_ACC),.25,'g');
520
+ errorbar(1-.25:4-.25,mean(ON.TST_ACC),std(ON.TST_ACC)./sqrt(BigN),'k.');
521
+ errorbar(1:1:4,mean(OFF.TST_ACC),std(OFF.TST_ACC)./sqrt(BigN),'k.');
522
+ errorbar(1.25:1:4.25,mean(CTL.TST_ACC),std(CTL.TST_ACC)./sqrt(BigN_ctl),'k.');
523
+ set(gca,'xlim',[0 5],'xtick',[1:1:4],'xticklabel',{'AB','WX','CD','YZ'});
524
+ title('TST Acc');
525
+
526
+ subplot(2,5,4:5); hold on
527
+ bar(1-.25:4-.25,mean(ON.TST_BIAS),.25,'w');
528
+ bar(1:1:4,mean(OFF.TST_BIAS),.25,'r');
529
+ bar(1.25:1:4.25,mean(CTL.TST_BIAS),.25,'g');
530
+ errorbar(1-.25:4-.25,mean(ON.TST_BIAS),std(ON.TST_BIAS)./sqrt(BigN),'k.');
531
+ errorbar(1:1:4,mean(OFF.TST_BIAS),std(OFF.TST_BIAS)./sqrt(BigN),'k.');
532
+ errorbar(1.25:1:4.25,mean(CTL.TST_BIAS),std(CTL.TST_BIAS)./sqrt(BigN_ctl),'k.');
533
+ set(gca,'xlim',[0 5],'xtick',[1:1:4],'xticklabel',{'AW','CY','DZ','BX'});
534
+ title('TST BIAS');
535
+
536
+ [H,P,CI,STATS]=ttest2(ON.TST_BIAS(:,1),CTL.TST_BIAS(:,1))
537
+ [H,P,CI,STATS]=ttest2(OFF.TST_BIAS(:,1),CTL.TST_BIAS(:,1))
538
+
539
+ subplot(2,5,6); hold on
540
+ bar(1,mean(ON.TRN_ACC-OFF.TRN_ACC),'b');
541
+ errorbar(1,mean(ON.TRN_ACC-OFF.TRN_ACC),std(ON.TRN_ACC-OFF.TRN_ACC)./sqrt(BigN),'k.');
542
+ set(gca,'xlim',[0 2],'xtick',[1:1:1]);
543
+ title('TRN Acc DIFF');
544
+
545
+ subplot(2,5,7:8); hold on
546
+ bar(1:4,mean(ON.TST_ACC-OFF.TST_ACC),.25,'b');
547
+ errorbar(1:4,mean(ON.TST_ACC-OFF.TST_ACC),std(ON.TST_ACC-OFF.TST_ACC)./sqrt(BigN),'k.');
548
+ set(gca,'xlim',[0 5],'xtick',[1:1:4],'xticklabel',{'AB','WX','CD','YZ'});
549
+ title('TST Acc DIFF');
550
+
551
+ subplot(2,5,9:10); hold on
552
+ bar(1:4,mean(ON.TST_BIAS-OFF.TST_BIAS),.25,'w');
553
+ errorbar(1:4,mean(ON.TST_BIAS-OFF.TST_BIAS),std(ON.TST_BIAS-OFF.TST_BIAS)./sqrt(BigN),'k.');
554
+ % % for plotdiffi=1:4
555
+ % % plot(plotdiffi+jitter',(ON.TST_BIAS(:,plotdiffi)-OFF.TST_BIAS(:,plotdiffi)),'mo');
556
+ % % end
557
+ set(gca,'xlim',[0 5],'xtick',[1:1:4],'xticklabel',{'AW','CY','DZ','BX'});
558
+ title('TST BIAS DIFF');
559
+
560
+ %%
561
+
562
+ %%
563
+
564
+
565
+ figure;
566
+ subplot(3,2,1:2)
567
+ hold on
568
+ bar(1-.25:1:8-.25,mean(VV.CTL.TST_WITHINSET),.25,'g');
569
+ bar(1:1:8,mean(VV.ON.TST_WITHINSET),.25,'w');
570
+ bar(1+.25:1:8+.25,mean(VV.OFF.TST_WITHINSET),.25,'r');
571
+ errorbar(1-.25:1:8-.25,mean(VV.CTL.TST_WITHINSET),std(VV.CTL.TST_WITHINSET)./sqrt(BigN_ctl),'k.');
572
+ errorbar(1:1:8,mean(VV.ON.TST_WITHINSET),std(VV.ON.TST_WITHINSET)./sqrt(BigN),'k.');
573
+ errorbar(1+.25:1:8+.25,mean(VV.OFF.TST_WITHINSET),std(VV.OFF.TST_WITHINSET)./sqrt(BigN),'k.');
574
+ plot([0 9],[.5 .5],'b:')
575
+ set(gca,'xlim',[0 9],'xtick',[1:1:8],'xticklabel',{'AC','AD','CB','BD','WY','WZ','YX','XZ'},'ytick',[0:.25:1]);
576
+ title('TST w/in set Acc');
577
+
578
+ subplot(3,2,3:4)
579
+ hold on
580
+ bar(1-.25:1:6-.25,nanmean(VV.CTL.TST_EASY),.25,'g');
581
+ bar(1:1:6,nanmean(VV.ON.TST_EASY),.25,'w');
582
+ bar(1+.25:1:6+.25,nanmean(VV.OFF.TST_EASY),.25,'r');
583
+ errorbar(1-.25:1:6-.25,nanmean(VV.CTL.TST_EASY),nanstd(VV.CTL.TST_EASY)./sqrt(BigN_ctl),'k.');
584
+ errorbar(1:1:6,nanmean(VV.ON.TST_EASY),nanstd(VV.ON.TST_EASY)./sqrt(BigN),'k.');
585
+ errorbar(1+.25:1:6+.25,nanmean(VV.OFF.TST_EASY),nanstd(VV.OFF.TST_EASY)./sqrt(BigN),'k.');
586
+ plot([0 7],[.5 .5],'b:')
587
+ set(gca,'xlim',[0 7],'xtick',[1:1:6],'xticklabel',{'AX','AY','AZ','WB','WC','WD'},'ytick',[0:.25:1]);
588
+ title('TST EASY Acc');
589
+
590
+ subplot(3,2,5)
591
+ hold on
592
+ bar(1-.25:1:4-.25,nanmean(VV.CTL.TST_MEDIUM),.25,'g');
593
+ bar(1:1:4,nanmean(VV.ON.TST_MEDIUM),.25,'w');
594
+ bar(1+.25:1:4+.25,nanmean(VV.OFF.TST_MEDIUM),.25,'r');
595
+ errorbar(1-.25:1:4-.25,nanmean(VV.CTL.TST_MEDIUM),nanstd(VV.CTL.TST_MEDIUM)./sqrt(BigN_ctl),'k.');
596
+ errorbar(1:1:4,nanmean(VV.ON.TST_MEDIUM),nanstd(VV.ON.TST_MEDIUM)./sqrt(BigN),'k.');
597
+ errorbar(1+.25:1:4+.25,nanmean(VV.OFF.TST_MEDIUM),nanstd(VV.OFF.TST_MEDIUM)./sqrt(BigN),'k.');
598
+ plot([0 5],[.5 .5],'b:')
599
+ set(gca,'xlim',[0 5],'xtick',[1:1:4],'xticklabel',{'CX','CZ','YB','YD'},'ytick',[0:.25:1]);
600
+ title('TST MEDIUM Acc');
601
+
602
+ subplot(3,2,6)
603
+ hold on
604
+ bar(1-.25:1:2-.25,nanmean(VV.CTL.TST_HARD),.25,'g');
605
+ bar(1:1:2,nanmean(VV.ON.TST_HARD),.25,'w');
606
+ bar(1+.25:1:2+.25,nanmean(VV.OFF.TST_HARD),.25,'r');
607
+ errorbar(1-.25:1:2-.25,nanmean(VV.CTL.TST_HARD),nanstd(VV.CTL.TST_HARD)./sqrt(BigN_ctl),'k.');
608
+ errorbar(1:1:2,nanmean(VV.ON.TST_HARD),nanstd(VV.ON.TST_HARD)./sqrt(BigN),'k.');
609
+ errorbar(1+.25:1:2+.25,nanmean(VV.OFF.TST_HARD),nanstd(VV.OFF.TST_HARD)./sqrt(BigN),'k.');
610
+ plot([0 3],[.5 .5],'b:')
611
+ set(gca,'xlim',[0 3],'xtick',[1:1:2],'xticklabel',{'ZB','DX'},'ytick',[0:.25:1]);
612
+ title('TST HARD Acc');
613
+
614
+
615
+
616
+
617
+ % ^^^^^^
618
+
619
+
620
+
621
+ figure;
622
+ subplot(3,2,1:2)
623
+ hold on
624
+ bar(1-.3:1:8-.3,nanmean(VV.ON.TST_WITHINSET(Esx,:)),.15,'w');
625
+ bar(1-.1:1:8-.1,nanmean(VV.OFF.TST_WITHINSET(Esx,:)),.15,'r');
626
+ bar(1+.1:1:8+.1,nanmean(VV.ON.TST_WITHINSET(Lsx,:)),.15,'w');
627
+ bar(1+.3:1:8+.3,nanmean(VV.OFF.TST_WITHINSET(Lsx,:)),.15,'r');
628
+ errorbar(1-.3:1:8-.3,mean(VV.ON.TST_WITHINSET(Esx,:)),std(VV.ON.TST_WITHINSET(Esx,:))./sqrt(EarlyN),'k.');
629
+ errorbar(1-.1:1:8-.1,mean(VV.OFF.TST_WITHINSET(Esx,:)),std(VV.OFF.TST_WITHINSET(Esx,:))./sqrt(EarlyN),'k.');
630
+ errorbar(1+.1:1:8+.1,mean(VV.ON.TST_WITHINSET(Lsx,:)),std(VV.ON.TST_WITHINSET(Lsx,:))./sqrt(LateN),'k.');
631
+ errorbar(1+.3:1:8+.3,mean(VV.OFF.TST_WITHINSET(Lsx,:)),std(VV.OFF.TST_WITHINSET(Lsx,:))./sqrt(LateN),'k.');
632
+ plot([0 9],[.5 .5],'b:')
633
+ set(gca,'xlim',[0 9],'xtick',[1:1:8],'xticklabel',{'AC','AD','CB','BD','WY','WZ','YX','XZ'},'ytick',[0:.25:1]);
634
+ title('TST w/in set Acc');
635
+
636
+ subplot(3,2,3:4)
637
+ hold on
638
+ bar(1-.3:1:6-.3,nanmean(VV.ON.TST_EASY(Esx,:)),.15,'w');
639
+ bar(1-.1:1:6-.1,nanmean(VV.OFF.TST_EASY(Esx,:)),.15,'r');
640
+ bar(1+.1:1:6+.1,nanmean(VV.ON.TST_EASY(Lsx,:)),.15,'w');
641
+ bar(1+.3:1:6+.3,nanmean(VV.OFF.TST_EASY(Lsx,:)),.15,'r');
642
+ errorbar(1-.3:1:6-.3,mean(VV.ON.TST_EASY(Esx,:)),std(VV.ON.TST_EASY(Esx,:))./sqrt(EarlyN),'k.');
643
+ errorbar(1-.1:1:6-.1,mean(VV.OFF.TST_EASY(Esx,:)),std(VV.OFF.TST_EASY(Esx,:))./sqrt(EarlyN),'k.');
644
+ errorbar(1+.1:1:6+.1,mean(VV.ON.TST_EASY(Lsx,:)),std(VV.ON.TST_EASY(Lsx,:))./sqrt(LateN),'k.');
645
+ errorbar(1+.3:1:6+.3,mean(VV.OFF.TST_EASY(Lsx,:)),std(VV.OFF.TST_EASY(Lsx,:))./sqrt(LateN),'k.');
646
+ plot([0 7],[.5 .5],'b:')
647
+ set(gca,'xlim',[0 7],'xtick',[1:1:6],'xticklabel',{'AX','AY','AZ','WB','WC','WD'},'ytick',[0:.25:1]);
648
+ title('TST EASY Acc');
649
+
650
+ subplot(3,2,5)
651
+ hold on
652
+ bar(1-.3:1:4-.3,nanmean(VV.ON.TST_MEDIUM(Esx,:)),.15,'w');
653
+ bar(1-.1:1:4-.1,nanmean(VV.OFF.TST_MEDIUM(Esx,:)),.15,'r');
654
+ bar(1+.1:1:4+.1,nanmean(VV.ON.TST_MEDIUM(Lsx,:)),.15,'w');
655
+ bar(1+.3:1:4+.3,nanmean(VV.OFF.TST_MEDIUM(Lsx,:)),.15,'r');
656
+ errorbar(1-.3:1:4-.3,mean(VV.ON.TST_MEDIUM(Esx,:)),std(VV.ON.TST_MEDIUM(Esx,:))./sqrt(EarlyN),'k.');
657
+ errorbar(1-.1:1:4-.1,mean(VV.OFF.TST_MEDIUM(Esx,:)),std(VV.OFF.TST_MEDIUM(Esx,:))./sqrt(EarlyN),'k.');
658
+ errorbar(1+.1:1:4+.1,mean(VV.ON.TST_MEDIUM(Lsx,:)),std(VV.ON.TST_MEDIUM(Lsx,:))./sqrt(LateN),'k.');
659
+ errorbar(1+.3:1:4+.3,mean(VV.OFF.TST_MEDIUM(Lsx,:)),std(VV.OFF.TST_MEDIUM(Lsx,:))./sqrt(LateN),'k.');
660
+ plot([0 5],[.5 .5],'b:')
661
+ set(gca,'xlim',[0 5],'xtick',[1:1:4],'xticklabel',{'CX','CZ','YB','YD'},'ytick',[0:.25:1]);
662
+ title('TST MEDIUM Acc');
663
+
664
+ subplot(3,2,6)
665
+ hold on
666
+ bar(1-.3:1:2-.3,nanmean(VV.ON.TST_HARD(Esx,:)),.15,'w');
667
+ bar(1-.1:1:2-.1,nanmean(VV.OFF.TST_HARD(Esx,:)),.15,'r');
668
+ bar(1+.1:1:2+.1,nanmean(VV.ON.TST_HARD(Lsx,:)),.15,'w');
669
+ bar(1+.3:1:2+.3,nanmean(VV.OFF.TST_HARD(Lsx,:)),.15,'r');
670
+ errorbar(1-.3:1:2-.3,mean(VV.ON.TST_HARD(Esx,:)),std(VV.ON.TST_HARD(Esx,:))./sqrt(EarlyN),'k.');
671
+ errorbar(1-.1:1:2-.1,mean(VV.OFF.TST_HARD(Esx,:)),std(VV.OFF.TST_HARD(Esx,:))./sqrt(EarlyN),'k.');
672
+ errorbar(1+.1:1:2+.1,mean(VV.ON.TST_HARD(Lsx,:)),std(VV.ON.TST_HARD(Lsx,:))./sqrt(LateN),'k.');
673
+ errorbar(1+.3:1:2+.3,mean(VV.OFF.TST_HARD(Lsx,:)),std(VV.OFF.TST_HARD(Lsx,:))./sqrt(LateN),'k.');
674
+ plot([0 3],[.5 .5],'b:')
675
+ set(gca,'xlim',[0 3],'xtick',[1:1:2],'xticklabel',{'ZB','DX'},'ytick',[0:.25:1]);
676
+ title('TST HARD Acc');
677
+
678
+
679
+
680
+
681
+
682
+
683
+ %%
684
+ % % % clc;
685
+ % % % disp([num2str(subno),'_sess',num2str(session),'_VVbeh'])
686
+ % % % disp(' ')
687
+ % % % disp('Accuracy: >.5 shows that they learned optimal choice')
688
+ % % % disp([' choose: AB (90/10)',' match: WX (90/10)',' choose: CD (70/30)',' match: YZ (70/30)'])
689
+ % % % disp(['Test Acc: ',num2str(MEGA(row).TST_ACC)])
690
+ % % % disp(' ')
691
+ % % % disp('BIAS: >.5 is prefer Choose over Match (may only happen for first 2)')
692
+ % % % disp([' AW (90/90)',' CY (70/70)',' DZ (30/30)',' BX (30/30)'])
693
+ % % % disp(['Test BIAS: ',num2str(MEGA(row).TST_BIAS)])
694
+
695
+
696
+
697
+ %%
698
+
699
+
700
+
701
+
702
+
scripts/BEH_VV_CTL.m ADDED
@@ -0,0 +1,320 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ %% Calculate Data
2
+ clear all; clc
3
+ datapath=('Y:\EEG_Data\PDDys\BEH\');
4
+ cd(datapath);
5
+
6
+ SUBJS=[8010,8070,8060,890:914];
7
+
8
+ for subno=SUBJS
9
+ for session=1
10
+
11
+ disp(['VV Beh --- Subno: ',num2str(subno),' Session: ',num2str(session)]); disp(' ');
12
+
13
+ % TRAIN
14
+ fileID=dir([num2str(subno),'_S',num2str(session),'*']);
15
+ load(fileID.name); clear fileID
16
+
17
+ % ----- Columns are: -----
18
+ % 1 = block
19
+ % 2 = trial
20
+ % 3 = (cTrialID)
21
+ % 4 = Forced choice
22
+ % 6 = S1
23
+ % 8 = S2
24
+ % 10 = S1 is left
25
+ % 11 = Stim Selected
26
+ % 13 = Reward (1 or 0)
27
+ % 14 = RT
28
+
29
+ % ----------- Re-make With More Simpleness
30
+ ABchoose=[1,2]; CDchoose=[3,4]; WXmatch=[5,6]; YZmatch=[7,8];
31
+ for ai=1:length(task_struct.trainTrials)
32
+ if any(task_struct.trainTrials(ai,6)==ABchoose)
33
+ CONDI=1;
34
+ elseif any(task_struct.trainTrials(ai,6)==CDchoose)
35
+ CONDI=2;
36
+ elseif any(task_struct.trainTrials(ai,6)==WXmatch)
37
+ CONDI=3;
38
+ elseif any(task_struct.trainTrials(ai,6)==YZmatch)
39
+ CONDI=4;
40
+ end
41
+ TRAIN(ai,1)=CONDI; clear CONDI; % Condi: 1=ABchoose 2=CDchoose 3=ABmatch 4=CDmatch
42
+ TRAIN(ai,2)=mod(task_struct.trainTrials(ai,11),2); % Optimal choice (odd num are optimal: 1,3,5,7)
43
+ TRAIN(ai,3)=task_struct.trainTrials(ai,14); % RT
44
+ TRAIN(ai,4)=task_struct.trainTrials(ai,13); % was rewarded or not
45
+ end
46
+
47
+ % ----------- Re-make With More Simpleness
48
+
49
+ for ai=1:length(task_struct.testTrials)
50
+ ThisSet=task_struct.testTrials(ai,[6,8]);
51
+ ThisSet=str2num(cat(2,num2str(ThisSet(1)),num2str(ThisSet(2))));
52
+ ThisChoice=task_struct.testTrials(ai,11);
53
+
54
+ if any(ThisSet==[12,21]), CONDI='AB';
55
+ elseif any(ThisSet==[13,31]), CONDI='AC';
56
+ elseif any(ThisSet==[14,41]), CONDI='AD';
57
+ elseif any(ThisSet==[15,51]), CONDI='AW';
58
+ elseif any(ThisSet==[16,61]), CONDI='AX';
59
+ elseif any(ThisSet==[17,71]), CONDI='AY';
60
+ elseif any(ThisSet==[18,81]), CONDI='AZ';
61
+ elseif any(ThisSet==[23,32]), CONDI='BC';
62
+ elseif any(ThisSet==[24,42]), CONDI='BD';
63
+ elseif any(ThisSet==[25,52]), CONDI='BW';
64
+ elseif any(ThisSet==[26,62]), CONDI='BX';
65
+ elseif any(ThisSet==[27,72]), CONDI='BY';
66
+ elseif any(ThisSet==[28,82]), CONDI='BZ';
67
+ elseif any(ThisSet==[34,43]), CONDI='CD';
68
+ elseif any(ThisSet==[35,53]), CONDI='CW';
69
+ elseif any(ThisSet==[36,63]), CONDI='CX';
70
+ elseif any(ThisSet==[37,73]), CONDI='CY';
71
+ elseif any(ThisSet==[38,83]), CONDI='CZ';
72
+ elseif any(ThisSet==[45,54]), CONDI='DW';
73
+ elseif any(ThisSet==[46,64]), CONDI='DX';
74
+ elseif any(ThisSet==[47,74]), CONDI='DY';
75
+ elseif any(ThisSet==[48,84]), CONDI='DZ';
76
+ elseif any(ThisSet==[56,65]), CONDI='WX';
77
+ elseif any(ThisSet==[57,75]), CONDI='WY';
78
+ elseif any(ThisSet==[58,85]), CONDI='WZ';
79
+ elseif any(ThisSet==[67,76]), CONDI='XY';
80
+ elseif any(ThisSet==[68,86]), CONDI='XZ';
81
+ elseif any(ThisSet==[78,87]), CONDI='YZ';
82
+ end
83
+
84
+ TEST(ai).condi=CONDI; % Condi
85
+ TEST(ai).choice=ThisChoice; % This Choice
86
+ TEST(ai).RT=task_struct.testTrials(ai,14); % RT
87
+ clear ThisSet ThisChoice CONDI;
88
+ end
89
+
90
+ save([num2str(subno),'_sess',num2str(session),'_VVbeh.mat'],'TRAIN','TEST');
91
+
92
+ clear task_struct disp_struct AB* CD* TRAIN TEST
93
+ end
94
+ end
95
+
96
+ row=0;
97
+ for subno=SUBJS
98
+ for session=1;
99
+ row=row+1;
100
+
101
+ load([num2str(subno),'_sess',num2str(session),'_VVbeh.mat'],'TRAIN','TEST');
102
+
103
+ MEGA(row).ID=subno;
104
+ MEGA(row).session=session;
105
+ MEGA(row).TRN_blocks=size(TRAIN,1)./40;
106
+ MEGA(row).TRN_ACC=mean(TRAIN(:,2));
107
+ MEGA(row).TRN_RT=mean(TRAIN(:,3));
108
+ for bi=1:4 % Condi: 1=ABchoose 2=CDchoose 3=ABmatch 4=CDmatch
109
+ MINISET=TRAIN(TRAIN(:,1)==bi,:);
110
+ MINISET(:,[5,6])=[MINISET(2:end,[2,3]);[NaN,NaN]];
111
+ MINISET(:,6)=MINISET(:,6)-MINISET(:,3); % RT diff
112
+ % --------
113
+ WINS=MINISET(MINISET(:,4)==1,[2,5,6]);
114
+ LOSSES=MINISET(MINISET(:,4)==0,[2,5,6]);
115
+ % --------
116
+ WinStay(bi)=mean(WINS(:,1)==WINS(:,2));
117
+ LoseSwitch(bi)=mean(LOSSES(:,1)~=LOSSES(:,2));
118
+ WinSpeed(bi)=mean(WINS(WINS(:,1)==WINS(:,2),3));
119
+ % --------
120
+ clear MINISET WINS LOSSES
121
+ end
122
+
123
+ MEGA(row).WinStay=WinStay;
124
+ MEGA(row).LoseSwitch=LoseSwitch;
125
+ MEGA(row).WinSpeed=WinSpeed;
126
+
127
+ % ********************************************************
128
+ for ci=1:128
129
+ RT(ci,1)=TEST(ci).RT;
130
+ % ^^^^ General Accuracy A,B,C,D == W,X,Y,Z - 4 of each set
131
+ ACC=NaN; PARSE=NaN;
132
+ if strmatch(TEST(ci).condi,'AB');
133
+ if TEST(ci).choice==1, ACC=1; elseif TEST(ci).choice==2, ACC=0; end; PARSE=1;
134
+ elseif strmatch(TEST(ci).condi,'WX');
135
+ if TEST(ci).choice==5, ACC=1; elseif TEST(ci).choice==6, ACC=0; end; PARSE=2;
136
+ elseif strmatch(TEST(ci).condi,'CD');
137
+ if TEST(ci).choice==3, ACC=1; elseif TEST(ci).choice==4, ACC=0; end; PARSE=3;
138
+ elseif strmatch(TEST(ci).condi,'YZ');
139
+ if TEST(ci).choice==7, ACC=1; elseif TEST(ci).choice==8, ACC=0; end; PARSE=4;
140
+ end
141
+ % ^^^^ free vs. forced A,B,C,D == W,X,Y,Z - 8 of each set
142
+ BIAS=NaN;
143
+ if strmatch(TEST(ci).condi,'AW');
144
+ if TEST(ci).choice==1, BIAS=1; elseif TEST(ci).choice==5, BIAS=0; end; PARSE=5;
145
+ elseif strmatch(TEST(ci).condi,'CY');
146
+ if TEST(ci).choice==3, BIAS=1; elseif TEST(ci).choice==7, BIAS=0; end; PARSE=6;
147
+ elseif strmatch(TEST(ci).condi,'DZ');
148
+ if TEST(ci).choice==4, BIAS=1; elseif TEST(ci).choice==8, BIAS=0; end; PARSE=7;
149
+ elseif strmatch(TEST(ci).condi,'BX');
150
+ if TEST(ci).choice==2, BIAS=1; elseif TEST(ci).choice==6, BIAS=0; end; PARSE=8;
151
+ end
152
+ % ^^^^
153
+ WITHINSET=NaN;
154
+ if strmatch(TEST(ci).condi,'AC');
155
+ if TEST(ci).choice==1, WITHINSET=1; elseif TEST(ci).choice==3, WITHINSET=0; end; PARSE=9;
156
+ elseif strmatch(TEST(ci).condi,'AD');
157
+ if TEST(ci).choice==1, WITHINSET=1; elseif TEST(ci).choice==4, WITHINSET=0; end; PARSE=10;
158
+ elseif strmatch(TEST(ci).condi,'BC');
159
+ if TEST(ci).choice==3, WITHINSET=1; elseif TEST(ci).choice==2, WITHINSET=0; end; PARSE=11;
160
+ elseif strmatch(TEST(ci).condi,'BD');
161
+ if TEST(ci).choice==4, WITHINSET=1; elseif TEST(ci).choice==2, WITHINSET=0; end; PARSE=12;
162
+ elseif strmatch(TEST(ci).condi,'WY');
163
+ if TEST(ci).choice==5, WITHINSET=1; elseif TEST(ci).choice==7, WITHINSET=0; end; PARSE=13;
164
+ elseif strmatch(TEST(ci).condi,'WZ');
165
+ if TEST(ci).choice==5, WITHINSET=1; elseif TEST(ci).choice==8, WITHINSET=0; end; PARSE=14;
166
+ elseif strmatch(TEST(ci).condi,'XY');
167
+ if TEST(ci).choice==7, WITHINSET=1; elseif TEST(ci).choice==6, WITHINSET=0; end; PARSE=15;
168
+ elseif strmatch(TEST(ci).condi,'XZ');
169
+ if TEST(ci).choice==8, WITHINSET=1; elseif TEST(ci).choice==6, WITHINSET=0; end; PARSE=16;
170
+ end
171
+ % ^^^^
172
+ EASY=NaN;
173
+ if strmatch(TEST(ci).condi,'AX');
174
+ if TEST(ci).choice==1, EASY=1; elseif TEST(ci).choice==5, EASY=0; end; PARSE=17;
175
+ elseif strmatch(TEST(ci).condi,'AY');
176
+ if TEST(ci).choice==1, EASY=1; elseif TEST(ci).choice==7, EASY=0; end; PARSE=18;
177
+ elseif strmatch(TEST(ci).condi,'AZ');
178
+ if TEST(ci).choice==1, EASY=1; elseif TEST(ci).choice==8, EASY=0; end; PARSE=19;
179
+ elseif strmatch(TEST(ci).condi,'BW');
180
+ if TEST(ci).choice==5, EASY=1; elseif TEST(ci).choice==2, EASY=0; end; PARSE=20;
181
+ elseif strmatch(TEST(ci).condi,'CW');
182
+ if TEST(ci).choice==5, EASY=1; elseif TEST(ci).choice==3, EASY=0; end; PARSE=21;
183
+ elseif strmatch(TEST(ci).condi,'DW');
184
+ if TEST(ci).choice==5, EASY=1; elseif TEST(ci).choice==4, EASY=0; end; PARSE=22;
185
+ end
186
+ % ^^^^
187
+ MEDIUM=NaN;
188
+ if strmatch(TEST(ci).condi,'CX');
189
+ if TEST(ci).choice==3, MEDIUM=1; elseif TEST(ci).choice==6, MEDIUM=0; end; PARSE=23;
190
+ elseif strmatch(TEST(ci).condi,'CZ');
191
+ if TEST(ci).choice==3, MEDIUM=1; elseif TEST(ci).choice==8, MEDIUM=0; end; PARSE=24;
192
+ elseif strmatch(TEST(ci).condi,'BY');
193
+ if TEST(ci).choice==7, MEDIUM=1; elseif TEST(ci).choice==2, MEDIUM=0; end; PARSE=25;
194
+ elseif strmatch(TEST(ci).condi,'DY');
195
+ if TEST(ci).choice==7, MEDIUM=1; elseif TEST(ci).choice==4, MEDIUM=0; end; PARSE=26;
196
+ end
197
+ % ^^^^
198
+ HARD=NaN;
199
+ if strmatch(TEST(ci).condi,'BZ');
200
+ if TEST(ci).choice==8, HARD=1; elseif TEST(ci).choice==2, HARD=0; end; PARSE=27;
201
+ elseif strmatch(TEST(ci).condi,'DX');
202
+ if TEST(ci).choice==4, HARD=1; elseif TEST(ci).choice==6, HARD=0; end; PARSE=28;
203
+ end
204
+ % ^^^^
205
+ TST_ACC(ci,1)=ACC;
206
+ TST_BIAS(ci,1)=BIAS;
207
+ TST_WITHINSET(ci,1)=WITHINSET;
208
+ TST_EASY(ci,1)=EASY;
209
+ TST_MEDIUM(ci,1)=MEDIUM;
210
+ TST_HARD(ci,1)=HARD;
211
+ TST_PARSE(ci,1)=PARSE;
212
+ clear ACC BIAS WITHINSET EASY MEDIUM HARD PARSE;
213
+ end
214
+
215
+ for di=1:4
216
+ ACCURACIES(di)=nanmean(TST_ACC(TST_PARSE==di));
217
+ end
218
+ for di=5:8
219
+ BIASES(di-4)=nanmean(TST_BIAS(TST_PARSE==di));
220
+ end
221
+ for di=9:16
222
+ WITHINSETS(di-8)=nanmean(TST_WITHINSET(TST_PARSE==di));
223
+ end
224
+ for di=17:22
225
+ EASYS(di-16)=nanmean(TST_EASY(TST_PARSE==di));
226
+ end
227
+ for di=23:26
228
+ MEDIUMS(di-22)=nanmean(TST_MEDIUM(TST_PARSE==di));
229
+ end
230
+ for di=27:28
231
+ HARDS(di-26)=nanmean(TST_HARD(TST_PARSE==di));
232
+ end
233
+
234
+
235
+ MEGA(row).TST_ACC=ACCURACIES;
236
+ MEGA(row).TST_BIAS=BIASES;
237
+ MEGA(row).TST_WITHINSET=WITHINSETS;
238
+ MEGA(row).TST_EASY=EASYS;
239
+ MEGA(row).TST_MEDIUM=MEDIUMS;
240
+ MEGA(row).TST_HARD=HARDS;
241
+ MEGA(row).TST_RT=mean(RT);
242
+
243
+ clearvars -except MEGA subjcount subno session RT row ONOFF SUBJS;
244
+ end
245
+ end
246
+ save('VV_Behavior_CTL.mat','MEGA');
247
+
248
+ clear RT row session subno
249
+
250
+ %%
251
+
252
+ row=0;
253
+ for subno=SUBJS
254
+ row=row+1;
255
+ CTL.ID(row,:)=MEGA(row).ID;
256
+ CTL.session(row,:)=MEGA(row).session;
257
+ CTL.TRN_ACC(row,:)=MEGA(row).TRN_ACC;
258
+ CTL.TRN_RT(row,:)=MEGA(row).TRN_RT;
259
+ CTL.WinStay(row,:)=MEGA(row).WinStay;
260
+ CTL.LoseSwitch(row,:)=MEGA(row).LoseSwitch;
261
+ CTL.WinSpeed(row,:)=MEGA(row).WinSpeed;
262
+ CTL.TST_ACC(row,:)=MEGA(row).TST_ACC;
263
+ CTL.TST_BIAS(row,:)=MEGA(row).TST_BIAS;
264
+ CTL.TST_WITHINSET(row,:)=MEGA(row).TST_WITHINSET;
265
+ CTL.TST_EASY(row,:)=MEGA(row).TST_EASY;
266
+ CTL.TST_MEDIUM(row,:)=MEGA(row).TST_MEDIUM;
267
+ CTL.TST_HARD(row,:)=MEGA(row).TST_HARD;
268
+ CTL.TST_RT(row,:)=MEGA(row).TST_RT;
269
+ CTL.Blocks(row,:)=MEGA(mi).TRN_blocks;
270
+ end
271
+ save('VV_Behavior_CTL.mat','MEGA','CTL');
272
+
273
+ BigN=length(SUBJS);
274
+ jitter=rand(1,BigN)./2.5; jitter=jitter-mean(jitter);
275
+ %%
276
+ figure;
277
+ subplot(1,5,1); hold on
278
+ bar(1,mean(CTL.TRN_ACC),'g');
279
+ errorbar(1,mean(CTL.TRN_ACC),std(CTL.TRN_ACC)./sqrt(BigN),'k.');
280
+ set(gca,'xlim',[0 2],'xtick',[1:1:1],'xticklabel',{'CTL'},'ylim',[.5 1]);
281
+ title('TRN Acc');
282
+
283
+ subplot(1,5,2:3); hold on
284
+ bar(1:4,mean(CTL.TST_ACC),.4,'g');
285
+ errorbar(1:4,mean(CTL.TST_ACC),std(CTL.TST_ACC)./sqrt(BigN),'k.');
286
+ plot(1:4,CTL.TST_ACC,'b.');
287
+ set(gca,'xlim',[0 5],'xtick',[1:1:4],'xticklabel',{'AB','WX','CD','YZ'});
288
+ title('TST Acc');
289
+
290
+ subplot(1,5,4:5); hold on
291
+ bar(1:4,mean(CTL.TST_BIAS),.4,'g');
292
+ errorbar(1:4,mean(CTL.TST_BIAS),std(CTL.TST_BIAS)./sqrt(BigN),'k.');
293
+ plot(1:4,CTL.TST_BIAS,'b.');
294
+ set(gca,'xlim',[0 5],'xtick',[1:1:4],'xticklabel',{'AW','CY','DZ','BX'});
295
+ title('TST BIAS');
296
+
297
+
298
+
299
+
300
+
301
+ %%
302
+ % % % clc;
303
+ % % % disp([num2str(subno),'_sess',num2str(session),'_VVbeh'])
304
+ % % % disp(' ')
305
+ % % % disp('Accuracy: >.5 shows that they learned optimal choice')
306
+ % % % disp([' choose: AB (90/10)',' match: WX (90/10)',' choose: CD (70/30)',' match: YZ (70/30)'])
307
+ % % % disp(['Test Acc: ',num2str(MEGA(row).TST_ACC)])
308
+ % % % disp(' ')
309
+ % % % disp('BIAS: >.5 is prefer Choose over Match (may only happen for first 2)')
310
+ % % % disp([' AW (90/90)',' CY (70/70)',' DZ (30/30)',' BX (30/30)'])
311
+ % % % disp(['Test BIAS: ',num2str(MEGA(row).TST_BIAS)])
312
+
313
+
314
+
315
+ %%
316
+
317
+
318
+
319
+
320
+
scripts/VV_Behavior.mat ADDED
Binary file (8.86 kB). View file
 
scripts/VV_Behavior_CTL.mat ADDED
Binary file (7.17 kB). View file
 
scripts/VV_Main.m ADDED
@@ -0,0 +1,177 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ %% Choice Bias AKA Value of Volition Task - 4 stims ---------------- JOYSTICK + EEG
2
+ % Adapted from Jeff Cockburn's script by JFC 02/18/2015
3
+
4
+ % clear screen
5
+ clc;
6
+ % clear memory
7
+ clear all;
8
+ close all;
9
+
10
+ %%%%%%%%%%%%%%%%%%
11
+ % struct holding info need to present and track data
12
+ disp_struct = struct();
13
+ % struct to hold experiment parameters
14
+ task_struct = struct();
15
+
16
+ % will store all subject trials
17
+ allTrainTrials = [];
18
+ allTestTrials = [];
19
+ % start time for the experiment
20
+ task_struct.startTime = GetSecs();
21
+
22
+ % set the randome seed
23
+ RandStream.setGlobalStream(RandStream('mt19937ar','seed',sum(100*clock)));
24
+
25
+ % track the start time for the experiment
26
+ experiemtn_start = GetSecs();
27
+
28
+ % get the subject number for data storage
29
+ subject_number = input('Enter the subject number :\n','s');
30
+ session = input('Is this the first or second visit? (enter 1 or 2):\n','s'); session=str2num(session);
31
+ % Pick 1 or 2 screens (if 1, put 0, if 2, put 1)
32
+ SCREENS=2;
33
+ % build the file name
34
+ file_name = [num2str(subject_number) '_S' num2str(session) '_' datestr(now, 'mm-dd-yyyy_HH-MM-SS')];
35
+
36
+ % *********% *********% *********% *********% *********% *********% *********
37
+ % Initialize joystick
38
+ addpath(genpath('C:\Users\GA217B\Desktop\PDDys Suite\JoyMEX'));
39
+ JoyMEX('init',0);
40
+ % ********* Call JoyTest to get these trigger numbers for each device
41
+ LEFTKEY=5;
42
+ RIGHTKEY=6;
43
+ % Initialize EEG triggers
44
+ ioObject = io64;
45
+ LTP1address = hex2dec('C050');
46
+ status = io64(ioObject);
47
+ % *********% *********% *********% *********% *********% *********% *********
48
+
49
+ % hide the cursor
50
+ HideCursor();
51
+
52
+ % skip the screen test for now
53
+ Screen('Preference', 'SkipSyncTests', 1);
54
+ % disable user responses from being displayed
55
+ ListenChar(2);
56
+ % ensure similar keyboard capture across platforms
57
+ KbName('UnifyKeyNames');
58
+
59
+ % initialize
60
+ [disp_struct, task_struct] = taskInit(disp_struct, task_struct, SCREENS, session, LEFTKEY, RIGHTKEY);
61
+
62
+ %%%%%%%%%%%%%%%%%%%%%%%%%
63
+ % INSTRUCT
64
+ train_Inst1(disp_struct);
65
+ train_Inst2(disp_struct);
66
+ %
67
+ instruct_slide = Screen('MakeTexture', disp_struct.wPtr, imread(['../images/Slide1.jpg']));
68
+ Screen('DrawTexture', disp_struct.wPtr, instruct_slide);
69
+ Screen(disp_struct.wPtr, 'Flip');KbWait([],3); %Waits for keyboard(any) press
70
+ %
71
+ train_Inst3(disp_struct);
72
+ %
73
+ instruct_slide = Screen('MakeTexture', disp_struct.wPtr, imread(['../images/Slide2.jpg']));
74
+ Screen('DrawTexture', disp_struct.wPtr, instruct_slide);
75
+ Screen(disp_struct.wPtr, 'Flip');KbWait([],3); %Waits for keyboard(any) press
76
+ instruct_slide = Screen('MakeTexture', disp_struct.wPtr, imread(['../images/Slide3.jpg']));
77
+ Screen('DrawTexture', disp_struct.wPtr, instruct_slide);
78
+ Screen(disp_struct.wPtr, 'Flip');KbWait([],3); %Waits for keyboard(any) press
79
+ %
80
+ train_Inst4(disp_struct);
81
+ %
82
+ instruct_slide = Screen('MakeTexture', disp_struct.wPtr, imread(['../images/Slide4.jpg']));
83
+ Screen('DrawTexture', disp_struct.wPtr, instruct_slide);
84
+ Screen(disp_struct.wPtr, 'Flip');KbWait([],3); %Waits for keyboard(any) press
85
+ %
86
+ train_Inst5(disp_struct);
87
+ runPractice(disp_struct, task_struct, ioObject, LTP1address);
88
+ train_Inst_Xtra(disp_struct);
89
+ train_Inst_Xtra2(disp_struct);
90
+ train_Inst6(disp_struct);
91
+
92
+ %%%%%%%%%%%%%%%%%%%
93
+ % TRAIN
94
+ trainDone = false;
95
+ trainBlock = 0;
96
+ while ~trainDone
97
+ trainBlock = trainBlock + 1;
98
+
99
+ % build the training trials
100
+ trainTrials = buildTrainTrials(disp_struct, task_struct);
101
+ trainTrials(:, task_struct.cBlock) = trainBlock;
102
+ trainTrials(:, task_struct.cTrialType) = task_struct.TRAIN;
103
+
104
+ % loop through each trial
105
+ tI = 1;
106
+ while tI <= size(trainTrials,1)
107
+ trainTrials(tI,:) = runTrainTrial(disp_struct, task_struct, trainTrials(tI,:), ioObject, LTP1address);
108
+
109
+ % was this a free-choice trial?
110
+ if trainTrials(tI, task_struct.cTrialCond) == task_struct.FC
111
+ % find it's no-choice pair, and set the resp/feedback
112
+ ncI = find( trainTrials(:, task_struct.cTrialID) == trainTrials(tI, task_struct.cTrialID) & trainTrials(:, task_struct.cTrialCond) == task_struct.NC );
113
+ trainTrials(ncI, task_struct.cRespAct) = trainTrials(tI, task_struct.cRespAct) + task_struct.ncAdjust;
114
+ trainTrials(ncI, task_struct.cRespRew) = trainTrials(tI, task_struct.cRespRew);
115
+ end
116
+
117
+ % move trial if FC or match under RT limit - otherwise repeat
118
+ if trainTrials(tI, task_struct.cRespAct) ~= disp_struct.RESP_SLOW && (trainTrials(tI, task_struct.cTrialCond) == task_struct.FC || trainTrials(tI, task_struct.cMatch))
119
+ tI = tI + 1;
120
+ end
121
+ end
122
+
123
+ % store all training from the current block
124
+ allTrainTrials = [allTrainTrials; trainTrials];
125
+
126
+ % check to see if we've exceeded the max # of blocks
127
+ if trainBlock >= task_struct.maxTrain
128
+ trainDone = true;
129
+ elseif trainBlock >= task_struct.minTrain
130
+ % check performance for each stim pair
131
+ perfAB = mean(trainTrials(trainTrials(:, task_struct.cS1) == task_struct.sCodes.Afc, task_struct.cRespAct) == task_struct.sCodes.Afc);
132
+ perfCD = mean(trainTrials(trainTrials(:, task_struct.cS1) == task_struct.sCodes.Cfc, task_struct.cRespAct) == task_struct.sCodes.Cfc);
133
+
134
+ % did they meet performance threshold on all stim pairs
135
+ trainDone = perfAB >= task_struct.minPerf(1) && perfCD >= task_struct.minPerf(2);
136
+ end
137
+
138
+ % take a break
139
+ if ~trainDone
140
+ trainBreak(disp_struct);
141
+ end
142
+ end % while still training
143
+
144
+
145
+ %%%%%%%%%%%%%%%%%%%
146
+ % TEST
147
+ test_Inst1(disp_struct);
148
+ testTrials = buildTestTrials(disp_struct, task_struct);
149
+ tI = 1;
150
+ % run through all the test trials
151
+ while tI <= size(testTrials,1)
152
+ testTrials(tI,:) = runTestTrial(disp_struct, task_struct, testTrials(tI,:), ioObject, LTP1address);
153
+
154
+ % move to the next trial if valid response
155
+ if testTrials(tI, task_struct.cRespAct) ~= disp_struct.RESP_SLOW
156
+ tI = tI + 1;
157
+ end
158
+ end % while not done test trials
159
+ % store all test trials
160
+ allTestTrials = testTrials;
161
+
162
+ % final note to the subject
163
+ taskDone(disp_struct);
164
+
165
+ % store task data
166
+ task_struct.endTime = GetSecs();
167
+ task_struct.expTime = task_struct.endTime - task_struct.startTime;
168
+ task_struct.trainTrials = allTrainTrials;
169
+ task_struct.testTrials = allTestTrials;
170
+ % save to file
171
+ save( fullfile('..', 'Data', file_name), 'task_struct', 'disp_struct');
172
+
173
+
174
+ % clean up
175
+ sca;
176
+ ListenChar();
177
+ ShowCursor();
scripts/VV_Triggers.xlsx ADDED
Binary file (9.08 kB). View file
 
scripts/buildTestTrials.m ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function trials = buildTestTrials(disp_struct, task_struct)
2
+
3
+ % full cross-combination of all stimuli
4
+ [p,q] = meshgrid(1:length(task_struct.pWin), 1:length(task_struct.pWin));
5
+ pairs = repmat([p(:) q(:)], 2, 1);
6
+ % remove stimuli paired with themselves
7
+ pairs( pairs(:,1) == pairs(:,2), : ) = [];
8
+ % double the bias pairs
9
+ pairs = [pairs; repmat([1 2 3 4; 5 6 7 8]', 4, 1)];
10
+
11
+ % define the trials
12
+ trials = nan(size(pairs, 1), task_struct.cRT);
13
+ trials(:, task_struct.cBlock) = 0;
14
+ trials(:, task_struct.cTrialNum) = 1:size(trials, 1);
15
+ trials(:, task_struct.cTrialID) = 1:size(trials, 1);
16
+ trials(:, task_struct.cTrialCond) = task_struct.FC;
17
+ trials(:, task_struct.cTrialType) = task_struct.TEST;
18
+ trials(:, task_struct.cS1) = pairs(:, 1);
19
+ trials(:, task_struct.cS2) = pairs(:, 2);
20
+ trials(:, task_struct.cIsS1Left) = rand(size(trials, 1), 1) > 0.5;
21
+
22
+ % randomize
23
+ trials = trials(randperm(size(trials,1)), :);
24
+ end % function
scripts/buildTrainTrials.m ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function trials = buildTrainTrials(disp_struct, task_struct)
2
+
3
+ % define each fc stimulus pair trial
4
+ stimPairs = [1,2; 3,4;];
5
+
6
+ % will hold all the trials
7
+ fcTrials = [];
8
+
9
+ % loop through each pair
10
+ for pI = 1 : size(stimPairs, 1)
11
+ % will hold the stimulus trials
12
+ pairTrials = nan(task_struct.numTrainReps, task_struct.cRT);
13
+ pairTrials(:, task_struct.cTrialCond) = task_struct.FC;
14
+ startID = 1 + 10*(pI - 1);
15
+ pairTrials(:, task_struct.cTrialID) = startID:(startID+task_struct.numTrainReps-1);
16
+
17
+ % specs for card 1
18
+ pairTrials(:,task_struct.cS1) = stimPairs(pI, 1);
19
+ stim1Win = rand(task_struct.numTrainReps, 1) <= task_struct.pWin(stimPairs(pI, 1));
20
+ pairTrials(stim1Win,task_struct.cS1Rew) = task_struct.WIN;
21
+ pairTrials(~stim1Win,task_struct.cS1Rew) = task_struct.LOSS;
22
+ % specs for card 2
23
+ pairTrials(:,task_struct.cS2) = stimPairs(pI, 2);
24
+ stim2Win = rand(task_struct.numTrainReps, 1) <= task_struct.pWin(stimPairs(pI, 2));
25
+ pairTrials(stim2Win,task_struct.cS2Rew) = task_struct.WIN;
26
+ pairTrials(~stim2Win,task_struct.cS2Rew) = task_struct.LOSS;
27
+
28
+ % compile paired trials
29
+ fcTrials = [fcTrials; pairTrials];
30
+
31
+ end % for each stim pair
32
+
33
+ % get all AB, CD pairs
34
+ ABfc = fcTrials(fcTrials(:, task_struct.cS1) == task_struct.sCodes.Afc,:);
35
+ CDfc = fcTrials(fcTrials(:, task_struct.cS1) == task_struct.sCodes.Cfc,:);
36
+
37
+ % build matching nc trials
38
+ ABnc = ABfc;
39
+ ABnc(:, task_struct.cTrialCond) = task_struct.NC;
40
+ ABnc(:, task_struct.cS1) = ABnc(:, task_struct.cS1) + task_struct.ncAdjust;
41
+ ABnc(:, task_struct.cS2) = ABnc(:, task_struct.cS2) + task_struct.ncAdjust;
42
+ % for CD
43
+ CDnc = CDfc;
44
+ CDnc(:, task_struct.cTrialCond) = task_struct.NC;
45
+ CDnc(:, task_struct.cS1) = CDnc(:, task_struct.cS1) + task_struct.ncAdjust;
46
+ CDnc(:, task_struct.cS2) = CDnc(:, task_struct.cS2) + task_struct.ncAdjust;
47
+
48
+ % knit the fc and nc trials together
49
+ AB = nan(2*size(ABfc,1), size(ABfc,2));
50
+ AB(1:2:end) = ABfc;
51
+ AB(2:2:end) = ABnc;
52
+ % CD trials
53
+ CD = nan(2*size(CDfc,1), size(CDfc,2));
54
+ CD(1:2:end) = CDfc;
55
+ CD(2:2:end) = CDnc;
56
+
57
+ % now knit all AB, CD,trials toghether
58
+ % maintaining the order within each AB, CD and EF set
59
+ trials = nan(2*size(AB,1), size(AB,2));
60
+ slots = reshape(randperm(size(trials,1)), size(AB,1), 2);
61
+ % assign AB slots
62
+ trials(sort(slots(:,1)),:) = AB;
63
+ trials(sort(slots(:,2)),:) = CD;
64
+
65
+
66
+ trials(:, task_struct.cTrialNum) = 1:size(trials,1);
67
+ % stim ordering for each trial
68
+ trials(:,task_struct.cIsS1Left) = rand(size(trials,1), 1) >= 0.5;
69
+ trials(:,task_struct.cTrialType) = task_struct.TRAIN;
70
+
71
+ end % function
scripts/runChoice.m ADDED
@@ -0,0 +1,210 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function trial = runChoice(disp_struct, task_struct, trial, TRAINTEST, ioObject, LTP1address)
2
+
3
+ % Fixation
4
+ JIT=Shuffle(.3:.001:.5);
5
+ fixation_text = '+';
6
+ DrawFormattedText(disp_struct.wPtr,fixation_text,'center','center');
7
+ Screen(disp_struct.wPtr, 'Flip');
8
+ WaitSecs(JIT(1));
9
+
10
+ % get the center for the screen
11
+ center_x = round(disp_struct.wPtr_rect(3)/2);
12
+ center_y = round(disp_struct.wPtr_rect(4)/2);
13
+
14
+ % define the text font
15
+ Screen('TextSize', disp_struct.wPtr, 40);
16
+ Screen('TextFont', disp_struct.wPtr, 'Times');
17
+ Screen('TextStyle', disp_struct.wPtr, 0);
18
+ Screen('TextColor', disp_struct.wPtr, [255 255 255]);
19
+ Screen('FillRect', disp_struct.wPtr,[0 0 0]);
20
+
21
+ % stimuli bounds
22
+ sWidth = 300;
23
+ sHeight = 300;
24
+ sTop = center_y - sHeight/2;
25
+ sL_left = center_x - 80 - sWidth;
26
+ sR_left = center_x + 80;
27
+ sL_rect = [sL_left, sTop, sL_left + sWidth, sTop + sHeight];
28
+ sR_rect = [sR_left, sTop, sR_left + sWidth, sTop + sHeight];
29
+
30
+ % define the left and right stimuli
31
+ if trial(task_struct.cIsS1Left)
32
+ respL = trial(task_struct.cS1);
33
+ respR = trial(task_struct.cS2);
34
+ s1Rect = sL_rect;
35
+ s2Rect = sR_rect;
36
+ else
37
+ respL = trial(task_struct.cS2);
38
+ respR = trial(task_struct.cS1);
39
+ s1Rect = sR_rect;
40
+ s2Rect = sL_rect;
41
+ end
42
+
43
+ % show the stimuli
44
+ Screen('DrawTexture', disp_struct.wPtr, disp_struct.cards(trial(task_struct.cS1)), [], s1Rect);
45
+ Screen('DrawTexture', disp_struct.wPtr, disp_struct.cards(trial(task_struct.cS2)), [], s2Rect);
46
+ io64(ioObject,LTP1address,3); WaitSecs(.05); io64(ioObject,LTP1address,0);
47
+
48
+ % see if we need to frame the nc stim
49
+ if trial(task_struct.cTrialCond) == task_struct.NC
50
+ if trial(task_struct.cRespAct) == trial(task_struct.cS1)
51
+ ncFrameRect = s1Rect;
52
+ else
53
+ ncFrameRect = s2Rect;
54
+ end
55
+ Screen('FrameRect', disp_struct.wPtr, [0 0 255], ncFrameRect, 5);
56
+ end % frame the fc selected stim
57
+
58
+ % limit input
59
+ RestrictKeysForKbCheck([disp_struct.RESP_L, disp_struct.RESP_R]);
60
+ KbReleaseWait();
61
+
62
+ % flip to show the stims
63
+ [VBLTimestamp StimulusOnsetTime FlipTimestamp Missed Beampos] = Screen(disp_struct.wPtr, 'Flip', 0, 1);
64
+ % % % wait for response
65
+ % % [secs, keyCode, deltaSecs] = KbWait([], 2, GetSecs()+task_struct.maxRT);
66
+ wait_stamp=GetSecs;
67
+ while 1
68
+ [a ab] = JoyMEX(0);
69
+ if find(ab) ~= 0
70
+ if ab(1,disp_struct.RESP_L) == 1
71
+ stim_resp = disp_struct.RESP_L;
72
+ io64(ioObject,LTP1address,4); WaitSecs(.05); io64(ioObject,LTP1address,0);
73
+ break;
74
+ elseif ab(1,disp_struct.RESP_R) == 1
75
+ stim_resp = disp_struct.RESP_R;
76
+ io64(ioObject,LTP1address,5); WaitSecs(.05); io64(ioObject,LTP1address,0);
77
+ break;
78
+ end
79
+ elseif(GetSecs-wait_stamp) > task_struct.maxRT,
80
+ stim_resp=999;
81
+ break;
82
+ end
83
+ end
84
+ % compute the RT
85
+ RT = GetSecs - StimulusOnsetTime;
86
+
87
+ if stim_resp == disp_struct.RESP_L
88
+ % left-most action
89
+ choice = respL;
90
+ % hide the non-selected stim
91
+ Screen('FillRect', disp_struct.wPtr, [0 0 0], sR_rect);
92
+ % hide selection
93
+ Screen(disp_struct.wPtr, 'Flip');
94
+ WaitSecs(0.75);
95
+
96
+ elseif stim_resp == disp_struct.RESP_R
97
+ % right-most action
98
+ choice = respR;
99
+ % hide the non-selected stim
100
+ Screen('FillRect', disp_struct.wPtr, [0 0 0], sL_rect);
101
+ % hide selection
102
+ Screen(disp_struct.wPtr, 'Flip');
103
+ WaitSecs(0.75);
104
+ else
105
+ % they didn't respond in time
106
+ choice = disp_struct.RESP_SLOW;
107
+ end
108
+
109
+
110
+ % make sure they matched if this was a no-choice trial
111
+ if trial(task_struct.cTrialCond) == task_struct.NC && choice == trial(task_struct.cRespAct)
112
+ trial(task_struct.cMatch) = true;
113
+ else
114
+ trial(task_struct.cMatch) = false;
115
+ end
116
+
117
+ % do not update the response if they didn't match
118
+ if trial(task_struct.cTrialCond) == task_struct.FC || trial(task_struct.cMatch)
119
+ % store response
120
+ trial(task_struct.cRespAct) = choice;
121
+ trial(task_struct.cRT) = RT;
122
+ end
123
+
124
+
125
+ % --------------------------------------- FB
126
+ if TRAINTEST==1
127
+ % define the text font
128
+ Screen('TextSize', disp_struct.wPtr, 60);
129
+ Screen('TextFont', disp_struct.wPtr, 'Times');
130
+ Screen('TextStyle', disp_struct.wPtr, 0);
131
+ Screen('TextColor', disp_struct.wPtr, [255 255 255]);
132
+ Screen('FillRect', disp_struct.wPtr,[0 0 0]);
133
+
134
+ % get feedback for the selected stimulus
135
+ if trial(task_struct.cTrialCond) == task_struct.NC && ~trial(task_struct.cMatch)
136
+ fbText = 'You must match the framed symbol';
137
+ respRew = NaN;
138
+ SIMPLEFB=1;
139
+ FBTRIGGER=6;
140
+ elseif trial(task_struct.cRespAct) == trial(task_struct.cS1)
141
+ % they picked stim 1
142
+ respRew = trial(task_struct.cS1Rew);
143
+ fbText = num2str(respRew);
144
+ SIMPLEFB=0;
145
+ FBTRIGGER=10+respRew;
146
+ elseif trial(task_struct.cRespAct) == trial(task_struct.cS2)
147
+ % they picked stim 2
148
+ respRew = trial(task_struct.cS2Rew);
149
+ fbText = num2str(respRew);
150
+ SIMPLEFB=0;
151
+ FBTRIGGER=10+respRew;
152
+ else
153
+ % they responded too slow
154
+ fbText = ['Too Slow!\nYou must respond in under ' num2str(task_struct.maxRT) ' seconds'];
155
+ respRew = NaN;
156
+ SIMPLEFB=1;
157
+ FBTRIGGER=7;
158
+ end
159
+
160
+ if respRew==0
161
+ Screen('TextSize', disp_struct.wPtr, 100);
162
+ Screen('TextColor', disp_struct.wPtr, [255 0 0]);
163
+ elseif respRew==1
164
+ Screen('TextSize', disp_struct.wPtr, 100);
165
+ Screen('TextColor', disp_struct.wPtr, [0 255 0]);
166
+ end
167
+
168
+
169
+ % show the feedback
170
+ if SIMPLEFB==1
171
+ io64(ioObject,LTP1address,FBTRIGGER); WaitSecs(.05); io64(ioObject,LTP1address,0);
172
+ DrawFormattedText(disp_struct.wPtr, fbText, 'center', 'center');
173
+ Screen(disp_struct.wPtr, 'Flip');
174
+ WaitSecs(0.75);
175
+ Screen(disp_struct.wPtr, 'Flip');
176
+ else
177
+ % FIRST show the selected stim
178
+ Screen('DrawTexture', disp_struct.wPtr, disp_struct.cards(trial(task_struct.cS1)), [], s1Rect);
179
+ Screen('DrawTexture', disp_struct.wPtr, disp_struct.cards(trial(task_struct.cS2)), [], s2Rect);
180
+ % Blank out the alternative
181
+ if trial(task_struct.cRespAct) == respL
182
+ Screen('FillRect', disp_struct.wPtr, [0 0 0], sR_rect);
183
+ elseif trial(task_struct.cRespAct) == respR
184
+ Screen('FillRect', disp_struct.wPtr, [0 0 0], sL_rect);
185
+ end
186
+ % If forced, show the box
187
+ if trial(task_struct.cTrialCond) == task_struct.NC
188
+ if trial(task_struct.cRespAct) == trial(task_struct.cS1)
189
+ ncFrameRect = s1Rect;
190
+ else
191
+ ncFrameRect = s2Rect;
192
+ end
193
+ Screen('FrameRect', disp_struct.wPtr, [0 0 255], ncFrameRect, 5);
194
+ end
195
+ % Next show the FB
196
+ io64(ioObject,LTP1address,FBTRIGGER); WaitSecs(.05); io64(ioObject,LTP1address,0);
197
+ DrawFormattedText(disp_struct.wPtr, fbText, 'center', 'center');
198
+ Screen(disp_struct.wPtr, 'Flip');
199
+ WaitSecs(1.25);
200
+ Screen(disp_struct.wPtr, 'Flip');
201
+ end
202
+ clear FBTRIGGER;
203
+ Screen('TextSize', disp_struct.wPtr, 60);
204
+ Screen('TextColor', disp_struct.wPtr, [255 255 255]);
205
+
206
+ % store the feedback
207
+ trial(task_struct.cRespRew) = respRew;
208
+ end
209
+ end % function
210
+
scripts/runConditionNotice.m ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function trial = runConditionNotice(disp_struct, task_struct, trial, ioObject, LTP1address)
2
+ % define the text font
3
+ Screen('TextSize', disp_struct.wPtr, 60);
4
+ Screen('TextFont', disp_struct.wPtr, 'Times');
5
+ Screen('TextStyle', disp_struct.wPtr, 0);
6
+ Screen('TextColor', disp_struct.wPtr, [255 255 255]);
7
+ Screen('FillRect', disp_struct.wPtr,[0 0 0]);
8
+
9
+ if trial(task_struct.cTrialCond) == task_struct.FC
10
+ % free choice trial
11
+ condText = 'Choose';
12
+ io64(ioObject,LTP1address,1); WaitSecs(.05); io64(ioObject,LTP1address,0);
13
+ else
14
+ % no-choice trial
15
+ Screen('TextColor', disp_struct.wPtr, [0 0 255]);
16
+ condText = 'Match';
17
+ io64(ioObject,LTP1address,2); WaitSecs(.05); io64(ioObject,LTP1address,0);
18
+ end
19
+
20
+ DrawFormattedText(disp_struct.wPtr, condText, 'center', 'center');
21
+ Screen(disp_struct.wPtr, 'Flip');
22
+ WaitSecs(0.5);
23
+
24
+ % clear
25
+ Screen(disp_struct.wPtr, 'Flip');
26
+ Screen('TextColor', disp_struct.wPtr, [255 255 255]);
27
+
28
+ end % function
scripts/runFeedback.m ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function trial = runFeedback(disp_struct, task_struct, trial, ioObject, LTP1address)
2
+ % define the text font
3
+ Screen('TextSize', disp_struct.wPtr, 60);
4
+ Screen('TextFont', disp_struct.wPtr, 'Times');
5
+ Screen('TextStyle', disp_struct.wPtr, 0);
6
+ Screen('TextColor', disp_struct.wPtr, [255 255 255]);
7
+ Screen('FillRect', disp_struct.wPtr,[0 0 0]);
8
+
9
+ % get feedback for the selected stimulus
10
+ if trial(task_struct.cTrialCond) == task_struct.NC && ~trial(task_struct.cMatch)
11
+ fbText = 'You must match the framed symbol';
12
+ respRew = NaN;
13
+ SIMPLEFB=1;
14
+ elseif trial(task_struct.cRespAct) == trial(task_struct.cS1)
15
+ % they picked stim 1
16
+ respRew = trial(task_struct.cS1Rew);
17
+ fbText = num2str(respRew);
18
+ SIMPLEFB=0;
19
+ elseif trial(task_struct.cRespAct) == trial(task_struct.cS2)
20
+ % they picked stim 2
21
+ respRew = trial(task_struct.cS2Rew);
22
+ fbText = num2str(respRew);
23
+ SIMPLEFB=0;
24
+ else
25
+ % they responded too slow
26
+ fbText = ['Too Slow!\nYou must respond in under ' num2str(task_struct.maxRT) ' seconds'];
27
+ respRew = NaN;
28
+ SIMPLEFB=1;
29
+ end
30
+
31
+
32
+ % define the left and right stimuli
33
+ center_x = round(disp_struct.wPtr_rect(3)/2);
34
+ center_y = round(disp_struct.wPtr_rect(4)/2);
35
+ sWidth = 300;
36
+ sHeight = 300;
37
+ sTop = center_y - sHeight/2;
38
+ sL_left = center_x - 80 - sWidth;
39
+ sR_left = center_x + 80;
40
+ sL_rect = [sL_left, sTop, sL_left + sWidth, sTop + sHeight];
41
+ sR_rect = [sR_left, sTop, sR_left + sWidth, sTop + sHeight];
42
+ if trial(task_struct.cIsS1Left)
43
+ respL = trial(task_struct.cS1);
44
+ respR = trial(task_struct.cS2);
45
+ s1Rect = sL_rect;
46
+ s2Rect = sR_rect;
47
+ else
48
+ respL = trial(task_struct.cS2);
49
+ respR = trial(task_struct.cS1);
50
+ s1Rect = sR_rect;
51
+ s2Rect = sL_rect;
52
+ end
53
+ if respRew==0
54
+ Screen('TextSize', disp_struct.wPtr, 100);
55
+ Screen('TextColor', disp_struct.wPtr, [255 0 0]);
56
+ elseif respRew==1
57
+ Screen('TextSize', disp_struct.wPtr, 100);
58
+ Screen('TextColor', disp_struct.wPtr, [0 255 0]);
59
+ end
60
+
61
+
62
+ % show the feedback
63
+ if SIMPLEFB==1
64
+ DrawFormattedText(disp_struct.wPtr, fbText, 'center', 'center');
65
+ Screen(disp_struct.wPtr, 'Flip');
66
+ WaitSecs(0.75);
67
+ Screen(disp_struct.wPtr, 'Flip');
68
+ else
69
+ % FIRST show the selected stim
70
+ Screen('DrawTexture', disp_struct.wPtr, disp_struct.cards(trial(task_struct.cS1)), [], s1Rect);
71
+ Screen('DrawTexture', disp_struct.wPtr, disp_struct.cards(trial(task_struct.cS2)), [], s2Rect);
72
+ % Blank out the alternative
73
+ if trial(task_struct.cRespAct) == respL
74
+ Screen('FillRect', disp_struct.wPtr, [0 0 0], sR_rect);
75
+ elseif trial(task_struct.cRespAct) == respR
76
+ Screen('FillRect', disp_struct.wPtr, [0 0 0], sL_rect);
77
+ end
78
+ % If forced, show the box
79
+ if trial(task_struct.cTrialCond) == task_struct.NC
80
+ if trial(task_struct.cRespAct) == trial(task_struct.cS1)
81
+ ncFrameRect = s1Rect;
82
+ else
83
+ ncFrameRect = s2Rect;
84
+ end
85
+ Screen('FrameRect', disp_struct.wPtr, [0 0 255], ncFrameRect, 5);
86
+ end
87
+ % Next show the FB
88
+ DrawFormattedText(disp_struct.wPtr, fbText, 'center', 'center');
89
+ Screen(disp_struct.wPtr, 'Flip');
90
+ WaitSecs(1.25);
91
+ Screen(disp_struct.wPtr, 'Flip');
92
+ end
93
+
94
+ Screen('TextSize', disp_struct.wPtr, 60);
95
+ Screen('TextColor', disp_struct.wPtr, [255 255 255]);
96
+
97
+ % store the feedback
98
+ trial(task_struct.cRespRew) = respRew;
99
+ end % function
scripts/runPractice.m ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function trials = runPractice(disp_struct, task_struct, ioObject, LTP1address)
2
+ % use cards [13 14 15 16] for practice trials
3
+
4
+ % set up the practice trials
5
+ trials = nan(6, task_struct.cRT);
6
+ trials(:,task_struct.cBlock) = -1;
7
+ trials(:,task_struct.cTrialNum) = 1:size(trials,1);
8
+ trials(:,task_struct.cTrialID) = 1:size(trials,1);
9
+ trials(:,task_struct.cTrialCond) = [task_struct.FC, task_struct.NC, task_struct.FC, task_struct.FC, task_struct.NC, task_struct.NC];
10
+ trials(:,task_struct.cTrialType) = task_struct.PRAC;
11
+ trials(:,task_struct.cS1) = [13 15 13 13 15 15];
12
+ trials(:,task_struct.cS1Rew) = [task_struct.WIN task_struct.WIN task_struct.WIN task_struct.LOSS task_struct.LOSS task_struct.WIN];
13
+ trials(:,task_struct.cS2) = [14 16 14 14 16 16];
14
+ trials(:,task_struct.cS2Rew) = [task_struct.WIN task_struct.WIN task_struct.WIN task_struct.LOSS task_struct.LOSS task_struct.WIN];
15
+ trials(:,task_struct.cIsS1Left) = [1 1 0 1 0 1];
16
+ trials(:,task_struct.cRespAct) = [nan 15 nan nan 16 15];
17
+ trials(:,task_struct.cRespRew) = [nan task_struct.WIN nan nan task_struct.LOSS task_struct.WIN];
18
+
19
+ % loop through each practice trial
20
+ for tI = 1 : size(trials,1)
21
+ runTrainTrial(disp_struct, task_struct, trials(tI,:), ioObject, LTP1address);
22
+ end % for each trial
23
+
24
+ end % practice
scripts/runTestTrial.m ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function trial = runTestTrial(disp_struct, task_struct, trial, ioObject, LTP1address)
2
+
3
+ % blank screen
4
+ WaitSecs(0.5);
5
+ Screen(disp_struct.wPtr, 'Flip');
6
+
7
+ % show the stims, and get the choice
8
+ TRAINTEST=0;
9
+ trial = runChoice(disp_struct, task_struct, trial, TRAINTEST, ioObject, LTP1address);
10
+
11
+ % show too slow feedback
12
+ if trial(task_struct.cRespAct) == disp_struct.RESP_SLOW
13
+ runFeedback(disp_struct, task_struct, trial, ioObject, LTP1address);
14
+ end
15
+
16
+ end % function
scripts/runTrainTrial.m ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function trial = runTrainTrial(disp_struct, task_struct, trial, ioObject, LTP1address)
2
+
3
+ % blank screen
4
+ WaitSecs(1);
5
+ Screen(disp_struct.wPtr, 'Flip');
6
+
7
+ % show the choice condition
8
+ trial = runConditionNotice(disp_struct, task_struct, trial, ioObject, LTP1address);
9
+ WaitSecs(0.5);
10
+ % show the stims, and get the choice, show the FB
11
+ TRAINTEST=1;
12
+ trial = runChoice(disp_struct, task_struct, trial, TRAINTEST, ioObject, LTP1address);
13
+
14
+
15
+ end % function
scripts/taskDone.m ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function [] = taskDone(disp_struct)
2
+
3
+ % the outline task instructions
4
+ text_0 = '-COMPLETE-\n\n\n';
5
+ text_1 = 'The task is complete.\n\nPlease let the experimenter know you''re done.\n\n Thank you for your time';
6
+
7
+ Screen('TextSize', disp_struct.wPtr, 30);
8
+ Screen('TextFont', disp_struct.wPtr, 'Times');
9
+ Screen('TextStyle', disp_struct.wPtr, 0);
10
+ Screen('TextColor', disp_struct.wPtr, [255 255 255]);
11
+ Screen('FillRect', disp_struct.wPtr,[0 0 0]);
12
+ % the number of charaters per line
13
+ wrap_length = 70;
14
+
15
+ % Print out the initial instructions
16
+
17
+ % Bold the intro
18
+ Screen('TextStyle', disp_struct.wPtr, 1);
19
+ [nx, ny, textbounds] = DrawFormattedText(disp_struct.wPtr, text_0, 'center', 50, [], wrap_length, [], [], 1.25 );
20
+
21
+ % reset to normal font
22
+ Screen('TextStyle', disp_struct.wPtr, 0);
23
+ [nx, ny, textbounds] = DrawFormattedText(disp_struct.wPtr, text_1, 'center', ny, [], wrap_length, [], [], 1.25 );
24
+
25
+ % flip the screen
26
+ Screen(disp_struct.wPtr, 'Flip');
27
+ WaitSecs(0.5);
28
+
29
+ % wait for P
30
+ RestrictKeysForKbCheck(KbName('SPACE'));
31
+ % wait for keypress
32
+ KbWait([],2); % Waits for keyboard(any) press
33
+ end
scripts/taskInit.m ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ % initialize the task structure
2
+ function [disp_struct, task_struct] = taskInit(disp_struct, task_struct, SCREENS, session, LEFTKEY, RIGHTKEY)
3
+ % structure to hold data pertinant to the task
4
+ task_data = struct();
5
+ % set up the matrix columns
6
+ task_struct.cBlock = 1;
7
+ task_struct.cTrialNum = 2;
8
+ task_struct.cTrialID = 3;
9
+ task_struct.cTrialCond = 4;
10
+ task_struct.cTrialType = 5;
11
+ task_struct.cS1 = 6;
12
+ task_struct.cS1Rew = 7;
13
+ task_struct.cS2 = 8;
14
+ task_struct.cS2Rew = 9;
15
+ task_struct.cIsS1Left = 10;
16
+ task_struct.cRespAct = 11;
17
+ task_struct.cMatch = 12;
18
+ task_struct.cRespRew = 13;
19
+ task_struct.cRT = 14;
20
+
21
+
22
+ % maximum trial gap between free-choice and its no-choice pair
23
+ task_struct.maxGap = 7;
24
+ % code for each stimulus
25
+ task_struct.sCodes = struct('Afc', 1, 'Bfc', 2, 'Cfc', 3, 'Dfc', 4, 'Anc', 5, 'Bnc', 6, 'Cnc', 7, 'Dnc', 8);
26
+ % the reward probabilities for each stim
27
+ task_struct.pWin = [0.9 0.1 0.7 0.3 0.9 0.1 0.7 0.3]; % JFC changed to 90/10 and 70/30
28
+ % number of reps for each stimulus pair per training block
29
+ task_struct.numTrainReps = 10;
30
+ task_struct.numTestBiasReps = 10;
31
+ task_struct.numTestABReps = 4;
32
+ task_struct.numTestTrainReps = 4;
33
+ % index to match each free-choice with it's no-choice stim pair
34
+ task_struct.ncAdjust = 4;
35
+
36
+ % max response time
37
+ task_struct.maxRT = 4;
38
+ % training performance thresholds
39
+ task_struct.minPerf = [0.60 0.60];
40
+ % min/max number of training blocks
41
+ task_struct.minTrain = 3;
42
+ task_struct.maxTrain = 5;
43
+
44
+ % condition flags for each trial type
45
+ task_struct.NC = 0;
46
+ task_struct.FC = 1;
47
+ task_struct.PRAC = -1;
48
+ task_struct.TRAIN = 0;
49
+ task_struct.TEST = 1;
50
+ task_struct.WIN = 1;
51
+ task_struct.LOSS = 0;
52
+
53
+ % set up the response keys
54
+ disp_struct.RESP_L = LEFTKEY;
55
+ disp_struct.RESP_R = RIGHTKEY;
56
+ disp_struct.RESP_SLOW = -1;
57
+
58
+ % first set up the display window
59
+ % screenRect_debug = [0,0,1000,800]; % screen for debugging
60
+ screenRect_task = []; % full screen
61
+ % open the window
62
+ [wPtr,rect] = Screen('OpenWindow', SCREENS, [], screenRect_task);
63
+ % store the display window and it's bounds
64
+ disp_struct.wPtr = wPtr;
65
+ disp_struct.wPtr_rect = rect;
66
+
67
+ % load the images
68
+ if session==1
69
+ cardNames = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'I', 'J', 'K', 'L'}; % Practice stims repeated here b/c of laziness
70
+ elseif session==2
71
+ cardNames = {'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'I', 'J', 'K', 'L', 'I', 'J', 'K', 'L'}; % Practice stims repeated here b/c of laziness
72
+ else
73
+ disp(' '); disp(' '); disp(' '); disp('Enter a 1 or a 2 for session!'); disp(' ');
74
+ end
75
+ disp_struct.cards = nan(length(cardNames), 1);
76
+ for imgI = 1 : length(cardNames)
77
+ disp_struct.cards(imgI) = Screen('MakeTexture', disp_struct.wPtr, imread(fullfile('..', 'images', [cardNames{imgI},'.bmp'])));
78
+ end % for each card
79
+ % randomize the first 8 (I,J,K,L are for practice)
80
+ disp_struct.cards(1:length(task_struct.pWin)) = disp_struct.cards(randperm(length(task_struct.pWin)));
81
+ end % function
82
+
83
+
scripts/test_Inst1.m ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function [] = test_Inst1(disp_struct)
2
+
3
+ % the outline task instructions
4
+ text_0 = '-Instructions-\n\n\n';
5
+ text_1 = 'Great Job!\nIt''s time to test what you''ve learned.\n\n';
6
+ text_2 = 'Now you''ll be free to choose on every trial,\n but you''ll NO LONGER RECIEVE ANY FEEDBACK!\n\n';
7
+ text_3 = 'If you see new combinations of symbols, choose the symbol that ''feels'' most likely to award points based on what you''ve learned.\n\n If you''re not sure which one to pick,\n just go with your gut instinct.\n\n';
8
+ text_4 = 'Press the space bar when you''re ready to begin';
9
+
10
+ Screen('TextSize', disp_struct.wPtr, 30);
11
+ Screen('TextFont', disp_struct.wPtr, 'Times');
12
+ Screen('TextStyle', disp_struct.wPtr, 0);
13
+ Screen('TextColor', disp_struct.wPtr, [255 255 255]);
14
+ Screen('FillRect', disp_struct.wPtr,[0 0 0]);
15
+ % the number of charaters per line
16
+ wrap_length = 70;
17
+
18
+ % Print out the initial instructions
19
+
20
+ % Bold the intro
21
+ Screen('TextStyle', disp_struct.wPtr, 1);
22
+ [nx, ny, textbounds] = DrawFormattedText(disp_struct.wPtr, text_0, 'center', 50, [], wrap_length, [], [], 1.25 );
23
+
24
+ % reset to normal font
25
+ Screen('TextStyle', disp_struct.wPtr, 0);
26
+ [nx, ny, textbounds] = DrawFormattedText(disp_struct.wPtr, text_1, 'center', ny, [], wrap_length, [], [], 1.25 );
27
+ [nx, ny, textbounds] = DrawFormattedText(disp_struct.wPtr, text_2, 'center', ny, [], wrap_length, [], [], 1.25 );
28
+ [nx, ny, textbounds] = DrawFormattedText(disp_struct.wPtr, text_3, 'center', ny, [], wrap_length, [], [], 1.25 );
29
+ [nx, ny, textbounds] = DrawFormattedText(disp_struct.wPtr, text_4, 'center', ny, [], wrap_length, [], [], 1.25 );
30
+
31
+ % flip the screen
32
+ Screen(disp_struct.wPtr, 'Flip');
33
+ WaitSecs(0.5);
34
+
35
+ % wait for P
36
+ RestrictKeysForKbCheck(KbName('SPACE'));
37
+ % wait for keypress
38
+ KbWait([],2); % Waits for keyboard(any) press
39
+ end
scripts/trainBreak.m ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function [] = trainBreak(disp_struct)
2
+
3
+ % the outline task instructions
4
+ text_0 = '-BREAK-\n\n\n';
5
+ text_1 = 'Press the space bar when you''re ready to continue';
6
+
7
+ Screen('TextSize', disp_struct.wPtr, 30);
8
+ Screen('TextFont', disp_struct.wPtr, 'Times');
9
+ Screen('TextStyle', disp_struct.wPtr, 0);
10
+ Screen('TextColor', disp_struct.wPtr, [255 255 255]);
11
+ Screen('FillRect', disp_struct.wPtr,[0 0 0]);
12
+ % the number of charaters per line
13
+ wrap_length = 70;
14
+
15
+ % Print out the initial instructions
16
+
17
+ % Bold the intro
18
+ Screen('TextStyle', disp_struct.wPtr, 1);
19
+ [nx, ny, textbounds] = DrawFormattedText(disp_struct.wPtr, text_0, 'center', 50, [], wrap_length, [], [], 1.25 );
20
+
21
+ % reset to normal font
22
+ Screen('TextStyle', disp_struct.wPtr, 0);
23
+ [nx, ny, textbounds] = DrawFormattedText(disp_struct.wPtr, text_1, 'center', ny, [], wrap_length, [], [], 1.25 );
24
+
25
+ % flip the screen
26
+ Screen(disp_struct.wPtr, 'Flip');
27
+ WaitSecs(0.5);
28
+
29
+ % wait for P
30
+ RestrictKeysForKbCheck(KbName('SPACE'));
31
+ % wait for keypress
32
+ KbWait([],2); % Waits for keyboard(any) press
33
+ end
scripts/train_Inst1.m ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function [] = train_Inst1(disp_struct)
2
+
3
+ % the outline task instructions
4
+ text_0 = '-Instructions-\n\n\n';
5
+ text_1 = 'Your task is to learn about various pictures.\n\n';
6
+ text_2 = 'Some pictures will award points more reliably than others,\n but you''ll have to learn which ones.\n\n';
7
+
8
+ Screen('TextSize', disp_struct.wPtr, 30);
9
+ Screen('TextFont', disp_struct.wPtr, 'Times');
10
+ Screen('TextStyle', disp_struct.wPtr, 0);
11
+ Screen('TextColor', disp_struct.wPtr, [255 255 255]);
12
+ Screen('FillRect', disp_struct.wPtr,[0 0 0]);
13
+ % the number of charaters per line
14
+ wrap_length = 70;
15
+
16
+ % Print out the initial instructions
17
+
18
+ % Bold the intro
19
+ Screen('TextStyle', disp_struct.wPtr, 1);
20
+ [nx, ny, textbounds] = DrawFormattedText(disp_struct.wPtr, text_0, 'center', 50, [], wrap_length, [], [], 1.25 );
21
+
22
+ % reset to normal font
23
+ Screen('TextStyle', disp_struct.wPtr, 0);
24
+ [nx, ny, textbounds] = DrawFormattedText(disp_struct.wPtr, text_1, 'center', ny, [], wrap_length, [], [], 1.25 );
25
+ [nx, ny, textbounds] = DrawFormattedText(disp_struct.wPtr, text_2, 'center', ny, [], wrap_length, [], [], 1.25 );
26
+
27
+ % flip the screen
28
+ Screen(disp_struct.wPtr, 'Flip');
29
+ WaitSecs(0.5);
30
+
31
+ % wait for P
32
+ RestrictKeysForKbCheck(KbName('SPACE'));
33
+ % wait for keypress
34
+ KbWait([],2); % Waits for keyboard(any) press
35
+ end
scripts/train_Inst2.m ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function [] = train_Inst2(disp_struct)
2
+
3
+ % the outline task instructions
4
+ text_0 = '-Instructions-\n\n\n';
5
+ text_1 = 'On each trial, two pictures will appear on the screen simultaneously.\n\nYou can select either the pictures on the left using the LEFT TRIGGER,\n or the pictures on the right using the RIGHT TRIGGER\n\n\n\n';
6
+ text_2 = 'Every pictures can appear on the left or the right. This is totally random and does not influence the outcome at all.\n\n\n\n (This is only done to ensure left/right handed people don''t have an advantage.)';
7
+
8
+ Screen('TextSize', disp_struct.wPtr, 30);
9
+ Screen('TextFont', disp_struct.wPtr, 'Times');
10
+ Screen('TextStyle', disp_struct.wPtr, 0);
11
+ Screen('TextColor', disp_struct.wPtr, [255 255 255]);
12
+ Screen('FillRect', disp_struct.wPtr,[0 0 0]);
13
+ % the number of charaters per line
14
+ wrap_length = 70;
15
+
16
+ % Print out the initial instructions
17
+
18
+ % Bold the intro
19
+ Screen('TextStyle', disp_struct.wPtr, 1);
20
+ [nx, ny, textbounds] = DrawFormattedText(disp_struct.wPtr, text_0, 'center', 50, [], wrap_length, [], [], 1.25 );
21
+
22
+ % reset to normal font
23
+ Screen('TextStyle', disp_struct.wPtr, 0);
24
+ [nx, ny, textbounds] = DrawFormattedText(disp_struct.wPtr, text_1, 'center', ny, [], wrap_length, [], [], 1.25 );
25
+ [nx, ny, textbounds] = DrawFormattedText(disp_struct.wPtr, text_2, 'center', ny, [], wrap_length, [], [], 1.25 );
26
+
27
+ % flip the screen
28
+ Screen(disp_struct.wPtr, 'Flip');
29
+ WaitSecs(0.5);
30
+
31
+ % wait for P
32
+ RestrictKeysForKbCheck(KbName('SPACE'));
33
+ % wait for keypress
34
+ KbWait([],2); % Waits for keyboard(any) press
35
+ end
scripts/train_Inst3.m ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function [] = train_Inst3(disp_struct)
2
+
3
+ % the outline task instructions
4
+ text_0 = '-Instructions-\n\n\n';
5
+ text_1 = 'The picture you select will either award you a point (+1) or not (0).\n\n\n\n There''s no *absolute* right answer, but try to pick pictures that have the best chance of awarding points.\n\n\n\n';
6
+ text_2 = 'At first this might seem difficult, but you''ll get lots of practice.';
7
+
8
+ Screen('TextSize', disp_struct.wPtr, 30);
9
+ Screen('TextFont', disp_struct.wPtr, 'Times');
10
+ Screen('TextStyle', disp_struct.wPtr, 0);
11
+ Screen('TextColor', disp_struct.wPtr, [255 255 255]);
12
+ Screen('FillRect', disp_struct.wPtr,[0 0 0]);
13
+ % the number of charaters per line
14
+ wrap_length = 70;
15
+
16
+ % Print out the initial instructions
17
+
18
+ % Bold the intro
19
+ Screen('TextStyle', disp_struct.wPtr, 1);
20
+ [nx, ny, textbounds] = DrawFormattedText(disp_struct.wPtr, text_0, 'center', 50, [], wrap_length, [], [], 1.25 );
21
+
22
+ % reset to normal font
23
+ Screen('TextStyle', disp_struct.wPtr, 0);
24
+ [nx, ny, textbounds] = DrawFormattedText(disp_struct.wPtr, text_1, 'center', ny, [], wrap_length, [], [], 1.25 );
25
+ [nx, ny, textbounds] = DrawFormattedText(disp_struct.wPtr, text_2, 'center', ny, [], wrap_length, [], [], 1.25 );
26
+
27
+ % flip the screen
28
+ Screen(disp_struct.wPtr, 'Flip');
29
+ WaitSecs(0.5);
30
+
31
+ % wait for P
32
+ RestrictKeysForKbCheck(KbName('SPACE'));
33
+ % wait for keypress
34
+ KbWait([],2); % Waits for keyboard(any) press
35
+ end
scripts/train_Inst4.m ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function [] = train_Inst4(disp_struct)
2
+
3
+ % the outline task instructions
4
+ text_0 = '-Instructions-\n\n\n';
5
+ text_1 = 'OK - here''s an interesting twist: \n\n On some trials, one of the picture will be selected for you and will be framed in blue. These are called ''Match'' trials.\n\n On ''Match'' trials, you must select the framed picture.\n\n\n\n';
6
+ text_2 = 'On other trials you will be free to choose either picture.\n\n These are called ''Choose'' trials.';
7
+
8
+ Screen('TextSize', disp_struct.wPtr, 30);
9
+ Screen('TextFont', disp_struct.wPtr, 'Times');
10
+ Screen('TextStyle', disp_struct.wPtr, 0);
11
+ Screen('TextColor', disp_struct.wPtr, [255 255 255]);
12
+ Screen('FillRect', disp_struct.wPtr,[0 0 0]);
13
+ % the number of charaters per line
14
+ wrap_length = 70;
15
+
16
+ % Print out the initial instructions
17
+
18
+ % Bold the intro
19
+ Screen('TextStyle', disp_struct.wPtr, 1);
20
+ [nx, ny, textbounds] = DrawFormattedText(disp_struct.wPtr, text_0, 'center', 50, [], wrap_length, [], [], 1.25 );
21
+
22
+ % reset to normal font
23
+ Screen('TextStyle', disp_struct.wPtr, 0);
24
+ [nx, ny, textbounds] = DrawFormattedText(disp_struct.wPtr, text_1, 'center', ny, [], wrap_length, [], [], 1.25 );
25
+ [nx, ny, textbounds] = DrawFormattedText(disp_struct.wPtr, text_2, 'center', ny, [], wrap_length, [], [], 1.25 );
26
+
27
+ % flip the screen
28
+ Screen(disp_struct.wPtr, 'Flip');
29
+ WaitSecs(0.5);
30
+
31
+ % wait for P
32
+ RestrictKeysForKbCheck(KbName('SPACE'));
33
+ % wait for keypress
34
+ KbWait([],2); % Waits for keyboard(any) press
35
+ end
scripts/train_Inst5.m ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function [] = train_Inst5(disp_struct)
2
+
3
+ % the outline task instructions
4
+ text_0 = '-Instructions-\n\n\n';
5
+ text_1 = 'Regardless of whether you Choose or Match on each trial,\n\n your goal is to learn which pictures are more rewarding. \n\n\n\n (Doing so will help you later in the task!)\n\n\n\n';
6
+ text_2 = 'The faster you learn which pictures are better,\n\n the faster you will finish!\n\n\n\n';
7
+ text_3 = 'Let''s try a few practice trials.';
8
+
9
+ Screen('TextSize', disp_struct.wPtr, 30);
10
+ Screen('TextFont', disp_struct.wPtr, 'Times');
11
+ Screen('TextStyle', disp_struct.wPtr, 0);
12
+ Screen('TextColor', disp_struct.wPtr, [255 255 255]);
13
+ Screen('FillRect', disp_struct.wPtr,[0 0 0]);
14
+ % the number of charaters per line
15
+ wrap_length = 70;
16
+
17
+ % Print out the initial instructions
18
+
19
+ % Bold the intro
20
+ Screen('TextStyle', disp_struct.wPtr, 1);
21
+ [nx, ny, textbounds] = DrawFormattedText(disp_struct.wPtr, text_0, 'center', 50, [], wrap_length, [], [], 1.25 );
22
+
23
+ % reset to normal font
24
+ Screen('TextStyle', disp_struct.wPtr, 0);
25
+ [nx, ny, textbounds] = DrawFormattedText(disp_struct.wPtr, text_1, 'center', ny, [], wrap_length, [], [], 1.25 );
26
+ [nx, ny, textbounds] = DrawFormattedText(disp_struct.wPtr, text_2, 'center', ny, [], wrap_length, [], [], 1.25 );
27
+ [nx, ny, textbounds] = DrawFormattedText(disp_struct.wPtr, text_3, 'center', ny, [], wrap_length, [], [], 1.25 );
28
+
29
+ % flip the screen
30
+ Screen(disp_struct.wPtr, 'Flip');
31
+ WaitSecs(0.5);
32
+
33
+ % wait for P
34
+ RestrictKeysForKbCheck(KbName('SPACE'));
35
+ % wait for keypress
36
+ KbWait([],2); % Waits for keyboard(any) press
37
+ end
scripts/train_Inst6.m ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function [] = train_Inst6(disp_struct)
2
+
3
+ % the outline task instructions
4
+ text_0 = '-Instructions-\n\n\n';
5
+ text_1 = 'Please let the experimenter know if you have any questions or don''t fully understand your task\n\n\n';
6
+ text_2 = 'Press the space bar when you''re ready to begin';
7
+
8
+ Screen('TextSize', disp_struct.wPtr, 30);
9
+ Screen('TextFont', disp_struct.wPtr, 'Times');
10
+ Screen('TextStyle', disp_struct.wPtr, 0);
11
+ Screen('TextColor', disp_struct.wPtr, [255 255 255]);
12
+ Screen('FillRect', disp_struct.wPtr,[0 0 0]);
13
+ % the number of charaters per line
14
+ wrap_length = 70;
15
+
16
+ % Print out the initial instructions
17
+
18
+ % Bold the intro
19
+ Screen('TextStyle', disp_struct.wPtr, 1);
20
+ [nx, ny, textbounds] = DrawFormattedText(disp_struct.wPtr, text_0, 'center', 50, [], wrap_length, [], [], 1.25 );
21
+
22
+ % reset to normal font
23
+ Screen('TextStyle', disp_struct.wPtr, 0);
24
+ [nx, ny, textbounds] = DrawFormattedText(disp_struct.wPtr, text_1, 'center', ny, [], wrap_length, [], [], 1.25 );
25
+ [nx, ny, textbounds] = DrawFormattedText(disp_struct.wPtr, text_2, 'center', ny, [], wrap_length, [], [], 1.25 );
26
+
27
+ % flip the screen
28
+ Screen(disp_struct.wPtr, 'Flip');
29
+ WaitSecs(0.5);
30
+
31
+ % wait for P
32
+ RestrictKeysForKbCheck(KbName('SPACE'));
33
+ % wait for keypress
34
+ KbWait([],2); % Waits for keyboard(any) press
35
+ end
scripts/train_Inst_Xtra.m ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function [] = train_Inst_Xtra(disp_struct)
2
+
3
+ % the outline task instructions
4
+ text_0 = '-Instructions-\n\n\n';
5
+ text_1 = 'OK - here''s something *important* to remember.\n\n\n';
6
+ text_2 = 'The pictures are RANDOMLY selected for each person, \n\n and are PROBABILISTICALLY associated with the amount of reward. \n\n\n There is NO RELATIONSHIP between the picture type and probability of reward. \n\n\n ';
7
+
8
+ Screen('TextSize', disp_struct.wPtr, 30);
9
+ Screen('TextFont', disp_struct.wPtr, 'Times');
10
+ Screen('TextStyle', disp_struct.wPtr, 0);
11
+ Screen('TextColor', disp_struct.wPtr, [255 255 255]);
12
+ Screen('FillRect', disp_struct.wPtr,[0 0 0]);
13
+ % the number of charaters per line
14
+ wrap_length = 70;
15
+
16
+ % Print out the initial instructions
17
+
18
+ % Bold the intro
19
+ Screen('TextStyle', disp_struct.wPtr, 1);
20
+ [nx, ny, textbounds] = DrawFormattedText(disp_struct.wPtr, text_0, 'center', 50, [], wrap_length, [], [], 1.25 );
21
+
22
+ % reset to normal font
23
+ Screen('TextStyle', disp_struct.wPtr, 0);
24
+ [nx, ny, textbounds] = DrawFormattedText(disp_struct.wPtr, text_1, 'center', ny, [], wrap_length, [], [], 1.25 );
25
+ [nx, ny, textbounds] = DrawFormattedText(disp_struct.wPtr, text_2, 'center', ny, [], wrap_length, [], [], 1.25 );
26
+
27
+ % flip the screen
28
+ Screen(disp_struct.wPtr, 'Flip');
29
+ WaitSecs(0.5);
30
+
31
+ % wait for P
32
+ RestrictKeysForKbCheck(KbName('SPACE'));
33
+ % wait for keypress
34
+ KbWait([],2); % Waits for keyboard(any) press
35
+ end