Skip to content

Commit

Permalink
add more info to adhd example (#3739)
Browse files Browse the repository at this point in the history
* add more info to adhd example

* reformat with black

* change figsize

* Update examples/04_glm_first_level/plot_adhd_dmn.py

Co-authored-by: Yasmin <63292494+ymzayek@users.noreply.github.com>

---------

Co-authored-by: Remi Gau <remi_gau@hotmail.com>
Co-authored-by: Yasmin <63292494+ymzayek@users.noreply.github.com>
  • Loading branch information
3 people committed Jun 12, 2023
1 parent c93e89a commit b576d9f
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions examples/04_glm_first_level/plot_adhd_dmn.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
Default Mode Network extraction of ADHD dataset
===============================================
This example shows a full step-by-step workflow of fitting a GLM to data
This example shows a full step-by-step workflow of fitting a GLM to signal
extracted from a seed on the Posterior Cingulate Cortex and saving the results.
More precisely, this example shows how to use a signal extracted from a
seed region as the regressor in a GLM to determine the correlation
of each region in the dataset with the seed region.
More specifically:
Expand Down Expand Up @@ -39,9 +42,9 @@
pcc_coords = (0, -53, 26)

#########################################################################
# Estimate contrasts
# ------------------
# Specify the contrasts.
# Extract the seed region's time course
# -------------------------------------
# Extract the time course of the seed region.
seed_masker = NiftiSpheresMasker(
[pcc_coords],
radius=10,
Expand All @@ -56,6 +59,22 @@
)
seed_time_series = seed_masker.fit_transform(adhd_dataset.func[0])
frametimes = np.linspace(0, (n_scans - 1) * t_r, n_scans)

#########################################################################
# Plot the time course of the seed region.
import matplotlib.pyplot as plt

fig = plt.figure(figsize=(9, 3))
ax = fig.add_subplot(111)
ax.plot(frametimes, seed_time_series, linewidth=2, label="seed region")
ax.legend(loc=2)
ax.set_title("Time course of the seed region")
plt.show()

#########################################################################
# Estimate contrasts
# ------------------
# Specify the contrasts.
design_matrix = make_first_level_design_matrix(
frametimes,
hrf_model="spm",
Expand Down

0 comments on commit b576d9f

Please sign in to comment.