{"id":23442547,"url":"https://github.com/mvdoc/srt_paradigm","last_synced_at":"2026-01-22T21:03:44.100Z","repository":{"id":75577441,"uuid":"48607505","full_name":"mvdoc/srt_paradigm","owner":"mvdoc","description":"My code for the SRT Paradigm introduced by Crouzet et al., 2010.","archived":false,"fork":false,"pushed_at":"2016-02-25T12:33:15.000Z","size":27,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-09T21:49:33.393Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Matlab","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mvdoc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-12-26T10:42:03.000Z","updated_at":"2016-02-21T02:55:36.000Z","dependencies_parsed_at":"2023-05-09T18:19:03.133Z","dependency_job_id":null,"html_url":"https://github.com/mvdoc/srt_paradigm","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mvdoc/srt_paradigm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mvdoc%2Fsrt_paradigm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mvdoc%2Fsrt_paradigm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mvdoc%2Fsrt_paradigm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mvdoc%2Fsrt_paradigm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mvdoc","download_url":"https://codeload.github.com/mvdoc/srt_paradigm/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mvdoc%2Fsrt_paradigm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28671207,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-22T20:48:19.482Z","status":"ssl_error","status_checked_at":"2026-01-22T20:48:14.968Z","response_time":144,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-23T17:32:41.065Z","updated_at":"2026-01-22T21:03:44.084Z","avatar_url":"https://github.com/mvdoc.png","language":"Matlab","funding_links":[],"categories":[],"sub_categories":[],"readme":"This is my code for the Saccadic Reaction Time paradigm, as first\nintroduced by [Sébastien M. Crouzet](https://scrouzet.github.io/) et al.\nin his paper *Crouzet, S. M., Kirchner, H., \u0026 Thorpe, S. J. (2010). Fast\nsaccades toward faces: face detection in just 100 ms. Journal of Vision,\n10(4), 16.1–17. http://doi.org/10.1167/10.4.16*. \nI used this code to\ntest our setup for our work on familiar faces, *Visconti di Oleggio\nCastello, M., \u0026 Gobbini, M. I. (2015). Familiar Face Detection in 180ms.\nPLoS ONE, 10(8), e0136548.\nhttp://doi.org/10.1371/journal.pone.0136548.s010*.\n\nIf you use this code, please acknowledge the original paper that introduced \nthe paradigm, and share your improvements with pull requests.\n\n# General requirements\nThe code requires\n\n- Psychtoolbox 3 (the code was run with version 3.0.11)\n- MATLAB (tested with version 2014b. It might work with octave, but I\n  haven't tried it)\n- **Eyelink Plus 1000** system—the code needs to be modified if you\n  plan to use it with other eye-tracking systems.\n\nAlso, you won't find stimuli in this repository as I do not have the\nrights to share them. Please contact the author of the original paper\n([Sébastien M. Crouzet](https://scrouzet.github.io/)) to obtain them.\n\n# How it works\nThe code could be made more user-friendly (I welcome pull requests),\nhowever this is how it works as of now.\n\nThe structure of the folder is as follows: the main code resides in the\n`code` directory; subject-specific trial-order files are under the `csv`\ndirectory, with one folder for each subject id, for example `csv/mv00`.\nIn the subject-specific folder you need two txt files containing the\nfilenames of the stimuli corresponding to faces and objects. These\nstimuli must exist in the `stim` directory. See `csv/test-before` as an\nexample of the directory before running `make_order_trials` (see below).\n\nMy approach was to create a modular code in which the main experiment\ncode reads in CSV files containing the trial order for each block and\nsubject, and another code creates the trial orders. The main files of \nthe experiment are \n\n- `setupExp.m` for general setup, \n- `make_order_trials.m` to generate the CSV files of the trial order,\n  and\n- `srt_paradigm.m`, the code that reads in the CSV files and shows the\n  experiment.\n\n**You must be in the `code` directory to make the code run. Do not add\nall the directories to the matlab path. Alternatively, you need to fix\n`setupExp.m`.**\n\n## `setupExp.m`\nHere you should only change what is between lines 23–44, in particular\nthe distance of the subject from the screen `DIST_CM`, the width of the\nscreen `SCREEN_W_CM`, and the resolution and refresh rate of your system\n`RESOLUTION`.\n\nFor debugging, you can also set `DEBUG` to 1 on line 24. In this way\nthere's no need to have the eye tracker connected and it will use mouse\nposition instead of eye position.\n\n## `make_order_trials.m`\nThis function generate blocks of pseudo-randomized trials, making sure\nthat targets occur in each hemifield equally often within each block.\nYou are welcome to write your own code to generate these CSV files. See\nbelow for the type of input that `srt_paradigm.m` accepts.\n\nTo generate the CSV files with this function, you need the following:\n\n```\n\u003e\u003e help make_order_trials\n  Saccadic Reaction Time paradigm\n  make_order_trials(subid, cfg) makes csv files for subject subid\n\n  Arguments\n        subid           subject id\n\n        cfg             a structure with the following fields\n\n           stimulitxt   a cell with the filenames of the txt files containing\n                        the filenames of the stimuli. It assumes that these txt\n                        files are stored under ./csv/subid/. Stimuli need to be\n                        stored in ./stim/\n           stimulitype  a cell containing the labels for the stimuli type, \n                        in the same order as stimulitxt \n           imagerep     (optional) number of repetitions for each image\n           blocklength  (optional) specify length of the blocks. The program\n                        will try to split each task into smaller blocks of\n                        length blocklength, with targets balanced into\n                        left/right hemifields. If it cannot do it (because\n                        blocklength does not evenly divide the total number of\n                        trials), it will complain and abort.\n\n  Output\n        csv files under ./csv/subid/\n        a txt file under ./csv/subid/ containing the codes for each condition\n```\n\nNote that it checks that the stimuli exist under `./stim/`—better to fail \nearly that during the experiment. As an example of the output, see the\nfiles contained in `csv/test-after/`. Those where generated running\nthe function in the following way (again, if you do not have the stimuli\nin the `stim` directory it will fail):\n\n``` matlab\nsubid = 'test-after';\ncfg = [];\ncfg.stimulitxt = {'faces.txt', 'objects.txt'};\ncfg.stimulitype = {'faces', 'objects'};\ncfg.blocklength = 50;\n\nmake_order_trials(subid, cfg);\n```\n\nthis generated the files in `csv/test-after`:\n\n```\ntest-after\n├── faces.txt\n├── objects.txt\n├── test-after_blocks_orig.txt\n├── test-after_code_description.txt\n├── test-after_tar-faces_dis-objects_1.csv\n├── test-after_tar-faces_dis-objects_2.csv\n├── test-after_tar-faces_dis-objects_3.csv\n├── test-after_tar-faces_dis-objects_4.csv\n├── test-after_tar-objects_dis-faces_1.csv\n├── test-after_tar-objects_dis-faces_2.csv\n├── test-after_tar-objects_dis-faces_3.csv\n└── test-after_tar-objects_dis-faces_4.csv\n```\n\nThe last important step is to counterbalance the order of the blocks.\nYou need to create a file named `subid_blocks.txt` where each line is\nthe filename of a block. You can look at\n`csv/test-after/test-after_blocks_orig.txt` as an example of an unbalanced\nblock order.\n\nThe generated CSV have this structure, which can be read-in by\n`srt_paradigm.m`.\n\n```\nnTrial,targType,targFn,distrType,distrFn,hemifield,code\n1,faces,hommePL14.bmp,objects,voituGP19.bmp,left,1\n2,faces,femmeGP02.bmp,objects,voituPL12.bmp,left,1\n3,faces,femmePL09.bmp,objects,voituGP04.bmp,right,2\n4,faces,femmePL19.bmp,objects,voituPL08.bmp,right,2\n5,faces,hommeGP22.bmp,objects,trainPL17.bmp,right,2\n6,faces,hommePL15.bmp,objects,voituPL06.bmp,left,1\n7,faces,femmeGP05.bmp,objects,trainPL16.bmp,right,2\n8,faces,hommePL13.bmp,objects,trainPL02.bmp,left,1\n9,faces,femmePL18.bmp,objects,trainGP06.bmp,left,1\n```\n\n## `srt_paradigm.m`\nThis is the code that shows the stimuli to the subject. It is run as \n`srt_paradigm(subid, subnr, blocknr)`. It starts with a 9-point\ncalibration of the eye-tracker, followed by the experimental paradigm.\nThe trial starts only after the subject has maintained fixation within\nthe allowed range (set to 2 visual degrees from the center of the\nscreen; it can be modified in `setupExp.m` with the var\n`MAX_DIST_FIXATION_DEG`.\n\nWhen the block ends, the EDF file generated by the eye tracker is moved\nto `res/edf/subid/`.\n\n# After data collection: analysis\nThe output EDF can then be converted to ASCII using the EDF2ASCII\nconverter available on the [SR research website](http://sr-support.com/)\n, and analyzed offline for saccade initiation.\n\nI included an example parser in the directory `ana`(lysis). It *should*\nwork with the output generated by this code. If you make any changes to\nthe code of the experiment, especially to the triggers such as the\nfollowing, you might have to adapt the parser since it uses these triggers as\nsentinels:\n\n```matlab\nEyelink('Message', sprintf('Trial %d Code %s: STIM ON', itrl, ...\n        output{1+itrl, 7}));\n```\n\nThe parser will generate a structure whose design is inspired by the \n[Fieldtrip toolbox](http://www.fieldtriptoolbox.org):\n\n```\ns = \n\n         dimord: 'trl_sample_x_y_na'\n            fix: {1x162 cell}\n          blank: {1x162 cell}\n           stim: {1x162 cell}\n      trialinfo: [1x162 double]\n        targets: {162x1 cell}\n    distractors: {162x1 cell}\n```\n\neach of the fields `fix`, `blank` and `stim` contain the x, y position of the eye \n(and the pupil area, I believe) over time in the respective conditions: initial fixation, \nblank period, and stimulus presentation. Each element represents a single trial, whose\ncode is stored in `trialinfo`, with `targets` and `distractors` in the respective fields.\nTo sum up, for trial `i`, the code of that trial is in `s.trialinfo(i)`, the target was\n`s.targets{i}` and the distractor `s.distractors{i}`; the position of the eye is stored in\n`s.stim{i}`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmvdoc%2Fsrt_paradigm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmvdoc%2Fsrt_paradigm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmvdoc%2Fsrt_paradigm/lists"}