Skip to content
This repository has been archived by the owner on May 26, 2023. It is now read-only.

Commit

Permalink
Day 7 pages
Browse files Browse the repository at this point in the history
  • Loading branch information
effigies committed Mar 1, 2022
1 parent 4748fe7 commit 0dcbf5c
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 131 deletions.
4 changes: 0 additions & 4 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,9 @@ exclude_patterns:
- pages/markdown.md
- pages/mentors.md
- pages/methods_vs_functions.Rmd
- pages/model_one_voxel.Rmd
- pages/multi_model_homework.md
- pages/multi_multiply.Rmd
- pages/nans.md
- pages/newaxis.Rmd
- pages/non_tr_onsets.Rmd
- pages/numpy_diag.Rmd
- pages/numpy_meshgrid.Rmd
- pages/numpy_random.Rmd
Expand All @@ -99,7 +96,6 @@ exclude_patterns:
- pages/subplots.Rmd
- pages/subtract_mean_math.md
- pages/subtract_means.Rmd
- pages/test_one_voxel.Rmd
- pages/topics.md
- pages/tr_and_headers.Rmd
- pages/two_dunders.md
Expand Down
4 changes: 4 additions & 0 deletions _toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ parts:
- caption: Hemodynamic response modeling
chapters:
- file: pages/convolution_background
- file: pages/model_one_voxel
- file: pages/test_one_voxel
- file: pages/multi_multiply
- file: pages/non_tr_onsets
- caption: Code organization and collaboration
chapters:
# - file: pages/git_walk_through
Expand Down
38 changes: 6 additions & 32 deletions pages/model_one_voxel.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ jupyter:
format_name: rmarkdown
format_version: '1.2'
jupytext_version: 1.11.5
kernelspec:
display_name: Python 3 (ipykernel)
language: python
name: python3
---

$\newcommand{L}[1]{\| #1 \|}\newcommand{VL}[1]{\L{ \vec{#1} }}\newcommand{R}[1]{\operatorname{Re}\,(#1)}\newcommand{I}[1]{\operatorname{Im}\, (#1)}$

## Modeling a single voxel
# Modeling a single voxel

Earlier – Voxel time courses – we were looking at a single voxel
time course.
Expand All @@ -30,7 +32,7 @@ we discovered in First go at brain activation exercise:

```{python}
img = nib.load('ds114_sub009_t2r1.nii')
data = img.get_data()
data = img.get_fdata()
data = data[..., 4:]
```

Expand Down Expand Up @@ -116,31 +118,3 @@ print(np.sum(e_vec ** 2))
plt.plot(voxel_time_course)
plt.plot(y_hat)
```

<!-- vim:ft=rst -->
<!-- Course -->
<!-- BIC -->
<!-- Python distributions -->
<!-- Version control -->
<!-- Editors -->
<!-- Python and common libraries -->
<!-- IPython -->
<!-- Virtualenv and helpers -->
<!-- Pypi and packaging -->
<!-- Mac development -->
<!-- Windows development -->
<!-- Nipy and friends -->
<!-- FMRI datasets -->
<!-- Languages -->
<!-- Imaging software -->
<!-- Installation -->
<!-- Tutorials -->
<!-- MB tutorials -->
<!-- Ideas -->
<!-- Psych-214 -->
<!-- People -->
<!-- Licenses -->
<!-- Neuroimaging stuff -->
<!-- OpenFMRI projects -->
<!-- Unix -->
<!-- Substitutions -->
36 changes: 5 additions & 31 deletions pages/multi_multiply.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ jupyter:
format_name: rmarkdown
format_version: '1.2'
jupytext_version: 1.11.5
kernelspec:
display_name: Python 3 (ipykernel)
language: python
name: python3
---

$\newcommand{L}[1]{\| #1 \|}\newcommand{VL}[1]{\L{ \vec{#1} }}\newcommand{R}[1]{\operatorname{Re}\,(#1)}\newcommand{I}[1]{\operatorname{Im}\, (#1)}$

## Estimation for many voxels at the same time
# Estimation for many voxels at the same time

We often want to fit the same design to many different voxels.

Expand Down Expand Up @@ -66,31 +68,3 @@ betas
```

Of course this is true for any number of columns of Y.

<!-- vim:ft=rst -->
<!-- Course -->
<!-- BIC -->
<!-- Python distributions -->
<!-- Version control -->
<!-- Editors -->
<!-- Python and common libraries -->
<!-- IPython -->
<!-- Virtualenv and helpers -->
<!-- Pypi and packaging -->
<!-- Mac development -->
<!-- Windows development -->
<!-- Nipy and friends -->
<!-- FMRI datasets -->
<!-- Languages -->
<!-- Imaging software -->
<!-- Installation -->
<!-- Tutorials -->
<!-- MB tutorials -->
<!-- Ideas -->
<!-- Psych-214 -->
<!-- People -->
<!-- Licenses -->
<!-- Neuroimaging stuff -->
<!-- OpenFMRI projects -->
<!-- Unix -->
<!-- Substitutions -->
1 change: 1 addition & 0 deletions pages/new_cond.txt
36 changes: 5 additions & 31 deletions pages/non_tr_onsets.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ jupyter:
format_name: rmarkdown
format_version: '1.2'
jupytext_version: 1.11.5
kernelspec:
display_name: Python 3 (ipykernel)
language: python
name: python3
---

$\newcommand{L}[1]{\| #1 \|}\newcommand{VL}[1]{\L{ \vec{#1} }}\newcommand{R}[1]{\operatorname{Re}\,(#1)}\newcommand{I}[1]{\operatorname{Im}\, (#1)}$

## Using onsets that do not start on a TR
# Using onsets that do not start on a TR

You’ll need the file `new_cond.txt` to type along with this
demonstration.
Expand Down Expand Up @@ -184,31 +186,3 @@ plt.plot(tr_times[:20], tr_hemo[:20], 'x:')
plt.xlabel('Time (seconds)')
plt.ylabel('Convolved values at TR onsets')
```

<!-- vim:ft=rst -->
<!-- Course -->
<!-- BIC -->
<!-- Python distributions -->
<!-- Version control -->
<!-- Editors -->
<!-- Python and common libraries -->
<!-- IPython -->
<!-- Virtualenv and helpers -->
<!-- Pypi and packaging -->
<!-- Mac development -->
<!-- Windows development -->
<!-- Nipy and friends -->
<!-- FMRI datasets -->
<!-- Languages -->
<!-- Imaging software -->
<!-- Installation -->
<!-- Tutorials -->
<!-- MB tutorials -->
<!-- Ideas -->
<!-- Psych-214 -->
<!-- People -->
<!-- Licenses -->
<!-- Neuroimaging stuff -->
<!-- OpenFMRI projects -->
<!-- Unix -->
<!-- Substitutions -->
40 changes: 7 additions & 33 deletions pages/test_one_voxel.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ jupyter:
format_name: rmarkdown
format_version: '1.2'
jupytext_version: 1.11.5
kernelspec:
display_name: Python 3 (ipykernel)
language: python
name: python3
---

$\newcommand{L}[1]{\| #1 \|}\newcommand{VL}[1]{\L{ \vec{#1} }}\newcommand{R}[1]{\operatorname{Re}\,(#1)}\newcommand{I}[1]{\operatorname{Im}\, (#1)}$

## Testing a single voxel
# Testing a single voxel

A short ago (Modeling a single voxel), we were modeling a single voxel time
course.
Expand All @@ -27,7 +29,7 @@ np.set_printoptions(precision=4)
```{python}
import nibabel as nib
img = nib.load('ds114_sub009_t2r1.nii')
data = img.get_data()
data = img.get_fdata()
data = data[..., 4:]
```

Expand Down Expand Up @@ -155,7 +157,7 @@ p = 1 - ltp # upper tail p
p
```

## Compare our manual estimation to R
# Compare our manual estimation to R

Finally let’s save the voxel time course for us to compare this analysis to
the `lm` estimation in R:
Expand All @@ -178,31 +180,3 @@ convolved = convolved[-(1:4)]
res = lm(voxels ~ convolved)
print(summary(res))
```

<!-- vim:ft=rst -->
<!-- Course -->
<!-- BIC -->
<!-- Python distributions -->
<!-- Version control -->
<!-- Editors -->
<!-- Python and common libraries -->
<!-- IPython -->
<!-- Virtualenv and helpers -->
<!-- Pypi and packaging -->
<!-- Mac development -->
<!-- Windows development -->
<!-- Nipy and friends -->
<!-- FMRI datasets -->
<!-- Languages -->
<!-- Imaging software -->
<!-- Installation -->
<!-- Tutorials -->
<!-- MB tutorials -->
<!-- Ideas -->
<!-- Psych-214 -->
<!-- People -->
<!-- Licenses -->
<!-- Neuroimaging stuff -->
<!-- OpenFMRI projects -->
<!-- Unix -->
<!-- Substitutions -->

0 comments on commit 0dcbf5c

Please sign in to comment.