Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

pingtim.m 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. clear all;
  2. %% settings (transfer to exp settings file)
  3. npings=5; % total number of pings
  4. nodd=1; % number of odd pings
  5. delth=5000; % delay period length (ms)
  6. pilth=100; % ping duration (ms)
  7. minipi=400; % minimum inter-ping-interval
  8. %% command for experiment script
  9. pausvec=pingT(npings,nodd,delth,pilth,minipi)
  10. % pausvec(1): time *before* the first ping
  11. % pausvec(2:npings): time *after* each ping
  12. % pausvec(1) will be between 0 and minipi
  13. % pausvec(2) and pausvec(end) will be between 0 and minipi
  14. %% vector defining which ping is an oddball
  15. odvec=[zeros(1,npings-nodd) ones(1,nodd)];
  16. odvec=odvec(randperm(npings));
  17. %% subfunction doing the timing job for delay between encoding and test
  18. function pausvec=pingT(npings,nodd,delth,pilth,minipi)
  19. pausvec=NaN(1,npings+1);
  20. pausvec(1)=randsample(0:minipi,1); % pause before first ping (<minipi)
  21. pausvec(end)=randsample(pilth:minipi,1); % pause after last ping (>pilth, <minipi)
  22. for p=2:npings-1
  23. tleft=delth-nansum(pausvec); % time left
  24. pleft=npings-p; % #pings left
  25. maxipi=tleft-pleft*minipi; % max inter-ping-interval
  26. pausvec(p)=randsample(minipi:maxipi,1); % pseudo-random pause length
  27. end
  28. pausvec(end-1)=delth-nansum(pausvec);% allocate remaining time left
  29. % shorten post-ping time by ping lenghts (already done for last one)
  30. pausvec(2:end)=pausvec(2:end)-pilth;
  31. % do another permute to be sure:
  32. pausvec=pausvec([1 randperm(npings-1)+1 npings+1]);
  33. if sum(pausvec)~=delth-pilth*npings
  34. error('ping time assignment error')
  35. end
  36. end
  37. %%