{"id":25613071,"url":"https://github.com/bchisholm08/neural-tetris","last_synced_at":"2025-10-04T01:49:35.157Z","repository":{"id":278816819,"uuid":"936668147","full_name":"bchisholm08/neural-Tetris","owner":"bchisholm08","description":"Repository for the Noel neuroscience laboratory Tetris project.","archived":false,"fork":false,"pushed_at":"2025-08-08T20:01:48.000Z","size":75831,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-08T22:10:13.492Z","etag":null,"topics":["matlab","matlabgui","neuroscience","psychtoolbox"],"latest_commit_sha":null,"homepage":"","language":"MATLAB","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bchisholm08.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-02-21T13:34:19.000Z","updated_at":"2025-08-08T20:01:51.000Z","dependencies_parsed_at":"2025-03-27T19:27:19.404Z","dependency_job_id":"9002dcc9-e1b2-49b6-a1c4-4c7ec49571c0","html_url":"https://github.com/bchisholm08/neural-Tetris","commit_stats":null,"previous_names":["bchisholm08/neural-tetris"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bchisholm08/neural-Tetris","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bchisholm08%2Fneural-Tetris","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bchisholm08%2Fneural-Tetris/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bchisholm08%2Fneural-Tetris/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bchisholm08%2Fneural-Tetris/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bchisholm08","download_url":"https://codeload.github.com/bchisholm08/neural-Tetris/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bchisholm08%2Fneural-Tetris/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278254464,"owners_count":25956598,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-03T02:00:06.070Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["matlab","matlabgui","neuroscience","psychtoolbox"],"created_at":"2025-02-22T01:22:21.531Z","updated_at":"2025-10-04T01:49:35.152Z","avatar_url":"https://github.com/bchisholm08.png","language":"MATLAB","funding_links":[],"categories":[],"sub_categories":[],"readme":"# **Jean-Paul Noel Neuroscience Lab Human Tetris Experiment**\n\nA neuroscience experiment exploring how neural reprentations of visual objects may vary depending on the context that surrounds an object, and possible actions or rewards an object encodes. \n\n## Table of Contents\n- [Overview](#overview)\n- [Repository Structure](#repository-structure)\n- [Requirements](#requirements)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Scripts \u0026 Functions](#scripts--functions)\n- [Data Output](#data-output)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Overview\nThis repository contains the code for a four-part experimental paradigm that integrates:\n- **EEG recording:** via BioSemi parallel port triggers.\n- **Eye-tracking:** using Tobii SDK.\n- **Task presentation:** built with Psychtoolbox.\n\nAn overall theme of this experiment is that is increases in complexity throughout. In scripts and functions (LINK HERE) see `p1.m`, `p2.m`, `p4.m` and `p5.m` for more detail on each section.  \n\n## Repository Structure\n```\n/  \n├── code/  \n│   ├── humanTetrisWrapper.m # handles running entire experiment\n│   ├── helperScripts/   # support functions to run experiment \n│       |── initExperiment.m \n│       |── p1.m\n│       |── etc...\n├── data/                # Generated data folders per subject  \n└── README.md            # This file  \n```\n\n## Requirements\n- **MATLAB R2023a** or later  \n- **Psychtoolbox-3.0.19** installed  \n  - PTB requires **GStreamer 1.22.5 (or later)** to be installed \n- **Tobii Pro SDK** on the MATLAB path  \n- **BioSemi parallel port** hardware (if `demoMode` is off)  \n\n\n\n## Installation\n1. Clone the repository:  \n   ```bash\n   git clone https://github.com/yourusername/human-tetris-eeg.git\n   ```\n2. Add subfolders to MATLAB path:  \n   ```matlab\n   addpath(genpath('path/to/human-tetris-eeg/code'));\n   ```\n\n## Usage\nEach participant is run with one single function call to a wrapper. This will run all experiment sections, give instructions, save data, and close everything at the end. \n\nThe experimenter should only *have* to enter the room if the participant requests it. \n\nFor running with demoMode ON...\n```matlab\nhumanTetrisWrapper(\"P01\")\n```  \n**OR**\n```matlab\nhumanTetrisWrapper(\"P01\", 1)\n```\n\n\nFor running with demoMode OFF...\n```matlab\nhumanTetrisWrapper(\"P01\",0)\n```  \n\n ***NOTE:*** Wrapper function **defaults** to demoMode == 1. This will  bypass EEG/eye‑tracker data collection and run the behavioral portion of the experiment. This will still save `.csv` data files. \n\n# Experiment Function Reference\n\n### initExperiment\n**Inputs:** `subjID`, `demoMode`  \n**Outputs:** `window`, `windowRect`, `expParams`, `ioObj`, `address`, `eyetracker`  \n**Description:** Location of all experiment settings and options. Initializing the eyetracker \u0026 EEG, timing, trial/block numbers, data saving, and more is all handled within this script. \n\n\n### pathsAndPlaces\n**Inputs:** `id`  \n**Outputs:** `p`     \n**Description:** Helper function for getting paths back to `initExperiment`. Function `ID` Map (input): 0=root, 1=code, 2=data, 3=tools.\n\n### p5instruct\n**Inputs:** `window`, `expParams`  \n**Outputs:** _None_.    \n**Description:** Gives participant instructions for p5 of the experiment. \n\n### p5\n**Inputs:** `subjID`, `demoMode`, `window`, `windowRect`, `expParams`, `ioObj`, `address`, `eyetracker`\n**Outputs:** _None_\n**Description:** P5 acts as a wrapper for the active play/watch section of the experiment. Within P5, `playOneTetrisGame` and `playBackGame` are called. \n\n\n### p2\n**Inputs:** `subjID`, `demoMode`, `expParams`, `ioObj`, `address`, `eyetracker`   \n**Outputs:** _None_     \n**Description:** Presents P2, Tetris pieces with tableaus, or contexts. Here our focus is on capturing the different evoked response to each unique tableau. \n\n### p1\n**Inputs:** `subjID`, `demoMode`, `window`, `windowRect`, `expParams`, `ioObj`, `address`, `eyetracker`\n**Outputs:** _None_       \n**Description:** Handles P1 of the Tetris experiment. This section is focused on obtaining evoked responses from each of the seven Tetris pieces. \n\n### p1instruct\n**Inputs:** `window`, `expParams`  \n**Outputs:** _None_.      \n**Description:** Displays participant instructions for P1 of the experiment. \n\n\n### p2instruct\n**Inputs:** `window`, `expParams`  \n**Outputs:** _None_.      \n**Description:** Displays participant instructions for P2 of the experiment. \n\n### waitForSpace\n**Inputs:** _None_.  \n**Outputs:** _None_.     \n**Description:** Helper script I wrote for a key binding issue we had in the experiment. \n\n### take5Brubeck\n**Inputs:** `window`, `params`  \n**Outputs:** _None_.      \n**Description:** Handles timing brief participant breaks, such as blocks. Forces break time by hiding spacebar.     \n\n### showScore\n**Inputs:** `window`,`score`, `expParams`  \n**Outputs:** _None_     \n**Description:** Displays the players current score.    \n\n\n### showEndScreen\n**Inputs:** `window`, `expParams`  \n**Outputs:** _None_.       \n**Description:** Thanks the participant for their time and ends the experiment.   \n\n\n### saveDat\n**Inputs:** `section`, `subjID`, `data`, `params`, `demoMode`  \n**Outputs:** _None_.     \n**Description:** Centralized saving function for all experiment sections. Saves behavioral data, experiment parameters, and other needed information from the session.  \n\n\n### playOneTetrisGame\n**Inputs:** `expParams`  \n**Outputs:** `snapshotFile`, `activInfo`, `eventLog`     \n**Description:** Handles playing one Tetris game. Records and saves pupillometry data, handles EEG triggers. Supported by multiple local helper functions within this function itself. Handles all control and logic for playing a game of Tetris. \n\n\n### handlePause\n**Inputs:** `window`,`keys`  \n**Outputs:** `pauseDuration`     \n**Description:** Checks for `p` to be pressed during the experiment. If a pause request is detected, this function will pause the experiment and record the length of the break which is returned in `pauseDuration`.\n\n\n### getTrig\n**Inputs:** `piece`,`eventType`  \n**Outputs:** `trig`     \n**Description:** Uses piece ID and event type as a method for getting the correct EEG trigger. Applies needed offset for events. \n\n\n### getTetrino\n**Inputs:** `expParams`  \n**Outputs:** `pieces`   \n**Description:** Returns a simple strucuture for each of the seven Tetris pieces. Piece IDs are constant throughout the experiment.\n\n\n### getTableaus\n**Inputs:** `window`, `expParams`  \n**Outputs:** `tableaus`  \n**Description:** Returns a .mat data structure of unique tableau sets for each of the seven Tetris pieces. Three conditions results in 21 unique tableaus, plus a shared common garbage tableau. \n\n\n### getBoardSnapshot\n**Inputs:**`boardMatrix`,`currentTrigger`  \n**Outputs:** `snapShot`  \n**Description:** Records a unit64 matrix of the Tetris board, along the current EEG trigger for the frame (if it exists), and a timestamp.\n\n### drawFixation\n**Inputs:**`window`, `windowRect`,`expParams`     \n**Outputs:** _None_   \n**Description:** Draws a simple fixation cross on the screen.\n\n\n### humanTetrisWrapper\n**Inputs:** `subjID`, `demoMode`  \n**Outputs::** _None_.  \n**Purpose:** Full Tetris experiment wrapper. Handles initializing the experiment, and then running all subsequent experiment sections (`P5`,`P1`,`P2`).  \n**Notes:** Facilitates breaks and some master timing. \n\n\n### calibrateTobii\n**Inputs:**`window`, `windowRect`, `eyeTracker`,`expParams`  \n**Outputs:**`calibrationData`   \n**Description:** A binocular calibration for the Tobii Pro Spectrum. Modeled off Tobii SDK example calibration code and modified for my experiment.  \n\n\n### playBackGame\n**Inputs:**`playBackGame`  \n**Outputs:** _None_.   \n**Description:** Plays back Tetris games for players to watch.\n\n### betweenSectionBreakScreen\n**Inputs:**`window`, `expParams`  \n**Outputs:** _None_.  \n**Description:** Handles giving the participant a break between experiment sections, forces break and locks keys.\n\n\n\n```markdown\n## Data Output\nEach section saves `.mat` data files in participant specific directories:\n```  \ndata/`subjID`/  \n├── eyeData/  \n├── behavioralData/  \n├── misc/  \n└── \n\n## Contributing\nPlease open issues or pull requests for enhancements, bug fixes, or documentation improvements.\n\nDon't hesitate to reach out! I can be contacted at two different emails, \n\u003ca href=\"mailto:chish071@umn.edu\" target=\"_blank\"\u003echish071@umn.edu\u003c/a\u003e\n or \u003ca href=\"mailto:bmc@brady-c.cc\" target=\"_blank\"\u003ebmc@brady-c.cc\u003c/a\u003e. \n\n\n## License\nThis project is licensed under the MIT License. See `LICENSE` for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbchisholm08%2Fneural-tetris","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbchisholm08%2Fneural-tetris","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbchisholm08%2Fneural-tetris/lists"}