Howdy, Stranger!

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

Supported by

Is this possible and how?

Dear OpenSesame community,

I have previously built a couple of simple experiments in OpenSesame (e.g. IAT) and never had any issues, but I have recently encountered an obstacle in building a more complex experiment that I do not know how to overcome, and in fact I am not sure whether it is possible to build the type of experiment I would like to build (I hope it is), so I would really appreciate any help and pointers you have.

The type of experiment is a fully crossed within-subjects design with 2 variables, to which I will refer as Variable 1 and Variable 2, and which therefore has conditions.

Variable 1 Variable 2 Condition
A C 1
A D 2
B C 3
B D 4

The dependent variable will be time estimation. Participants will need to undertake 40 blocks (10 for each condition), and in each block they will need to click on the black dot in the middle of the canvas (see the depiction below) 30 times at 1s intervals. When they click for the first time number 1 should appear above the dot (corresponding to their estimate of 1 second), when they click for the second time number 2 shall appear, and so on until 30. In each block, a different word will be presented below the dot in the middle while participants are clicking on the dot (the word corresponds to Variable 1, as there will be two different types of words).

Here is where it gets tricky:
Above the black dot in the middle, there should be a dot flashing at a specific time interval (independent of participants' clicking). In some blocks, the dot will need to be flashing at 1s intervals, and in some blocks at random intervals that range between 0.5s-3s. The pattern of flashing corresponds to variable 2, given that there will be two different types of flashing (random and non-random).

I would be very grateful to anyone who has some ideas regarding how to do this.

Comments

  • p.s. I realized that the table where I explain Variable 1, Variable 2, and Condition got impaired after I posted it, this is what it shall look like:

  • Hi,

    That is a little more complicated alright. Not sure whether it is implementable with a sketchpad. It might, but certainly not easily. I recommend you look at inline_scripts and how to prsent stimuli and collect responses with python code (e.g. http://osdoc.cogsci.nl/3.1/manual/python/canvas/).

    You can browse this forum a little. What you are looking for are examples of how response collection can be done independently of image presentaiton. The implementation will probably involve a while loop, one or two canvasses and a mouse item.

    It is a little late right now, but next week I might ahve some time to tinker some code together.

    But you give it a try first.

    Good luck,
    Eduard

    Buy Me A Coffee

  • Dear Eduard,

    thank you very much for your advice. I've spent this weekend searching for examples of how response collection can be done independently of image presentaiton, and I was also researching different python codes and the "coroutines" feature, and I did not make much progress unfortuntely because I still have not found any indication of how what I want to do would be possible.

    To make it easier to understand what I want to do, I made the basic version of my experiment in OpenSesame, where people need to estimate 1s time intervals by clicking inside the circle in the middle of the screen while a specific word is being presented below the circle. This part is easy to do in OpenSesame.

    The tricky part is that I still cannot figure out how to add a dot at the top of the screen that is flashing at either irregular or regular intervals (depending on the block) and is independent of response selection and the presentation of seconds.

    I would really appreciate any help and pointers you or anyone else may have on this. My experiment is scheduled to run in exactly 2 weeks and I did not expect this would be so difficult to build when I constructed the plan for the experiment. Thanks a lot.

  • Hi,

    I made a little script. Hope this gets you started.

    Good luck,
    Eduard

    Buy Me A Coffee

  • Thank you, I really appreciate it.

  • Hi Eduard,

    thank you once again for creating the script.

    I extended the script you created and shaped it into a full experiment, and now there are only 3 things (I hope minor) that I still did not figure out how to achieve.

    1. It seems that "time = ms.get_click()" outputs only aggregate times across all 30 clicks per each stimulus in the practice or block loops, but I need response times for each of the 30 clicks of the counter, and I have not managed to figure out how to do that.
    2. When a loop starts and participants start clicking to estimate seconds, mouse cursor stops being visible, and yet it is very important for the experiment that the cursor is visible so that participants can click inside the circle in the middle of the screen. I tried setting double buffering in legacy to "no" and also tried psycho and expyriment back-ends but that does not seem to be the reason for mouse cursor invisibility. If the cursor cannot be made visible, I will need to use keyboard rather than mouse responses.
    3. In "random_canvas" inline_script, I used the random.randint function (see line 23 in the attached experiment) to make the appearance of the black dot random (so that the interval between each blink is random). This function, however, does not seem to have a desired effect. Only when xpyriment back-end is used it actually works properly, but using xpyriment has different issues, such as a long delay between when participants click the mouse and when this actually affects the counter of the screen. Do you perhaps know how to achieve this in legacy?

    I would be really grateful if you would know how to resolve these 3 issues, and that will be everything I need to make the experiment work.

    Thanks for your help, I appreciate it.

  • P.s. I resolved number 2 so I do not need help regarding that anymore but still cannot resolve the other 2 points.

  • Hi,

    1) time = ms.get_click()

    That is not correct. ms.get_click() returns the button that wa spressed, the current position and then the time from experiment start on. So the correct way to get the time is button, pos, time = ms.get_click().
    See here: http://osdoc.cogsci.nl/3.1/manual/python/mouse/#function-mouse46get95click404242resp95args41
    If you want a response time. You have to manually compute it. Use the clock.time() function to start the timer at some point (e.g. when stimulus presentation starts), and then take the difference of time of button press with the initial time. Does that make sense?

    3

    Mh, I see what you mean. I think you should not include the random.randint(200, 5000) in the if statement, because on every iteration (of which there are a lot!), it would have a different value, so that the logic would be messed up. Instead initialize it once before the while loop (e.g. interval = random.randint(200, 5000)) and then use interval in the if statement. Inside the body of the if statement, you can then update the variable, by calling interval = random.randint(200, 5000) again.

    I haven't tested it, but does this happen to solve your issue?

    Eudard

    Buy Me A Coffee

  • edited November 2017

    Thank you Eduard,

    I am getting there.

    • To capture timing, I added the following line of code in the while loop: var.rtime=clock.time()-t0 (see below). The main problem now is that the variable gets overwritten in every new iteration of the loop, so in the end the reaction time that is captured is that of the entire loop. Sebastiaan explained here how to change variable name in every iteration of the loop, but I have not managed to implement it in my loop: http://forum.cogsci.nl/index.php?p=/discussion/2850/logging-variables-in-a-while-loop. Being able to do this would resolve all my issues

      t0 = cv.show()
      interval = random.randint(200, 5000)

      while counter < 30:
      left_button, pos, timestamp = ms.get_click() # samples a response on every iteration (waits for 3ms)

      if left_button == True: # only after a click do the updating
          var.rtime=clock.time()-t0
          cv.clear() # empty the current screen
          # draw the updates information on it
          cv.text(var.Stimulus,x=0,y = -300, font_size=200, font_family='Arial Black')
          cv.circle(0,0,32, penwidth=5)
          cv.text(counter,x= 0, y = -100)
          # present the new screen
          cv.show()
          counter += 1
      
    • To achieve random display of the dot, I added the codes you suggested as below but I still did not get the desire effect. What I would need is that the dot is always displayed for 400ms, but at random intervals (ranging from 200ms to 4000ms) while the loop is not finished. Do you maybe know how it would be possible to achieve this?

      while counter < 30:
      left_button, pos, timestamp = ms.get_click() # samples a response on every iteration (waits for 3ms)

      if left_button == True: # only after a click do the updating
          var.rtime=clock.time()-t0
          cv.clear() # empty the current screen
          # draw the updates information on it
          cv.text(var.Stimulus,x=0,y = -300, font_size=200, font_family='Arial Black')
          cv.circle(0,0,32, penwidth=5)
          cv.text(counter,x= 0, y = -100)
          # present the new screen
          cv.show()
          counter += 1
      if ((clock.time()-t0)%interval) < blinkrate: 
          interval = random.randint(200, 5000)
          cv.clear()
          cv.circle(0,200,30, fill= True)
          cv.text(var.Stimulus,x=0,y = -300, font_size=200, font_family='Arial Black')
          cv.circle(0,0,32, penwidth=5)
          cv.text(counter,x= 0, y = -100)
          cv.show()
      

    Thanks again for all your help. This is everything that is still left to be resolved for my experiment and after that I will need no more help. I am also attaching the abridged version of the experiment if needed.

  • Hi dario,

    Attached the (hopefully finished) experiment. I changed the inline_scripts and also the general structure a bit, primarily to make things easier. Now there is only a single trial loop and a single stimulus canvas inline_script. (The only difference between condition was the flicker rate, so I added a single if-else statement to the script, and everything was good). Also it is never a good idea to have multiple logger files. Always use a single one. (unless you have two entirely different tasks).

    Let me know if there are problems.

    Eduard

    Buy Me A Coffee

  • edited November 2017

    Thanks, perfect! Now the only issue when I run the script is that 0 in the counter changes to 1 only after two clicks rather than after one click. If you maybe know what needs to be changed in the script you created for that no to happen everything will run with no mistakes.

  • Fixed. It was actually quite easy. You should try to figure these things out yourself. Make a backup of the experiment, and then play around with the order of lines, etc. and see how the behaviour changes.

    Good luck,
    Eduard

    Buy Me A Coffee

  • Thanks, I actually tried many different things and had no idea it was this small twitch that would make it work.

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