Skip to content
Draft
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,6 @@ dmypy.json

# Pyre type checker
.pyre/

# Nilearn cache
nilearn_cache
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ sphinx:
configuration: docs/conf.py

python:
version: 3.7
version: "3.11"
install:
- method: pip
path: .
Expand Down
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
12 changes: 12 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
API Reference
=============

.. automodule:: mapca.mapca
:members:
:undoc-members:
:show-inheritance:

.. automodule:: mapca.utils
:members:
:undoc-members:
:show-inheritance:
47 changes: 47 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Configuration file for the Sphinx documentation builder.
import os
import sys

# Add project root to path
sys.path.insert(0, os.path.abspath(".."))

import mapca

# -- Project information -----------------------------------------------------
project = "mapca"
copyright = "2020, mapca developers"
author = "mapca developers"
release = mapca.__version__

# -- General configuration ---------------------------------------------------
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.intersphinx",
"sphinx.ext.napoleon",
"sphinx.ext.viewcode",
]

templates_path = ["_templates"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

# -- Options for HTML output -------------------------------------------------
html_theme = "sphinx_rtd_theme"
html_static_path = ["_static"]

# -- Intersphinx configuration -----------------------------------------------
intersphinx_mapping = {
"python": ("https://docs.python.org/3", None),
"numpy": ("https://numpy.org/doc/stable/", None),
"scipy": ("https://docs.scipy.org/doc/scipy/", None),
"nilearn": ("https://nilearn.github.io/stable/", None),
"nibabel": ("https://nipy.org/nibabel/", None),
"sklearn": ("https://scikit-learn.org/stable/", None),
}

# -- Autodoc configuration ---------------------------------------------------
autodoc_default_options = {
"members": True,
"undoc-members": True,
"show-inheritance": True,
}
23 changes: 23 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
mapca: Moving Average PCA
=========================

A Python implementation of the moving average principal components analysis
methods from GIFT.

``mapca`` estimates the dimensionality of fMRI data by accounting for spatial
correlations through subsampling and applying information-theoretic criteria
(AIC, KIC, MDL) to determine the optimal number of principal components.

.. toctree::
:maxdepth: 2
:caption: Contents:

installation
api

Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
24 changes: 24 additions & 0 deletions docs/installation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Installation
============

Requirements
------------

``mapca`` requires Python >= 3.5 and the following packages:

- nibabel >= 2.5.1
- nilearn
- numpy >= 1.15
- scikit-learn >= 0.22
- scipy >= 1.3.3

Install
-------

You can install ``mapca`` from PyPI::

pip install mapca

Or install the latest development version from GitHub::

pip install git+https://github.com/ME-ICA/mapca.git
8 changes: 6 additions & 2 deletions mapca/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
from urllib.request import urlretrieve

import requests

import pytest

Expand Down Expand Up @@ -28,7 +29,10 @@ def fetch_file(osf_id, path, filename):
url = 'https://osf.io/{}/download'.format(osf_id)
full_path = os.path.join(path, filename)
if not os.path.isfile(full_path):
urlretrieve(url, full_path)
r = requests.get(url)
r.raise_for_status()
with open(full_path, "wb") as f:
f.write(r.content)
return full_path


Expand Down
Loading