Introduction to Python and Open Sesame THE S
- Slides: 81
Introduction to: Python and Open. Sesame THE S C I S BA
Open. Sesame • Open. Sesame is an open-source experiment building platform. • It is totally free. • It has Python in-line integration which enables complex experimental designs. 2 Intro to: Python and Open. Sesame
Looks and Feels Objects 3 Experiment Sequence Overview Working Window Intro to: Python and Open. Sesame
Our Experiment We will create two versions of the Posner’s cuing paradigm. 1. Exogenous cue 2. Endogenous cue 4 Intro to: Python and Open. Sesame
Our Experiment – Exogenous Version 5 Intro to: Python and Open. Sesame
Our Experiment – Endogenous Version 6 Intro to: Python and Open. Sesame
Our Experiment We manipulate these factors: 1. Side of the cue (left / right) 2. Side of the target (left / right) 3. Stimulus onset asynchrony (200, 400, 600, 800 ms). We will start with the exogenous cue 7 Intro to: Python and Open. Sesame
Outline of an experiment • • • 8 Instruction message Practice Start of experiment message Experiment (x blocks) End of experiment message Intro to: Python and Open. Sesame
Structure of the experiment General Properties (Posner’s Cuing Paradigm) Experiment Sequence Instructions (txt) Start Experiment (txt) Practice Loop Block Sequence Trial Loop Experiment Loop End (txt) Break Trial Sequence Fixation 9 Cue SOA Target Appearance Intro to: Python and Open. Sesame Keyboard Response Logging
Create a new experiment let’s create a new experiment We will use the default template 10 Intro to: Python and Open. Sesame
General Properties Here we define the general properties of our experiment, For example the back-end, resolution, fonts and colors Under the hood 11 Intro to: Python and Open. Sesame
General Properties We can check under the hood of every object in the experiment and change its properties with script changes. These are not Python scripts, but they are pretty straight-forward and easily manipulated 12 Intro to: Python and Open. Sesame
Sequence An object that holds other objects in order (you can add conditions for objects). As its name implies, it is launching the objects in a sequence. Our whole experiment is created inside a sequence called experiment 13 Intro to: Python and Open. Sesame
Sequence Let’s start filling the experiment sequence with the most important thing in the experiment, the instructions 14 Intro to: Python and Open. Sesame
Built-In Objects Open. Sesame has plenty of objects for many specific needs. We will use the commonly used ones for this class. 15 Intro to: Python and Open. Sesame
Sketchpad – Where the magic happens Extra options Tools: like writing, drawing lines and dots, presenting images 16 Intro to: Python and Open. Sesame Canvas – An object which holds what you see on the screen
Sketchpad – Introduction message Change name Use a text tool to write instructions 17 Intro to: Python and Open. Sesame
Structure of the experiment General Properties (Posner’s Cuing Paradigm) Experiment Sequence Instructions (txt) Start Experiment (txt) Practice Loop Block Sequence Trial Loop Experiment Loop End (txt) Break Trial Sequence Fixation 18 Cue SOA Target Appearance Intro to: Python and Open. Sesame Keyboard Response Logging
Do it yourself Use sketchpad objects to create: 1. Begin experiment message. 2. End of experiment message. Make sure that their duration is until keypress 19 Intro to: Python and Open. Sesame
Structure of the experiment General Properties (Posner’s Cuing Paradigm) Experiment Sequence Instructions (txt) Start Experiment (txt) Practice Loop Block Sequence Trial Loop Experiment Loop End (txt) Break Trial Sequence Fixation 20 Cue SOA Target Appearance Intro to: Python and Open. Sesame Keyboard Response Logging
Looping – Experiment loop We will use a loop object to loop over the block sequence for the amount of blocks needed in our experiment. *[ block = a collection of trials ] 21 Intro to: Python and Open. Sesame
Experiment loop Change name Create variables 22 Intro to: Python and Open. Sesame
Experiment loop Note that the blocks should be sequential and not random We will have 3 experimental blocks (which are exactly the same) We will have two variables, block and practice. 23 Intro to: Python and Open. Sesame
Block Sequence We need a block_sequence. We can drag a sequence object from the menu and place it on the exp_loop. We tell Open. Sesame to set the sequence as an item to run for exp_loop 24 Intro to: Python and Open. Sesame
Structure of the experiment General Properties (Posner’s Cuing Paradigm) Experiment Sequence Instructions (txt) Start Experiment (txt) Practice Loop Block Sequence Trial Loop Experiment Loop End (txt) Break Trial Sequence Fixation 25 Cue SOA Target Appearance Intro to: Python and Open. Sesame Keyboard Response Logging
Inside Block Sequence block_Sequence should have a trial_loop inside as well as a break message. 26 Intro to: Python and Open. Sesame
Structure of the experiment General Properties (Posner’s Cuing Paradigm) Experiment Sequence Instructions (txt) Start Experiment (txt) Practice Loop Block Sequence Trial Loop Experiment Loop End (txt) Break Trial Sequence Fixation 27 Cue SOA Target Appearance Intro to: Python and Open. Sesame Keyboard Response Logging
Trial loop is looping over a trial sequence We will leave the trial_loop information for now Let’s build trial_sequence 28 Intro to: Python and Open. Sesame
Structure of the experiment General Properties (Posner’s Cuing Paradigm) Experiment Sequence Instructions (txt) Start Experiment (txt) Practice Loop Block Sequence Trial Loop Experiment Loop End (txt) Break Trial Sequence Fixation 29 Cue SOA Target Appearance Intro to: Python and Open. Sesame Keyboard Response Logging
Not good enough. . Some fine tuning are needed. . Let’s check under the hood Fixation Point Set the duration to 400 (ms) We can use the rectangle tool and line tool to draw these stimuli 30 Intro to: Python and Open. Sesame
Under the hood - Sketchpad <x, y> Do it yourself – Change the fixation cross size to be a little bit smaller and broader 31 Intro to: Python and Open. Sesame
Fixation Much better! 32 Intro to: Python and Open. Sesame
Structure of the experiment General Properties (Posner’s Cuing Paradigm) Experiment Sequence Instructions (txt) Start Experiment (txt) Practice Loop Block Sequence Trial Loop Experiment Loop Break Trial Sequence Fixation 33 End (txt) Feedback? Cue SOA Target Appearance Intro to: Python and Open. Sesame Keyboard Response Logging
Cue We can easily copy the script from fixation sketchpad to the cue sketchpad to keep the same design We want either the left or right squares to highlight depending on the condition 34 Intro to: Python and Open. Sesame
Cue We can use the show if conditions (just like in Python ifs!) to tell Open. Sesame when to highlight which square Putting a variable name in squared brackets is Open. Sesame’s way of using variables. So [cue] is a variable (not yet defined) which represents the side of the cue (can be right / left) We can also see this information in the script (under the hood) 35 Intro to: Python and Open. Sesame
Structure of the experiment General Properties (Posner’s Cuing Paradigm) Experiment Sequence Instructions (txt) Start Experiment (txt) Practice Loop Block Sequence Trial Loop Experiment Loop End (txt) Break Trial Sequence Fixation 36 Cue SOA Target Appearance Intro to: Python and Open. Sesame Keyboard Response Logging
SOA 37 The SOA sketchpad is pretty similar to the fixation sketchpad with a small difference, we can create an unlinked copy of fixation (right-click) and change what we need. Intro to: Python and Open. Sesame
SOA We need the duration of SOA to vary according to an experiment variable. . We’ll call the variable [SOA]. 38 Intro to: Python and Open. Sesame
Structure of the experiment General Properties (Posner’s Cuing Paradigm) Experiment Sequence Instructions (txt) Start Experiment (txt) Practice Loop Block Sequence Trial Loop Experiment Loop End (txt) Break Trial Sequence Fixation 39 Cue SOA Target Appearance Intro to: Python and Open. Sesame Keyboard Response Logging
Target Use the fixdot tool in the target sketchpad to draw a target in each of the squares. Use the show if condition to select when to present it (name the variable [target]) 40 Intro to: Python and Open. Sesame
Target Also, set the duration to be 0 This is the opensesame way of making the duration of presentation controlled by the keyboard response 41 Intro to: Python and Open. Sesame
Our Experiment so far; We’re getting there! This is what you all should see in your programs 42 Intro to: Python and Open. Sesame
Structure of the experiment General Properties (Posner’s Cuing Paradigm) Experiment Sequence Instructions (txt) Start Experiment (txt) Practice Loop Block Sequence Trial Loop Experiment Loop End (txt) Break Trial Sequence Fixation 43 Cue SOA Target Appearance Intro to: Python and Open. Sesame Keyboard Response Logging
Keyboard response • Define the correct response • Define the allowed responses (separated by ; ) • Timeout (how long to listen to the keyboard) • Flush – discard any previous keyboard presses 44 Intro to: Python and Open. Sesame
Keyboard response The variable [correct_response] is in charge of the correct response in a trial and its already linked to the keyboard object. We set it elsewhere (where all the variables are set). We want the participant to press: • ‘q’ if the target is in the left square • ‘p’ if the target is in the right square We give the participant 2 seconds to respond. 45 Intro to: Python and Open. Sesame
Structure of the experiment General Properties (Posner’s Cuing Paradigm) Experiment Sequence Instructions (txt) Start Experiment (txt) Practice Loop Block Sequence Trial Loop Experiment Loop End (txt) Break Trial Sequence Fixation 46 Cue SOA Target Appearance Intro to: Python and Open. Sesame Keyboard Response Logging
Logger tool For now we will let it save all the variables for us. Decides which variables to save at every trial 47 Intro to: Python and Open. Sesame
Structure of the experiment General Properties (Posner’s Cuing Paradigm) Experiment Sequence Instructions (txt) Start Experiment (txt) Practice Loop Block Sequence Trial Loop Experiment Loop End (txt) Break GREAT JOB SO FAR! Trial Sequence Fixation 48 Cue SOA Target Appearance Intro to: Python and Open. Sesame Keyboard Response Logging
Looping – Trial Loop Now that we have the trial_sequence out of the way. . Let’s define the trial_loop that represent all the variables we used in the sequence. 1. 2. 3. 4. 49 [cue] [target] [SOA] [correct_response] Intro to: Python and Open. Sesame
trial_loop We will use the variable wizard to define most of the variables 50 Intro to: Python and Open. Sesame
Loop Variable Wizard The first row represents the variable names. The rest of the rows represent the categories of the variables 51 Intro to: Python and Open. Sesame
Loop Variable Wizard The wizard will create all the combination of these three variables for us. 2*2*4 = 16 combinations 52 Intro to: Python and Open. Sesame
trial_loop We still have to set the [correct_response] variable to be ‘p’ when the target is to the right and ‘q’ when it is left. Sounds like an if statement. . I wish we had Python to do that automatically. . 53 Intro to: Python and Open. Sesame
trial_loop 54 Intro to: Python and Open. Sesame
trial_loop And randomly We can set a loop for 4 times in a block 55 Intro to: Python and Open. Sesame
Structure of the experiment General Properties (Posner’s Cuing Paradigm) Experiment Sequence Instructions (txt) Start Experiment (txt) Practice Loop Block Sequence Trial Loop Experiment Loop End (txt) Break Trial Sequence Fixation 56 Cue SOA Target Appearance Intro to: Python and Open. Sesame Keyboard Response Logging
Status The experiment is almost done! We need to make sure the participant understands the instructions and so a practice block is required. Append a new loop after the instructions and call it prac_loop 57 Intro to: Python and Open. Sesame
Practice vs. Experiment The practice and experiment sequences are pretty much similar. There are some differences: 1. The practice block should have only 1 block 2. A practice block should have only 8 trials and not 64. 3. We need breaks in the experiment blocks but not the practice blocks. We should re-use objects as much as we can to avoid bugs and having to change multiple places. 58 Intro to: Python and Open. Sesame
Prac_loop And we tell prac_loop to iterate on block_sequence (our pre-defined sequence). This creates a linked copy of block_sequence in prac_loop Like exp_loop, prac_loop should have two variables, block and practice. 59 Intro to: Python and Open. Sesame
Practice vs. Experiment 1. The practice block should have only 1 block 2. A practice block should have only 8 trials and not 64. 3. We need breaks in the experiment blocks but not the practice blocks. 60 Intro to: Python and Open. Sesame
Practice vs. Experiment So how would we create the other two differences between the sequences? 61 Intro to: Python and Open. Sesame
Breaks! Inside block_sequence, We can tell Open. Sesame to run the break sketchpad only if the [practice] variable is set to no (i. e, in the exp_loop) 62 Intro to: Python and Open. Sesame
Practice vs. Experiment 1. The practice block should have only 1 block 2. A practice block should have only 8 trials and not 64. 3. We need breaks in the experiment blocks but not the practice blocks. 63 Intro to: Python and Open. Sesame
Practice vs. Experiment We notice that an experiment block has: 64 trials (4 repeats of 16 trials). The practice block should have: 8 trials, or 0. 5 repeats of 16 trials. We can create a variable to define our repeats. 64 Intro to: Python and Open. Sesame
Repeating trials We create a new variable in both exp_loop and prac_loop called repeat_block We set it to 0. 5 in the prac_loop and 4 in the exp_loop 65 Intro to: Python and Open. Sesame
Trial_loop Next, in the trial_loop, we tell the repeat command to take input from the [repeat_block] variable! 66 Intro to: Python and Open. Sesame
Practice vs. Experiment 1. The practice block should have only 1 block 2. A practice block should have only 8 trials and not 64. 3. We need breaks in the experiment blocks but not the practice blocks. 67 Intro to: Python and Open. Sesame
Structure of the experiment General Properties (Posner’s Cuing Paradigm) ! E N O D Experiment Sequence Instructions (txt) Start Experiment (txt) Practice Loop Block Sequence Trial Loop Experiment Loop End (txt) Break Trial Sequence Fixation 68 Cue SOA Target Appearance Intro to: Python and Open. Sesame Keyboard Response Logging
Time for a test drive! Save the experiment and run it using this key: Seems to run pretty too fast and the target doesn’t disappear after you press the keyboard. . We better add another sketchpad at the beginning of trial_sequence. Call it blank and set the duration for 1000 ms. 69 Intro to: Python and Open. Sesame
Log file Open. Sesame saves the experiment log in. csv files (comma separated values). These can be easily opened with Microsoft Excel But they are pretty big if we ask Open. Sesame to save all the variables from the experiment. 70 Intro to: Python and Open. Sesame
Open. Sesame Logging We can tell opensesame which variables are important to us in the logger tool. [Although, I recommend logging everything in the beginning until you know what are the relevant variables, better to work harder on preprocessing than re-running the experiment] 71 Intro to: Python and Open. Sesame
Log file We can scroll and choose manually… Or use the script to log the variables we are interested in 72 Intro to: Python and Open. Sesame
Open. Sesame Experiment Files When saving an opensesame project, we can save it in a couple of ways: The experiment with the files (e. g. , pictures) Just the experiment Re-save our experiment in an Open. Sesame files type and call it Posners. Cueing. Paradigm_endo 73 Intro to: Python and Open. Sesame
Posner’s Cueing paradigm – endogenous cue To create the endogenous cue version of the task, we’ll need arrow stimuli. One easy one of getting these pictures is from Power. Point. Create a white arrow and save it as a. png file. 74 Intro to: Python and Open. Sesame
Posner’s Cueing paradigm – endogenous cue We should create two arrows • left. png M ake su re the • right. png are pretty sse arrows mall We’ll add these two files to the experiment’s file pool 75 Intro to: Python and Open. Sesame
Posner’s Cueing paradigm – endogenous cue To alter our experiment, we just need some minor modifications to the cue sketchpad. 76 Intro to: Python and Open. Sesame
Posner’s Cueing paradigm – endogenous cue First, we remove the highlighted squares and fixation cross (use the sketchpad script) 77 Intro to: Python and Open. Sesame
Posner’s Cueing paradigm – endogenous cue Next, place one of the arrows in the middle Use the draw image element 78 Intro to: Python and Open. Sesame
Posner’s Cueing paradigm – endogenous cue We want a left arrow to appear when [cue] is left and a right arrow when [cue] is right… 79 Intro to: Python and Open. Sesame
Posner’s Cueing paradigm – endogenous cue 80 Intro to: Python and Open. Sesame
Testing our work We are done! Let’s test our work 81 Intro to: Python and Open. Sesame
- Opensesame logger
- Sad day on sesame street
- Sesame synchrotron
- Sesame school dungarvan
- Open innovation open science open to the world
- Python open buffering
- Open python files
- Hình ảnh bộ gõ cơ thể búng tay
- Slidetodoc
- Bổ thể
- Tỉ lệ cơ thể trẻ em
- Gấu đi như thế nào
- Glasgow thang điểm
- Chúa yêu trần thế alleluia
- Các môn thể thao bắt đầu bằng tiếng đua
- Thế nào là hệ số cao nhất
- Các châu lục và đại dương trên thế giới
- Công thức tính độ biến thiên đông lượng
- Trời xanh đây là của chúng ta thể thơ
- Cách giải mật thư tọa độ
- Làm thế nào để 102-1=99
- Phản ứng thế ankan
- Các châu lục và đại dương trên thế giới
- Thơ thất ngôn tứ tuyệt đường luật
- Quá trình desamine hóa có thể tạo ra
- Một số thể thơ truyền thống
- Cái miệng nó xinh thế
- Vẽ hình chiếu vuông góc của vật thể sau
- Thế nào là sự mỏi cơ
- đặc điểm cơ thể của người tối cổ
- Thế nào là giọng cùng tên
- Vẽ hình chiếu đứng bằng cạnh của vật thể
- Fecboak
- Thẻ vin
- đại từ thay thế
- điện thế nghỉ
- Tư thế ngồi viết
- Diễn thế sinh thái là
- Dạng đột biến một nhiễm là
- Số nguyên tố là
- Tư thế ngồi viết
- Lời thề hippocrates
- Thiếu nhi thế giới liên hoan
- ưu thế lai là gì
- Hổ đẻ mỗi lứa mấy con
- Sự nuôi và dạy con của hươu
- Hệ hô hấp
- Từ ngữ thể hiện lòng nhân hậu
- Thế nào là mạng điện lắp đặt kiểu nổi
- Python programming an introduction to computer science
- Notc contact
- Open hearts open hands
- Intro paragraph layout
- Difference between tuple and list
- Contoh stack python
- Empty python
- Single slash and double slash in python
- Append vs extend in python list
- Pure functions and modifiers in python
- Python compiler
- Topping d10b
- Pure function and modifiers in python
- Python logic gates
- Rapid gui programming with python and qt
- Fruitful and non fruitful function in python
- Chapter 4 python for everybody
- Variables expressions and statements in python
- Python spirit
- Difference between range and xrange in python
- Iterators and generators in python
- Nww python
- Ergm python
- Python full form
- Violent python 3
- Arabic wordnet python
- Hitran python
- Tres en raya python
- Scipy audio processing
- Python 7 razred
- Python duck typing
- Python flag code
- Pythonü