A lightweight, cross-platform tool designed to simulate scanner triggers automatically. It exposes a localhost socket and can optionally display a transparent, always-on-top debugging overlay without intercepting experiment input.
Pass --gui to show the overlay. It shows scan status, elapsed scan time, current/total TR, trigger key, configured TR duration, and a brief green pulse whenever a trigger is emitted.
You can download from the releases or install from my homebrew tap
brew tap ChengranAA/neuraltools
brew install mock_scannerStart the scanner utility first:
mock_scanner --tr 1.5 --volumes 120 --trigger 5 --guiOmit --gui to run headlessly with no window.
To switch automatically into step mode after a fixed number of TRs:
mock_scanner --tr 1.5 --volumes 120 --pause-after 20 --guiAdd the following snippet to your experiment scripts
For python:
import socket
def start_scanner(host = "127.0.0.1", port = 2333):
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.connect((host, port))
s.sendall(b"Start")
if __name__ == "__main__":
start_scanner()
# rest of your codeFor MATLAB:
function start_scanner(host, port)
if nargin < 1
host = '127.0.0.1';
end
if nargin < 2
port = 2333;
end
t = tcpclient(host, port);
write(t, uint8('Start'));
clear t;
end
start_scanner();
% rest of your code