![]() Ori text corrAns 0 aaa left 90 aaa left 0 bbb right 90 bbb right (Headers must also not include spaces or other characters other than letters, numbers or underscores and must not be the same as any variable names used elsewhere in your experiment.) For example, a file containing the following table: (Note that csv files can also be generated using most text editors, as long as they allow you to save the file as “plain text” other output formats will not work, including “rich text”.) The top row should be a row of headers: text labels describing the contents of the respective columns. These can easily be generated from a spreadsheet package like Excel. This should be an Excel 2007 ( xlsx) file or a comma-separated-value ( csv ) file in which columns refer to parameters that are needed to describe stimuli etc. In this case, a file must be provided that describes the parameters for the repeats. That is, the trials cannot vary depending on how the subject has responded on a previous trial. Selecting a loop type of random, sequential, or fullRandom will result in a method of constants experiment, whereby the types of trials that can occur are predetermined. This parameter can be unchecked to improve (hopefully) your data file outputs. In these cases we don’t want the data file to add an extra line with each pass around the loop. The parameter Is trials exists because some loops are not there to indicate trials per se but a set of stimuli within a trial, or a set of blocks. they must be unique, have no punctuation or spaces (underscores are ok) and must not start with a digit. $text.Īs the column names from the input file are used in this way they must have legal variable names i.e. The column names are turned into variables (in this case text, letterColor, corrAns and congruent), these can be used to define parameters in the loop by putting a $ sign before them e.g. An example of this kind of file can be found in the Stroop demo (trialTypes.xlsx). When inserting a loop into the flow you can browse to find the file you wish to use for this. It is usually best to use trial information that is contained in an external file (.xlsx or. For example, trials, blocks or epochs would be good names for your loops. I would normally use a plural name, since the loop represents multiple repeats of something. they can be nested).Īs with components in Routines, the loop must be given a name, which must be unique and made up of only alpha-numeric characters (underscores are allowed). ![]() Loops can encompass one or more Routines and other loops (i.e. The start and end of a loop is set in the same way as the location of a Routine (see above). To insert a loop use the button on the left of the Flow panel, or the item in the Experiment menu of the Builder. PsychoPy can generate the next trial based on the method of constants or using an adaptive staircase. In each iteration, get the value of the list at the current index using the statement value = my_list.Loops control the repetition of Routines and the choice of stimulus parameters for each.Loop variable index starts from 0 in this case. Using a for loop, iterate through the length of my_list.You can access the index even without using enumerate(). The value of the parameter start provides the starting index.Įxample 3: Without using enumerate() my_list = If you want to learn more about enumerate(), please visit Python enumerate().Įxample 2: Start the indexing with non zero value my_list = įor index, val in enumerate(my_list, start=1): The function of enumerate() is to add a counter (i.e. Print the required variables inside the for loop block.You can give any name to these variables. Pass two loop variables index and val in the for loop.Using enumerate(), we can print both the index and the values.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |