Howdy, Stranger!

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

Supported by

[solved] Control of the stimulus feature repetition in consecutive trials

edited January 2014 in OpenSesame

Dear all,

I prepare the Stroop task experiment,where different words appear in four different colors.
I want to eliminate the repetition of the color in consecutive trials.
To achieve this, I tried the following:

  1. Using a build-in "repeat_cycle" plug-in, and its fine. But it seems to have a bug. If it must to repeat the last cycle it won't do it, it just freezes...

  2. I also tried using an in-line script like the one below, but it also doesn't work. It freezes already on the first usage.

exp.items['trialsequence'].prepare()
exp.items['trialsequence'].run()

Do you have any ideas how can I not allow to the color to be repeated from trial to trial?

Thank you and best regards,

Boris.

Comments

  • edited January 2014

    hi

    I don't know why it freezes but you can try this way:

    1. look at the pic for the exp structure
    2. put the two inline script
      http://pastebin.com/mX8b5B6w
    3. decide how many trails in each block be setting the cycle loop

    enjoy
    dror

  • edited 4:54PM

    Di Dror,

    Thank you for the response and an idea!
    Unfortunately, this kind of solution will not work for me. I didn't mentioned it previously, but I have to dis-balance the proportion of colors.
    As I see it now, the implementation of your idea on this particular case will enable repetition of the color in consecutive trials.

    Thanks,
    Boris.

  • edited 4:54PM

    Hi Boris,

    The issue of pseudo-randomization has come up a few times before on this forum. There are some tools available to prepare a pseudo-random list beforehand, or you can use some scripting to accomplish this in OpenSesame.

    For relevant discussions, see:

    Cheers!
    Sebastiaan

  • edited 4:54PM

    Thanks! It was very helpful.

    However, when I am trying to save my 'stimulus', 'color', and 'correct response' list into the external 'csv' file using following piece of code, it doesn't work (it works in Spyder):

    import csv
    
    myfile = open('test.csv', 'wb')
    wr = csv.writer(myfile)
    wr.writerow(['word', 'color', 'cr'])
    for ii in range(len(final_list)):
        wr.writerow(final_list[ii])
    myfile.close()
    

    Any ideas?

    Thanks and best regards,
    Boris.

  • edited 4:54PM

    Hi Boris,

    An actual error message or description of what doesn't work would be helpful! ;)

    Cheers,
    Sebastiaan

  • edited 4:54PM

    Hi Boris,

    Why would you want to log your variables manually, rather than by appending a logger item to the end of your trial sequence?

    image

    About your Python code: you didn't define the variable 'final_list' before using it. Could that be it?

    Best,

    Lotje

    Did you like my answer? Feel free to Buy Me A Coffee :)

  • edited January 2014

    Hi Sebastiaan and Lotje,

    First of all, my experiment is working in OpenSesame without any error message. In this particular experiment I have two inline_scripts: one before the first loop and another in the sequence (both of them in prepare stage). Please see the first one here, and the second one here.
    The problem is that any test_1.csv (as it defined in the first script) file is saving... On the other hand, it works like it should to work with an external Python IDE (Spyder).

    Regarding the question why I am interesting in this, this way I have the ability to do more precise debugging of my experiment. And of course I am using the logger.

  • edited 4:54PM

    Hi Boris,

    Thanks for providing us with your inline scripts, that really helped!

    I think the "test_1.csv" file is saved in your Home folder. Could that be it? To save it in another directory:

    import os
    dst = os.path.join("/home/lotje/OpenSesame/Scripts", "test_1.csv")
    myfile = open(dst, 'wb')
    

    Does that help?

    Cheers,

    Lotje

    Did you like my answer? Feel free to Buy Me A Coffee :)

  • edited 4:54PM

    Thanks a lot Lotje!

    Indeed it is a case :)
    Is it possible to get current folder (the one with the experiment), in order to save there the 'test_1.csv'?

  • edited 4:54PM

    Hi Boris,

    Yes, that's possible! :)

    import os
    currentPath = self.get('experiment_path')
    dstPath = os.path.join(currentPath, "my_output.csv")
    myfile = open(dstPath, 'wb')
    

    Cheers,

    Lotje

    Did you like my answer? Feel free to Buy Me A Coffee :)

  • edited 4:54PM

    Thanks a lot! It works like charm :)

Sign In or Register to comment.