|
@@ -0,0 +1,276 @@
|
|
|
+# Reakce je na psa i kočku - tlačítko 1 - pes štěká/kočka mňouká (správný zvuk) tlačítko 2- pes mňouká/ kočka štěká (špatný zvuk), na ostatní se odezva bere jako false allarm
|
|
|
+
|
|
|
+randomize_trials=true;
|
|
|
+#no_logfile = true;
|
|
|
+
|
|
|
+
|
|
|
+active_buttons = 2;
|
|
|
+button_codes = 1,2;
|
|
|
+response_matching = simple_matching;
|
|
|
+
|
|
|
+write_codes = true;
|
|
|
+pulse_width = 100;
|
|
|
+
|
|
|
+
|
|
|
+begin;
|
|
|
+array {
|
|
|
+ sound{
|
|
|
+ wavefile { filename = "koza.wav"; } snd_buck;
|
|
|
+ } standard_stimulus; # standard stimulus;
|
|
|
+ sound{
|
|
|
+ wavefile { filename = "pes.wav"; } snd_dog;
|
|
|
+ }; # target 1
|
|
|
+ sound{
|
|
|
+ wavefile { filename = "kocka.wav"; } snd_cat;
|
|
|
+ };
|
|
|
+ } sound_stimulus;
|
|
|
+
|
|
|
+array {
|
|
|
+ picture {
|
|
|
+ bitmap { filename = "koza1.jpg"; } buck;
|
|
|
+ x=0; y=0;
|
|
|
+ } standard_pic;
|
|
|
+ picture {
|
|
|
+ bitmap { filename = "pes1.jpg"; } dog;
|
|
|
+ x=0; y=0;
|
|
|
+ } target1_pic;
|
|
|
+ picture {
|
|
|
+ bitmap { filename = "kocka1.jpg"; } cat;
|
|
|
+ x=0; y=0;
|
|
|
+ } target2_pic;
|
|
|
+} picture_stimulus;
|
|
|
+
|
|
|
+trial {
|
|
|
+ trial_duration = 1200;
|
|
|
+ stimulus_event{
|
|
|
+ picture standard_pic;
|
|
|
+ duration=700;
|
|
|
+ } event1;
|
|
|
+ stimulus_event{
|
|
|
+ sound standard_stimulus;
|
|
|
+ duration=700;
|
|
|
+ port_code=1;
|
|
|
+ code=1;
|
|
|
+ } event2;
|
|
|
+
|
|
|
+ } main;
|
|
|
+
|
|
|
+begin_pcl;
|
|
|
+array <int> stim[300];
|
|
|
+array <int> out_code[300];
|
|
|
+array <int> tg_stim_list[60];
|
|
|
+array <int> tg_type_list[60]; # obsahuje info o typu targetu 2 - pes steka¡ 3 - kocka mnouka¡ 4- kocka steka¡ 5 - pes mnouka¡
|
|
|
+array <string> type[6]={"buck ","dog b", "cat m","cat b","dog m"};
|
|
|
+int st,num,en,pos,cat_pos;
|
|
|
+int cat_dog_pos, dog_cat_pos;
|
|
|
+int react_time, cum_creact_time,cum_ireact_time,incorrect_react_time, cum_incorrect_react_time, false_cum_react_time, false_react_time;
|
|
|
+int correct_snd_n, incorrect_snd_n;
|
|
|
+double avg_creact,avg_ireact,incorrect_avg_react, false_avg_react;
|
|
|
+string userid;
|
|
|
+output_file s_output = new output_file;
|
|
|
+
|
|
|
+
|
|
|
+# naplnění pole standardními stimuly
|
|
|
+loop int j=1 until j>300
|
|
|
+ begin
|
|
|
+ stim[j]=1;
|
|
|
+ out_code[j]=1;
|
|
|
+ j=j+1;
|
|
|
+ end;
|
|
|
+
|
|
|
+# 20% se vymění za targety s kodem 2 (pes)
|
|
|
+st=3; num=60;
|
|
|
+loop int k=1 until k>60
|
|
|
+ begin
|
|
|
+ if (st <205) then en=st+4; else en=st + 3; end;
|
|
|
+ if (en>295) then en=295; end;
|
|
|
+ pos=random(st,en);
|
|
|
+ tg_stim_list[k]=pos;
|
|
|
+ tg_type_list[k]=2;
|
|
|
+ stim[pos]=2;
|
|
|
+ out_code[pos]=2; out_code[pos+1]=11;
|
|
|
+ st=pos+3;
|
|
|
+ k=k+1;
|
|
|
+ end;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+# z předchozíchch 20% se jich 10% zamění za tg s kodem 3 (kočka)
|
|
|
+loop int l=1 until l>30
|
|
|
+ begin
|
|
|
+ pos=random(1,60);
|
|
|
+ cat_pos= tg_stim_list[pos];
|
|
|
+ if (stim[cat_pos]!=3) then
|
|
|
+ tg_type_list[pos] = 3;
|
|
|
+ stim[cat_pos]=3; out_code[cat_pos]=3;
|
|
|
+ out_code[cat_pos+1]=12;
|
|
|
+ l=l+1;
|
|
|
+ end;
|
|
|
+end;
|
|
|
+
|
|
|
+
|
|
|
+# u 5% targetu se zamění zvuky - tj. pes mňouká¡ a kočka štěká
|
|
|
+loop int l=1 until l>15
|
|
|
+ begin
|
|
|
+ int pos1, pos2;
|
|
|
+ loop
|
|
|
+ pos1=random(1,60);
|
|
|
+ pos2=random(1,60);
|
|
|
+ until (tg_type_list[pos1]==2) && (tg_type_list[pos2]==3)
|
|
|
+ begin
|
|
|
+ pos1=random(1,60);
|
|
|
+ pos2=random(1,60);
|
|
|
+ end;
|
|
|
+ tg_type_list[pos1]=5; tg_type_list[pos2]=4;
|
|
|
+ dog_cat_pos= tg_stim_list[pos1]; cat_dog_pos = tg_stim_list[pos2];
|
|
|
+ stim[dog_cat_pos]=2; out_code[dog_cat_pos]=5;
|
|
|
+ stim[cat_dog_pos]=3; out_code[cat_dog_pos]=4;
|
|
|
+ out_code[dog_cat_pos+1]=13;out_code[cat_dog_pos+1]=14;
|
|
|
+ l=l+1;
|
|
|
+ end;
|
|
|
+
|
|
|
+/*-----------------------------------------------------------------------------------*/
|
|
|
+/*loop int i=1 until i>300
|
|
|
+begin
|
|
|
+#term.print(stim[i]);
|
|
|
+i=i+1;
|
|
|
+end;
|
|
|
+#term.print("\n");
|
|
|
+
|
|
|
+loop int i=1 until i>300
|
|
|
+begin
|
|
|
+#term.print(out_code[i]); term.print(" ");
|
|
|
+i=i+1;
|
|
|
+end;
|
|
|
+#term.print("\n");*/
|
|
|
+/*---------------------------------------------------------------------------------*/
|
|
|
+/* ----------------------- tady se spouští vlastní stimulace ----------------------*/
|
|
|
+userid=logfile.subject();
|
|
|
+s_output.open(userid+".txt");
|
|
|
+cum_creact_time=0;
|
|
|
+cum_ireact_time=0;
|
|
|
+correct_snd_n=0;
|
|
|
+incorrect_snd_n=0;
|
|
|
+cum_incorrect_react_time=0;
|
|
|
+false_react_time=0;
|
|
|
+false_cum_react_time=0;
|
|
|
+int bt;
|
|
|
+s_output.print("*********************** BARKING DOG, MIAOWING CAT ***************************\n\n");
|
|
|
+loop int i=1 until i>300 # POČET STIMULŮ
|
|
|
+ begin
|
|
|
+ s_output.print(i); s_output.print("\t"); s_output.print(out_code[i]);s_output.print("\t");
|
|
|
+ event1.set_stimulus(picture_stimulus[stim[i]]);
|
|
|
+ if (out_code[i]>3) && (out_code[i]<6) then
|
|
|
+ event2.set_stimulus(sound_stimulus[out_code[i]-2]);
|
|
|
+ s_output.print(type[out_code[i]]+"\t");
|
|
|
+ else
|
|
|
+ event2.set_stimulus(sound_stimulus[stim[i]]);
|
|
|
+ s_output.print(type[stim[i]]+"\t");
|
|
|
+ end;
|
|
|
+ event2.set_port_code(out_code[i]);
|
|
|
+ event2.set_event_code(string(out_code[i]));
|
|
|
+ if (out_code[i]==2) || (out_code[i]==3)
|
|
|
+ then event2.set_target_button(1);
|
|
|
+ bt=1;
|
|
|
+ event2.set_stimulus_time_in(200);
|
|
|
+ event2.set_stimulus_time_out(1000);
|
|
|
+ elseif (out_code[i]==4) || (out_code[i]==5)
|
|
|
+ then event2.set_target_button(2);
|
|
|
+ bt=2;
|
|
|
+ event2.set_stimulus_time_in(200);
|
|
|
+ event2.set_stimulus_time_out(1000);
|
|
|
+ else event2.set_target_button(0);
|
|
|
+ event2.set_response_active(true);
|
|
|
+ end;
|
|
|
+ main.present();
|
|
|
+ stimulus_data last = stimulus_manager.last_stimulus_data();
|
|
|
+ if (last.type()==stimulus_hit)
|
|
|
+ then
|
|
|
+ if (out_code[i]==2) || (out_code[i]==3)
|
|
|
+ then
|
|
|
+ react_time=last.reaction_time();
|
|
|
+ cum_creact_time=cum_creact_time+react_time;
|
|
|
+ s_output.print("o"+"\t");s_output.print(bt);s_output.print(" ");s_output.print(response_manager.last_response());s_output.print(" ");s_output.print(react_time);
|
|
|
+ correct_snd_n=correct_snd_n+1;
|
|
|
+ /* term.print("React_time = "); term.print(react_time); term.print("\n"); */
|
|
|
+ elseif (out_code[i]==4) || (out_code[i]==5)
|
|
|
+ then
|
|
|
+ react_time=last.reaction_time();
|
|
|
+ cum_ireact_time=cum_ireact_time+react_time;
|
|
|
+ s_output.print("o"+"\t");s_output.print(bt);s_output.print(" ");s_output.print(response_manager.last_response());s_output.print(" ");s_output.print(react_time);
|
|
|
+ incorrect_snd_n=incorrect_snd_n+1;
|
|
|
+ end;
|
|
|
+ elseif (last.type()==stimulus_incorrect)
|
|
|
+ then
|
|
|
+ incorrect_react_time=last.reaction_time();
|
|
|
+ cum_incorrect_react_time=cum_incorrect_react_time+incorrect_react_time;
|
|
|
+ s_output.print("x"+"\t");s_output.print(bt);s_output.print(" ");s_output.print(response_manager.last_response());s_output.print(" "); s_output.print(incorrect_react_time);
|
|
|
+
|
|
|
+ elseif (last.type()==stimulus_false_alarm)
|
|
|
+ then
|
|
|
+ false_react_time=last.reaction_time();
|
|
|
+ false_cum_react_time=false_cum_react_time+false_react_time;
|
|
|
+ s_output.print("f"+"\t");s_output.print("-");s_output.print(" ");s_output.print(response_manager.last_response());s_output.print(" "); s_output.print(false_react_time);
|
|
|
+ end;
|
|
|
+ i=i+1;
|
|
|
+ s_output.print("\n");
|
|
|
+ end;
|
|
|
+
|
|
|
+int total_hits=response_manager.total_hits();
|
|
|
+int total_false_alarms=response_manager.total_false_alarms();
|
|
|
+#int total_hits_correct_snd = response_manager.total_response_count(1);
|
|
|
+#int total_hits_incorrect_snd = response_manager.total_response_count(2);
|
|
|
+int total_incorrects = response_manager.total_incorrects();
|
|
|
+if (correct_snd_n!=0)
|
|
|
+ then avg_creact=double(cum_creact_time)/double(correct_snd_n);
|
|
|
+ else avg_creact=0.;
|
|
|
+ end;
|
|
|
+if (incorrect_snd_n!=0)
|
|
|
+ then avg_ireact=double(cum_ireact_time)/double(incorrect_snd_n);
|
|
|
+ else avg_ireact=0.;
|
|
|
+ end;
|
|
|
+if (total_incorrects!=0)
|
|
|
+ then incorrect_avg_react=double(cum_incorrect_react_time)/double(total_incorrects);
|
|
|
+ else incorrect_avg_react=0.;
|
|
|
+ end;
|
|
|
+if (total_false_alarms!=0)
|
|
|
+ then false_avg_react=double(false_cum_react_time)/double(total_false_alarms);
|
|
|
+ else false_avg_react=0.;
|
|
|
+ end;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+s_output.print("\n\n");
|
|
|
+term.print("\n\n");
|
|
|
+s_output.print("Total hits = "); s_output.print(total_hits); s_output.print("\n");
|
|
|
+s_output.print("Total correct sound hits = "); s_output.print(correct_snd_n); s_output.print("\n");
|
|
|
+s_output.print("Average correct sound reaction time = "); s_output.print(avg_creact); s_output.print("\n\n");
|
|
|
+#_________________________ term print _________________________________________________________________
|
|
|
+term.print("Total hits = "); term.print(total_hits); term.print("\n");
|
|
|
+term.print("Total correct sound hits = "); term.print(correct_snd_n); term.print("\n");
|
|
|
+term.print("Average correct sound reaction time = "); term.print(avg_creact); term.print("\n\n");
|
|
|
+#______________________________________________________________________________________________________
|
|
|
+
|
|
|
+s_output.print("Total incorrect sound hits = "); s_output.print(incorrect_snd_n); s_output.print("\n");
|
|
|
+s_output.print("Average incorrect sound reaction time = "); s_output.print(avg_ireact); s_output.print("\n\n");
|
|
|
+#_________________________ term print _________________________________________________________________
|
|
|
+term.print("Total incorrect sound hits = "); term.print(incorrect_snd_n); term.print("\n");
|
|
|
+term.print("Average incorrect sound reaction time = "); term.print(avg_ireact); term.print("\n\n");
|
|
|
+#______________________________________________________________________________________________________
|
|
|
+
|
|
|
+s_output.print("Total incorrect responses = "); s_output.print(total_incorrects); s_output.print("\n");
|
|
|
+s_output.print("Average incorrect responses time = "); s_output.print(incorrect_avg_react); s_output.print("\n\n");
|
|
|
+#_________________________ term print _________________________________________________________________
|
|
|
+
|
|
|
+term.print("Total incorrect responses = "); term.print(total_incorrects); term.print("\n");
|
|
|
+term.print("Average incorrect responses time = "); term.print(incorrect_avg_react); term.print("\n\n");
|
|
|
+#______________________________________________________________________________________________________
|
|
|
+
|
|
|
+s_output.print("Total false alarms = "); s_output.print(total_false_alarms); s_output.print("\n");
|
|
|
+s_output.print("Average false alarm response time = "); s_output.print(false_avg_react); s_output.print("\n\n");
|
|
|
+#_________________________ term print _________________________________________________________________
|
|
|
+term.print("Total false alarms = "); term.print(total_false_alarms); term.print("\n");
|
|
|
+term.print("Average false alarm response time = "); term.print(false_avg_react); term.print("\n\n");
|
|
|
+#______________________________________________________________________________________________________
|
|
|
+
|
|
|
+s_output.close();
|