billkarsh / SpikeGLX

SpikeGLX recording system GUI [Neuropixels NI]
Other
83 stars 29 forks source link

Trigger mode: Remote Controlled Start and Stop #26

Closed Flavia0310 closed 3 years ago

Flavia0310 commented 3 years ago

Hello I have a question about how to remotely control the start and stop trigger in order to create several files with same g (ex. g0) and different t (ex t1, t2, … , tN). I’m controlling all the experiment, so also the probe recording, trough Matlab and according to the user manual instructions this should be possible using TCP command: SpikeGLX contains a "Gate/Trigger" server that listens via TCP/IP for connections from remote applications (like StimGL) and accepts simple commands: {SETTRIG 1, SETTRIG 0}. To do so I set the gate and trigger configuration as follow

image image

Then in Matlab I executed the following commands: hSGL = SpikeGL('172.20.62.170'); StartRun(hSGL) SetRecordingEnable( hSGL,1) And then to control the trigger I should run a command similar to the following (if I’m correct) xxx = StimGL ('172.20.62.170',52521,'SETTRIG',1) if I run as wrote the command of course I get this error: Unrecognized function or variable 'StimGL'. Then looking how to get this function I found out https://github.com/cculianu/StimulateOpenGL_II/blob/master/StimGL_SpikeGL_Integration.h but the function I need is in C++ and the way to extract it is a bit unclear to me. Maybe I’m completely wrong and the solution of this problem is simpler , but do you think is possible to control the trigger activation by matlab? And if it is the case, how to do it?

billkarsh commented 3 years ago

Hi Flavia,

The Gate/Trigger server is not needed. Using only the standard command server and API, a software controlled t-series can be scripted using the sequence of calls: SetNextFileName(".../parent/name_g0_t0"), SetRecordingEnable(1), SetRecordingEnable(0), SetNextFileName(".../parent/name_g0_t1"), SetRecordingEnable(1), SetRecordingEnable(0)... This method results in all files being written to the single flat directory 'parent'.

As of release 20210122 a new API call is added (TriggerGT( g, t )) to set the gate and trigger levels from a script. This will be simpler and will allow creation of probe folders as with other triggering methods.