I was wondering if you could verify if this would get me the result I want, which is to say, blocks of 200 trials chosen from the set of 4000, and within that block of 200 operate as random without replacement.
Yes, that's correct.
Then, the next block will be a different random block of 200 out of the 4000, and so on.
You're guaranteed to get a different 200 only if the experiment isn't stopped between blocks. If the experiment ends (or is stopped), and you restart it, all selections are reset, so any of the previous 200 trials may be repeated.
Is it important that each image be presented for each of the 100 trial "types"? If not, you could omit the outer range replicator and just use disc_rand to select the image for each trial. Then, set the block's sampling method to "cycles" and nsamples to however many iterations of the 100 types you want. (Note that this would force the animal to perform each of the 100 "types" once before any are repeated.)
If you do need to ensure that each of the 4000 possible combinations is executed, and you can't get through them all in a single session, then you'll need to do some external bookkeeping to keep track of which combinations you've done in previous sessions. This will probably involve using saved variable sets or reading/write state to external files via Python. If this is the approach you need, let me know, and I'll work up an example showing how you might accomplish it.
I've attached an example that demonstrates one way to accomplish what you want.
I couldn't find a way to implement this using MWorks' selection tools, so I moved all the selection stuff in to Python. I changed some of the experiment parameters for ease of demonstration, but the code should work for any trial type percentages or number of images, trial type, and trials per block.
Thanks Chris, this looks great! I wish it were possible in vanilla MWorks
-- fewer moving parts -- but this looks like a good solution. Is there any
way to extend this solution to arrange trials/types the other way? The goal
would be to alleviate the issue of changing probabilities near the end of a
block when the block size is small by making the block artificially bigger.
An example of that would be having 7 trials types, but putting them in
blocks of 35, with each trial type occurring 5 times in a random order, and
not allow the animal to continue until all trials in the block of 35 have
An example of that would be having 7 trials types, but putting them in blocks of 35, with each trial type occurring 5 times in a random order, and not allow the animal to continue until all trials in the block of 35 have been accepted.
The Python script can generate the combinations of image index and trial type any way you want. It could definitely be adapted to do this.
However, this design is also possible without resorting to Python. Please see the attached example.