# psychopy-bids
A [PsychoPy](https://www.psychopy.org/) plugin to work with the [Brain Imaging Data Structure (BIDS)](https://bids-specification.readthedocs.io/)
* **Website:** [https://psygraz.gitlab.io/psychopy-bids](https://psygraz.gitlab.io/psychopy-bids)
* **Documentation:** [https://psychopy-bids.readthedocs.io](https://psychopy-bids.readthedocs.io)
* **Source code:** [https://gitlab.com/psygraz/psychopy-bids](https://gitlab.com/psygraz/psychopy-bids)
* **Contributing:** [https://psychopy-bids.readthedocs.io/en/latest/contributing](https://psychopy-bids.readthedocs.io/en/latest/contributing)
* **Bug reports:** [https://gitlab.com/psygraz/psychopy-bids/issues](https://gitlab.com/psygraz/psychopy-bids/issues)
* **Code of Conduct:** [https://psychopy-bids.readthedocs.io/en/latest/conduct](https://psychopy-bids.readthedocs.io/en/latest/conduct)
## Installation
We recommend installation in a virtual environment.
```console
pip install psychopy-bids
```
## Usage
The psychopy bids plugin can be used to create valid BIDS valid datasets by creating [behavioral](https://bids-specification.readthedocs.io/en/stable/modality-specific-files/behavioral-experiments.html#example-_behtsv) or [task events](https://bids-specification.readthedocs.io/en/stable/04-modality-specific-files/05-task-events.html) in Psychopy. This can be done directly in python code or using the psychopy builder.
In code, the *BIDSHandler* can create or extend an existing BIDS dataset, including directory structure and necessary metadata files. Individual BIDS events can be added during the experiment and are passed to the *BIDSHandler* to write event `.tsv` files and accompanying `.json` files.
```py
from psychopy_bids import bids
handler = bids.BIDSHandler(dataset="example_dataset", subject="01", task="A")
handler.createDataset()
events = [
bids.BIDSTaskEvent(onset=1.0, duration=0.5, event_type="stimulus", response="correct"),
bids.BIDSTaskEvent(onset=1.0, duration=0, trial_type="trigger")
]
for event in events:
handler.addEvent(event)
participant_info = {"participant_id": handler.subject, "age": 18}
handler.writeTaskEvents(participant_info=participant_info)
handler.addStimuliFolder(event_file="example_dataset/sub-01/beh/sub-01_task-A_run-1_events.tsv")
handler.addEnvironment()
handler.addTaskCode()
```
## Contributing
Interested in contributing? Check out the [contributing guidelines](https://psychopy-bids.readthedocs.io/en/latest/contributing/). Please note that this project is released with a [Code of Conduct](https://psychopy-bids.readthedocs.io/en/latest/conduct/). By contributing to this project, you agree to abide by its terms.
## License
`psychopy-bids` was created by Christoph Anzengruber & Florian Schöngaßner. It is licensed under the terms of the GNU General Public License v3.0 license.
## Credits
`psychopy-bids` was created with [`cookiecutter`](https://cookiecutter.readthedocs.io/en/latest/) and the `py-pkgs-cookiecutter` [template](https://github.com/py-pkgs/py-pkgs-cookiecutter).
Raw data
{
"_id": null,
"home_page": null,
"name": "psychopy-bids",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "psychopy, bids, psychology, data organization",
"author": null,
"author_email": "Christoph Anzengruber <christoph.anzengruber@uni-graz.at>, Florian Sch\u00f6nga\u00dfner <florian.schoengassner@uni-graz.at>",
"download_url": "https://files.pythonhosted.org/packages/58/6a/da0da868cdd5ea4005333afbf4865dfbf18f35957187ec24f42c2ea4919e/psychopy_bids-2024.2.0.tar.gz",
"platform": null,
"description": "# psychopy-bids\n\nA [PsychoPy](https://www.psychopy.org/) plugin to work with the [Brain Imaging Data Structure (BIDS)](https://bids-specification.readthedocs.io/)\n\n* **Website:** [https://psygraz.gitlab.io/psychopy-bids](https://psygraz.gitlab.io/psychopy-bids)\n* **Documentation:** [https://psychopy-bids.readthedocs.io](https://psychopy-bids.readthedocs.io)\n* **Source code:** [https://gitlab.com/psygraz/psychopy-bids](https://gitlab.com/psygraz/psychopy-bids)\n* **Contributing:** [https://psychopy-bids.readthedocs.io/en/latest/contributing](https://psychopy-bids.readthedocs.io/en/latest/contributing)\n* **Bug reports:** [https://gitlab.com/psygraz/psychopy-bids/issues](https://gitlab.com/psygraz/psychopy-bids/issues)\n* **Code of Conduct:** [https://psychopy-bids.readthedocs.io/en/latest/conduct](https://psychopy-bids.readthedocs.io/en/latest/conduct)\n\n## Installation\n\nWe recommend installation in a virtual environment.\n\n```console\npip install psychopy-bids\n```\n\n## Usage\n\nThe psychopy bids plugin can be used to create valid BIDS valid datasets by creating [behavioral](https://bids-specification.readthedocs.io/en/stable/modality-specific-files/behavioral-experiments.html#example-_behtsv) or [task events](https://bids-specification.readthedocs.io/en/stable/04-modality-specific-files/05-task-events.html) in Psychopy. This can be done directly in python code or using the psychopy builder.\n\nIn code, the *BIDSHandler* can create or extend an existing BIDS dataset, including directory structure and necessary metadata files. Individual BIDS events can be added during the experiment and are passed to the *BIDSHandler* to write event `.tsv` files and accompanying `.json` files.\n\n```py\nfrom psychopy_bids import bids\n\nhandler = bids.BIDSHandler(dataset=\"example_dataset\", subject=\"01\", task=\"A\")\nhandler.createDataset()\n\nevents = [\n bids.BIDSTaskEvent(onset=1.0, duration=0.5, event_type=\"stimulus\", response=\"correct\"),\n bids.BIDSTaskEvent(onset=1.0, duration=0, trial_type=\"trigger\")\n]\n\nfor event in events:\n handler.addEvent(event)\n\nparticipant_info = {\"participant_id\": handler.subject, \"age\": 18}\n\nhandler.writeTaskEvents(participant_info=participant_info)\n\nhandler.addStimuliFolder(event_file=\"example_dataset/sub-01/beh/sub-01_task-A_run-1_events.tsv\")\nhandler.addEnvironment()\nhandler.addTaskCode()\n```\n\n## Contributing\n\nInterested in contributing? Check out the [contributing guidelines](https://psychopy-bids.readthedocs.io/en/latest/contributing/). Please note that this project is released with a [Code of Conduct](https://psychopy-bids.readthedocs.io/en/latest/conduct/). By contributing to this project, you agree to abide by its terms.\n\n## License\n\n`psychopy-bids` was created by Christoph Anzengruber & Florian Sch\u00f6nga\u00dfner. It is licensed under the terms of the GNU General Public License v3.0 license.\n\n## Credits\n\n`psychopy-bids` was created with [`cookiecutter`](https://cookiecutter.readthedocs.io/en/latest/) and the `py-pkgs-cookiecutter` [template](https://github.com/py-pkgs/py-pkgs-cookiecutter).\n",
"bugtrack_url": null,
"license": "GNU General Public License v3 (GPLv3)",
"summary": "A PsychoPy plugin for using the Brain Imaging Data Structure (BIDS) to organize and describe data.",
"version": "2024.2.0",
"project_urls": {
"changelog": "https://gitlab.com/psygraz/psychopy-bids/-/blob/master/CHANGELOG",
"documentation": "https://psychopy-bids.readthedocs.io/en/stable",
"homepage": "https://psygraz.gitlab.io/psychopy-bids",
"project": "https://pypi.org/project/psychopy-bids",
"repository": "https://gitlab.com/psygraz/psychopy-bids"
},
"split_keywords": [
"psychopy",
" bids",
" psychology",
" data organization"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "310f4f4d99fd7b439fc83cbd6bc3e44bc5ae0761ed477da1783e97f2218fc4c3",
"md5": "d1c4be79adb067bd4c3c832c636c4f4b",
"sha256": "0be04a933978b617e7e32d735f474eb93f8ef062c2fedcfdd416ec677b766ccc"
},
"downloads": -1,
"filename": "psychopy_bids-2024.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d1c4be79adb067bd4c3c832c636c4f4b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 230431,
"upload_time": "2024-12-16T11:31:06",
"upload_time_iso_8601": "2024-12-16T11:31:06.150600Z",
"url": "https://files.pythonhosted.org/packages/31/0f/4f4d99fd7b439fc83cbd6bc3e44bc5ae0761ed477da1783e97f2218fc4c3/psychopy_bids-2024.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "586ada0da868cdd5ea4005333afbf4865dfbf18f35957187ec24f42c2ea4919e",
"md5": "8ba72d53064f1eacae8bb1ce4472b5e2",
"sha256": "301e7e2aff9b5a8ff1ba2da398aacd1465dd809cb7f93f6d7c7f24ece6f669f5"
},
"downloads": -1,
"filename": "psychopy_bids-2024.2.0.tar.gz",
"has_sig": false,
"md5_digest": "8ba72d53064f1eacae8bb1ce4472b5e2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 23948962,
"upload_time": "2024-12-16T11:31:10",
"upload_time_iso_8601": "2024-12-16T11:31:10.710341Z",
"url": "https://files.pythonhosted.org/packages/58/6a/da0da868cdd5ea4005333afbf4865dfbf18f35957187ec24f42c2ea4919e/psychopy_bids-2024.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-16 11:31:10",
"github": false,
"gitlab": true,
"bitbucket": false,
"codeberg": false,
"gitlab_user": "psygraz",
"gitlab_project": "psychopy-bids",
"lcname": "psychopy-bids"
}