 In this video we'll be taking a look at OpenSesame. OpenSesame is a free open source experiment builder package rather than a commercial package such as E-Prime. It's available from www.coxsci.nl slash software slash OpenSesame and it's a cross-platform product. You can get versions for Windows, for Mac and also for Linux. Now if you've viewed the tutorial video that I already have for E-Prime you'll know this experiment we're going to be doing. If you haven't viewed that video though it's quite a straightforward experiment we're going to be using and it's the catfaces experiment where basically we show people pictures of a cat face such as like this one here and we ask them to make a judgment about that cat face to say whether they think that cat is male or what they think that cat is female. Just press one of two keys to indicate male or female. So this is the sort of format we'll be using for this experiment. We're going to start off by giving the participants some instructions of how to complete the experiment. We'll then have the main experimental trial which will be a fixation cross maybe for about 500 milliseconds. They have a blank screen for 500 milliseconds then we'll show the participant the picture of the cat face which will remain on screen until participants make their response male or female. We'll run through the experiment and then when the experiment's finished we will give the participant a thank you message to say thanks for taking part. Now of course not much point just running through this once to have a single trial we want to run through this a number of times and so what we're going to do is we're going to run this particular section here 40 times basically create a loop when we run through this 40 times with 40 different cat faces 20 of them being a male and 20 of them being female. This is one way that you might visualize the experiment. Another way of doing so is in a vertical format so that start with the instructions at the top here then we have this loop lock here which is basically for the holding the experiment itself that's the sequence in the trials and then finishing off with a thank you message at the end. The experimental trials are just now listed vertically so we have the fixation cross, the blank screen and then the picture of the cat face and all this section here we're going to run through that 40 times for the 20 male and 20 female cat faces. Now the reason that I've drawn this out this particular way is that inside of open sesame when we're actually constructing the experiment it constructs it in a very list this view sort of way so in a vertical sort of structure so as we go through creating the experiment what we're aiming for is for the overview of the experiment that appears in open sesame to be similar to this one that's here on the screen right now so let's take a look at open sesame itself as we open it up this is the default start state we get this dialog box for a new experiment asking us what we would like to do when we begin do we want to open one of two templates that being a default template an extended template you also get the option to open up some existing experiments if you already have any or we can sprout through for an experiment somewhere on your hard disk. I'm just going to go over the default template the extended template contains many many more blocks or loops I really want to turn them they mean the same thing really and we don't need them in our simple example so I'm just going to go for the default template click on start the default template and if you look over in the other view here it's giving us a very basic sort of experiment we have this new experiment general options for the experiment up at the top then we have one sequence here which is the experiment itself which contains two objects the getting started and the welcome object now we're not actually going to use either of those two in our experiment so I'm just going to highlight each one and click on delete and that just gets rid of both of them so I want a pretty blank experiment to begin with just looking around the interface we've got four main components we have a toolbar at the top full of the usual commands such as new open and save we get the option to run the experiment full screen or run in a window just one point to note here that if you're using the macOS version as of open sesame 0.24 you can't use running a window I say you can't use it you can start to run the experiment in in a window but I found that it would tend to just crash after the experiment has completed it's an own bug it's being worked on but it runs up to fine if you're running full screen which is what we'll be using for this example we get some other toolbar options up here that we won't be going into too much and someone that can be useful like close other tabs you see on this over on this right hand side here we've got this one single tab at the moment which is the general properties of the experiment if I click on the experiment sequence you see we get another tab and every time we click on any of these items so it's going to be unused we get the tab up again and if you click on the welcome get another tab so you can imagine if you've got a reasonable size experiment it's not going to take too long before you've got crazy number of tabs up here and so we can easily get rid of all the other tabs by clicking on the one that we want to keep so I want to keep the general properties then just click on close other tabs and that gets rid of the other launch force we get the option to show it for you info in the overview so this is your view window here and as you can see there we go telling us that the experiment actually contains no items currently the unused items contains items and it says that welcome is a sketch display item that's going to wait on screen to the key press maybe it's useful if you start collapsing items down so if unused items was hidden it will tell you that it contains items but at the moment for this particular experiment we're doing quite a basic one so we're not going to I need to worry about that it's just going to turn that off then we get these other options over here to show various things we can show the file pool variable inspector or the debug window the debug window you just use to help you debug any Python code that that you're running or inserting into the experiment the variable inspector allows you to view the variables that you specify in the experiment and the file pool we will be using this in this example because it contains all the files that referred to by our experiment that's a nice feature of open sesame that when you save your experiment you have to save all of the stimuli as well at the same time in one single archive file which means that you'd have to worry about sorting out which files go where if you move the experiment to a different machine you just simply have to take the archive file onto the other machine and it run perfectly fine that's the toolbar window on the left hand side we have the toolbox which contains some commonly used objects these are some of the most common objects that you use when you're creating experiments and also click on the downward arrow see you've got a few more as well that's actually using the text screen objects from the visual stimuli subsection in this experiment rather quite straightforward you've got the loop item which contains all the trials that you might use in particular block we've got the sequence item and this basically is where you contain the procedure for your experiment or for your particular trial we've got the sketch pad item which contain images and text and drawings and so forth there's a sampler item so you can play sounds two other ones that we will be using this experiment is the keyboard response if you want to collect responses from participants during the experiment which I'm sure you want to do so you need to have this particular item associated with a particular trial and if you want to recall the data that they make you need to use the logger item but we'll see how these come together as we create the experiment next to the toolbox we've got the overview window and this basically gives us the structure of the experiment we've created and you can see now it's in this vertical sort of format which is why I'm suggesting that for learning how to create experiments of open sesame it's worthwhile just having to think about how your experiment would look in this kind of form since what we want to do is have this particular structure mimicked in this particular window over here and on the right-hand side we've got the bit where we do all the real work with our experiment where we set all the properties of the experiment and all of the objects that we drag in so for example the sketch pad display object it looks like we're going to use a display of cat face picture it would be in this particular area that we define how that cat face picture actually appears on the screen so let's get started creating our experiment so I'm going to click on the experiment at the top here this is like sets the general options and as you see up here it's marked up general properties you can actually give the experiment a name if you want to use if you're coming back to an experiment sometime in the future and you haven't seen this before and sometime and specify default description as well if you want to say what experiments actually doing we'll specify the entry point we're going to leave it at experiment which will be the first item here now what's nice about this entry point ability or ability to select the entry point is if you imagine experiment where you have say five different blocks and each block can be say 10 15 minutes long if you run through this parameter in your testing it and you find an error saying block five you could be sitting at the machine for over an hour before you actually found that error you go from fix the error but then of course you're going to have to run through all the whole other blocks again which could take you up to an hour to get through just to make sure that you have fixed that particular error what you can do here is you'd have to be able to specify the entry point as being that fifth block rather than having to start at the very beginning again so it's a it's a very useful little tool to have best of course it the first item to run so this will be the very first thing when you click on run the experiment this is going to be the first thing that's actually executed we have the back end that you can choose from it defaults to legacy there are actually three options there's one for psycho which is to use the back end from psycho pie legacy which is the default as I say and open GL which is pie game in GL mode now if you're using the macOS version as I said as of version point two four you have to use the legacy back end the other two are supported however on Linux I've noticed that open GL seem to give me the best performance I haven't tried the windows version but at least on the limits one I can definitely say that all three options did work very well although I did find that open GL was giving me the best results let's say because we're using the Mac here we've got to stay really with legacy we've got to play resolution here so we can actually set what resolution we want to run the experiment at to leave at the default for the time being on 1024 by 768 pixels we've also specified the for help color and the background color for all our objects in our experiment gonna change these around actually to the background the foreground color so it becomes black and the background color becomes white that's giving us white text on a black background you also get the option to add in some time in compensation for any timing errors that your particular setup produces I'm just gonna leave that in a second it's not the only point change in this for this example not these because the screen capture software will interfere with timing no end anyway because I've got the option to show the script editor so this is actual script that's executed by the program the nice thing about site open sesame is that you don't have to worry about changing script if you don't want to and for this example we don't need it so much it's going to hide all completely so we don't actually need to edit any code so let's get started on creating our experiment we just refer back one last time to the structure here we basically want something to display a little text on the screen which are the instructions to the participant we then want something to contain a loop of trials for to them in this particular case in the middle and then we want to create something that contains some text that contains the thank you message so what we're going to use to do these there's two ways you can add objects to the experiment itself one is to find the object you want and so if you want to display instructions to the participant the one we're going to use the text display item and one way doing adding this to the experiment is to simply click on it and just drag it into the experiment overview over the top of the experiment sequence and that adds in the text supply object into there to give that a name of instructions and as it changes the name in here now I'm not going to enter in the texting at the moment I will come back to that in a minute after we've created the basic outline that's one way you can add objects to the to the experiment the other way of doing it is to click on the sequence itself as you can see it's got two options down here to append an existing item that's one that we're already have available so if for example I wanted to add the instruction screen twice not make any sense to do it but say I did I can just click on add the instructions and on the plus button as you see now get a duplicate of the instructions object the thing that actually do need to do is to append a new item and this particular case I need to add a loop now the loop is the object that contains all our trials that are used in the experiment so I'm going to click on that and then make sure it's selected and then click on the plus button and it asks us here that a loop needs another item to run usually a sequence this is indeed the case in our case because we've got the loop that's going to contain our trials but what's it actually going to run inside that loop if we go back to the overview again this is like our loop block but all of these items have to exist on a separate timeline or even a separate sequence so what we need to do when we're creating the loop is to say that we're going to use a new item and it's going to be a new sequence that's going to contain our exact trial procedure if a sequence already existed that you wanted to use you can of course use an existing sequence but I'm just going to make sure that sequences are selected here and then click on create as you can see now we've got our loop here which is going to contain all our trials and then the sequence that's going to contain our actual trial sequence so that's I added in so I forget about two experiments I need to add in one more item that's going to be the goodbye message so I'm going to append a new item I'm going to add in a text display and click on plus that's I did the text by the end I'm going to call this goodbye so I'm going to rename the loop object as well we've got a single block in this experiment so I'm going to call it block loop and then I'm going to rename sequence as well and I'm going to call it say trial sequence so if we just look at this if I just clamp that down actually you see there we've got this experiment object with instructions a block loop and a goodbye message and that's exactly what we're looking for here so I'm going to enter in some of the properties so for the instructions I'm going to add in the text here that people actually see when they start the experiment we get the option of setting what the duration is going to be now it's going to actually be an exact value so you can specify a number here in milliseconds it can be a key press or a mouse click now in this experiment we just want to sit there and wait until the system presses a key and then they can start the experiment so it's going to leave that on key press it inherited the overall experiment properties with a black foreground i.e. black text with a white background we can change the font family from mono sans or serif leave that mono and an 80 point font size will be absolutely fine I'm going to change the wrap line after 80 characters makes it more wider on the screen and leave the text alignment into the center can specified left and right of course there's this case coming down to the box at the bottom and entering your instructions for the experiment so type something in here these are the two keys I'm going to be using for this experiment the Z key the male cats is the M key the female cats so we've got some basic instructions there and we've got a little warning here there because we haven't applied any unsafe changes so I'm just going to click on the apply button and that's it that's our instruction set up click on the goodbye and we'll have exactly the same setup here I'm not really going to change anything I did have that 80 before but it's not a huge amount of differences to our example so I'm going to add in a thank you message and then click on apply so that set up our instructions and it set up goodbye message that's going to do is look at the loop itself and think about what actually is that we're going to display on the screen now to say we've got all these pictures of cat faces so here they are here we've got to have some pictures for these cat faces and I already have those actually in a folder on my desktop it's the cat face photos and here they all are they all labeled up fo1.bmpfo2 these are all the females as we scroll down we start to get the males mo1 mo2 there's 20 females f20 and that got up to m20 for the male cats so basically we need to indicate to open sesame that these file names are the images that should be being used and we also need to indicate what key participants should be pressing if they get the trial right and I also want to add an extra variable in that's going to indicate whether the cat was male or female now it is possible of course to extract that information from whether people pressed them so the correct response was a Z key for male and M key for female but I'm going to add that extra variable in to make it look a little bit more easier when we come to do the analysis later on there's couple ways of doing it you can use the variable wizard or add them in manually I'm just going to add them in manually for this particular example and to get the option of entering a variable name option followed by default value I'm just going to call it not the default value I'm just going to call it the variable names the first one will contain the file name that refers to the cat face picture I'll call that cat another one in which I'm going to call correct response and I'll add a last one in which I'm just going to call gender which is going to just be a much more readable form of whether the cat was male whether it's female now of course we've only got one possible trial here actually need to carry 40 of these things so we got to the cycles box where it's cut except of one the type number 40 in and when I do that you'll see that we now have a total of 40 rows in this spreadsheet here which can contain our 40 trials just look at these other items at the top here because we don't actually worry about them again says item to run is trial sequence we can change the actual procedure that's going to be run at this particular stage if you wanted to of course trial sequence is the one I created for this particular experiment so I leave it as it is cycles are just mentioned we got the option to repeat the block a number of times so if we repeat it twice for example we'd end up with a total of 80 trials and then we get some choices about how we want the order to be do we want them to be random we don't want to be sequential and leave it on random which is the default because of course otherwise we'll end up with all the cats being sent in the same order to every participant next thing I need to do is add in the details about each individual trial just refer back to quickly to the catface photos as I said before you can see they're called fo1.bmp fo2.bmp fo3.bmp and so on so what I need to do is indicate what these file names are in the cells down here in the cat column so I'm going to the meme and but notice I'm not only adding the .bmp there's a particular reason for that you can add it in here but it's just going to save a bit of time if we don't add it in because we use a little bit trick stuff later on to automatically add the .bmp for us and it saves us doing a bit of typing at this phase so I'm just going to add in all of the file names or least the first part of all the file names for the cats one thing I have noticed at this stage is that when you've actually typed like that in F17 you can't press the down arrow to actually just move down to the next cell you actually have to press enter first and then move down so if you're used to using a spreadsheet where you can just hit the down arrow to enter in the data you can't do that in this particular data editor so that's all the female cats now I'll add in all the male cats and there we go so we've got our 20 males and our 20 females in the correct response column we need to put down the key that the participant should be pressing in order to get that particular trial right for the females we want them to be pressing M and P to try to beat that up and then for the males we want them to press the Z key and the final thing I'll add in the human readable form of the gender of the cat okay there we go so that specified all the particular things that open sesame we need to know in order to be able to run our experiment and what we can do is when we actually create the things relating to the cat face picture is that instead of specifying the exact file name that should be displayed we can actually use this particular variable up here the variable now is called caps in order to determine which picture should be displayed upon the screen likewise when we want to collect the responses of the participant we can just say refer back to the correct response column and pull out whichever trial it was that was running to find out whether it should be a Z or whether it should be an M and likewise gender will be pulled out although we don't actually need that to run the experiment that's just more for the data file to help us actually make sense of the data file at the end so the next thing to do is actually create our trial sequence click on the trial sequence here and then add in the objects using the opinion item method the first one we need is a fixation cross or fixation point a couple ways you could do this you could add in a text display object with a plus sign on it but the sketchpad display actually want to use that it does have one nice little feature in it is actually got a fixation dot object already built into it so I'm going to add a sketchpad in to begin with I'll then add in a text display which is going to be just a blank screen that will be on the screen for 500 milliseconds and then finally I'll add in another sketchpad which can contain the picture of the cap face so that's basically our overall structure of the experiment so I'm just going to give these a name fixation 500 text display that's called blank and there are other methods of doing that I'm just using a blank text display because then you can clearly see what's going on at various stages in this experiment could use a sketchpad object across if you wanted to and then this one's going to be the actual picture of the cap face itself now I'm going to go back to the sequence because we need to add in some extra things here as well and if you've used eprime in the past this is one thing that's slightly different about open sesame versus eprime up to this point it's probably seen quite familiar what we need to do out here is add in the ability to collect the response from the participant and to do that we need to add in a keyboard response object so select that and add that in and also if we want to record the data to a file we also need to tell open sesame to use the logger item and add that in that means that each each trial is going to be recorded to the data file so there we go now I've got too many times open which is hidden now what I do is just actually fill in all the details of our individual objects so we go to the fixation 500 this is the sketchpad editor starts off with duration it's currently set to a key press of course we want that to be 500 milliseconds so into 500 in there and we get some various different options that we can add in so we can add in lines we can add in arrows some text circles there's also a noise patch what we want here is the fixation dot tool select fixation dot tool and then move down and you see this got this grid here and this is going to be the center of the screen that if you look over this portion here it tells you what grid value we actually have wanting it to zero zero which is the center of the screen F click the mouse button then we get fixation dot up here at that particular point and that's all there is to it to setting up that particular object so click on the close tab the next one I'll do is go to the blank 500 it's just duration is going to be 500 milliseconds with absolutely no text apply that I'll say there's multiple ways you can do that I'm just using this text of the object so you can clearly see that particular blank screen stop with the harm experimenter tool by doing it that way then we'll go to the cat face picture or cat face sketch pad now one thing that might seem a bit weird here is the duration we're actually going to set not to infinite or key press or anything like that you can set it to zero I for zero milliseconds and the reason is that what we do is we display the cat face picture and then get open sesame to go straight to the keyboard response item so we want the keyboard response item to wait for the key press not the cat face sketch pad item which is why we set the duration to zero which basically means display it and then just move straight on to actually put the picture of the cat face on we need to specify the image tool and then go down to the center point again and click in the center this brings up the file pool which is where we need to add in our particular cat face pictures that we have now we can do that by clicking on add a file so click on add I'm just going to find my cat face photo now one thing I found about open sesame is that I can do a nice multiple select like so so I've actually been to select all of the cat face pictures so I don't have to add them in one by one I select all of them in one go I did that by selecting the first one and then holding down the shift key and selecting whoop did it up if there is select F2 in that case can we added F1 hold down the shift key and click on M20 then click on open and now all our pictures have appeared in our file pool so I'm just going to specify any of them any of these pictures doesn't make any difference which one I select because when I click on select you actually see we've got one particular cat face picture has appeared in here now of course if we left it like that it's always going to show that one particular cat face picture it's not going to change it depending upon what is in the cat face variable so the way that we change this is that we select sorry right click on the cat face picture itself and say edit this is the only bit more complicated thing about using open sesame you spread out that window here and this is basically saying to draw an image at this location of the screen which is the center this particular file name which in those speech marks that's how that bit we're interested in it's that bit there which is F01 dot BMP which if you remember is the image that I selected from the list what I'm going to do is get rid of everything before the dot BMP and put in square brackets caps like so and what that's going to do is go back to the list block or block loop and actually extract out to it from that list whatever was in the cat variable for that particular trial so remember they went down order F01 F02 F03 or so on whichever one of those 40 trials is being run it will take whatever is in that cat column and insert it into this point here so if you went through a sequential order F01 would go in there if it was in the second trial F02 would go in there so it's a variable it's always changed on every single trial need to put on the quotes again to indicate dot BMP so it's going to insert the cat face name then the dot BMP so that's why we didn't have to put dot BMP onto every single particular cat face I just got that the wrong state and it needs to go there and that's all there is to that part so I just click on ok and it tells us here that one object is not shown because it is defined using variables we can actually see that in the script now that's where the variable has actually been inserted so as I said on the first trial through if it was sequential F01 would be on the first trial to go back to the cat face script you can see here that F01 would be added in where this cat in the square brackets is so it actually read F01 dot BMP that's the way that the variables work for the cat face image and that's basically what we need to do for setting up the cat face picture itself so I'm going to close down that one get rid of a few of these tabs the next thing to do is set up the keyboard response the correct response of course is defined in the block loop in the correct response variable so I add in the variable as we did for the cat face picture the variables defined by the square brackets like so that's what those square brackets mean allowed responses it says that set allowed responses separated by a semicolon E Z semicolon slash and so on now we're allowed to use the key Z and M in our particular experiment so I put Z is the first one then put a semicolon then M so those are the two keys that participants can press if they press any other key open sesame will actually ignore that particular key press time out is set to infinite because we want to remain on the screen until the participant makes a response underneath this we have the log up item by default it's specified to automatically detect and log all variables in my experience it's best just to leave it just on that and it record every single item that the open sesame knows about and it's probably best just to leave at that particular setting rather than playing about with what it is that you want to select and what it is you don't want to select one of those cases it's always best to record too much than too little so that's pretty much it so this is actually should now run as a full experiment so first thing I'm going to do though is to save it save as and put this just onto the desktop all this cat faces and I've got the option here just to save as open sesame files or the open sesame script and file pool click on that because it actually means I'll actually get all the files in the file pool as well which will be cat face pictures I need to change the extension so if I quickly look on my desktop see I've got the picture so the archive there look at the size of it it's nine megabytes so for that tiny little script it's not the only thing that's in there we've actually got all our full file pool items as well which includes all those cat face pictures so that's creating a basic experiment I'll give it a go running it no idea how it's going to respond to the screen capture software but we'll give it a go we get to enter a subject number so just give it the subject number one click okay then we'll ask where do we want to save the log file sort of say on the desktop and see if we get it actually working and there we go so welcome to the cat face at spread we'll see 40 cat faces we've got to indicate with the cat's male or female breasted if you think the cat is male press n if you think the cat is female press any key to begin so press any key fixation cross-plants green there's the cat face and taking responses male female and so on so there's the experiment running to exit out the experiment once it's actually running just press the escape key and it says we get an error there because this gate key was pressed but that's a basic experiment inside hope and sesame