Howdy, Stranger!

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

Supported by

Experiment coding help

Hi everyone.

As the title suggests I need a bit of help when it comes to creating my experiment and I am stuck in two places trying to write the code to do it.

One of my independent variables is set size between 5-8 where I want a sketch pad item to draw uniformly sized red circles that corresponds to the set size in random positions on the screen. So if the set size is 6 then 6 red dots will appear for 0.5 seconds.

The other area I am stuck is as follows. In my experimental condition another IV is whether the another sketchpad item is correct or not. The outline for the experimental condition is that the red dots will appear and then after a sketchpad item will say if it was odd or even with it either being correct or incorrect. So is there a way to make the vague, butchered idea of code below work for the 4 condition iterations?

if var.set_size = 5,7 and var.computer_correct = incorrect
show.sketchpad_item 'Even'

if var.set_size = 6,8 and var.computer_correct = incorrect
show.sketchpad_item 'Odd'

if var.set_size = 5,7 and var.computer_correct = correct
show.sketchpad_item 'Odd'

if var.set_size = 6,8, and var.computer_correct = correct
show.sketchpad_item 'Even'

P.S. as you can tell I'm not that familiar with coding but I really want to learn and I hope you can help

Comments

  • Hi,

    As the title suggests I need a bit of help when it comes to creating my experiment

    This is a support forum. Being here in first place suggests that you need help. Please try to make more specific titles in future. Like that it will be easier for other users to find already existing solutions to their problems.

    P.S. as you can tell I'm not that familiar with coding but I really want to learn and I hope you can help

    never late to start learning. Here we have provided a few links to improve your python skills: http://osdoc.cogsci.nl/3.1/manual/python/about/

    As for your problem, a set size manipulation is a little annoying to implement with sketchpads (not impossible though). The trick is to manipulate the show_iffield for item 6/7/8 only to be true if the setsize is 6/7/ or 8. But then you have also to control the location on the screen and probably do some randomization. So, not very easy. I would recommend you try to implement your experiment with an inline_script. Opensesame comes with example scripts (Tools --> examples). Some of them use python coding (e.g. the Theeuwes ask has even a set size manipulation), so you could try to use those approaches to apply to your problem (and learn coding in the mean time).

    Once you have this done, your second problem will be a piece of cake. The logic of your pseudocode looks fine, you would just have to implement it properly, for which you need to know some coding.

    Is this enough information to get you started? I recommend you give it a try, even if it seems hard in the beginning you will gain much from it, and of course whenever you get stuck, we can help out.

    Good luck,
    Eduard

    Buy Me A Coffee

  • Hi Eduard, thanks for the help, I appreciate it.

    I've learnt some basic python and I've had a go at using inline_script for drawing the red circles but I'm not getting very far. I can write the code to draw one circle in a fixed spot but I'm stuck on drawing more than one circle in random positions. I feel like I know the code for each one roughly, it is just integrating them all together in a way that python is able to run.

    Do I have to define a new function to draw the variable then add it to code to create more than one red circle in random locations or am i getting the wrong end of the stick entirely?

  • edited November 2017

    wait. never mind I just had a eureka moment and I've managed to get it the red dot set size working.

    On separate notes how do you make it so that the array generated in the inline_script only appears for a certain amount of time. would it be the clock function?

    Also, can you use inline_script to "call" things from the file pool?

  • I have been beavering away and managed to generate some script to show it for a certain amount of time using a sleep and blank canvas method.

    The last thing i need help with is writing my pseudo code properly so as to include drawing the red shapes as well. Would I have to define a new variable such as draw_circle and then add the correct pseudo code to that? Any help in the pseudocode would be most appreciated.

    Thanks

  • On separate notes how do you make it so that the array generated in the inline_script only appears for a certain amount of time. would it be the clock function?

    Yes. clock.sleep(1000) # sleeps for 1 seconds

    Also, can you use inline_script to "call" things from the file pool?

    Yes. path = exp.pool[u'image_in_pool.png']

    In general, you should have a look at our documentation. It gives plenty useful information about using Opensesame in different ways: http://osdoc.cogsci.nl/3.1/manual/python/canvas/

    Would I have to define a new variable such as draw_circle and then add the correct pseudo code to that?

    I don't quite get this question, but if you check out the documentation, I think you could find an answer. Alternatively, try to rephrase please.

    Eduard

    Buy Me A Coffee

  • Hi Eduard, thanks for the help so far.

    In terms of trying to rephrase the question I'll show you the code I have thus far and hopefully that gives an idea of what I want to do. The code is in the attached picture. In general I'm trying to show the word odd or even after displaying a random array of red dots. But the word odd or even is going to be wrong for some of the trials.

  • print is not showing anything on a canvas, but only in the debug window. You have to use canvas.text() to present a word on a canvas: http://osdoc.cogsci.nl/3.1/manual/python/canvas/#function-canvas46text40text-centertrue-xnone-ynone-max95widthnone-4242style95args41

    Eduard

    Buy Me A Coffee

  • I've managed to get it working now.

    I just want to say a massive thank you for the help and also creating such an amazing piece of software for free, it's absolutely amazing. Thanks :)

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