Skip to content

Commit ba42f98

Browse files
authored
Merge pull request #1 from alexisthual/feat/add_doc
Add documentation
2 parents caaea2c + e582478 commit ba42f98

File tree

14 files changed

+834
-259
lines changed

14 files changed

+834
-259
lines changed

.github/workflows/deploy_site.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Build and/or deploy documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- "*"
10+
11+
jobs:
12+
build_docs:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Generate HTML docs
17+
uses: ammaraskar/sphinx-action@master
18+
with:
19+
docs-folder: "doc/"
20+
pre-build-command: |
21+
apt-get update
22+
pip install -U pip
23+
pip install -e ".[doc]"
24+
- name: Upload generated HTML as artifact
25+
uses: actions/upload-artifact@v2
26+
with:
27+
name: DocHTML
28+
path: doc/_build/html/
29+
30+
deploy_docs:
31+
if: github.ref == 'refs/heads/main'
32+
needs: build_docs
33+
runs-on: ubuntu-latest
34+
steps:
35+
- uses: actions/checkout@v2
36+
- name: Download artifacts
37+
uses: actions/download-artifact@v2
38+
with:
39+
name: DocHTML
40+
path: doc/_build/html/
41+
- name: Commit to documentation branch
42+
run: |
43+
git clone --no-checkout --depth 1 https://github.com/alexisthual/brain-cockpit.git --branch gh-pages --single-branch gh-pages
44+
cp -r doc/_build/html/* gh-pages/
45+
cd gh-pages
46+
touch .nojekyll
47+
git config --local user.email "[email protected]"
48+
git config --local user.name "brain-cockpit GitHub Action"
49+
git add .
50+
git commit -m "Update documentation" -a || true
51+
- name: Push changes
52+
uses: ad-m/[email protected]
53+
with:
54+
branch: gh-pages
55+
directory: gh-pages
56+
github_token: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,21 @@ build
1717

1818
.ipynb_checkpoints
1919

20+
# yarn without zero-installs
21+
# see https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored
2022
.pnp.*
2123
.yarn/*
2224
!.yarn/patches
2325
!.yarn/plugins
2426
!.yarn/releases
2527
!.yarn/sdks
26-
!.yarn/versions
28+
!.yarn/versions
29+
30+
# Documentation
31+
doc/_build
32+
doc/auto_examples
33+
doc/gen_modules
34+
doc/generated
35+
doc/modules/generated
36+
37+
*.egg-info

LICENSE

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2018 The Python Packaging Authority
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
SOFTWARE.

README.md

Lines changed: 6 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -1,99 +1,12 @@
11
# Brain cockpit
22

3-
![GitHub license](https://img.shields.io/badge/VERSION-0.1.0-black.svg?style=for-the-badge)
4-
![Python version](https://img.shields.io/badge/PYTHON-3.7-black.svg?style=for-the-badge)
3+
![license](https://img.shields.io/github/license/alexisthual/brain-cockpit?style=for-the-badge)
4+
![python version](https://img.shields.io/badge/python-3.7_|_3.8_|_3.9_|_3.10_|_3.11-blue?style=for-the-badge)
5+
![code style](https://img.shields.io/badge/code_style-black-black?style=for-the-badge)
56

6-
`brain-cockpit` is a Typescript and Python web-application meant to help explore
7-
(1) fMRI datasets projected on surface meshes as well as
8-
(2) alignments computed between individuals.
7+
`brain-cockpit` is a web-app comprising a Typescript front-end and a Python back-end. It is meant to help explore:
98

10-
It comes as a React application making calls to Python functions through a [`flask`](https://flask.palletsprojects.com/en/2.0.x/) server.
11-
12-
For now, it consists of a sole view to help looking at IBC contrasts projected on `fsaverage`. Key features include selecting subject, selecting contrast, and clicking on voxel to display its functional fingerprint.
13-
Keys `J`, `L` allow one to switch between contrasts, `I`, `K` between subjects.
9+
* large surface fMRI datasets projected
10+
* alignments computed between brains, such as those computed with [fugw](https://alexisthual.github.io/fugw/index.html)
1411

1512
![Screenshot](https://mybox.inria.fr/thumbnail/192bdcc47f8c4decbac7/1024/Screenshot%20from%202020-12-07%2012-23-45.png)
16-
17-
## Install
18-
19-
### Dependencies
20-
21-
```bash
22-
yarn install
23-
conda env create -f environment.yml
24-
```
25-
26-
Once the `conda` environment is created, activate it with
27-
28-
```bash
29-
conda activate brain-cockpit
30-
```
31-
32-
#### Updating dependencies after installation
33-
34-
Dependencies in `package.json` and `environment.yml` might evolve quickly. In order to update your local environment, run the following commands:
35-
36-
```bash
37-
yarn install
38-
conda env update --file environment.yml
39-
```
40-
41-
### Generate assets (3D meshes)
42-
43-
This command generates `fsaverage` meshes from `nilearn` and stores them in `./public/assets`
44-
45-
```bash
46-
python bc_utils/gifty_to_gltf.py
47-
```
48-
49-
### Download IBC contrasts
50-
51-
Projected contrasts are available at `/storage/store2/work/athual/data/ibc_surface_conditions_db.zip`. You most likely want to download and unzip this archive locally:
52-
53-
```bash
54-
scp username@drago2:/storage/store2/work/athual/data/ibc_surface_conditions_db.zip /path/to/archive
55-
unzip /path/to/ibc_surface_conditions_db.zip
56-
```
57-
58-
### Overwrite default environment variables
59-
60-
Default environment variables are initiated in `.env`.
61-
You can overwrite these by creating a `.env.development.local` file suited to your needs.
62-
In particular, you most likely want to set `DATA_PATH` to point to downloaded IBC contrasts.
63-
64-
If you need a more custom `.env` files setup, check out [all other possibilities](https://create-react-app.dev/docs/adding-custom-environment-variables/#what-other-env-files-can-be-used) allowed by `create-react-app`.
65-
66-
## Run
67-
68-
### Application in dev mode
69-
70-
In separate prompts:
71-
72-
- start the frontend with `yarn start`
73-
- start the backend with `python main.py` (using your `brain-cockpit` conda env)
74-
75-
### Application in production mode
76-
77-
In separate prompts:
78-
79-
- build the frontend with `yarn build`
80-
- start the backend with `python main.py --env production` (using your `brain-cockpit` conda env)
81-
82-
### Custom utilitaries
83-
84-
#### Functional images resampling
85-
86-
This will resample functional images contained in `SLICE_DATA_PATH`, to later be displayed in `brain-cockpit`.
87-
88-
```bash
89-
python bc_utils/resample_functional_images.py --env {development, production}
90-
```
91-
92-
## Contributing
93-
94-
Commits must validate a pre-commit routine launched by a git hook.
95-
To enable this hook locally, run
96-
97-
```bash
98-
pre-commit install
99-
```

doc/Makefile

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
# Makefile for Sphinx documentation
2+
3+
# You can set these variables from the command line.
4+
SPHINXOPTS =
5+
SPHINXBUILD = sphinx-build
6+
PAPER =
7+
BUILDDIR = _build
8+
9+
GITHUB_PAGES_BRANCH = gh-pages
10+
OUTPUTDIR = _build/html
11+
12+
# User-friendly check for sphinx-build
13+
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
14+
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
15+
endif
16+
17+
# Internal variables.
18+
PAPEROPT_a4 = -D latex_paper_size=a4
19+
PAPEROPT_letter = -D latex_paper_size=letter
20+
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
21+
# the i18n builder cannot share the environment and doctrees with the others
22+
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
23+
24+
.PHONY: help
25+
help:
26+
@echo "Please use \`make <target>' where <target> is one of"
27+
@echo " html-noplot to make standalone HTML files, without plotting anything"
28+
@echo " html to make standalone HTML files"
29+
@echo " dirhtml to make HTML files named index.html in directories"
30+
@echo " singlehtml to make a single large HTML file"
31+
@echo " pickle to make pickle files"
32+
@echo " htmlhelp to make HTML files and a HTML help project"
33+
@echo " qthelp to make HTML files and a qthelp project"
34+
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
35+
@echo " latexpdf to make LaTeX files and run them through pdflatex"
36+
@echo " changes to make an overview of all changed/added/deprecated items"
37+
@echo " linkcheck to check all external links for integrity"
38+
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
39+
@echo " coverage to run coverage check of the documentation (if enabled)"
40+
@echo " install to make the html and push it online"
41+
42+
.PHONY: clean
43+
44+
clean:
45+
rm -rf $(BUILDDIR)/
46+
rm -rf auto_examples/
47+
rm -rf gen_modules/
48+
rm -rf generated/
49+
rm -rf modules/generated/
50+
51+
html-noplot:
52+
$(SPHINXBUILD) -D plot_gallery=0 -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
53+
@echo
54+
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
55+
56+
.PHONY: html
57+
html:
58+
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
59+
@echo
60+
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
61+
62+
.PHONY: dirhtml
63+
dirhtml:
64+
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
65+
@echo
66+
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
67+
68+
.PHONY: singlehtml
69+
singlehtml:
70+
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
71+
@echo
72+
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
73+
74+
.PHONY: pickle
75+
pickle:
76+
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
77+
@echo
78+
@echo "Build finished; now you can process the pickle files."
79+
80+
.PHONY: htmlhelp
81+
htmlhelp:
82+
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
83+
@echo
84+
@echo "Build finished; now you can run HTML Help Workshop with the" \
85+
".hhp project file in $(BUILDDIR)/htmlhelp."
86+
87+
.PHONY: qthelp
88+
qthelp:
89+
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
90+
@echo
91+
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
92+
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
93+
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/smica.qhcp"
94+
@echo "To view the help file:"
95+
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/smica.qhc"
96+
97+
.PHONY: latex
98+
latex:
99+
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
100+
@echo
101+
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
102+
@echo "Run \`make' in that directory to run these through (pdf)latex" \
103+
"(use \`make latexpdf' here to do that automatically)."
104+
105+
.PHONY: latexpdf
106+
latexpdf:
107+
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
108+
@echo "Running LaTeX files through pdflatex..."
109+
$(MAKE) -C $(BUILDDIR)/latex all-pdf
110+
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
111+
112+
.PHONY: changes
113+
changes:
114+
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
115+
@echo
116+
@echo "The overview file is in $(BUILDDIR)/changes."
117+
118+
.PHONY: linkcheck
119+
linkcheck:
120+
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
121+
@echo
122+
@echo "Link check complete; look for any errors in the above output " \
123+
"or in $(BUILDDIR)/linkcheck/output.txt."
124+
125+
.PHONY: doctest
126+
doctest:
127+
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
128+
@echo "Testing of doctests in the sources finished, look at the " \
129+
"results in $(BUILDDIR)/doctest/output.txt."
130+
131+
.PHONY: coverage
132+
coverage:
133+
$(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
134+
@echo "Testing of coverage in the sources finished, look at the " \
135+
"results in $(BUILDDIR)/coverage/python.txt."
136+
137+
install:
138+
touch $(OUTPUTDIR)/.nojekyll
139+
ghp-import -m "Generate Pelican site [ci skip]" -b $(GITHUB_PAGES_BRANCH) $(OUTPUTDIR)
140+
git push origin $(GITHUB_PAGES_BRANCH)

0 commit comments

Comments
 (0)