Skip to content

Commit 014d6eb

Browse files
authored
Bump jupyter-book from 1 to 2 (#74)
1 parent 4b50478 commit 014d6eb

425 files changed

Lines changed: 8219 additions & 278787 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ data/
33
_build/
44

55
# Generated figures (copied to docs/_images/ by Sphinx during build)
6-
content/figures/
6+
content/figures/*
7+
!content/figures/
8+
!content/figures/*animation.gif
79

810
.DS_Store
911

Makefile

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@
22
# `uv` honors UV_PROJECT_ENVIRONMENT to place the venv somewhere other than .venv.
33
export UV_PROJECT_ENVIRONMENT := meda
44

5+
# GitHub Pages serves this repository as a project site under this path.
6+
# MyST/Jupyter Book 2 uses BASE_URL to prefix CSS, JS, images, JSON, and route links.
7+
PAGES_BASE_URL ?= /multi-echo-data-analysis
8+
59
# Reproducible image outputs: matplotlib honors SOURCE_DATE_EPOCH and will stamp
610
# PNGs with a fixed timestamp instead of "now", so identical plots produce
711
# identical bytes (and identical content-hashed filenames in _images/).
812
# 1577836800 == 2020-01-01T00:00:00Z
913
export SOURCE_DATE_EPOCH := 1577836800
1014

11-
.PHONY: help check-env book clean serve sync-docs site-publish install runall build site
15+
.PHONY: help check-env book clean serve sync-docs site-publish install runall build preview-docs
1216

1317
help:
1418
@echo "Please use 'make <target>' where <target> is one of:"
@@ -17,9 +21,9 @@ help:
1721
@echo " book to activate 'meda' and build the Jupyter Book into _build/"
1822
@echo " clean to clean out site build files"
1923
@echo " runall to run all notebooks in-place, capturing outputs with the notebook"
20-
@echo " serve to serve the repository locally with Jekyll"
21-
@echo " build to build the site HTML and store in _site/"
22-
@echo " site to build the site HTML, store in _site/, and serve with Jekyll"
24+
@echo " serve to build and serve the site locally at http://localhost:3000"
25+
@echo " build to build the site HTML into _build/html/"
26+
@echo " preview-docs to serve committed docs/ files at the GitHub Pages base path"
2327
@echo " sync-docs to copy _build/html into docs/ for GitHub Pages"
2428
@echo " site-publish to build the book and sync docs/ (book + sync-docs)"
2529

@@ -35,25 +39,24 @@ check-env:
3539

3640
# Activate the 'meda' environment (via `uv run`) and build the book.
3741
book: check-env
38-
uv run --locked jupyter-book build ./
42+
BASE_URL=$(PAGES_BASE_URL) uv run --locked jupyter-book build --html --execute
3943

4044
sync-docs:
41-
python scripts/sync_docs.py
45+
uv run --locked python scripts/sync_docs.py
4246

4347
site-publish: book sync-docs
4448

4549
runall:
4650
jupyter-book run ./content
4751

4852
clean:
49-
python scripts/clean.py
53+
uv run --locked python scripts/clean.py
5054

51-
serve:
52-
bundle exec guard
55+
serve: check-env
56+
uv run --locked jupyter-book start
5357

5458
build: check-env
55-
uv run --locked jupyter-book build ./
59+
BASE_URL=$(PAGES_BASE_URL) uv run --locked jupyter-book build --html --execute
5660

57-
site: build
58-
bundle exec jekyll build
59-
touch _site/.nojekyll
61+
preview-docs:
62+
uv run --locked python scripts/serve_docs.py

_config.yml

Lines changed: 0 additions & 75 deletions
This file was deleted.

_toc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ parts:
2020
- file: content/fMRI_Sequences
2121
- file: content/Signal_Decay
2222
- file: content/TE_Dependence
23-
- file: content/plot_approach_figures.md
2423
- caption: Practical Resources
2524
chapters:
2625
- file: content/Multi_Echo_Datasets
@@ -36,6 +35,7 @@ parts:
3635
- file: content/06_Cerebrovascular_Reactivity_Mapping.md
3736
- file: content/07_Manual_Classification_with_rica.md
3837
- file: content/08_ICA_Based_Denoising.md
38+
- file: content/09_Advanced_Applications.md
3939
- caption: Final Thoughts
4040
chapters:
4141
- file: content/bibliography.md

content/01_Optimal_Combination_with_t2smap.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ glue_figure("figure_t2starmap", fig, display=False)
7676
:name: "figure_t2starmap"
7777
:align: center
7878
79-
T2* map estimated from multi-echo data using tedana's {py:func}`~tedana.workflows.t2smap_workflow`.
79+
T2* map estimated from multi-echo data using tedana's {external+tedana:py:func}`~tedana.workflows.t2smap_workflow`.
8080
```
8181

8282
```{code-cell} ipython3
@@ -102,7 +102,7 @@ glue_figure("figure_s0map", fig, display=False)
102102
:name: "figure_s0map"
103103
:align: center
104104
105-
S0 map estimated from multi-echo data using tedana's {py:func}`~tedana.workflows.t2smap_workflow`.
105+
S0 map estimated from multi-echo data using tedana's {external+tedana:py:func}`~tedana.workflows.t2smap_workflow`.
106106
```
107107

108108
```{code-cell} ipython3

content/02_Volume-wise_T2star_estimation_with_t2smap.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ kernelspec:
1212

1313
# Volume-wise T2*/S0 estimation with `t2smap`
1414

15-
Use {py:func}`tedana.workflows.t2smap_workflow` {cite:p}`DuPre2021` to calculate volume-wise T2*/S0,
15+
Use {external+tedana:py:func}`tedana.workflows.t2smap_workflow` {cite:p}`DuPre2021` to calculate volume-wise T2*/S0,
1616
as in {cite:t}`power2018ridding` and {cite:t}`heunis2021effects`.
1717

1818
```{code-cell} ipython3

content/03_Denoising_with_tedana.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ kernelspec:
1414

1515
In this analysis tutorial, we will use `tedana` {cite:p}`DuPre2021` to perform multi-echo denoising.
1616

17-
Specifically, we will use {py:func}`tedana.workflows.tedana_workflow`.
17+
Specifically, we will use {external+tedana:py:func}`tedana.workflows.tedana_workflow`.
1818

1919
```{code-cell} ipython3
2020
import json

content/08_ICA_Based_Denoising.md

Lines changed: 40 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ To remove noise from your data, you can regress the "bad" components out of it,
1818

1919
Let's start by loading the necessary data.
2020

21-
````{tab} Python
21+
:::::{tab-set}
22+
::::{tab-item} Python
2223
```python
2324
import numpy as np
2425
import pandas as pd
@@ -44,30 +45,32 @@ arr = arr.T
4445
# The first dimension should be time
4546
assert arr.shape[1] == mixing.shape[0]
4647
```
47-
````
48-
````{tab} FSL
48+
::::
49+
::::{tab-item} FSL
4950
```bash
5051
data_file=preprocessed_data.nii.gz
5152
mixing_file=mixing.tsv
5253
mask_file=mask.nii.gz
5354
den_idx=(0, 1, 2, 3, 4, 5)
5455
```
55-
````
56-
````{tab} AFNI
56+
::::
57+
::::{tab-item} AFNI
5758
```bash
5859
data_file=preprocessed_data.nii.gz
5960
mixing_file=mixing.tsv
6061
mask_file=mask.nii.gz
6162
den_idx=(0, 1, 2, 3, 4, 5)
6263
```
63-
````
64+
::::
65+
:::::
6466

6567
## Aggressive Denoising
6668

6769
If you regress just nuisance regressors (i.e., rejected components) out of your data,
6870
then retain the residuals for further analysis, you are doing aggressive denoising.
6971

70-
````{tab} Python
72+
:::::{tab-set}
73+
::::{tab-item} Python
7174
```python
7275
# Fit GLM to bad components only
7376
betas = np.linalg.lstsq(motion_components, arr, rcond=None)[0]
@@ -80,24 +83,26 @@ arr_denoised = arr - pred_arr
8083
img_denoised = masking.unmask(arr_denoised.T, data['mask'])
8184
img_denoised.to_filename("denoised.nii.gz")
8285
```
83-
````
84-
````{tab} FSL
86+
::::
87+
::::{tab-item} FSL
8588
```bash
8689
3dcalc --input stuff
8790
```
88-
````
89-
````{tab} AFNI
91+
::::
92+
::::{tab-item} AFNI
9093
```bash
9194
3dcalc --input stuff
9295
```
93-
````
96+
::::
97+
:::::
9498

9599
## Non-Aggressive Denoising
96100

97101
If you include both nuisance regressors and regressors of interest in your regression,
98102
you are doing nonaggressive denoising.
99103

100-
````{tab} Python
104+
:::::{tab-set}
105+
::::{tab-item} Python
101106
```python
102107
# Fit GLM to all components
103108
betas = np.linalg.lstsq(mixing, arr, rcond=None)[0]
@@ -110,17 +115,18 @@ arr_denoised = arr - pred_arr
110115
img_denoised = masking.unmask(arr_denoised.T, data['mask'])
111116
img_denoised.to_filename("denoised.nii.gz")
112117
```
113-
````
114-
````{tab} FSL
118+
::::
119+
::::{tab-item} FSL
115120
```bash
116121
3dcalc --input stuff
117122
```
118-
````
119-
````{tab} AFNI
123+
::::
124+
::::{tab-item} AFNI
120125
```bash
121126
3dcalc --input stuff
122127
```
123-
````
128+
::::
129+
:::::
124130

125131
## Component orthogonalization
126132

@@ -130,7 +136,8 @@ If you want to ensure that variance shared between the accepted and rejected com
130136
you may wish to orthogonalize the rejected components with respect to the accepted components.
131137
This way, you can regress the rejected components out of the data in the form of, what we call, "pure evil" components.
132138

133-
````{tab} Python
139+
:::::{tab-set}
140+
::::{tab-item} Python
134141
```python
135142
good_idx = np.setdiff1d(np.arange(mixing.shape[1]), den_idx)
136143

@@ -146,21 +153,23 @@ orth_motion_components = bad_mixing - pred_bad_mixing
146153
# Replace the old component time series in the mixing matrix with the new ones
147154
mixing[:, den_idx] = orth_motion_components
148155
```
149-
````
150-
````{tab} FSL
156+
::::
157+
::::{tab-item} FSL
151158
```bash
152159
3dcalc --input stuff
153160
```
154-
````
155-
````{tab} AFNI
161+
::::
162+
::::{tab-item} AFNI
156163
```bash
157164
3dcalc --input stuff
158165
```
159-
````
166+
::::
167+
:::::
160168

161169
Once you have these "pure evil" components, you can perform aggressive denoising on the data.
162170

163-
````{tab} Python
171+
:::::{tab-set}
172+
::::{tab-item} Python
164173
```python
165174
# Fit GLM to bad components only
166175
betas = np.linalg.lstsq(orth_motion_components, arr, rcond=None)[0]
@@ -173,14 +182,15 @@ arr_denoised = arr - pred_arr
173182
img_denoised = masking.unmask(arr_denoised.T, data['mask'])
174183
img_denoised.to_filename("denoised.nii.gz")
175184
```
176-
````
177-
````{tab} FSL
185+
::::
186+
::::{tab-item} FSL
178187
```bash
179188
3dcalc --input stuff
180189
```
181-
````
182-
````{tab} AFNI
190+
::::
191+
::::{tab-item} AFNI
183192
```bash
184193
3dcalc --input stuff
185194
```
186-
````
195+
::::
196+
:::::

0 commit comments

Comments
 (0)