Back to Blog
Psychopy loop type random no repeat5/30/2023 ![]() you are now sampling without replacement). How can i properly change the assigned secret key in a Django Web Application Django1. You will always get a unique row number because previous ones disappear as the list shrinks by popping entries off the end (i.e. Function with random experiment related to value pairs Pyspark DataFrame select rows with distinct values, and rows with non-distinct values django. The pop() function of a list removes and returns the next item of a list (being randomly shuffled, you will get a random number even though we are proceeding in order through the list). Then in your loop dialog, replace the $ expression with this: Shuffle(randomRowList) # put them into a random order RandomRowList = range(25) # create a list of the numbers 0 to 25 insert a code component, and in the “Begin Experiment” tab, put this: If this is a problem, then you need a slightly different approach so that you can keep track of what rows have already been selected. rows 6, 23, 6) because each random selection is independent (i.e it is sampling with replacement). NB in this case, it is still quite possible that duplicate rows could be selected across three trials (e.g. Therefore, a new randint() is chosen on each iteration. > Having a nested situation like this means that the inner loop (PreX_loop) is re-created from scratch on each iteration of the outer loop (effectively, three loops are created and run only once each). Senior Research Fellow, Whare Wānanga o Otāgo, Otautahi Ph: +64 3 3786 072 New Zealand Brain Research Institute NEW ZEALAND > To unsubscribe from this group and stop receiving emails from it, send an email to To post to this group, send email to To view this discussion on the web visit. > You received this message because you are subscribed to the Google Groups "psychopy-users" group. ![]() > My experiment requires me to randomly select 50 conditions out of a 1000 conditions from a condition file. I currently have the Loop run based on the condition file (which is working. The next thing I need to do is to have the ‘PopupLoop’ run conditionally. Currently my experiment runs as is, which is a great start. But you also add a code component which terminates that loop after 50 trials. Here is a picture of my experiment sequence for reference: 2152×262 44.8 KB. > In essence, you create a loop pointed to your 1000-line file, with random selection. Edit: To create a PsychoPy-style conditions file from the trial list, just write the values into a file like this: with open ('emoneuface.csv', 'wb') as f: f.write ('stim ') this is a 'header' row f.write (' '.join (tr)) these are the values Then you can use that as a conditions file in a Builder loop in the regular way. > How could I make it pick just one letter out of 26 letters? > With the above setting, PsychoPy still plays everything in the condition file list. If stim_list != 'standard.wav' and stim_list != 'standard.> I set m圜ount = 0 in the Begin Experiment section as well. Would you have any advice? Do you know where is my mistake? filename_to_read = _thisDir + os.sep + 'MMN_stim.csv'įilename_to_write = _thisDir + os.sep + 'MMN_stim_' + expInfo + '.csv' In other words, each deviant stim must always be immediately followed by a standard stim.īellow is the code I inserted in my first routine. I would like to randomise my list by making sure that a deviant stim will never be immediately followed by another deviant. So I have 1030 lines of standard stim, 100 for deviant_1, 100 for deviant_2, 100 for deviant_3, and 100 for deviant_4. I have a csv file (MMN_stim.csv) containing my stim and trigger’s info (it will be an EEG study). The text component of my first routine never shows up so I guess psychopy is running the while loop again and again, but the message "reshuffle. The script keeps running without ending (even after 1 or 2 minutes) and I can’t figure out why. I tried to use Mirjam’s code to randomize my stimuli according to 1 condition but it did not work. ![]()
0 Comments
Read More
Leave a Reply. |