Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Generated by OpenSesame 0.27.4 (Frisky Freud)
- # Mon Sep 23 12:34:20 2013 (nt)
- # <http://www.cogsci.nl/opensesame>
- set mouse_backend "xpyriment"
- set subject_parity "even"
- set height "768"
- set font_family "sans"
- set font_italic "no"
- set custom_cursor "yes"
- set synth_backend "legacy"
- set title "visuospatial_1234"
- set coordinates "relative"
- set start "experiment"
- set sampler_backend "legacy"
- set transparent_variables "no"
- set foreground "Black"
- set font_bold "no"
- set description "Default description"
- set background "White"
- set font_size "20"
- set enable_escape "yes"
- set keyboard_backend "legacy"
- set canvas_backend "xpyriment"
- set compensation "0"
- set subject_nr "0"
- set width "1366"
- define loop practice
- set repeat "1"
- set description "Repeatedly runs another item"
- set item "practice_sequence"
- set column_order ""
- set cycles "1"
- set order "sequential"
- run practice_sequence
- define loop p_block_loop
- set repeat "1"
- set description "Repeatedly runs another item"
- set skip "0"
- set item "p_trial_sequence"
- set column_order ""
- set cycles "50"
- set order "sequential"
- run p_trial_sequence
- define sequence experiment
- set flush_keyboard "yes"
- set description "Runs a number of items in sequence"
- run read_point_files "always"
- run practice "always"
- define sketchpad p_trial_display
- set duration "0"
- set description "Displays stimuli"
- draw textline -180 0 "[shape1]" center=1 color=black font_family="sans" font_size=40 font_italic=no font_bold=no show_if="always" html="yes"
- draw textline 180 0 "[shape2]" center=1 color=black font_family="sans" font_size=40 font_italic=no font_bold=no show_if="always" html="yes"
- draw rect -480 -160 960 320 fill=0 penwidth=3 color=black show_if="always"
- define sequence practice_sequence
- set flush_keyboard "yes"
- set description "Runs a number of items in sequence"
- run ongoing_task "always"
- run p_block_loop "always"
- define inline_script ongoing_task
- set _run ""
- ___prepare__
- # For both images, shuffle points:
- import random
- image1 = random.shuffle(image1_points)
- image2 = random.shuffle(image2_points)
- # Make lists global for future use
- global image1, image2
- __end__
- set description "Executes Python code"
- define sequence p_trial_sequence
- set flush_keyboard "yes"
- set description "Runs a number of items in sequence"
- run ongoing_script "always"
- run p_trial_display "always"
- define inline_script ongoing_script
- set _run ""
- ___prepare__
- # Create the shape generating script:
- # First, define a list of numerical values representing an 'n' sided-shape
- n = [12,8,6,4,3]
- # Then, we need a random value from 'n' for every shape presented:
- #(code found in cogsci.nl thread http://forum.cogsci.nl/index.php?p=/
- # discussion/325/solved-question-randomization-on-one-page-using-forms/p1)
- random.shuffle(n) # Shuffle the list order
- while len(n) > 0: # While the list is not empty
- nss = n.pop() # 'Pop' the first item
- # Import the built-in OS function 'canvas':
- from openexp .canvas import canvas
- p_trial_display = canvas(exp)
- # ... each group of 'image points' totals 24 points, so divide by value of 'nss'
- # and take a random sample to generate various randomly presented 3, 4, 6, 8 and 12
- # sided shapes:
- shape_1 = random.sample(image1, len(image1)/nss)
- shape_2 = random.sample(image2, len(image2)/nss)
- # Use variables 'shape1' and 'shape2' with the polygon function:
- shape1 = p_trial_display.polygon(shape_1)
- shape2 = p_trial_display.polygon(shape_2)
- # Set variables using built-in OS function exp.set, to make variables
- # available in GUI (i.e. sketchpad item):
- exp.set('shape1', shape1)
- exp.set('shape2', shape2)
- __end__
- set description "Executes Python code"
- define inline_script read_point_files
- set _run ""
- ___prepare__
- # Read the coordinate points from the two .txt files.
- # Specify the path to the files by using the built-in OpenSesame function exp.get_file.
- path_image1_points = exp.get_file('image1_points.txt')
- path_image2_points = exp.get_file('image2_points.txt')
- # Use the built-in Python module numpy to read the .txt files:
- # Import the module
- import numpy as np
- # And load the text file, with value set to 'integer':
- image1_points = np.loadtxt(path_image1_points, dtype=int)
- image2_points = np.loadtxt(path_image2_points, dtype=int)
- # Make the files global for future use:
- global image1_points, image2_points
- __end__
- set description "Executes Python code"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement