
[](https://pypi.org/project/snirf2bids/)
[](https://github.com/BUNPC/snirf2bids/actions/workflows/test.yml)
[](https://zenodo.org/badge/latestdoi/478632378)
# snirf2BIDS
Conveniently generate [BIDS files](https://bids-specification--802.org.readthedocs.build/en/802/04-modality-specific-files/11-functional-near-infrared-spectroscopy.html) from [SNIRF files](https://github.com/fnirs/snirf).
## Installation
### `pip install snirf2bids`
snirf2bids requires Python > 3.
## Usage
SNIRF files with [valid BIDS names](https://bids-specification.readthedocs.io/en/stable/02-common-principles.html#file-name-structure) can be converted into BIDS metadata text files.
For use with snirf2bids, a SNIRF file name must include at least the `sub-` and `task-` entitites and end in `_nirs.snirf`, i.e. `sub-01_task-tapping_nirs.snirf`.
### Generate BIDS text files from a SNIRF file
If the list_files parameter is empty, snirf2bids replaces all existing BIDS files with newly generated ones; otherwise, it replaces only the files specified in list_files. The parameter retain_old_info, with a default value of True, ensures that information in the existing scans and participants files is retained whenever a conflict occurs.
```python
snirf2bids.snirf2bids('<path to snirf file>', 'outputpath = <folder to generate files in>', 'list_files =<list of BIDS files to replace>' , 'retain_old_info=True')
```
### Generate BIDS text files from a SNIRF file or from all SNIRF files within a directory and its subdirectories
If the list_files parameter is empty, snirf2bids replaces all existing BIDS files with newly generated ones; otherwise, it replaces only the files specified in list_files. The parameter retain_old_info, with a default value of True, ensures that information in the existing scans and participants files is retained whenever a conflict occurs.
```python
snirf2bids.snirf2bids_recurse('<path to a directiory or path to snirf file>', 'list_files =<list of BIDS files to replace>', 'retain_old_info=True')
```
### Export BIDS text files in JSON Format
```python
s = snirf2bids.snirf2json('<path to snirf file>') # Returns serialized JSON in which keys are filenames and values are their contents
```
## Contributors
Developed by BU BME Senior Design Group 3 (2022): Christian Arthur, Jeonghoon Choi, Jiazhen Liu, Juncheng Zhang and the [Boston University Neurophotonics Center](https://github.com/BUNPC).
[@Christian Arthur :melon:](https://github.com/chrsthur)<br>
[@Juncheng Zhang :tangerine:](https://github.com/andyzjc)<br>
[@Jeonghoon Choi :pineapple:](https://github.com/jeonghoonchoi)<br>
[@Jiazhen Liu :grapes:](https://github.com/ELISALJZ)<br>
This project exists thanks to:
<br>
<center class= "half">
<a href="https://github.com/sstucker">
<img src="https://github.com/sstucker.png" width="50" height="50">
</a>
<a href="https://github.com/rob-luke">
<img src="https://github.com/rob-luke.png" width="50" height="50">
</a>
<a href="https://github.com/chrsthur">
<img src="https://github.com/chrsthur.png" width="50" height="50">
</a>
<a href="https://github.com/andyzjc">
<img src="https://github.com/andyzjc.png" width="50" height="50">
</a>
<a href="https://github.com/jeonghoonchoi">
<img src="https://github.com/jeonghoonchoi.png" width="50" height="50">
</a>
<a href="https://github.com/ELISALJZ">
<img src="https://github.com/ELISALJZ.png" width="50" height="50">
</a>
<a href="https://github.com/dboas">
<img src="https://github.com/dboas.png" width="50" height="50">
</a>
</center>
Raw data
{
"_id": null,
"home_page": "https://github.com/BUNPC/snirf2bids",
"name": "snirf2bids",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6.0",
"maintainer_email": null,
"keywords": null,
"author": "JC",
"author_email": "skura@bu.edu",
"download_url": "https://files.pythonhosted.org/packages/e7/60/10d3ce0b87c0e3dd4b9906ccfbf005f82419ad27c34b79341a05b758b8a9/snirf2bids-0.8.7.tar.gz",
"platform": null,
"description": "\n\n[](https://pypi.org/project/snirf2bids/)\n[](https://github.com/BUNPC/snirf2bids/actions/workflows/test.yml)\n[](https://zenodo.org/badge/latestdoi/478632378)\n\n# snirf2BIDS\nConveniently generate [BIDS files](https://bids-specification--802.org.readthedocs.build/en/802/04-modality-specific-files/11-functional-near-infrared-spectroscopy.html) from [SNIRF files](https://github.com/fnirs/snirf). \n\n## Installation\n### `pip install snirf2bids`\n\nsnirf2bids requires Python > 3.\n\n## Usage\nSNIRF files with [valid BIDS names](https://bids-specification.readthedocs.io/en/stable/02-common-principles.html#file-name-structure) can be converted into BIDS metadata text files.\n\nFor use with snirf2bids, a SNIRF file name must include at least the `sub-` and `task-` entitites and end in `_nirs.snirf`, i.e. `sub-01_task-tapping_nirs.snirf`.\n\n### Generate BIDS text files from a SNIRF file\nIf the list_files parameter is empty, snirf2bids replaces all existing BIDS files with newly generated ones; otherwise, it replaces only the files specified in list_files. The parameter retain_old_info, with a default value of True, ensures that information in the existing scans and participants files is retained whenever a conflict occurs.\n```python\nsnirf2bids.snirf2bids('<path to snirf file>', 'outputpath = <folder to generate files in>', 'list_files =<list of BIDS files to replace>' , 'retain_old_info=True')\n```\n### Generate BIDS text files from a SNIRF file or from all SNIRF files within a directory and its subdirectories\nIf the list_files parameter is empty, snirf2bids replaces all existing BIDS files with newly generated ones; otherwise, it replaces only the files specified in list_files. The parameter retain_old_info, with a default value of True, ensures that information in the existing scans and participants files is retained whenever a conflict occurs.\n```python\nsnirf2bids.snirf2bids_recurse('<path to a directiory or path to snirf file>', 'list_files =<list of BIDS files to replace>', 'retain_old_info=True')\n```\n### Export BIDS text files in JSON Format\n```python\ns = snirf2bids.snirf2json('<path to snirf file>') # Returns serialized JSON in which keys are filenames and values are their contents\n```\n\n## Contributors\n\nDeveloped by BU BME Senior Design Group 3 (2022): Christian Arthur, Jeonghoon Choi, Jiazhen Liu, Juncheng Zhang and the [Boston University Neurophotonics Center](https://github.com/BUNPC).\n\n[@Christian Arthur :melon:](https://github.com/chrsthur)<br>\n[@Juncheng Zhang :tangerine:](https://github.com/andyzjc)<br>\n[@Jeonghoon Choi :pineapple:](https://github.com/jeonghoonchoi)<br>\n[@Jiazhen Liu :grapes:](https://github.com/ELISALJZ)<br>\n\nThis project exists thanks to:\n<br>\n<center class= \"half\">\n<a href=\"https://github.com/sstucker\">\n<img src=\"https://github.com/sstucker.png\" width=\"50\" height=\"50\">\n</a>\n\n<a href=\"https://github.com/rob-luke\">\n<img src=\"https://github.com/rob-luke.png\" width=\"50\" height=\"50\">\n</a>\n\n<a href=\"https://github.com/chrsthur\">\n<img src=\"https://github.com/chrsthur.png\" width=\"50\" height=\"50\">\n</a>\n\n<a href=\"https://github.com/andyzjc\">\n<img src=\"https://github.com/andyzjc.png\" width=\"50\" height=\"50\">\n</a>\n\n<a href=\"https://github.com/jeonghoonchoi\">\n<img src=\"https://github.com/jeonghoonchoi.png\" width=\"50\" height=\"50\">\n</a>\n\n<a href=\"https://github.com/ELISALJZ\">\n<img src=\"https://github.com/ELISALJZ.png\" width=\"50\" height=\"50\">\n</a>\n \n<a href=\"https://github.com/dboas\">\n<img src=\"https://github.com/dboas.png\" width=\"50\" height=\"50\">\n</a>\n </center>\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "To convert snirf file to bids format.",
"version": "0.8.7",
"project_urls": {
"Homepage": "https://github.com/BUNPC/snirf2bids"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f019c3a1754395ea07fb76b9c9656f418ce8cc11aeaf3a6aee942adfff93eed4",
"md5": "7ceb169a1edebbe507440b5d7fd61a32",
"sha256": "7904284f1bd1df00dac0eced143b79101d6db5d84e31556fa3f2974eff54c17c"
},
"downloads": -1,
"filename": "snirf2bids-0.8.7-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7ceb169a1edebbe507440b5d7fd61a32",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6.0",
"size": 20546,
"upload_time": "2025-01-15T16:56:26",
"upload_time_iso_8601": "2025-01-15T16:56:26.192438Z",
"url": "https://files.pythonhosted.org/packages/f0/19/c3a1754395ea07fb76b9c9656f418ce8cc11aeaf3a6aee942adfff93eed4/snirf2bids-0.8.7-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e76010d3ce0b87c0e3dd4b9906ccfbf005f82419ad27c34b79341a05b758b8a9",
"md5": "bdaf5786a099d90150dfa3e9d8e54e06",
"sha256": "804f2c9b5f02dbf61dbac29579169815f56f539511cd17d6a770a7eb23ede0a0"
},
"downloads": -1,
"filename": "snirf2bids-0.8.7.tar.gz",
"has_sig": false,
"md5_digest": "bdaf5786a099d90150dfa3e9d8e54e06",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6.0",
"size": 22061,
"upload_time": "2025-01-15T16:56:29",
"upload_time_iso_8601": "2025-01-15T16:56:29.967968Z",
"url": "https://files.pythonhosted.org/packages/e7/60/10d3ce0b87c0e3dd4b9906ccfbf005f82419ad27c34b79341a05b758b8a9/snirf2bids-0.8.7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-15 16:56:29",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "BUNPC",
"github_project": "snirf2bids",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "numpy",
"specs": [
[
"==",
"1.19.5"
]
]
},
{
"name": "pysnirf2",
"specs": [
[
"==",
"0.6.2"
]
]
},
{
"name": "importlib_resources",
"specs": [
[
"==",
"5.4.0"
]
]
},
{
"name": "tabulate",
"specs": [
[
"==",
"0.8.9"
]
]
},
{
"name": "pandas",
"specs": [
[
"==",
"1.3.5"
]
]
}
],
"lcname": "snirf2bids"
}