klabhub / neurostim

Design and run visual neuroscience experiments using Matlab and the Psychophysics Toolbox.
MIT License
5 stars 4 forks source link

control rdp random number seed #214

Open dshimaoka opened 1 year ago

dshimaoka commented 1 year ago

I'd like to add an option to control the random number generator. This will enable to 1) realize the same dot pattern across trials 2) realize the same dot pattern across different rdp instances, presented at once

cnuahs commented 1 year ago

The rdp stimulus is lagging best practice a bit. Have a look at the addRNGStream() plugin method, and the RNG machinery provided by cic. There is some support there for reserving a random number stream for a stimulus, and for (re-)seeding a stream to recreate a previous stimulus sequence. You can see how this is done in the noiseclut stimulus.

You might also be interested in the newdots branch (https://github.com/cnuahs/neurostim/tree/newdots) where we have done some work to improve this aspect of the dot stimuli, inc. reconstruction etc.

adammorrissirrommada commented 2 months ago

@dshimaoka What is the status of this pull request and branch? The latest commit doesn't follow Shaun's advice, so we cannot merge in its current form. please see how to add an rng to your stimulus plugin using this example.

Your approach will not work because you are using the global rng, which means any other plugin/stimulus/process could be drawing numbers from it and you wouldn't know. You need to request an isolated rng for your stimulus.

adammorrissirrommada commented 1 month ago

@dshimaoka Please see my message above and let me know.