Donders-Institute / staff-scientists

The consultancy page for the DCCN staff scientists
https://staff-scientists-dccn.readthedocs.io
3 stars 1 forks source link

Document and share BITSI code and examples on github #27

Open robertoostenveld opened 11 months ago

robertoostenveld commented 11 months ago

Mark @henneysq is using PsychoPy for his stimulation. Even though he was familiar with Python, stimulus presentation, decimal and binary representations, getting this to work still took quite some time and required input not only from Uriel @namrolyat, but also from Konstantinos @contsili and Vivian. Also @contsili recently spent quite some time on this, together with @schoffelen.

I think that we can make new researchers more independent and efficient and that we can benefit from existing researchers' expertise by making a bitsi-psychtoolbox and a bits-psychopy repository (or bitsi-matlab/python, or possibly one repo with two sections, or possibly also make one for NBS presentation) and use those to store and document the code snippets that Mark now received from the different people that provided input.

Questions to address could be

Furthermore, it could contain a few standard (but complete) stimulus presentation scripts for testing and for new people getting started.

The presentation database that we have on intranet since 2005 (thanks to Ingrid, Tineke and Shaozheng) could perhaps move over to the new repository

However, we should also consider the existing but significantly outdated Knowledge Database (that I think hardly anyone knows about any more), it documents Presentation, but not PsychoPy or PTB.

henneysq commented 11 months ago

I would be happy to contribute with relevant python implementations. I have ended up programming my experiment in a fairly object-oriented manner, which is probably not very accessible. But I can break it down into independent scripts that demonstrate the basic use of psychopy for stimulus presentation and pyserial for communicating with the BITSI.

schoffelen commented 11 months ago

thanks for starting this discussion @robertoostenveld , let me explicitly ping @mekman and @marcelzwiers as well, before getting to electrophys centric. I agree that the documentation on the intranet and knowledge database is extremely scattered, relatively incomplete, and often outdated. It would be good to give this a fresh swing. Perhaps from a didactical point of view I would be in favour of a single repo, e.g. experimentprogramming_gettingstarted (or something more catchy), with a substructure linking to the different softwares used, presentation/matlab/python, to collect code and start (reorganizing) documentation. Perhaps not everything needs to be at 100% from the start, but it would be great to collect snippets of code, which probably need to be tested a bit before uploading.

Other questions:

robertoostenveld commented 11 months ago

I think it is also important to consolidate and move (and not just copy) existing documentation over, to prevent inconsistent versions of code snippets to linger.

schoffelen commented 11 months ago

fair enough, and I'd say also label stale code as stale.

robertoostenveld commented 11 months ago

can I just copy over 15-year old code from my lab mates?

Ingrid documented it in 2005 and it is still on the DCCN internet, so the answer would be "yes", right? 😄

mekman commented 11 months ago

Thanks you Robert & co, I think this is an excellent initiative. I come by students with old bitsi code on a weekly basis, so very happy with the idea.

Just to make sure I understand it correctly. Is there anything M/EEG specific about the proposed code? My initial hope was, that the bitsi-ptb/bitsi-psychopy code would work for all modalities (behavioral, M/EEG, fMRI) equally well.

schoffelen commented 11 months ago

no the way in which one interfaces with bitsi from the stim PCs is the same in all labs. The exact details may differ with respect to other aspects of the coding (e.g.: fMRI people may get away with some sloppy timing, scanning pulses need to be sent, ...)

robertoostenveld commented 11 months ago

What is EEG/MEG specific is - as JM writes - that the timing of the triggers is much more critical. I suspect that people would not bother with a photodiode and oscilloscope to check the timing on an fMRI or fNIRS experiment.

Furthermore, with EEG/MEG we tend to store (=code) all experimental details (stimuli and responses and their timing) in the numerical trigger channel of the acquisition system and less so as lines in an ASCII-formatted stimulus presentation log file. This has quite some consequences, such as a limited number of numeric codes, and triggers that not only need to turn on, but also need to turn off to make "room" for the next trigger.

But good documentation will benefit the users of all labs. So rather than highlighting the differences, I think we should build on the similarities between labs and the people using them.