Skip to content

Commit

Permalink
doc updates [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
Circle Ci committed Dec 7, 2023
1 parent 9fb1c47 commit 0c9fca5
Show file tree
Hide file tree
Showing 50 changed files with 404 additions and 2,536 deletions.
2 changes: 1 addition & 1 deletion dev/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: cdc81cce15090a1726205caf1398f763
config: a45f11a6cfb1de791052d41fb2dfb979
tags: 645f666f9bcd5a90fca523b33c5a78b7
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
},
"outputs": [],
"source": [
"import os\nimport os.path as op\nimport openneuro\n\nfrom mne.datasets import sample\nfrom mne_bids import (\n BIDSPath,\n read_raw_bids,\n print_dir_tree,\n make_report,\n find_matching_paths,\n get_entity_vals,\n)"
"import os\nimport os.path as op\n\nimport openneuro\nfrom mne.datasets import sample\n\nfrom mne_bids import (\n BIDSPath,\n find_matching_paths,\n get_entity_vals,\n make_report,\n print_dir_tree,\n read_raw_bids,\n)"
]
},
{
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
},
"outputs": [],
"source": [
"import os.path as op\nimport shutil\n\nimport mne\nfrom mne.datasets import eegbci\n\nfrom mne_bids import write_raw_bids, BIDSPath, print_dir_tree\nfrom mne_bids.stats import count_events"
"import os.path as op\nimport shutil\n\nimport mne\nfrom mne.datasets import eegbci\n\nfrom mne_bids import BIDSPath, print_dir_tree, write_raw_bids\nfrom mne_bids.stats import count_events"
]
},
{
Expand Down Expand Up @@ -256,7 +256,7 @@
},
"outputs": [],
"source": [
"readme = op.join(bids_root, \"README\")\nwith open(readme, \"r\", encoding=\"utf-8-sig\") as fid:\n text = fid.read()\nprint(text)"
"readme = op.join(bids_root, \"README\")\nwith open(readme, encoding=\"utf-8-sig\") as fid:\n text = fid.read()\nprint(text)"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
from mne.datasets import eegbci

from mne_bids import (
write_raw_bids,
BIDSPath,
get_anonymization_daysback,
make_report,
print_dir_tree,
write_raw_bids,
)
from mne_bids.stats import count_events

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
},
"outputs": [],
"source": [
"import os.path as op\nimport shutil\n\nimport mne\nfrom mne.datasets import eegbci\n\nfrom mne_bids import (\n write_raw_bids,\n BIDSPath,\n get_anonymization_daysback,\n make_report,\n print_dir_tree,\n)\nfrom mne_bids.stats import count_events"
"import os.path as op\nimport shutil\n\nimport mne\nfrom mne.datasets import eegbci\n\nfrom mne_bids import (\n BIDSPath,\n get_anonymization_daysback,\n make_report,\n print_dir_tree,\n write_raw_bids,\n)\nfrom mne_bids.stats import count_events"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,13 @@
import shutil

import mne

from mne_bids import (
BIDSPath,
write_raw_bids,
read_raw_bids,
inspect_dataset,
mark_channels,
read_raw_bids,
write_raw_bids,
)

data_path = mne.datasets.sample.data_path()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
},
"outputs": [],
"source": [
"import json\nimport os.path as op\nfrom pprint import pprint\nimport shutil\n\nimport mne\nfrom mne.datasets import sample\n\nfrom mne_bids import (\n write_raw_bids,\n read_raw_bids,\n write_meg_calibration,\n write_meg_crosstalk,\n BIDSPath,\n print_dir_tree,\n make_dataset_description,\n)\nfrom mne_bids.stats import count_events"
"import json\nimport os.path as op\nimport shutil\nfrom pprint import pprint\n\nimport mne\nfrom mne.datasets import sample\n\nfrom mne_bids import (\n BIDSPath,\n make_dataset_description,\n print_dir_tree,\n read_raw_bids,\n write_meg_calibration,\n write_meg_crosstalk,\n write_raw_bids,\n)\nfrom mne_bids.stats import count_events"
]
},
{
Expand Down Expand Up @@ -249,7 +249,7 @@
},
"outputs": [],
"source": [
"readme = op.join(output_path, \"README\")\nwith open(readme, \"r\", encoding=\"utf-8-sig\") as fid:\n text = fid.read()\nprint(text)"
"readme = op.join(output_path, \"README\")\nwith open(readme, encoding=\"utf-8-sig\") as fid:\n text = fid.read()\nprint(text)"
]
},
{
Expand All @@ -267,7 +267,7 @@
},
"outputs": [],
"source": [
"how_to_acknowledge = \"\"\"\\\nIf you reference this dataset in a publication, please acknowledge its \\\nauthors and cite MNE papers: A. Gramfort, M. Luessi, E. Larson, D. Engemann, \\\nD. Strohmeier, C. Brodbeck, L. Parkkonen, M. H\u00e4m\u00e4l\u00e4inen, \\\nMNE software for processing MEG and EEG data, NeuroImage, Volume 86, \\\n1 February 2014, Pages 446-460, ISSN 1053-8119 \\\nand \\\nA. Gramfort, M. Luessi, E. Larson, D. Engemann, D. Strohmeier, C. Brodbeck, \\\nR. Goj, M. Jas, T. Brooks, L. Parkkonen, M. H\u00e4m\u00e4l\u00e4inen, MEG and EEG data \\\nanalysis with MNE-Python, Frontiers in Neuroscience, Volume 7, 2013, \\\nISSN 1662-453X\"\"\"\n\nmake_dataset_description(\n path=bids_path.root,\n name=task,\n authors=[\"Alexandre Gramfort\", \"Matti H\u00e4m\u00e4l\u00e4inen\"],\n how_to_acknowledge=how_to_acknowledge,\n acknowledgements=\"\"\"\\\nAlexandre Gramfort, Mainak Jas, and Stefan Appelhoff prepared and updated the \\\ndata in BIDS format.\"\"\",\n data_license=\"CC0\",\n ethics_approvals=[\n \"Human Subjects Division at the University of Washington\"\n ], # noqa: E501\n funding=[\n \"NIH 5R01EB009048\",\n \"NIH 1R01EB009048\",\n \"NIH R01EB006385\",\n \"NIH 1R01HD40712\",\n \"NIH 1R01NS44319\",\n \"NIH 2R01NS37462\",\n \"NIH P41EB015896\",\n \"ANR-11-IDEX-0003-02\",\n \"ERC-StG-263584\",\n \"ERC-StG-676943\",\n \"ANR-14-NEUC-0002-01\",\n ],\n references_and_links=[\n \"https://doi.org/10.1016/j.neuroimage.2014.02.017\",\n \"https://doi.org/10.3389/fnins.2013.00267\",\n \"https://mne.tools/stable/documentation/datasets.html#sample\",\n ],\n doi=\"doi:10.18112/openneuro.ds000248.v1.2.4\",\n overwrite=True,\n)\ndesc_json_path = bids_path.root / \"dataset_description.json\"\nwith open(desc_json_path, \"r\", encoding=\"utf-8-sig\") as fid:\n pprint(json.loads(fid.read()))"
"how_to_acknowledge = \"\"\"\\\nIf you reference this dataset in a publication, please acknowledge its \\\nauthors and cite MNE papers: A. Gramfort, M. Luessi, E. Larson, D. Engemann, \\\nD. Strohmeier, C. Brodbeck, L. Parkkonen, M. H\u00e4m\u00e4l\u00e4inen, \\\nMNE software for processing MEG and EEG data, NeuroImage, Volume 86, \\\n1 February 2014, Pages 446-460, ISSN 1053-8119 \\\nand \\\nA. Gramfort, M. Luessi, E. Larson, D. Engemann, D. Strohmeier, C. Brodbeck, \\\nR. Goj, M. Jas, T. Brooks, L. Parkkonen, M. H\u00e4m\u00e4l\u00e4inen, MEG and EEG data \\\nanalysis with MNE-Python, Frontiers in Neuroscience, Volume 7, 2013, \\\nISSN 1662-453X\"\"\"\n\nmake_dataset_description(\n path=bids_path.root,\n name=task,\n authors=[\"Alexandre Gramfort\", \"Matti H\u00e4m\u00e4l\u00e4inen\"],\n how_to_acknowledge=how_to_acknowledge,\n acknowledgements=\"\"\"\\\nAlexandre Gramfort, Mainak Jas, and Stefan Appelhoff prepared and updated the \\\ndata in BIDS format.\"\"\",\n data_license=\"CC0\",\n ethics_approvals=[\"Human Subjects Division at the University of Washington\"],\n funding=[\n \"NIH 5R01EB009048\",\n \"NIH 1R01EB009048\",\n \"NIH R01EB006385\",\n \"NIH 1R01HD40712\",\n \"NIH 1R01NS44319\",\n \"NIH 2R01NS37462\",\n \"NIH P41EB015896\",\n \"ANR-11-IDEX-0003-02\",\n \"ERC-StG-263584\",\n \"ERC-StG-676943\",\n \"ANR-14-NEUC-0002-01\",\n ],\n references_and_links=[\n \"https://doi.org/10.1016/j.neuroimage.2014.02.017\",\n \"https://doi.org/10.3389/fnins.2013.00267\",\n \"https://mne.tools/stable/documentation/datasets.html#sample\",\n ],\n doi=\"doi:10.18112/openneuro.ds000248.v1.2.4\",\n overwrite=True,\n)\ndesc_json_path = bids_path.root / \"dataset_description.json\"\nwith open(desc_json_path, encoding=\"utf-8-sig\") as fid:\n pprint(json.loads(fid.read()))"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
},
"outputs": [],
"source": [
"import os.path as op\nimport shutil\n\nfrom datetime import datetime, timezone\n\nimport mne\nfrom mne.datasets import sample\n\nfrom mne_bids import write_raw_bids, read_raw_bids, BIDSPath, print_dir_tree"
"import os.path as op\nimport shutil\nfrom datetime import datetime, timezone\n\nimport mne\nfrom mne.datasets import sample\n\nfrom mne_bids import BIDSPath, print_dir_tree, read_raw_bids, write_raw_bids"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,17 @@
# We are importing everything we need for this example:
import os
import os.path as op
import openneuro

import openneuro
from mne.datasets import sample

from mne_bids import (
BIDSPath,
read_raw_bids,
print_dir_tree,
make_report,
find_matching_paths,
get_entity_vals,
make_report,
print_dir_tree,
read_raw_bids,
)

# %%
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
},
"outputs": [],
"source": [
"from mne.datasets import somato\n\nfrom mne_bids import (\n read_raw_bids,\n find_matching_paths,\n print_dir_tree,\n make_report,\n update_sidecar_json,\n)"
"from mne.datasets import somato\n\nfrom mne_bids import (\n find_matching_paths,\n make_report,\n print_dir_tree,\n read_raw_bids,\n update_sidecar_json,\n)"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
},
"outputs": [],
"source": [
"import shutil\nfrom pathlib import Path\nimport mne\nfrom mne_bids import (\n BIDSPath,\n write_raw_bids,\n write_anat,\n write_meg_calibration,\n write_meg_crosstalk,\n anonymize_dataset,\n print_dir_tree,\n)\n\ndata_path = Path(mne.datasets.sample.data_path())\nevent_id = {\n \"Auditory/Left\": 1,\n \"Auditory/Right\": 2,\n \"Visual/Left\": 3,\n \"Visual/Right\": 4,\n \"Smiley\": 5,\n \"Button\": 32,\n}\n\nraw_path = data_path / \"MEG\" / \"sample\" / \"sample_audvis_raw.fif\"\nraw_er_path = data_path / \"MEG\" / \"sample\" / \"ernoise_raw.fif\" # empty-room\nevents_path = data_path / \"MEG\" / \"sample\" / \"sample_audvis_raw-eve.fif\"\ncal_path = data_path / \"SSS\" / \"sss_cal_mgh.dat\"\nct_path = data_path / \"SSS\" / \"ct_sparse_mgh.fif\"\nt1w_path = data_path / \"subjects\" / \"sample\" / \"mri\" / \"T1.mgz\"\n\nbids_root = data_path.parent / \"MNE-sample-data-bids\"\nbids_root_anon = data_path.parent / \"MNE-sample-data-bids-anon\""
"import shutil\nfrom pathlib import Path\n\nimport mne\n\nfrom mne_bids import (\n BIDSPath,\n anonymize_dataset,\n print_dir_tree,\n write_anat,\n write_meg_calibration,\n write_meg_crosstalk,\n write_raw_bids,\n)\n\ndata_path = Path(mne.datasets.sample.data_path())\nevent_id = {\n \"Auditory/Left\": 1,\n \"Auditory/Right\": 2,\n \"Visual/Left\": 3,\n \"Visual/Right\": 4,\n \"Smiley\": 5,\n \"Button\": 32,\n}\n\nraw_path = data_path / \"MEG\" / \"sample\" / \"sample_audvis_raw.fif\"\nraw_er_path = data_path / \"MEG\" / \"sample\" / \"ernoise_raw.fif\" # empty-room\nevents_path = data_path / \"MEG\" / \"sample\" / \"sample_audvis_raw-eve.fif\"\ncal_path = data_path / \"SSS\" / \"sss_cal_mgh.dat\"\nct_path = data_path / \"SSS\" / \"ct_sparse_mgh.fif\"\nt1w_path = data_path / \"subjects\" / \"sample\" / \"mri\" / \"T1.mgz\"\n\nbids_root = data_path.parent / \"MNE-sample-data-bids\"\nbids_root_anon = data_path.parent / \"MNE-sample-data-bids-anon\""
]
},
{
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,20 @@

import json
import os.path as op
from pprint import pprint
import shutil
from pprint import pprint

import mne
from mne.datasets import sample

from mne_bids import (
write_raw_bids,
BIDSPath,
make_dataset_description,
print_dir_tree,
read_raw_bids,
write_meg_calibration,
write_meg_crosstalk,
BIDSPath,
print_dir_tree,
make_dataset_description,
write_raw_bids,
)
from mne_bids.stats import count_events

Expand Down Expand Up @@ -180,7 +180,7 @@
# for mne-bids. If you are preparing a manuscript, please make sure to also
# cite MNE-BIDS there.
readme = op.join(output_path, "README")
with open(readme, "r", encoding="utf-8-sig") as fid:
with open(readme, encoding="utf-8-sig") as fid:
text = fid.read()
print(text)

Expand Down Expand Up @@ -209,9 +209,7 @@
Alexandre Gramfort, Mainak Jas, and Stefan Appelhoff prepared and updated the \
data in BIDS format.""",
data_license="CC0",
ethics_approvals=[
"Human Subjects Division at the University of Washington"
], # noqa: E501
ethics_approvals=["Human Subjects Division at the University of Washington"],
funding=[
"NIH 5R01EB009048",
"NIH 1R01EB009048",
Expand All @@ -234,7 +232,7 @@
overwrite=True,
)
desc_json_path = bids_path.root / "dataset_description.json"
with open(desc_json_path, "r", encoding="utf-8-sig") as fid:
with open(desc_json_path, encoding="utf-8-sig") as fid:
pprint(json.loads(fid.read()))

# %%
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
from mne.datasets import somato

from mne_bids import (
read_raw_bids,
find_matching_paths,
print_dir_tree,
make_report,
print_dir_tree,
read_raw_bids,
update_sidecar_json,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
},
"outputs": [],
"source": [
"import os.path as op\nimport shutil\n\nimport numpy as np\nimport matplotlib.pyplot as plt\n\nfrom nilearn.plotting import plot_anat\n\nimport mne\nfrom mne.datasets import sample\nfrom mne import head_to_mri\n\nfrom mne_bids import (\n write_raw_bids,\n BIDSPath,\n write_anat,\n get_anat_landmarks,\n get_head_mri_trans,\n print_dir_tree,\n)"
"import os.path as op\nimport shutil\n\nimport matplotlib.pyplot as plt\nimport mne\nimport numpy as np\nfrom mne import head_to_mri\nfrom mne.datasets import sample\nfrom nilearn.plotting import plot_anat\n\nfrom mne_bids import (\n BIDSPath,\n get_anat_landmarks,\n get_head_mri_trans,\n print_dir_tree,\n write_anat,\n write_raw_bids,\n)"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import mne
from mne_nirs import datasets # For convenient downloading of example data

from mne_bids import write_raw_bids, BIDSPath, print_dir_tree
from mne_bids import BIDSPath, print_dir_tree, write_raw_bids
from mne_bids.stats import count_events

# %%
Expand Down Expand Up @@ -172,7 +172,7 @@
# If you are preparing a manuscript, please make sure to also cite MNE-BIDS
# there.
readme = op.join(bids_root, "README")
with open(readme, "r", encoding="utf-8-sig") as fid:
with open(readme, encoding="utf-8-sig") as fid:
text = fid.read()
print(text)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,24 +50,24 @@
# %%

import os.path as op
import numpy as np
import shutil

import mne
import nibabel as nib
import numpy as np
from nilearn.plotting import plot_anat

import mne
from mne_bids import (
BIDSPath,
write_raw_bids,
write_anat,
convert_montage_to_mri,
convert_montage_to_ras,
get_anat_landmarks,
print_dir_tree,
read_raw_bids,
search_folder_for_text,
print_dir_tree,
template_to_head,
convert_montage_to_ras,
convert_montage_to_mri,
write_anat,
write_raw_bids,
)

# %%
Expand Down Expand Up @@ -289,11 +289,8 @@

# compare with standard
print(
"Recovered coordinate: {recovered}\n"
"Saved coordinate: {saved}".format(
recovered=montage2.get_positions()["ch_pos"]["LENT 1"],
saved=montage.get_positions()["ch_pos"]["LENT 1"],
)
f"Recovered coordinate: {montage2.get_positions()['ch_pos']['LENT 1']}\n"
f"Saved coordinate: {montage.get_positions()['ch_pos']['LENT 1']}"
)

# %%
Expand All @@ -303,7 +300,7 @@
# If you are preparing a manuscript, please make sure to also cite MNE-BIDS
# there.
readme = op.join(bids_root, "README")
with open(readme, "r", encoding="utf-8-sig") as fid:
with open(readme, encoding="utf-8-sig") as fid:
text = fid.read()
print(text)

Expand Down Expand Up @@ -397,25 +394,20 @@

# check difference in trans
print(
"Recovered trans:\n{recovered}\n"
"Original trans:\n{original}".format(
recovered=trans2["trans"].round(3),
# combine head->mri with mri->mni to get head->mni
# and then invert to get mni->head
original=np.linalg.inv(np.dot(trans["trans"], mri_mni_t["trans"])).round(3),
)
f"Recovered trans:\n{trans2['trans'].round(3)}\n"
# combine head->mri with mri->mni to get head->mni
# and then invert to get mni->head
"Original trans:\n"
f"{np.linalg.inv(np.dot(trans['trans'], mri_mni_t['trans'])).round(3)}"
)

# ensure that the data in MNI coordinates is exactly the same
# (within computer precision)
montage2 = raw2.get_montage() # get montage after transformed back to head
montage2.apply_trans(trans2)
print(
"Recovered coordinate: {recovered}\n"
"Original coordinate: {original}".format(
recovered=montage2.get_positions()["ch_pos"]["LENT 1"],
original=montage.get_positions()["ch_pos"]["LENT 1"],
)
f"Recovered coordinate: {montage2.get_positions()['ch_pos']['LENT 1']}\n"
f"Original coordinate: {montage.get_positions()['ch_pos']['LENT 1']}"
)

# %%
Expand Down Expand Up @@ -521,11 +513,8 @@
montage2 = raw2.get_montage() # get montage after transformed back to head
montage2.apply_trans(trans2) # apply trans to go back to 'mri'
print(
"Recovered coordinate: {recovered}\n"
"Original coordinate: {original}".format(
recovered=montage2.get_positions()["ch_pos"]["LENT 1"],
original=montage.get_positions()["ch_pos"]["LENT 1"],
)
f"Recovered coordinate: {montage2.get_positions()['ch_pos']['LENT 1']}\n"
f"Original coordinate: {montage.get_positions()['ch_pos']['LENT 1']}"
)

# %%
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,20 @@
import os.path as op
import shutil

import numpy as np
import matplotlib.pyplot as plt

from nilearn.plotting import plot_anat

import mne
from mne.datasets import sample
import numpy as np
from mne import head_to_mri
from mne.datasets import sample
from nilearn.plotting import plot_anat

from mne_bids import (
write_raw_bids,
BIDSPath,
write_anat,
get_anat_landmarks,
get_head_mri_trans,
print_dir_tree,
write_anat,
write_raw_bids,
)

# %%
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
},
"outputs": [],
"source": [
"import os.path as op\nimport pathlib\nimport shutil\n\nimport mne\nfrom mne_nirs import datasets # For convenient downloading of example data\n\nfrom mne_bids import write_raw_bids, BIDSPath, print_dir_tree\nfrom mne_bids.stats import count_events"
"import os.path as op\nimport pathlib\nimport shutil\n\nimport mne\nfrom mne_nirs import datasets # For convenient downloading of example data\n\nfrom mne_bids import BIDSPath, print_dir_tree, write_raw_bids\nfrom mne_bids.stats import count_events"
]
},
{
Expand Down Expand Up @@ -231,7 +231,7 @@
},
"outputs": [],
"source": [
"readme = op.join(bids_root, \"README\")\nwith open(readme, \"r\", encoding=\"utf-8-sig\") as fid:\n text = fid.read()\nprint(text)"
"readme = op.join(bids_root, \"README\")\nwith open(readme, encoding=\"utf-8-sig\") as fid:\n text = fid.read()\nprint(text)"
]
},
{
Expand Down
Loading

0 comments on commit 0c9fca5

Please sign in to comment.