Howdy, Stranger!

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

Supported by

[open] ISI with fixed intervals

edited September 2015 in OpenSesame

Hello
I want to present picture stimuli with different ISI. I used this inline script. The only thing is that I want the ISIs to be exactly 1000, 1500, 2000, and 2500.
Please could you kindly advice what on this case.

Thanks in advance,
Masoud

# Here we will determine the random duration between 1000 and 2500 ms:

# Import the Python module random:
# See also: http://docs.python.org/2/library/random.html
import random

# Use the function random.randint() to randomly draw
# an integer (i.e. a whole number) between a certain
# minimum and maximum.
# See also: http://docs.python.org/2/library/random.html#random.randint

# Set the minimum and maximum:
minimum = 1000
maximum = 2500

# Determine the ISI for the current trial like so:
ISI = random.randint(minimum, maximum)

# Set this variable for future use in the interface (and to log the variable
# in the logger item) like so:
# See also: http://osdoc.cogsci.nl/usage/variables-and-conditional-qifq-statements#inline
exp.set("ISI", ISI)

Comments

  • edited 5:40PM

    Hi Masoud,

    First of all, I took the liberty to edit your post a bit for better readability. I hope you don't mind.

    If you want the ISIs to be either 1000, 1500, 2000, or 2500, you better you use random.choice like so:

    ISI_options = [1000,1500,2000,2500]
    ISI = random.choice(ISI_options)
    

    Everything else stays the same. In case that you need counterbalanced ISIs, it might also be an option to multiply the list ISI_options with the amount of trials you need, shuffle it, and pop items from that list until it is empty:


    # assuming 28 trials ISI_options = [1000,1500,2000,2500]*7 random.shuffle(ISI_options) ISI =ISI_options.pop(0)

    I hope this is helpful.

    Good luck,

    Eduard

    Buy Me A Coffee

  • edited 5:40PM

    Dear Eudard
    Do apologize for the readability problem first. Thanks for the kind advice. Will do it now.

    Masoud

  • edited October 2015

    Hi again
    Thanks for your advice.
    Below is the amended inline script to set the ISI 1000, 1500, 2000 or 2500 ms.
    But there seems a problem in presenting stimulus in this stimuli intervals.

    I have added a sketchpad after the main one ( the one included the main stimuli) and the inline script but not sure if I need to specify the time in the Duration section.
    Please see the attached photos in the following link:
    http://img.cogsci.nl/?q=5612bfefc8f74

    Best,
    Masoud

    # Here we will determine the random duration between 400 and 600 ms:
    
    # Import the Python module random:
    # See also: http://docs.python.org/2/library/random.html
    import random
    
    # Use the function random.randint() to randomly draw
    # an integer (i.e. a whole number) between a certain
    # minimum and maximum.
    # See also: http://docs.python.org/2/library/random.html#random.randint
    
    # Set the minimum and maximum:
    minimum = 1000
    maximum = 2500
    
    # Determine the ISI for the current trial like so:
    ISI = random.randint(minimum, maximum)
    ISI_options = [1000,1500,2000,2500]
    ISI = random.choice(ISI_options)
    
    # Set this variable for future use in the interface (and to log the variable
    # in the logger item) like so:
    # See also: http://osdoc.cogsci.nl/usage/variables-and-conditional-qifq-statements#inline
    exp.set("ISI", ISI)
    
Sign In or Register to comment.