Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

[solved] Why is the display time about 100ms longer on average than I set?

edited September 2015 in OpenSesame

Hi,
I have been designing programs with opensesame, but meet some problem and need your help.
In this program, the stimulus will be shown for 600ms, and at the same time, I want to collect respose time data from the begining of the stimulus. So I used the parallel module. Since I want to keep the whole time of a trial for a fixed value of 2300ms, and not jitters because of the variance of response_time, I add another fixation(fixation2) for 900ms;so that the time of one trial=stimulus(600ms)+fixation2(900ms)+fixation3(800ms)=2300ms. The procedure is as following:
image

The problem is: the time of fixation2 I collected was not 900ms but about 1000ms. I calculated by minusing [time_fixation3]-[time_fixation2] in the data. However, the time of fixation2 is the same as I set.
The data I have used is like this:
image

Why is the result? Is there any mistake in my design?
Thank you very much.

The code is as following:

# Generated by OpenSesame 2.9.0 (Hesitant Heisenberg)
# Wed Dec 24 23:28:46 2014 (nt)
# <http://www.cogsci.nl/opensesame>

set foreground "white"
set font_bold "no"
set font_size "18"
set description "Default description"
set mouse_backend "legacy"
set compensation "0"
set title "New experiment"
set background "black"
set subject_parity "even"
set coordinates "relative"
set canvas_backend "legacy"
set start "experiment"
set sampler_backend "legacy"
set width "1024"
set font_italic "no"
set bidi "no"
set subject_nr "0"
set keyboard_backend "legacy"
set height "768"
set font_family "chinese-japanese-korean"
set synth_backend "legacy"

define sequence __sequence
    run stimulus "always"
    run fixation2 "always"

define feedback _feedback
    set duration "keypress"

define loop _loop
    set repeat "5"
    set item "_sequence"
    set break_if "never"
    set column_order "stimulus;correct_response"
    set cycles "2"
    set order "random"
    setcycle 0 stimulus "A"
    setcycle 0 correct_response "f"
    setcycle 1 stimulus "B"
    setcycle 1 correct_response "j"
    run _sequence

define sequence _sequence
    run parallel "always"
    run fixation3 "always"
    run logger "always"

define sequence experiment
    run welcome "always"
    run fixation1 "always"
    run loop "always"

define feedback feedback
    set duration "keypress"
    set reset_variables "yes"
    set description "Provides feedback to the participant"
    draw textline 0 -128 "End of block" center=1 color="white" font_family="mono" font_size=18 font_bold="no" font_italic="no" html="yes" z_index=0 show_if="always"
    draw textline 0 -64 "Your average response time was [avg_rt]ms" center=1 color="white" font_family="mono" font_size=18 font_bold="no" font_italic="no" html="yes" z_index=0 show_if="always"
    draw textline 0 0 "Your accuracy was [acc]%" center=1 color="white" font_family="mono" font_size=18 font_bold="no" font_italic="no" html="yes" z_index=0 show_if="always"
    draw textline 0 64 "Press any key to continue..." center=1 color="white" font_family="mono" font_size=18 font_bold="no" font_italic="no" html="yes" z_index=0 show_if="always"

define sketchpad fixation1
    set duration "1700"
    set reset_variables "no"
    draw rect -100 -120 200 240 fill=1 color="grey" penwidth=1 z_index=0 show_if="always"
    draw line 0 -10 0 10 color="white" penwidth=3 z_index=0 show_if="always"
    draw line -10 0 10 0 color="white" penwidth=3 z_index=0 show_if="always"

define sketchpad fixation2
    set duration "900"
    set reset_variables "no"
    draw rect -100 -120 200 240 fill=1 color="grey" penwidth=1 z_index=0 show_if="always"
    draw line 0 -10 0 10 color="white" penwidth=3 z_index=0 show_if="always"
    draw line -10 0 10 0 color="white" penwidth=3 z_index=0 show_if="always"

define sketchpad fixation3
    set duration "800"
    set reset_variables "no"
    draw rect -100 -120 200 240 fill=1 color="grey" penwidth=1 z_index=0 show_if="always"
    draw line 0 -10 0 10 color="white" penwidth=3 z_index=0 show_if="always"
    draw line -10 0 10 0 color="white" penwidth=3 z_index=0 show_if="always"

define keyboard_response keyboard_response
    set allowed_responses "f;j"
    set description "Collects keyboard responses"
    set timeout "1500"
    set flush "yes"

define logger logger
    set ignore_missing "yes"
    set auto_log "no"
    set use_quotes "yes"
    log "time_stimulus"
    log "time_fixation1"
    log "time_fixation2"
    log "time_fixation3"
    log "time_stimulus"
    log "time_keyboard_response"
    log "response"
    log "response_time"
    log "acc"
    log "stimulus"
    log "correct_response"

define loop loop
    set repeat "1"
    set item "sequence"
    set break_if "never"
    set column_order ""
    set cycles "1"
    set order "random"
    run sequence

define parallel parallel
    run keyboard_response "always"
    run __sequence "always"

define reset_feedback reset_feedback

define sequence sequence
    run reset_feedback "always"
    run _loop "always"
    run feedback "always"

define sketchpad stimulus
    set duration "600"
    set reset_variables "no"
    set description "Displays stimuli"
    draw rect -100 -120 200 240 fill=1 color="grey" penwidth=1 z_index=0 show_if="always"
    draw textline 0 0 "[stimulus]" center=1 color="red" font_family="sans" font_size=32 font_bold="no" font_italic="no" html="yes" z_index=0 show_if="always"

define sketchpad welcome
    set duration "keypress"
    set reset_variables "no"
    set description "Displays stimuli"
    set start_response_interval "no"
    draw textline 0 0 "Please  <br />respond to A with KEY F; <br />respond to B with KEY J." center=1 color="white" font_family="chinese-japanese-korean" font_size=32 font_bold="no" font_italic="no" html="yes" z_index=0 show_if="always"

Comments

  • edited 2:07PM

    Hi,

    With this setup, fixation3 is presented after the parallel item is finished (and by extension all the items within it). Apparently there is some delay in there, which is not surprising in itself. If you want to control the timing of the sketchpads better, it's best to put them in the same sequence. So, in this case, that would mean appending fixation3 to __sequence. Once you do that, the timing should be exactly as you've specified.

    For more information about timing and the way that items are prepared, see:

    Cheers!
    Sebastiaan

  • edited 2:07PM

    Thanks a lot. But I got further questions.

    I want to use Opensesame to run an ERP study, which for me the time course is very important. Therefore, I chose the PsychoPy and Xpyriment back-ends. However, the two back-ends seems to be not compatible with the parallel item in fullscreen display.
    I have changed part of my experiment, like this:

    image

    Short discription of my design:
    Particularly in the prac1_seq_seq sequence, I want to display a stimulus in the prac2_sketchpad for 600ms, but I need to response from the beginning of the stimulus display. So I used a parallel item, to load the key_response simultaneously with the prac1_sketchpad. Here I set the timeout of the key_response to 1500ms. To assure a constant trial length, a fix2 for 900ms was added. In the meantime, I wanted to send marker to the ERP machine, so I added the response marker (i.e., correct and wrong) and stimulus marker (i.e., marker_stimulus).

    My question:
    1. To get the correct response time, I have to put the key_response outside and before the sequence of prac1_parallel_sequence. To send marker exactly after the response was made, I have to put the triger correct and wrong after the key_response sequentially but not parallelly. The two sequences here would make the actual time longer than I set, but I still don't know how to optimize it. Could you give me some recommendations?
    2. When I run the exam in window or in quick-test modes, everything goes well. However, problem comes when I run it in fullscreen. In detail, the Psycho back-end just showed a fixation and got stuck, after which I press the ESC button but the computer crashed. While in the Expyriment back-end, after displaying a fixation the program exit with no data. No error was reported, however.
    I guess it might because the key_response goes ahead of the prac1_sketchpad. So I transposed the two sequences. The program ran successfully, but the response_time was all 1500ms, and all responses were not correct, which means the response was not recorded. I don’t know why the two sequences runs one after another when they are in the same parallel.
    But I really want to run it in a fullscreen mode with Psycho or Xpyriment back-ends, and get the accurate response time. How could I achieve this?
    Basic computer environment:
    My system is 64-bit windows 7 and the version of Opensesame is 2.9.7. The flush rate of my screen is 60Hz.

  • edited 2:07PM

    My codes are here. There are some Chinese words for instruction but you don’t need to know their meaning. Any help would be greatly appreciated.

    # Generated by OpenSesame 2.9.7 (Hesitant Heisenberg)
    # Thu Sep 17 15:56:17 2015 (nt)
    # <http://www.cogsci.nl/opensesame>
    
    set background "black"
    set bidi "no"
    set canvas_backend "xpyriment"
    set compensation "0"
    set coordinates "relative"
    set custom_cursor "no"
    set description "An attention capture paradigm, modified for the Android runtime"
    set enable_escape "no"
    set font_bold "no"
    set font_family "chinese-japanese-korean"
    set font_italic "no"
    set font_size "18"
    set foreground "white"
    set height "1024"
    set keyboard_backend "legacy"
    set mouse_backend "xpyriment"
    set psychopy_monitor "testMonitor"
    set psychopy_waitblanking "yes"
    set sampler_backend "legacy"
    set sound_buf_size "512"
    set sound_channels "2"
    set sound_freq "48000"
    set sound_sample_size "-16"
    set start "ASSVSS_ERP"
    set subject_nr "0"
    set subject_parity "even"
    set synth_backend "legacy"
    set title "Attentional capture for Android"
    set transparent_variables "no"
    set width "1280"
    
    define sequence ASSVSS_ERP
        set description "The main experimental sequence"
        run hello "always"
        run exp1 "always"
    
    define inline_script ___inline_script
        set _prepare ""
        ___run__
        exp.set('marker_correct',121)
        exp.set('marker_wrong',120)
        __end__
    
    define inline_script __inline_script
        set _prepare ""
        ___run__
        exp.set('marker_correct',111)
        exp.set('marker_wrong',110)
        exp.set('marker_Cond',112)
        __end__
    
    define parallel_port_trigger correct
        set _duration "2"
        set _port "0xC020"
        set _value "[marker_correct]"
    
    define sketchpad end_of_exp1
        set duration "keypress"
        set reset_variables "no"
        draw textline 0 -64 "实验一结束" center=1 color="white" font_family="chinese-japanese-korean" font_size=32 font_bold="no" font_italic="no" html="yes" z_index=0 show_if="always"
        draw textline 0 64 "请按任意键继续.." center=1 color="white" font_family="chinese-japanese-korean" font_size=32 font_bold="no" font_italic="no" html="yes" z_index=0 show_if="always"
    
    define sketchpad end_of_prac1
        set duration "keypress"
        set reset_variables "no"
        draw textline 0 -80 "练习一结束<br />" center=1 color="white" font_family="chinese-japanese-korean" font_size=32 font_bold="no" font_italic="no" html="yes" z_index=0 show_if="always"
        draw textline 0 80 "<br />请按任意键继续.." center=1 color="white" font_family="chinese-japanese-korean" font_size=32 font_bold="no" font_italic="no" html="yes" z_index=0 show_if="always"
        draw textline 0 0 "接下来是正式实验,<br />正式试验分为两段,每段3分钟左右" center=1 color="white" font_family="chinese-japanese-korean" font_size=32 font_bold="no" font_italic="no" html="yes" z_index=0 show_if="always"
    
    define sequence exp1
        run intro "always"
        run fix "always"
        run exp1_prac1_loop "always"
        run end_of_prac1 "always"
        run fix "always"
        run exp1_formal_loop "always"
        run end_of_exp1 "always"
    
    define loop exp1_formal_loop
        set break_if "never"
        set column_order ""
        set cycles "1"
        set item "sequence"
        set order "random"
        set repeat "1"
        run sequence
    
    define loop exp1_loop
        set break_if "never"
        set column_order "stimulus;correct_response;location;Cond;marker_Cond"
        set cycles "4"
        set item "prac1_seq_seq"
        set order "random"
        set repeat "20"
        setcycle 0 stimulus "上"
        setcycle 0 correct_response "f"
        setcycle 0 marker_Cond "113"
        setcycle 0 Cond "VSSC"
        setcycle 0 location "-77"
        setcycle 1 stimulus "下"
        setcycle 1 correct_response "j"
        setcycle 1 marker_Cond "113"
        setcycle 1 Cond "VSSC"
        setcycle 1 location "77"
        setcycle 2 stimulus "上"
        setcycle 2 correct_response "f"
        setcycle 2 marker_Cond "114"
        setcycle 2 Cond "VSSI"
        setcycle 2 location "77"
        setcycle 3 stimulus "下"
        setcycle 3 correct_response "j"
        setcycle 3 marker_Cond "114"
        setcycle 3 Cond "VSSI"
        setcycle 3 location "-77"
        run prac1_seq_seq
    
    define loop exp1_prac1_loop
        set break_if "never"
        set column_order ""
        set cycles "1"
        set description "Repeatedly runs another item"
        set item "prac1_seq"
        set order "random"
        set repeat "1"
        run prac1_seq
    
    define feedback feedback
        set description "Provides feedback to the participant"
        set duration "keypress"
        set reset_variables "yes"
        draw textline 0 -96 "本部分结束" center=1 color="white" font_family="chinese-japanese-korean" font_size=32 font_bold="no" font_italic="no" html="yes" z_index=0 show_if="always"
        draw textline 0 -32 "你的反应时为[avg_rt]ms" center=1 color="white" font_family="chinese-japanese-korean" font_size=32 font_bold="no" font_italic="no" html="yes" z_index=0 show_if="always"
        draw textline 0 32 "你的正确率为[acc]%" center=1 color="white" font_family="chinese-japanese-korean" font_size=32 font_bold="no" font_italic="no" html="yes" z_index=0 show_if="always"
        draw textline 0 96 "请按任意键继续.." center=1 color="white" font_family="chinese-japanese-korean" font_size=32 font_bold="no" font_italic="no" html="yes" z_index=0 show_if="always"
    
    define sketchpad fix
        set duration "1700"
        set reset_variables "no"
        draw rect -100 -100 200 200 fill=1 color="#505050" penwidth=1 z_index=0 show_if="always"
        draw line 0 -10 0 10 color="white" penwidth=3 z_index=0 show_if="always"
        draw line -10 0 10 0 color="white" penwidth=3 z_index=0 show_if="always"
    
    define sketchpad fix2
        set duration "1700"
        set reset_variables "no"
        draw rect -100 -100 200 200 fill=1 color="#505050" penwidth=1 z_index=0 show_if="always"
        draw line 0 -10 0 10 color="white" penwidth=3 z_index=0 show_if="always"
        draw line -10 0 10 0 color="white" penwidth=3 z_index=0 show_if="always"
    
    define sketchpad fix3
        set duration "800"
        set reset_variables "no"
        draw rect -100 -100 200 200 fill=1 color="#505050" penwidth=1 z_index=0 show_if="always"
        draw line 0 -10 0 10 color="white" penwidth=3 z_index=0 show_if="always"
        draw line -10 0 10 0 color="white" penwidth=3 z_index=0 show_if="always"
    
    define text_display hello
        set align "center"
        set background "black"
        __content__
    
        欢迎参加实验!
    
        注意:请将手机调至静音或者飞行模式
        为了放松眼睛,在实验休息时请不要翻看手机
    
        请仔细阅读接下来的实验说明。
        如有任何疑问,请及时联系主试人员。
    
    
        按空格键继续
        __end__
        set description "Presents a display consisting of text"
        set duration "keypress"
        set font_family "chinese-japanese-korean"
        set font_size "36"
        set foreground "white"
        set maxchar "50"
    

    to be continued...

  • edited 2:07PM

    define text_display intro set align "center" set background "black" __content__ 练习一 请对屏幕中央的文字做按键反应。 如果看到了“上”,请左手食指按“F”键; 如果看到了“下”,请右手食指按“J”键。 请做到又快又准确的按键。 明确了按空格键继续。 __end__ set description "Presents a display consisting of text" set duration "keypress" set font_family "chinese-japanese-korean" set font_size "36" set foreground "white" set maxchar "50" define keyboard_response key_response set allowed_responses "f;j" set description "Collects keyboard responses" set flush "yes" set timeout "1500" define logger logger set auto_log "yes" set description "Logs experimental data" set ignore_missing "yes" set use_quotes "yes" log "response" log "response_time" log "time_fix3" log "time_fix2" log "correct" log "average_response_time" log "avg_rt" log "accuracy" log "acc" log "response_train_choose" log "response_time_train_choose" log "correct_train_choose" log "stimulus" log "correct_response" log "location" log "Cond" log "time_formal_loop" log "block" log "back" log "Seq" log "time_keyboard_response" log "count_keyboard_response" log "response_keyboard_response" log "response_time_keyboard_response" log "correct_keyboard_response" log "response__keyboard_response" log "correct__keyboard_response" log "time_sketchpad" log "time_exp_sequence" log "time__keyboard_response" log "time_prac_sketchpad" define parallel_port_trigger marker_stimulus set _duration "2" set _port "0xC020" set _value "[marker_Cond]" define parallel parallel set flush_keyboard "yes" run response "always" run prac1_parallel_sequence "always" define loop prac1_loop set break_if "never" set column_order "stimulus;location;correct_response" set cycles "2" set item "prac1_seq_seq" set order "random" set repeat "5" setcycle 0 stimulus "上" setcycle 0 correct_response "f" setcycle 0 location "0" setcycle 1 stimulus "下" setcycle 1 correct_response "j" setcycle 1 location "0" run prac1_seq_seq define sequence prac1_parallel_sequence set flush_keyboard "no" run prac1_sketchpad "always" run marker_stimulus "always" run fix2 "always" define sequence prac1_seq set description "Runs a number of items in sequence" set flush_keyboard "yes" run __inline_script "always" run reset_feedback "always" run prac1_loop "always" run prac_feedback "always" run train_choose "always" run repeat_cycle "always" define sequence prac1_seq_seq set description "Runs a number of items in sequence" set flush_keyboard "yes" run parallel "always" run logger "always" define sketchpad prac1_sketchpad set description "Displays stimuli" set duration "600" set reset_variables "no" draw rect -100 -100 200 200 fill=1 color="#505050" penwidth=1 z_index=0 show_if="always" draw textline 0 "[location]" "[stimulus]" center=1 color="red" font_family="chinese-japanese-korean" font_size=32 font_bold="no" font_italic="no" html="yes" z_index=0 show_if="always" define feedback prac_feedback set description "Provides feedback to the participant" set duration "0" set reset_variables "yes" draw textline 0 -224 "本部分结束" center=1 color="white" font_family="chinese-japanese-korean" font_size=32 font_bold="no" font_italic="no" html="yes" z_index=0 show_if="always" draw textline 0 -160 "你的反应时为[avg_rt]ms" center=1 color="white" font_family="chinese-japanese-korean" font_size=32 font_bold="no" font_italic="no" html="yes" z_index=0 show_if="always" draw textline 0 -96 "你的正确率为[acc]%" center=1 color="white" font_family="chinese-japanese-korean" font_size=32 font_bold="no" font_italic="no" html="yes" z_index=0 show_if="always" draw textline 0 -32 "如果需要再次练习,请按a键;" center=1 color="white" font_family="chinese-japanese-korean" font_size=32 font_bold="no" font_italic="no" html="yes" z_index=0 show_if="always" draw textline 0 32 "否则,请按b键开始正式实验。" center=1 color="white" font_family="chinese-japanese-korean" font_size=32 font_bold="no" font_italic="no" html="yes" z_index=0 show_if="always" draw textline -128 160 "a" center=1 color="white" font_family="chinese-japanese-korean" font_size=32 font_bold="no" font_italic="no" html="yes" z_index=0 show_if="always" draw textline 128 160 "b" center=1 color="white" font_family="chinese-japanese-korean" font_size=32 font_bold="no" font_italic="no" html="yes" z_index=0 show_if="always" draw textline -128 224 "再次练习" center=1 color="white" font_family="chinese-japanese-korean" font_size=32 font_bold="no" font_italic="no" html="yes" z_index=0 show_if="always" draw textline 128 224 "不需练习" center=1 color="white" font_family="chinese-japanese-korean" font_size=32 font_bold="no" font_italic="no" html="yes" z_index=0 show_if="always" define repeat_cycle repeat_cycle set condition "[response_train_choose]=a" define reset_feedback reset_feedback define sequence response run key_response "always" run correct "[correct] = 1" run wrong "[correct] = 0" define sequence sequence run ___inline_script "always" run reset_feedback "always" run exp1_loop "always" run feedback "always" define keyboard_response train_choose set allowed_responses "a;b" set flush "yes" set timeout "infinite" define parallel_port_trigger wrong set _duration "2" set _port "0xC020" set _value "[marker_wrong]"

    :)

  • edited 2:07PM

    Hi,

    Do I understand correctly that the reason you are using the parallel plugin is that you need the keyboard take a reaction time from an item that is not directly preceding the keyboard?

    If so, it might be (a lot) easier, if you take another approach. You could place an inline_script at the position in your sequence from which you want to measure the time and type start_time = self.time() in it. Later, instead of the keyboard item, you put another inline_script at the position, at which the reaction time should be measured and type following in it:

    endtime = self.time()
    rt = endtime-starttime
    exp.set('response_time', rt)
    

    followed by the logger. Does this do the trick?

    Eduard

    Buy Me A Coffee

  • edited 2:07PM

    Thank you~
    The key problem is the parallel plugin itself. I could use my codes I pasted upside quite well in a legacy backend, but as you know, the legacy backend is not very good for a time-critical experiment. So you are right to use inline script.
    I finally rewrited nearly all the function defined by plugins with inline script, and it really works very well, since I don't need to use a parallel and two sequences. I really loves the inline scripts now. Haha.
    To make anybody that may have the same question, I would like to paste my newest scripts here(I changed the stimulus to English words in order to make it more friendly). And if there is anything wrong or anything that could be improved, I am glad to get the feedback.

    # Generated by OpenSesame 2.9.7 (Hesitant Heisenberg)
    # Sun Sep 27 22:02:50 2015 (nt)
    # <http://www.cogsci.nl/opensesame>
    
    set background "black"
    set bidi "no"
    set canvas_backend "xpyriment"
    set clock_backend "legacy"
    set color_backend "legacy"
    set compensation "0"
    set coordinates "relative"
    set custom_cursor "no"
    set description "In this experiment we use a Stroop-like task, in which the word UP or DOWN was shown upright or downright, so as to create some conflict.<br >This experiment is particularly for a ERP test, in which it sends markers to the port."
    set enable_escape "no"
    set font_bold "no"
    set font_family "sans"
    set font_italic "no"
    set font_size "18"
    set foreground "white"
    set height "1024"
    set keyboard_backend "legacy"
    set mouse_backend "xpyriment"
    set psychopy_monitor "testMonitor"
    set psychopy_waitblanking "yes"
    set sampler_backend "legacy"
    set sound_buf_size "512"
    set sound_channels "2"
    set sound_freq "48000"
    set sound_sample_size "-16"
    set start "Experiment"
    set subject_nr "0"
    set subject_parity "even"
    set synth_backend "legacy"
    set title "a simple paradigm"
    set transparent_variables "no"
    set uniform_coordinates "no"
    set width "1280"
    
    define sequence Experiment
        set description "The main experimental sequence"
        set flush_keyboard "yes"
        run exp "always"
    
    define sketchpad end_of_exp
        set description "End of the experiment"
        set duration "keypress"
        set reset_variables "no"
        draw textline 0 -48 "End of the experiment<br />" center=1 color="white" font_family="sans" font_size=32 font_bold="no" font_italic="no" html="yes" z_index=0 show_if="always"
        draw textline 0 48 "<br />Please press any button to exit..." center=1 color="white" font_family="sans" font_size=32 font_bold="no" font_italic="no" html="yes" z_index=0 show_if="always"
    
    define sequence exp
        set description "Runs a number of items in sequence"
        set flush_keyboard "yes"
        run welcome "always"
        run prac_loop "always"
        run formal_loop "always"
        run end_of_exp "always"
    
    define sketchpad exp_intr
        set description "Introduction of formal experiment."
        set duration "keypress"
        set reset_variables "no"
        draw textline 0 0 "Task Discription<br \\><br \\>You will see a word in every trial.<br \\>The task is to determine what word it is.<br \\><br \\>If it is UP, then press the F button;<br \\>or if it is DOWN, press the J button.<br \\><br \\>The place of the word may not be shown in the center of the screen, <br \\>but don't care about that.<br \\>Please press any button to continue..." center=1 color="white" font_family="sans" font_size=32 font_bold="no" font_italic="no" html="yes" z_index=0 show_if="always"
    
    define feedback feedback
        set description "Provides feedback to the participant"
        set duration "keypress"
        set reset_variables "yes"
        draw textline 0 -128 "End of experiment" center=1 color="white" font_family="sans" font_size=32 font_bold="no" font_italic="no" html="yes" z_index=0 show_if="always"
        draw textline 0 -32 "Your reaction time is [avg_rt]ms" center=1 color="white" font_family="sans" font_size=32 font_bold="no" font_italic="no" html="yes" z_index=0 show_if="always"
        draw textline 0 64 "Your accuracy is [acc]%" center=1 color="white" font_family="sans" font_size=32 font_bold="no" font_italic="no" html="yes" z_index=0 show_if="always"
        draw textline 0 160 "Press any button to continue..." center=1 color="white" font_family="sans" font_size=32 font_bold="no" font_italic="no" html="yes" z_index=0 show_if="always"
    
    define sketchpad fix
        set description "show a fixation"
        set duration "1700"
        set reset_variables "no"
        draw rect -100 -100 200 200 fill=1 color="#505050" penwidth=1 z_index=0 show_if="always"
        draw line 0 -10 0 10 color="white" penwidth=3 z_index=0 show_if="always"
        draw line -10 0 10 0 color="white" penwidth=3 z_index=0 show_if="always"
    
    define loop formal_loop
        set break_if "never"
        set column_order ""
        set cycles "1"
        set description "Repeatedly runs another item"
        set item "seq"
        set offset "no"
        set order "random"
        set repeat "1"
        set skip "0"
        run seq
    
    define loop formal_loop_loop
        set break_if "never"
        set column_order "stimulus;correct_response;location;Cond;marker_Cond"
        set cycles "6"
        set description "Repeatedly runs another item"
        set item "main_seq"
        set offset "no"
        set order "random"
        set repeat "3"
        set skip "0"
        setcycle 0 stimulus "UP"
        setcycle 0 correct_response "f"
        setcycle 0 marker_Cond "11"
        setcycle 0 Cond "VSSC"
        setcycle 0 location "-77"
        setcycle 1 stimulus "DOWN"
        setcycle 1 correct_response "j"
        setcycle 1 marker_Cond "11"
        setcycle 1 Cond "VSSC"
        setcycle 1 location "77"
        setcycle 2 stimulus "UP"
        setcycle 2 correct_response "f"
        setcycle 2 marker_Cond "12"
        setcycle 2 Cond "VSSN"
        setcycle 2 location "0"
        setcycle 3 stimulus "DOWN"
        setcycle 3 correct_response "j"
        setcycle 3 marker_Cond "12"
        setcycle 3 Cond "VSSN"
        setcycle 3 location "0"
        setcycle 4 stimulus "UP"
        setcycle 4 correct_response "f"
        setcycle 4 marker_Cond "13"
        setcycle 4 Cond "VSSI"
        setcycle 4 location "77"
        setcycle 5 stimulus "DOWN"
        setcycle 5 correct_response "j"
        setcycle 5 marker_Cond "13"
        setcycle 5 Cond "VSSI"
        setcycle 5 location "-77"
        run main_seq
    
    define logger logger
        set auto_log "yes"
        set description "Logs experimental data"
        set ignore_missing "yes"
        set use_quotes "yes"
        log "response"
        log "response_time"
        log "time_fix3"
        log "time_fix2"
        log "correct"
        log "average_response_time"
        log "avg_rt"
        log "accuracy"
        log "acc"
        log "response_train_choose"
        log "response_time_train_choose"
        log "correct_train_choose"
        log "stimulus"
        log "correct_response"
        log "location"
        log "Cond"
        log "time_formal_loop"
        log "block"
        log "back"
        log "Seq"
        log "time_keyboard_response"
        log "count_keyboard_response"
        log "response_keyboard_response"
        log "response_time_keyboard_response"
        log "correct_keyboard_response"
        log "response__keyboard_response"
        log "correct__keyboard_response"
        log "time_sketchpad"
        log "time_exp_sequence"
        log "time__keyboard_response"
        log "time_prac_sketchpad"
    
    define sequence main_seq
        set description "Runs a number of items in sequence"
        set flush_keyboard "yes"
        run proc "always"
        run variables "always"
        run logger "always"
    
    
  • edited 2:07PM
    define feedback prac_feedback
        set description "Provides feedback to the participant"
        set duration "0"
        set reset_variables "yes"
        draw textline 0 -224 "You finished the practice." center=1 color="white" font_family="sans" font_size=32 font_bold="no" font_italic="no" html="yes" z_index=0 show_if="always"
        draw textline 0 -160 "Your reaction time is [avg_rt]ms" center=1 color="white" font_family="sans" font_size=32 font_bold="no" font_italic="no" html="yes" z_index=0 show_if="always"
        draw textline 0 -96 "Your accuracy is [acc]%" center=1 color="white" font_family="sans" font_size=32 font_bold="no" font_italic="no" html="yes" z_index=0 show_if="always"
        draw textline 0 -32 "If you need more practice, press 'A'" center=1 color="white" font_family="sans" font_size=32 font_bold="no" font_italic="no" html="yes" z_index=0 show_if="always"
        draw textline 0 32 "Otherwise, press 'B' to begin the experiment." center=1 color="white" font_family="sans" font_size=32 font_bold="no" font_italic="no" html="yes" z_index=0 show_if="always"
        draw textline -128 160 "A" center=1 color="white" font_family="sans" font_size=32 font_bold="no" font_italic="no" html="yes" z_index=0 show_if="always"
        draw textline 128 160 "B" center=1 color="white" font_family="sans" font_size=32 font_bold="no" font_italic="no" html="yes" z_index=0 show_if="always"
        draw textline -128 224 "MORE<br />PRACTICE" center=1 color="white" font_family="sans" font_size=32 font_bold="no" font_italic="no" html="yes" z_index=0 show_if="always"
        draw textline 128 224 "NO MORE<br />PRACTICE" center=1 color="white" font_family="sans" font_size=32 font_bold="no" font_italic="no" html="yes" z_index=0 show_if="always"
    
    define sketchpad prac_intr
        set description "Introduction of practice."
        set duration "keypress"
        set reset_variables "no"
        draw textline 0 0 "Task Discription<br \\><br \\>You will see a word in every trial.<br \\>The task is to determine what word it is.<br \\><br \\>If it is UP, then press the F button;<br \\>or if it is DOWN, press the J button.<br \\><br \\>Please press any button to continue..." center=1 color="white" font_family="sans" font_size=32 font_bold="no" font_italic="no" html="yes" z_index=0 show_if="always"
    
    define loop prac_loop
        set break_if "never"
        set column_order ""
        set cycles "1"
        set item "prac_seq"
        set order "random"
        set repeat "1"
        run prac_seq
    
    define loop prac_loop_loop
        set break_if "never"
        set column_order "stimulus;correct_response;location;Cond;marker_Cond"
        set cycles "2"
        set description "Repeatedly runs another item"
        set item "main_seq"
        set offset "no"
        set order "random"
        set repeat "1"
        set skip "0"
        setcycle 0 stimulus "UP"
        setcycle 0 correct_response "f"
        setcycle 0 marker_Cond "1"
        setcycle 0 Cond "VSSN"
        setcycle 0 location "0"
        setcycle 1 stimulus "DOWN"
        setcycle 1 correct_response "j"
        setcycle 1 marker_Cond "1"
        setcycle 1 Cond "VSSN"
        setcycle 1 location "0"
        run main_seq
    
    define sequence prac_seq
        run prac_intr "always"
        run reset_feedback "always"
        run pre_set "always"
        run fix "always"
        run prac_loop_loop "always"
        run prac_feedback "always"
        run train_choose "always"
        run repeat_cycle "always"
    
    define inline_script pre_set
        ___prepare__
        #prepare for the feedback
        exp.set('total_responses', 0)
        exp.set('total_correct', 0)
        exp.set('total_response_time', 0)
        exp.set('average_response_time', 'NA')
        exp.set('avg_rt', 'NA')
        exp.set('accuracy', 'NA')
        exp.set('acc', 'NA')
        exp.set('trial', 0)
        __end__
        set _run ""
        set description "Set the original value of the exporting variables."
    
    define inline_script proc
        ___prepare__
        from openexp.canvas import canvas
        from openexp.keyboard import keyboard
    
        ##prepare for trigger
        try:
            from ctypes import windll
            global io
            io = windll.dlportio # requires dlportio.dll !!!
        except:
            print 'The parallel port couldn\'t be opened'
        port = 0xE100 ##The value is depends on the computer.
    
        #draw the stimulus
        stim = canvas(exp)
        stimulus = self.get("stimulus")
        location = self.get("location")
        x = stim.xcenter()
        x0 = x - 100
        y = stim.ycenter()
        y0 = y - 100
        y_stim = y + self.get("location")
        stim.rect(x0,y0,200,200,color="#505050",penwidth=1, fill=1)
        stim.set_font(style="sans", underline=None, bold=None, italic=None, size=32)
        stim.text('%s' % stimulus,color="red",bidi=None,y=y_stim,x=x)
    
        #draw fixation
        fix = canvas(exp)
        x0 = fix.xcenter()-100
        y0 = fix.ycenter()-100
        fix.rect(x0,y0,200,200,color="#505050",penwidth=1, fill=1)
        fix.line(640,502,640,522,color='white',penwidth=3)
        fix.line(630,512,650,512,color='white',penwidth=3)
        __end__
        ___run__
        ##set some variables
        timeout1 = 600
        timeout2 = 900
        ISI = 1700 #here the ISI means the time from the end of stimulus in a trial to the beginning of the stimulus of next trial
        marker_correct = 111
        marker_wrong = 110
    
        ##show the stimulus
        time_stim = stim.show()
    
        ##Send trigger to stimulus
        marker_Cond = self.get("marker_Cond") #name the markers
        trigger = marker_Cond
        try:
            io.DlPortWritePortUchar(port, trigger)
        except:
            print 'Failed to send trigger!'
    
        ##set response rules
        allowed_keys = ['f', 'j']
        my_keyboard = keyboard(exp, keylist=allowed_keys)
        #collect responding key and time of response
        resp, time = my_keyboard.get_key(timeout=timeout1) 
        ##set response
        resp_time = time - time_stim
    
        ##set correct or not
        if resp == self.get("correct_response"):
            correct = 1
        else:
            correct = 0
    
        ##Send correct/wrong trigger
        if correct == 1:
            trigger = marker_correct
        else:
            trigger = marker_wrong
        try:
            io.DlPortWritePortUchar(port, trigger)
        except:
            print 'Failed to send trigger!'
    
        ##if response_time<600ms,show the stimulus after response until 600ms(timeout1), and then fixation
        if resp == "f" or resp == "j":
            timeout = timeout1 - resp_time
            stim.show()
            self.sleep(timeout)
            time_fix=fix.show() #show fixation and collect the time
            self.sleep(ISI)
    
        ##if response_time>600ms,show fixation at once but keep collecting respones until 1500ms(timeout1+timeout2)
        if resp == None:
            time_fix=fix.show()
            resp, time = my_keyboard.get_key(timeout=timeout2)
            if resp == self.get("correct_response"):
                correct = 1
            else:
                correct = 0
            timeout = ISI - (time - time_fix)
            self.sleep(timeout)
        # Send correct/wrong trigger for trials of which resp_time > 600ms
            if correct == 1:
                trigger = marker_correct
            else:
                trigger = marker_wrong
            try:
                io.DlPortWritePortUchar(port, trigger)
            except:
                print 'Failed to send trigger!'
    
        ##set response for trials of which resp_time > 600ms
        resp_time = time - time_stim
        __end__
        set description "The main experiment process."
    
    
    
  • edited 2:07PM
    define repeat_cycle repeat_cycle
        set condition "[response_train_choose]=a"
        set description "Optionally repeat a cycle from a loop"
    
    define reset_feedback reset_feedback
        set description "Resets the feedback variables, such as 'avg_rt' and 'acc'"
    
    define sequence seq
        set description "Runs a number of items in sequence"
        set flush_keyboard "yes"
        run exp_intr "always"
        run reset_feedback "always"
        run pre_set "always"
        run fix "always"
        run formal_loop_loop "always"
        run feedback "always"
    
    define keyboard_response train_choose
        set allowed_responses "a;b"
        set description "Collects keyboard responses"
        set duration "keypress"
        set flush "yes"
        set timeout "infinite"
    
    define inline_script variables
        set _prepare ""
        ___run__
        ##print/log varibles
        exp.set("time_stim",time_stim)
        exp.set("response_time",resp_time)
        exp.set("correct",correct)
        exp.set("time_fix",time_fix)
        exp.set("response",resp)
    
        ##set the feedback variables
        exp.set('total_responses', self.get('total_responses')+1)
        exp.set('total_correct', self.get('total_correct')+correct)
        exp.set('total_response_time', self.get('total_response_time')+self.get('response_time'))
        avg_rt = self.get('total_response_time')/self.get('total_responses')
        acc = 100.*self.get('total_correct')/self.get('total_responses')
        exp.set('average_response_time', avg_rt)
        exp.set('avg_rt', avg_rt)
        exp.set('accuracy', acc)
        exp.set('acc', acc)
        __end__
        set description "To determine the exporting variables."
    
    define text_display welcome
        set align "center"
        set background "black"
        __content__
        Welcome to our experiment.
        press any key to continue...
        __end__
        set description "Presents a display consisting of text"
        set duration "keypress"
        set font_family "sans"
        set font_size "32"
        set foreground "white"
        set maxchar "50"
    
Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu http://45.77.173.118/ Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games