Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move notebooks into example gallery #278

Merged
merged 3 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions docs/about.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
===================
Background
Background
===================

Motivation
Expand All @@ -19,7 +19,7 @@ their computational time and resources** effectively.

``CuBIDS`` is designed to facilitate the curation of large, neuroimaging data so
that users can infer useful information from descriptive and accurate BIDS labels
before running pipelines *en masse*. ``CuBIDS`` accomplishes this by summarizing
before running pipelines *en masse*. ``CuBIDS`` accomplishes this by summarizing
BIDS data using :ref:`keygroup`, :ref:`paramgroup`, and :ref:`acquisitiongroup` categorizations in your data (we'll explain what these
are in more detail in the next section).

Expand All @@ -40,7 +40,7 @@ Definitions

* A set of scans whose filenames share all `BIDS filename key-value pairs <https://bids-specification.readthedocs.io/en/stable/02-common-principles.html#file-name-structure>`_, excluding subject and session
* Derived from the BIDS Filename
* Example structure: ``acquisition-*_datatype-*_run-*_task-*_suffix``
* Example structure: ``acquisition-*_datatype-*_run-*_task-*_suffix``

.. topic:: Parameter (Param) Group

Expand All @@ -53,15 +53,15 @@ Definitions
* The Param Group that contains the most scans in its Key Group

.. topic:: Variant Group

* Any Param Group that is non-dominant

.. topic:: Rename Key Group

* Auto-generated, recommended new Key Group name for Variant Groups
* Based on the metadata parameters that cause scans in Variant Groups to vary from those in their respective Dominant Groups
* Auto-generated, recommended new Key Group name for Variant Groups
* Based on the metadata parameters that cause scans in Variant Groups to vary from those in their respective Dominant Groups

.. topic:: Acquisition Group
.. topic:: Acquisition Group

* A collection of sessions across participants that contains the exact same set of Key and Param Groups

Expand All @@ -85,4 +85,4 @@ In the next section, we'll discuss these definitions in more detail and demonstr

.. [#f1] See the `BIDS Specification <https://bids-specification.readthedocs.io>`_.
.. [#f2] See this list of amazing `BIDS apps <https://bids-apps.neuroimaging.io/>`_.
.. [#f3] See `DataLad <https://www.datalad.org/>`_.
.. [#f3] See `DataLad <https://www.datalad.org/>`_.
1 change: 0 additions & 1 deletion docs/authors.rst

This file was deleted.

88 changes: 42 additions & 46 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,60 +16,61 @@
# directory, add these directories to sys.path here. If the directory is
# relative to the documentation root, use os.path.abspath to make it
# absolute, like shown here.
#
import os
import sys
sys.path.insert(0, os.path.abspath('..'))
from sphinx import __version__ as sphinxversion

sys.path.insert(0, os.path.abspath(".."))

import cubids
from packaging import version as pver # Avoid distutils.LooseVersion which is deprecated

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.append(os.path.abspath('sphinxext'))
sys.path.insert(0, os.path.abspath('../wrapper'))
sys.path.append(os.path.abspath("sphinxext"))
sys.path.insert(0, os.path.abspath("../wrapper"))

# -- General configuration ---------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
#
needs_sphinx = '1.5.3'
needs_sphinx = "1.5.3"

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.intersphinx',
'sphinx.ext.coverage',
'sphinx.ext.mathjax',
'sphinxarg.ext', # argparse extension
'sphinx.ext.viewcode'
"nbsphinx",
"sphinx.ext.autodoc",
"sphinx.ext.doctest",
"sphinx.ext.intersphinx",
"sphinx.ext.coverage",
"sphinx.ext.mathjax",
"sphinxarg.ext", # argparse extension
"sphinx.ext.viewcode",
"sphinx_gallery.load_style",
]

# Mock modules in autodoc:
autodoc_mock_imports = [
'numpy',
'nitime',
'matplotlib',
"numpy",
"nitime",
"matplotlib",
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
source_suffix = ".rst"

# The master toctree document.
master_doc = 'index'
master_doc = "index"

# General information about the project.
project = 'CuBIDS'
project = "CuBIDS"
copyright = "2020, PennLINC"
author = "PennLINC"

Expand All @@ -87,15 +88,15 @@
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = 'en'
language = "en"

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = "sphinx"

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False
Expand All @@ -106,8 +107,10 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'
html_theme_path = ["_themes", ]
html_theme = "sphinx_rtd_theme"
html_theme_path = [
"_themes",
]

# Theme options are theme-specific and customize the look and feel of a
# theme further. For a list of options available for each theme, see the
Expand All @@ -118,13 +121,13 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = ["_static"]


# -- Options for HTMLHelp output ---------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = 'cubidsdoc'
htmlhelp_basename = "cubidsdoc"


# -- Options for LaTeX output ------------------------------------------
Expand All @@ -133,15 +136,12 @@
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',

# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
Expand All @@ -151,21 +151,15 @@
# (source start file, target name, title, author, documentclass
# [howto, manual, or own class]).
latex_documents = [
(master_doc, 'cubids.tex',
'CuBIDS Documentation',
'PennLINC', 'manual'),
(master_doc, "cubids.tex", "CuBIDS Documentation", "PennLINC", "manual"),
]


# -- Options for manual page output ------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'cubids',
'CuBIDS Documentation',
[author], 1)
]
man_pages = [(master_doc, "cubids", "CuBIDS Documentation", [author], 1)]


# -- Options for Texinfo output ----------------------------------------
Expand All @@ -174,14 +168,16 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'cubids',
'CuBIDS Documentation',
author,
'cubids',
'One line description of project.',
'Miscellaneous'),
(
master_doc,
"cubids",
"CuBIDS Documentation",
author,
"cubids",
"One line description of project.",
"Miscellaneous",
),
]

# -- Fix automodule config
add_module_names = False

1 change: 0 additions & 1 deletion docs/contributing.rst

This file was deleted.

14 changes: 14 additions & 0 deletions docs/examples.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Thumbnails gallery
==================

.. nbgallery::
notebooks/Fieldmaps
notebooks/FirstProofofConcept
notebooks/HTML_param_groups
notebooks/JSON_PoC_read_write
notebooks/Key_and_Param_Groups
notebooks/keyparamgrouptest
notebooks/metadata_image_param
notebooks/PofC_Key_Values2
notebooks/rename_files_work
notebooks/workwithtestdata
1 change: 0 additions & 1 deletion docs/history.rst

This file was deleted.

7 changes: 4 additions & 3 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Contents
usage
installation
example
contributing
authors
history
examples
../CONTRIBUTING
../AUTHORS
../HISTORY
36 changes: 18 additions & 18 deletions notebooks/Fieldmaps.ipynb → docs/notebooks/Fieldmaps.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Fieldmaps OK?\n",
"# Check If Field Maps Are Defined For a Dataset\n",
"\n",
"This notebook shows how we check if fieldmaps are defined for the data set. There are two approaches:\n",
"\n",
Expand All @@ -29,19 +29,19 @@
"metadata": {},
"outputs": [],
"source": [
"# USE THIS BEFORE TESTING! \n",
"import sys \n",
"# USE THIS BEFORE TESTING!\n",
"import sys\n",
"sys.path.append(\"..\")\n",
"from pathlib import Path \n",
"from pathlib import Path\n",
"import shutil\n",
"import os\n",
"\n",
"from pkg_resources import resource_filename as pkgrf \n",
"from pkg_resources import resource_filename as pkgrf\n",
"\n",
"# returns string path to testdata\n",
"TEST_DATA = pkgrf(\"cubids\", \"testdata\")\n",
"\n",
"# should give you the full path \n",
"# should give you the full path\n",
"tmp_path = Path().resolve()\n",
"#print(tmp_path)\n",
"\n",
Expand Down Expand Up @@ -100,10 +100,10 @@
"import json\n",
"\n",
"def read_intendedfor(path):\n",
" \n",
"\n",
" with open(str(path), 'r') as infile:\n",
" data = json.load(infile)\n",
" \n",
"\n",
" return data.get('IntendedFor')"
]
},
Expand Down Expand Up @@ -143,9 +143,9 @@
"mapping = {}\n",
"\n",
"for fm in fmaps:\n",
" \n",
"\n",
" intfor = read_intendedfor(fm)\n",
" \n",
"\n",
" mapping[str(fm)] = intfor"
]
},
Expand Down Expand Up @@ -184,21 +184,21 @@
"all_files = [str(x) for x in pathlib.Path(data_root).rglob(\"*.nii*\")]\n",
"\n",
"for k, v in mapping.items():\n",
" \n",
"\n",
" if not v:\n",
" \n",
"\n",
" print(\"{}: This fieldmap is not intended for any files!\".format(k))\n",
" \n",
"\n",
" continue\n",
" \n",
"\n",
" for fi in v:\n",
" \n",
"\n",
" if any([fi in x for x in all_files]):\n",
" \n",
"\n",
" print(\"{}: This fieldmap has a file\".format(k))\n",
" \n",
"\n",
" else:\n",
" \n",
"\n",
" print(\"{}: The file this fieldmap is intended for doesn't exist\".format(k))"
]
},
Expand Down
Loading