#### 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

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.

Masoud

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

# Import the Python module random:
import random

# Use the function random.randint() to randomly draw
# an integer (i.e. a whole number) between a certain
# minimum and maximum.

# 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:
exp.set("ISI", ISI)

``````

• edited 6:05PM

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)
``````

Good luck,

Eduard

• edited 6:05PM

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

Masoud

• edited October 2015

Hi again
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.
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:
import random

# Use the function random.randint() to randomly draw
# an integer (i.e. a whole number) between a certain
# minimum and maximum.

# 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: