├── .gitignore
├── baseplot1.png
├── baseplot2.png
├── baseplot3.png
├── book
├── assets
│ └── assessments
│ │ ├── accessingDatainRAssessment.html
│ │ ├── assessTemplate.html
│ │ ├── dataPandasAssessment.html
│ │ ├── emacsBeginningAssessment.html
│ │ ├── finalProjectAssessment.html
│ │ ├── firstRmdAssessment.html
│ │ ├── forLoopPythonAssessment.html
│ │ ├── githubIDAssessment.html
│ │ ├── githubPullRequestAssmnt.html
│ │ ├── hangmanPython.html
│ │ ├── hangmanRAssessment.html
│ │ ├── installEmacs.html
│ │ ├── installXubuntuAssessment.html
│ │ ├── plottingRandPyAssessment.html
│ │ ├── psychopyAssessment.html
│ │ ├── rStudioInstallationWinMacAssessment.html
│ │ ├── reportGenAssessment.html
│ │ ├── rmd2htmlRstudio.html
│ │ └── terminal.html
├── baseplot1.png
├── baseplot2.png
├── baseplot3.png
├── basic-plotting.html
├── beginning-python.html
├── beginning-r.html
├── codeExamples
│ ├── brainsInR
│ │ ├── brains_in_R_kaitlin.html
│ │ └── readme.org
│ ├── emacsInit
│ │ └── readme.org
│ ├── plottingExample
│ │ ├── baseplot1.png
│ │ ├── baseplot2.png
│ │ ├── baseplot3.png
│ │ ├── ggplot1.png
│ │ ├── plotExampleJuly2022
│ │ │ ├── mypyplot.png
│ │ │ ├── myrplot.png
│ │ │ ├── readme.org
│ │ │ ├── test.html
│ │ │ └── test.org
│ │ ├── plottingRandPy.html
│ │ ├── plottingRandPy.org
│ │ ├── py-inter-fit-plt.png
│ │ ├── py-inter-plt.png
│ │ └── simplePlot.png
│ ├── presents
│ │ ├── test.png
│ │ ├── testBeamer.html
│ │ └── testBeamer.org
│ ├── reportGen
│ │ ├── simplePlot.png
│ │ ├── testLatex.html
│ │ ├── testLatex.org
│ │ ├── testRBabel.html
│ │ ├── testRBabel.org
│ │ ├── testRBabelBib.html
│ │ └── testRBabelBib.org
│ ├── simpOrgDemoFile.html
│ ├── simpOrgDemoFile.org
│ ├── simpleOrgExamples
│ │ ├── minimalPython.html
│ │ └── minimalPython.org
│ └── simplePlot.png
├── contents.html
├── emacs.html
├── example-os.png
├── ggplot1.png
├── index.html
├── linux.html
├── myrplot.png
├── programming-psychology-experiments.html
├── py-inter-fit-plt.png
├── report-writing.html
├── rstudio.html
├── simplePlot.png
├── terminal.html
├── test.png
├── version-control.html
└── working-with-data-in-python.html
├── chapters
├── HSQ.zip
├── HSQ
│ ├── codebook.txt
│ └── data.csv
├── assets
│ ├── assessments
│ │ ├── accessingDatainRAssessment.org
│ │ ├── assessTemplate.org
│ │ ├── dataPandasAssessment.org
│ │ ├── emacsBeginningAssessment.org
│ │ ├── finalProjectAssessment.org
│ │ ├── firstRmdAssessment.org
│ │ ├── forLoopPythonAssessment.org
│ │ ├── githubIDAssessment.org
│ │ ├── githubPullRequestAssmnt.org
│ │ ├── hangmanPython.org
│ │ ├── hangmanRAssessment.org
│ │ ├── installEmacs.org
│ │ ├── installXubuntuAssessment.org
│ │ ├── plottingRandPyAssessment.org
│ │ ├── psychopyAssessment.org
│ │ ├── rStudioInstallationWinMacAssessment.org
│ │ ├── reportGenAssessment.org
│ │ ├── rmd2htmlRstudio.org
│ │ └── terminal.org
│ └── chicago-note-bibliography-16th-edition.csl
├── backup.txt
├── baseplot1.png
├── baseplot2.png
├── baseplot3.png
├── basic-plotting.org
├── beginning-python.org
├── beginning-r.org
├── codeExamples
│ ├── brainsInR
│ │ ├── brains_in_R_kaitlin.Rmd
│ │ ├── brains_in_R_kaitlin.html
│ │ └── readme.org
│ ├── emacsInit
│ │ ├── init.el
│ │ └── readme.org
│ ├── pandas
│ │ └── getDataPandasExample.py
│ ├── plottingExample
│ │ ├── baseplot1.png
│ │ ├── baseplot2.png
│ │ ├── baseplot3.png
│ │ ├── ggplot1.png
│ │ ├── plotExampleJuly2022
│ │ │ ├── mypyplot.png
│ │ │ ├── myrplot.png
│ │ │ ├── readme.org
│ │ │ ├── test.html
│ │ │ └── test.org
│ │ ├── plottingRandPy.html
│ │ ├── plottingRandPy.org
│ │ ├── py-inter-fit-plt.png
│ │ ├── py-inter-plt.png
│ │ └── simplePlot.png
│ ├── presents
│ │ ├── test.png
│ │ └── testBeamer.org
│ ├── reportGen
│ │ ├── simplePlot.png
│ │ ├── test.bib
│ │ ├── testLatex.org
│ │ ├── testRBabel.org
│ │ └── testRBabelBib.org
│ ├── simpOrgDemoFile.org
│ ├── simplePlot.png
│ └── term
│ │ └── simpleTermEx.sh
├── contents.org
├── emacs.org
├── example-os.png
├── ggplot1.png
├── i2c4p.bib
├── index.org
├── linux.org
├── myrplot.png
├── programming-psychology-experiments.org
├── py-inter-fit-plt.png
├── report-writing.org
├── rstudio.org
├── simplePlot.png
├── terminal.org
├── version-control.org
└── working-with-data-in-python.org
├── ggplot1.png
├── index.html
├── index.org
├── myrplot.png
├── notes4nexttime.org
├── readme.org
├── simplePlot.png
└── topics
├── beginningPython.org
├── beginningR.org
├── emacs.org
├── emacsPythonIdeInstructions.org
├── githubIDBasics.org
├── githubPullRequest.org
├── installTestPsychopy.org
├── installUbuntu.org
├── installingR.org
├── installingUbuntu_MacVersion.org
├── intro2TheTerminal.html
├── intro2TheTerminal.org
├── plottingRandPy.org
├── pythonData.org
├── rStudioWinMacFirstSteps.html
├── rStudioWinMacFirstSteps.org
├── readme.org
└── reportWriting.org
/.gitignore:
--------------------------------------------------------------------------------
1 | auto/
2 | *.*~
3 | venv/
4 | __pycache__/
5 | *.synctex
6 | .Rhistory
7 | *.aux
8 | *.toc
9 | *.out
10 | *.blg
11 | *.bbl
12 | *.log
13 | *.*#
14 | *.#*
15 | .RData
16 | code/*.pyc
17 |
--------------------------------------------------------------------------------
/baseplot1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brittAnderson/Intro2Computing4Psychology/120f5eb3277787903df30de6c2f23484fed0fda0/baseplot1.png
--------------------------------------------------------------------------------
/baseplot2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brittAnderson/Intro2Computing4Psychology/120f5eb3277787903df30de6c2f23484fed0fda0/baseplot2.png
--------------------------------------------------------------------------------
/baseplot3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brittAnderson/Intro2Computing4Psychology/120f5eb3277787903df30de6c2f23484fed0fda0/baseplot3.png
--------------------------------------------------------------------------------
/book/assets/assessments/githubIDAssessment.html:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
235 |
Author: Britt Anderson
236 |
Created: 2023-04-23 Sun 11:52
237 |
Validate
238 |
239 |
240 |
--------------------------------------------------------------------------------
/book/assets/assessments/installXubuntuAssessment.html:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
229 |
Author: Britt Anderson
230 |
Created: 2023-04-23 Sun 11:52
231 |
Validate
232 |
233 |
234 |
--------------------------------------------------------------------------------
/book/baseplot1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brittAnderson/Intro2Computing4Psychology/120f5eb3277787903df30de6c2f23484fed0fda0/book/baseplot1.png
--------------------------------------------------------------------------------
/book/baseplot2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brittAnderson/Intro2Computing4Psychology/120f5eb3277787903df30de6c2f23484fed0fda0/book/baseplot2.png
--------------------------------------------------------------------------------
/book/baseplot3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brittAnderson/Intro2Computing4Psychology/120f5eb3277787903df30de6c2f23484fed0fda0/book/baseplot3.png
--------------------------------------------------------------------------------
/book/codeExamples/brainsInR/brains_in_R_kaitlin.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
fsbrain examples
67 | Kaitlin Gaerlan
68 | 01/10/2020
69 |
70 |
71 |
72 |
73 |
74 |
Installing fsbrain
75 |
The fsbrain package exists on CRAN To install the package on rstudio, use the following code:
76 |
install.packages("fsbrain");
77 |
You might get a warning message that prompts you to install Rtools, but this package seems to work without it so you can just continue.
78 |
79 |
80 |
Annotated Brain
81 |
Use the following code to load the fsbrain library and download the data needed for the visualizations:
82 |
library("fsbrain");
83 | fsbrain::download_optional_data();
84 | subjects_dir = fsbrain::get_optional_data_filepath("subjects_dir");
85 | subjects_list = c("subject1", "subject2");
86 | subject_id = 'subject1';
87 |
You can now use this code to generate a visualization of the brain that divides it into different sections:
88 |
vis.subject.annot(subjects_dir, 'subject1', 'aparc', 'both', views=c('si'));
89 |
A window should open with a brain like the one pictured below, but you should be able to grab it with your mouse and move it around.
90 |
91 |
95 |
96 |
97 |
98 |
Adding a colourbar
99 |
Using the same data from the first example, you can use this code to create an image that includes a colourbar. This graph is showing the range of thickness in the brain, but you can change the measure to something else like volume. You can also rotate this image once it’s generated.
100 |
rgloptions=list("windowRect"=c(50, 50, 1000, 1000)); # larger plot
101 | surface = 'white';
102 | measure = 'thickness';
103 | vis.subject.morph.native(subjects_dir, subject_id, measure, 'both', views=c('si'), rgloptions=rgloptions, draw_colorbar = TRUE);
104 |
105 |
109 |
110 |
111 |
112 |
Lightbox Slices
113 |
If you install and load the “magick” package, you can look at brain volume, which is visualized by brain slices using the code below.
114 |
install.packages("magick")
115 | library("magick")
116 | brain = subject.volume(subjects_dir, subject_id, 'brain') / 255;
117 | bounded_brain = vol.boundary.box(brain, apply=TRUE);
118 | volvis.lightbox(bounded_brain);
119 |
120 |
124 |
125 |
126 |
127 |
Masks
128 |
You can mask certain areas to isolate others. Use the code below and then compare to the image generated from the very first example. You’ll notice that it’s the same image but with the green area isolated.
129 |
surface = 'white';
130 | hemi = 'both';
131 | atlas = 'aparc';
132 | region = 'bankssts';
133 |
134 | # Create a mask from a region of an annotation:
135 | lh_annot = subject.annot(subjects_dir, subject_id, 'lh', atlas);
136 | rh_annot = subject.annot(subjects_dir, subject_id, 'rh', atlas);
137 | lh_label = label.from.annotdata(lh_annot, region);
138 | rh_label = label.from.annotdata(rh_annot, region);
139 | lh_mask = mask.from.labeldata.for.hemi(lh_label, length(lh_annot$vertices));
140 | rh_mask = mask.from.labeldata.for.hemi(rh_label, length(rh_annot$vertices));
141 |
142 | # visualize it
143 | vis.mask.on.subject(subjects_dir, subject_id, lh_mask, rh_mask);
144 |
145 |
149 |
150 |
151 |
152 |
Surface Options
153 |
For any visualization, you can add and change the “surface” parameter to change the texture of the brain. The past examples use “white” as default, but you can also use “pial” or “inflated”. The code below generates three different images of the same brain, with the three different surfaces.
154 |
vis.subject.morph.native(subjects_dir, subject_id, 'thickness', hemi='both', views=c('si'))
155 | vis.subject.morph.native(subjects_dir, subject_id, 'thickness', hemi='both', views=c('si'), surface='pial')
156 | vis.subject.morph.native(subjects_dir, subject_id, 'thickness', hemi='both', views=c('si'), surface='inflated')
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
--------------------------------------------------------------------------------
/book/codeExamples/brainsInR/readme.org:
--------------------------------------------------------------------------------
1 | * Read-me
2 |
3 | A student in the Fall 2020 offering did a Rmd file on using the Brains in R toolbox. The Rmd file and exported HTML are saved here as an example.
4 |
5 |
--------------------------------------------------------------------------------
/book/codeExamples/emacsInit/readme.org:
--------------------------------------------------------------------------------
1 | # -*- org-link-file-path-type: relative; -*-
2 | #+Title: Readme for Emacs Init
3 |
4 | * Purpose
5 | To provide a minimal emacs init example.
6 |
7 | * Emacs initialization
8 | This is the process emacs follows when it starts. All computers and all programs have something similar. Emacs reads a file to see what to do when it starts. It has coded into it where to look for those files and what they are called. Most contemporary advice is to use =~/.emacs.d/init.el= as the initialization file. For that to work you may have to get rid of =~/.emacs= first.
9 |
10 | * The init file
11 | A [[file:init.el][minimal version]] of an emacs init file is found in this same directory.
12 |
13 |
14 | * Testing (requires an internet connection)
15 | 1. Copy the init file as instructed in the commented points numbered 1 to 5 in the init file.
16 | 2. *If* you get no errors then delete those commented lines and save the file. Close emacs. Restart.
17 | 3. *If* you still have no errors run,
18 | =M-x package-list-packages=
19 |
20 | This should refresh the list of packages. Now you can search for (=C-s=) "use-package". When you find it mark it with an "i" for installation, and then an "x" for execute. You should see stuff happening that is the installation.
21 | 4. If that worked without errors open up your init file and uncomment (delete the two semi-colons) the lines for the magit package. Save. Now when you close and restart emacs it should install the magit package. You should see no errors.
22 | ** Orgmode and Org Babel
23 | If you have the above working then you will want to be able to have the right functions set up for using orgmode that the course requires. That will involve some additional elisp code to be cut and pasted into your init.el file. Here is the code you need (the stuff between the begin and end lines):
24 |
25 | #+begin_src elisp :eval never
26 | (setq org-confirm-babel-evaluate nil)
27 | (setq org-babel-python-command "python3")
28 | (org-babel-do-load-languages
29 | 'org-babel-load-languages
30 | '((emacs-lisp . t)
31 | (R . t)
32 | (python . t)))
33 | #+end_src
34 |
35 | You may need to save, and restart emacs for this to take effect.
36 | ** Using Emacs and Org for Running R and Python
37 | In addition to what you do in emacs you need to have installed R and python to your computer first. Then, if you want some nice syntax highlighting for python install the =elpy= package. And to be able to run =R= inside emacs install the ess package. Below are the two "use-package" snippets you will need to add to your init.el file to get them downloaded and installed the next time you start emacs[fn:1].
38 |
39 | #+begin_src elisp :eval never
40 | (use-package elpy
41 | :ensure t
42 | :init (elpy-enable))
43 |
44 | (use-package ess
45 | :ensure t
46 | )
47 | #+end_src
48 |
49 | * Footnotes
50 |
51 | [fn:1] There are ways to trigger this installation without restarting emacs all the time, but that is a safe way to start and helps you see when you have made an error. Then when you start emacs it will warn you if there is a syntax error in your start-up (init) script.
52 |
--------------------------------------------------------------------------------
/book/codeExamples/plottingExample/baseplot1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brittAnderson/Intro2Computing4Psychology/120f5eb3277787903df30de6c2f23484fed0fda0/book/codeExamples/plottingExample/baseplot1.png
--------------------------------------------------------------------------------
/book/codeExamples/plottingExample/baseplot2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brittAnderson/Intro2Computing4Psychology/120f5eb3277787903df30de6c2f23484fed0fda0/book/codeExamples/plottingExample/baseplot2.png
--------------------------------------------------------------------------------
/book/codeExamples/plottingExample/baseplot3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brittAnderson/Intro2Computing4Psychology/120f5eb3277787903df30de6c2f23484fed0fda0/book/codeExamples/plottingExample/baseplot3.png
--------------------------------------------------------------------------------
/book/codeExamples/plottingExample/ggplot1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brittAnderson/Intro2Computing4Psychology/120f5eb3277787903df30de6c2f23484fed0fda0/book/codeExamples/plottingExample/ggplot1.png
--------------------------------------------------------------------------------
/book/codeExamples/plottingExample/plotExampleJuly2022/mypyplot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brittAnderson/Intro2Computing4Psychology/120f5eb3277787903df30de6c2f23484fed0fda0/book/codeExamples/plottingExample/plotExampleJuly2022/mypyplot.png
--------------------------------------------------------------------------------
/book/codeExamples/plottingExample/plotExampleJuly2022/myrplot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brittAnderson/Intro2Computing4Psychology/120f5eb3277787903df30de6c2f23484fed0fda0/book/codeExamples/plottingExample/plotExampleJuly2022/myrplot.png
--------------------------------------------------------------------------------
/book/codeExamples/plottingExample/plotExampleJuly2022/readme.org:
--------------------------------------------------------------------------------
1 | A simple org file for testing plotting in python and R that worked in July 2022 on xubuntu.
2 |
--------------------------------------------------------------------------------
/book/codeExamples/plottingExample/plotExampleJuly2022/test.org:
--------------------------------------------------------------------------------
1 | #+Title: New test file for plotting
2 |
3 | * Python
4 |
5 |
6 | #+begin_src python :session *tst* :results silent :exports code
7 | import random as r
8 | import matplotlib
9 | from matplotlib import pyplot as plt
10 | #+end_src
11 |
12 | #+begin_src python :session *tst* :results file replace :exports both
13 | x = [r.random() for _ in range(10)]
14 | y = [r.random() for _ in range(10)]
15 | plt.plot(x,y,'bo')
16 | plt.savefig('./mypyplot.png')
17 | './mypyplot.png'
18 | #+end_src
19 |
20 | #+RESULTS:
21 | [[file:./mypyplot.png]]
22 |
23 | * R
24 |
25 |
26 | #+begin_src R :session *rtst*
27 | x = rnorm(10)
28 | y = rnorm(10)
29 | x
30 | #+end_src
31 |
32 | #+RESULTS:
33 | | -1.02260337386554 |
34 | | -0.970579796288701 |
35 | | 0.590838748829838 |
36 | | -1.24564293974992 |
37 | | 0.57971124057528 |
38 | | 0.0368641706338224 |
39 | | 1.09273067999275 |
40 | | 1.16276136392997 |
41 | | 0.720597366358001 |
42 | | 0.170190446483275 |
43 |
44 | #+begin_src R :session *rtst* :results output graphics file :file ./myrplot.png :exports both
45 | plot(x,y)
46 | #+end_src
47 |
48 | #+RESULTS:
49 | [[file:./myrplot.png]]
50 |
--------------------------------------------------------------------------------
/book/codeExamples/plottingExample/py-inter-fit-plt.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brittAnderson/Intro2Computing4Psychology/120f5eb3277787903df30de6c2f23484fed0fda0/book/codeExamples/plottingExample/py-inter-fit-plt.png
--------------------------------------------------------------------------------
/book/codeExamples/plottingExample/py-inter-plt.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brittAnderson/Intro2Computing4Psychology/120f5eb3277787903df30de6c2f23484fed0fda0/book/codeExamples/plottingExample/py-inter-plt.png
--------------------------------------------------------------------------------
/book/codeExamples/plottingExample/simplePlot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brittAnderson/Intro2Computing4Psychology/120f5eb3277787903df30de6c2f23484fed0fda0/book/codeExamples/plottingExample/simplePlot.png
--------------------------------------------------------------------------------
/book/codeExamples/presents/test.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brittAnderson/Intro2Computing4Psychology/120f5eb3277787903df30de6c2f23484fed0fda0/book/codeExamples/presents/test.png
--------------------------------------------------------------------------------
/book/codeExamples/presents/testBeamer.org:
--------------------------------------------------------------------------------
1 | #+options: ':nil *:t -:t ::t <:t H:2 \n:nil ^:t arch:headline
2 | #+options: author:t broken-links:nil c:nil creator:nil
3 | #+options: d:(not "LOGBOOK") date:t e:t email:nil f:t inline:t num:t
4 | #+options: p:nil pri:nil prop:nil stat:t tags:t tasks:t tex:t
5 | #+options: timestamp:t title:t toc:t todo:t |:t
6 | #+title: testBeamer
7 | #+date: <2019-12-03 Tue>
8 | #+author: Britt Anderson
9 | #+email: britt@uwaterloo.ca
10 | #+language: en
11 | #+select_tags: export
12 | #+exclude_tags: noexport
13 | #+creator: Emacs 26.3 (Org mode 9.2.6)
14 | #+latex_class: article
15 | #+latex_class_options:
16 | #+latex_header:
17 | #+latex_header_extra:
18 | #+description:
19 | #+keywords:
20 | #+subtitle:
21 | #+latex_compiler: pdflatex
22 | #+date: \today
23 | #+startup: beamer
24 | #+Latex_Class: beamer
25 | #+Latex_Class_Options: [bigger]
26 | #+Beamer_Frame_Level: 2
27 |
28 | * This is the title of my slide show
29 |
30 | ** This is a slide
31 | Here is some important text.
32 |
33 | ** Another side with some math
34 | $\Sigma_{i=1}^n i$
35 |
36 |
37 | ** Let's look at some code
38 |
39 | What is the correlation between height and weight in women? We can use the built in dataset =women= in R.
40 |
41 | #+Begin_src R :exports both :results output
42 | print(with(women,cor(height,weight)))
43 | #+End_src
44 |
45 | #+RESULTS:
46 | : [1] 0.9954948
47 |
48 | ** Including a plot
49 |
50 | #+Begin_src R :exports both :results value graphics :file test.png :height 200 :width 300
51 | print(with(women,plot(height,weight)))
52 | #+End_src
53 |
54 | #+Caption: Scatterplot of Women's Heights and Weights
55 | #+RESULTS:
56 | [[file:test.png]]
57 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/book/codeExamples/reportGen/simplePlot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brittAnderson/Intro2Computing4Psychology/120f5eb3277787903df30de6c2f23484fed0fda0/book/codeExamples/reportGen/simplePlot.png
--------------------------------------------------------------------------------
/book/codeExamples/reportGen/testLatex.html:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
199 |
testLatex
200 |
201 | This is a test of latex compiliation.
202 |
203 |
204 |
205 | If you type C-c C-e l p
you should create a pdf version of this document. Test that it works by changing the title and author above and seeing the new names in your output.
206 |
207 |
208 |
209 |
Date: \today
210 |
Author: Britt Anderson
211 |
Created: 2023-04-23 Sun 11:52
212 |
Validate
213 |
214 |
215 |
--------------------------------------------------------------------------------
/book/codeExamples/reportGen/testLatex.org:
--------------------------------------------------------------------------------
1 | #+options: ':nil *:t -:t ::t <:t H:3 \n:nil ^:t arch:headline
2 | #+options: author:t broken-links:nil c:nil creator:nil
3 | #+options: d:(not "LOGBOOK") date:t e:t email:nil f:t inline:t num:t
4 | #+options: p:nil pri:nil prop:nil stat:t tags:t tasks:t tex:t
5 | #+options: timestamp:t title:t toc:t todo:t |:t
6 | #+title: testLatex
7 | #+author: Britt Anderson
8 | #+email: britt@uwaterloo.ca
9 | #+language: en
10 | #+select_tags: export
11 | #+exclude_tags: noexport
12 | #+creator: Emacs 26.3 (Org mode 9.2.6)
13 | #+latex_class: article
14 | #+latex_class_options:
15 | #+latex_header:
16 | #+latex_header_extra:
17 | #+description:
18 | #+keywords:
19 | #+subtitle:
20 | #+latex_compiler: pdflatex
21 | #+date: \today
22 |
23 | This is a test of latex compiliation.
24 |
25 | If you type ~C-c C-e l p~ you should create a pdf version of this document. Test that it works by changing the title and author above and seeing the new names in your output.
26 |
27 |
--------------------------------------------------------------------------------
/book/codeExamples/reportGen/testRBabel.html:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
199 |
testRBabel
200 |
201 | This is to test your installation of the files and programs needed to make a simple report. To compile to pdf use C-c C-e l p
.
202 |
203 |
204 |
205 | This loads an R library
206 |
207 |
208 |
library(random)
209 |
210 |
211 |
212 |
213 |
214 | Now we will see if we can some source code and a simple plot for our export.
215 |
216 |
217 |
218 |
x = 1:10
219 | y = rnorm(10)
220 | print(mean(y))
221 |
222 |
223 |
224 |
225 | 0.288291754111168
226 |
227 |
228 |
229 |
230 |
plot(x,y,type = 'b')
231 |
232 |
233 |
234 |
235 |
Date: \today
236 |
Author: Britt Anderson
237 |
Created: 2023-04-23 Sun 11:52
238 |
Validate
239 |
240 |
241 |
--------------------------------------------------------------------------------
/book/codeExamples/reportGen/testRBabel.org:
--------------------------------------------------------------------------------
1 | #+options: ':nil *:t -:t ::t <:t H:3 \n:nil ^:t arch:headline
2 | #+options: author:t broken-links:nil c:nil creator:nil
3 | #+options: d:(not "LOGBOOK") date:t e:t email:nil f:t inline:t num:t
4 | #+options: p:nil pri:nil prop:nil stat:t tags:t tasks:t tex:t
5 | #+options: timestamp:t title:t toc:t todo:t |:t
6 | #+title: testRBabel
7 | #+author: Britt Anderson
8 | #+email: britt@uwaterloo.ca
9 | #+language: en
10 | #+select_tags: export
11 | #+exclude_tags: noexport
12 | #+creator: Emacs 26.3 (Org mode 9.2.6)
13 | #+latex_class: article
14 | #+latex_class_options:
15 | #+latex_header:
16 | #+latex_header_extra:
17 | #+description:
18 | #+keywords:
19 | #+subtitle:
20 | #+latex_compiler: pdflatex
21 | #+date: \today
22 |
23 | This is to test your installation of the files and programs needed to make a simple report. To compile to pdf use ~C-c C-e l p~.
24 |
25 | This loads an R library
26 | #+Begin_src R :session *testR*
27 | library(random)
28 | #+End_src
29 |
30 | #+RESULTS:
31 | | random |
32 | | stats |
33 | | graphics |
34 | | grDevices |
35 | | utils |
36 | | datasets |
37 | | methods |
38 | | base |
39 |
40 |
41 | Now we will see if we can some source code and a simple plot for our export.
42 |
43 | #+begin_src R :session *testR* :exports both
44 | x = 1:10
45 | y = rnorm(10)
46 | print(mean(y))
47 | #+end_src
48 |
49 | #+RESULTS:
50 | : 0.149571258953334
51 |
52 | #+begin_src R :session *testR* :exports both :results graphics :file "simplePlot.png"
53 | plot(x,y,type = 'b')
54 | #+end_src
55 |
56 | #+RESULTS:
57 | [[file:simplePlot.png]]
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/book/codeExamples/reportGen/testRBabelBib.org:
--------------------------------------------------------------------------------
1 | #+options: ':nil *:t -:t ::t <:t H:3 \n:nil ^:t arch:headline
2 | #+options: author:t broken-links:nil c:nil creator:nil
3 | #+options: d:(not "LOGBOOK") date:t e:t email:nil f:t inline:t num:t
4 | #+options: p:nil pri:nil prop:nil stat:t tags:t tasks:t tex:t
5 | #+options: timestamp:t title:t toc:t todo:t |:t
6 | #+title: testRBabel
7 | #+author: Britt Anderson
8 | #+email: britt@uwaterloo.ca
9 | #+language: en
10 | #+select_tags: export
11 | #+exclude_tags: noexport
12 | #+creator: Emacs 26.3 (Org mode 9.2.6)
13 | #+latex_class: article
14 | #+latex_class_options:
15 | #+latex_header: \bibliographystyle{plain}
16 | #+latex_header_extra:
17 | #+description:
18 | #+keywords:
19 | #+subtitle:
20 | #+latex_compiler: pdflatex
21 | #+date: \today
22 |
23 |
24 |
25 |
26 | This is to test your installation of the files and programs needed to make a simple report. To compile to pdf use ~C-c C-e l p~.
27 |
28 | This loads an R library
29 | #+Begin_src R :session *testR*
30 | library(random)
31 | #+End_src
32 |
33 |
34 | Now we will see if we can some source code and a simple plot for our export.
35 |
36 | #+begin_src R :session *testR* :exports both
37 | x = 1:10
38 | y = rnorm(10)
39 | print(mean(y))
40 | #+end_src
41 |
42 | #+RESULTS:
43 | : 0.18479671870621
44 |
45 | #+begin_src R :session *testR* :exports both :results graphics :file "simplePlot.png"
46 | plot(x,y,type = 'b')
47 | #+end_src
48 |
49 | ** Testing Citations
50 |
51 | This stackexchange [[https://tex.stackexchange.com/questions/114864/how-to-get-bibtex-to-work-with-org-mode-latex-export][question]] may be useful if you have trouble getting things to work.
52 |
53 | And the ta in the class wrote this article \cite{turpin2019bullshit}
54 |
55 |
56 | I wrote a book about using computers in psychology \cite{anderson2014computational}.
57 |
58 |
59 |
60 |
61 | #+latex: \bibliography{test}
62 |
63 |
--------------------------------------------------------------------------------
/book/codeExamples/simpOrgDemoFile.org:
--------------------------------------------------------------------------------
1 | #+Title: This is a title
2 |
3 | * This is a heading
4 | * This is a subheading
5 |
6 | 1. this is a list item
7 | 2. this should be second
8 | 3. this is another list item
9 |
10 | ** Let's make a link
11 |
12 | [[https://uwaterloo.ca][University of Waterloo]]
13 |
14 | ** Let's try R
15 |
16 | #+Begin_src R :exports both
17 | a <- 2
18 | b <- 2
19 | print(a+b)
20 | #+end_src
21 |
22 | #+RESULTS:
23 | : 4
24 |
25 |
26 |
--------------------------------------------------------------------------------
/book/codeExamples/simpleOrgExamples/minimalPython.html:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
209 |
Author: Britt Anderson
210 |
Created: 2023-06-21 Wed 17:18
211 |
Validate
212 |
213 |
214 |
--------------------------------------------------------------------------------
/book/codeExamples/simpleOrgExamples/minimalPython.org:
--------------------------------------------------------------------------------
1 | #+begin_src python :results function :exports both
2 | return(2+2)
3 | #+end_src
4 |
5 | #+RESULTS:
6 | : 4
7 |
--------------------------------------------------------------------------------
/book/codeExamples/simplePlot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brittAnderson/Intro2Computing4Psychology/120f5eb3277787903df30de6c2f23484fed0fda0/book/codeExamples/simplePlot.png
--------------------------------------------------------------------------------
/book/example-os.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brittAnderson/Intro2Computing4Psychology/120f5eb3277787903df30de6c2f23484fed0fda0/book/example-os.png
--------------------------------------------------------------------------------
/book/ggplot1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brittAnderson/Intro2Computing4Psychology/120f5eb3277787903df30de6c2f23484fed0fda0/book/ggplot1.png
--------------------------------------------------------------------------------
/book/myrplot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brittAnderson/Intro2Computing4Psychology/120f5eb3277787903df30de6c2f23484fed0fda0/book/myrplot.png
--------------------------------------------------------------------------------
/book/py-inter-fit-plt.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brittAnderson/Intro2Computing4Psychology/120f5eb3277787903df30de6c2f23484fed0fda0/book/py-inter-fit-plt.png
--------------------------------------------------------------------------------
/book/simplePlot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brittAnderson/Intro2Computing4Psychology/120f5eb3277787903df30de6c2f23484fed0fda0/book/simplePlot.png
--------------------------------------------------------------------------------
/book/test.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brittAnderson/Intro2Computing4Psychology/120f5eb3277787903df30de6c2f23484fed0fda0/book/test.png
--------------------------------------------------------------------------------
/chapters/HSQ.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brittAnderson/Intro2Computing4Psychology/120f5eb3277787903df30de6c2f23484fed0fda0/chapters/HSQ.zip
--------------------------------------------------------------------------------
/chapters/HSQ/codebook.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brittAnderson/Intro2Computing4Psychology/120f5eb3277787903df30de6c2f23484fed0fda0/chapters/HSQ/codebook.txt
--------------------------------------------------------------------------------
/chapters/assets/assessments/accessingDatainRAssessment.org:
--------------------------------------------------------------------------------
1 | #+Title: Accessing Data in R - Assessment
2 |
3 | * Task
4 | Provide an org or Rmd file that demonstrates the following functions with the *cars* data set in R.
5 | * Goal/Purpose
6 | Demonstrate some of the basic data processing tasks in R.
7 | * Instructions
8 | ** General
9 | Using the built in data set *cars* demonstrate sorting and selection.
10 | ** Detailed
11 | Produce a Rmd or org file that executes each of the following processes or provides as a result the answer to the listed questions.
12 | - Sort (or ~order~) cars by the ~dist~ variable.
13 | - Find the =mean= and =standard deviation= of the speed of the cars.
14 | - Print the name of the other built-in data sets (this code may help)
15 | #+begin_src R :export code :results hidden :eval never
16 | for (i in data()$results[,3]) {
17 | print(i)
18 | }
19 | #+end_src
20 | - Using any other data set find:
21 | 1. Print the column names?
22 | 2. Print how many rows?
23 | 3. Tell me what the /comment/ designator is for R?
24 | 4. Tell me what the ending extension is for an R script?
25 |
26 | * Comments
27 | ** Hints
28 | - To find the names of /columns/ in a data.frame try the =names= function (~names(cars)~).
29 | - To get help you can type a *?* at the command line of the R interpreter.
30 | - You may need to find an online resource you like for R help, for example to find out what the name of the function is for standard deviation. It is not "standard deviation", but something much shorter.
31 | - Extensions: For instance "docx" is the extension for a word file and "py" is the extension for a python script.
32 |
33 |
--------------------------------------------------------------------------------
/chapters/assets/assessments/assessTemplate.org:
--------------------------------------------------------------------------------
1 | #+Title: Title - Assessment
2 |
3 | * Task
4 |
5 | * Goal/Purpose
6 |
7 | * Instructions
8 |
9 | ** General
10 |
11 | ** Detailed
12 |
13 | * Comments
14 |
--------------------------------------------------------------------------------
/chapters/assets/assessments/dataPandasAssessment.org:
--------------------------------------------------------------------------------
1 | #+Title: Practicing Pandas for Data Analysis
2 |
3 | * Task
4 | You will
5 | 1. Download a data set in python
6 | 2. Unzip the data set
7 | 3. Tell me the names of all the columns
8 | 4. Tell me the length of one of the rows
9 | 5. And tell me the mean[fn:1] of one of the columns subset by rows[fn:2].
10 |
11 | * Requirements
12 | Your submission will be either an org[fn:3] file with code blocks that let me execute each of these steps by myself interactively one at a time. Or a python script that I can run from the command line and that will perform each of these functions displaying its output to ~stdout~. Stdout is the linux name for printing to the screen in the terminal. For example, when you do ~ls~ to list the names of files in a directory you are directing to stdout.
13 |
14 | * Comments
15 | Don't start by writing this as a script. That will almost certainly be too hard. Begin by doing this interactively, perhaps at a python interpreter until you get the code for a particular step done corrrectly. Then copy that code to your file and and test that it still works; that something did not get messed up in the copying and pasting.
16 | Once you have the data in your interpreter, don't just rush through. Take some time to play with various pandas commands or exercises such as examples you can find [[https://www.w3resource.com/python-exercises/pandas/index-data-series.php][here]] to generally grow more familiar with the package.
17 | * Footnotes
18 |
19 | [fn:1] Or some other simple statistic appropriate to the data, e.g. if your data was /categorical/ you might give me the number of rows for each type of category.
20 | [fn:2] An example of this is that if you had columns for heights and genders you could output the average height of men, women, and other.
21 | [fn:3] To make some nicer formatting and help available when using python from within emacs checkout the ~elpy~ [[https://elpy.readthedocs.io/en/latest/introduction.html#installation][package]].
22 |
23 |
24 |
--------------------------------------------------------------------------------
/chapters/assets/assessments/emacsBeginningAssessment.org:
--------------------------------------------------------------------------------
1 | #+Title: Beginning With Emacs Assessment
2 | * Task
3 | Create and submit an .org file edited in emacs. We will recreat the original [[file:firstRmdAssessment.org][Rmd exercise]] using this alternative markup syntax.
4 | * General Instructions
5 | 1. Create an org file in emacs using your name as the file name.
6 | 2. Create a major heading for you identifying information and put your name in bold and your student id in italics.
7 | 3. Create a functioning link to a favorite website relevant to science or research.
8 | 4. Create an inline link to an image from the web that will appear in your exported version.
9 | 5. Verify that when you export your org file =C-c C-e h h= to html that you can open your html output and that it shows the properly configured output.
10 |
11 |
12 |
--------------------------------------------------------------------------------
/chapters/assets/assessments/finalProjectAssessment.org:
--------------------------------------------------------------------------------
1 | #+Title: Final Project
2 |
3 | * Task
4 | Deliver a reproducible research report.
5 |
6 | * Objective
7 | Show that you have the coding and computer skills to implement an experiment in code, collect some (toy)data, analyze that data and produce a report that compiles all that material into a single pdf output, /and/ in a way that would allow another scientist to repeat your analysis and recompile your report.
8 |
9 | * Details
10 | 1. I will get an org file that I can compile to produce the final report.
11 | 2. You will also upload the pdf file that you compiled to demonstrate your ability to compile the raw file.
12 | 3. You will also upload the .py file that executed the task you used for collecting data.
13 | 4. You will have collected data and saved that data in a /csv/ format and you will upload the csv data file.
14 | 5. Your org file will include:
15 | 1. Title
16 | 2. Date
17 | 3. Authors
18 | 4. Sections for each of the standard research report sections.[fn:1]
19 | 5. Your /methods/ section should include computational tools you used.
20 | 6. Your /results/ section must include the code for the analyses in the body of the org file so that I can recompile and reproduce the analyses. As a minimum you should include:
21 | - some descriptive statistics (e.g. how many participants or total trials).
22 | - at least one statistical test (e.g. a t-test comparing the means of two groups or conditions). This will depend on the data you collect and the experiment you run.
23 | - at least one plot (again, the code generating this plot must be in the research report org file; don't create it in photoshop or something and simply insert it).
24 | 7. Minimal /introduction/ and /discussion/ sections that must include at least one citation each.
25 | 8. The citations must appear in a /Reference/ section. I don't care about whether it is APA style or not.
26 |
27 | ** Experiments You Can Pick From
28 | Each team will conduct a different experiment. If you want to suggest something not on this list get my approval first. Even if you do select something from the list make sure some other group is not already doing it by writing to me first.
29 |
30 | 1. [[https://en.wikipedia.org/wiki/Stroop_effect][Stroop Test]]
31 | 2. [[https://en.wikipedia.org/wiki/Pair_by_association][Paired Associate]]
32 | 3. [[https://en.wikipedia.org/wiki/Implicit-association_test][Implicit Association]]
33 | 4. [[https://en.wikipedia.org/wiki/Eriksen_flanker_task][Eriksen Flanker]]
34 | 5. [[https://en.wikipedia.org/wiki/Contextual_cueing_effect#/media/File:Contextual_cueing_example.png][Contextual Cuing]]
35 | 6. [[https://en.wikipedia.org/wiki/Deese%E2%80%93Roediger%E2%80%93McDermott_paradigm][False Memories]]
36 | 7. [[https://en.wikipedia.org/wiki/Sequence_learning][Sequence Learning]]
37 |
38 | * Footnotes
39 |
40 | [fn:1] Don't go overboard with the text in each of these sections. This final project is more about showing you have the skills to program an experiment, analyze the data, and combine it into a report, then it is the actual content of your data or the motivations for the experiment.
41 |
--------------------------------------------------------------------------------
/chapters/assets/assessments/firstRmdAssessment.org:
--------------------------------------------------------------------------------
1 | #+Title: Your First Rmd File - Assessment
2 |
3 | * Tasks
4 | Create and save an Rmd file making use of basic markdown conventions.
5 | 1. Put your name in *bold*.
6 | 2. Put your student ID or other value in /italic/.
7 | 3. A functioning link to a page on the web like [[https://brittlab.uwaterloo.ca][brittlab]]
8 | 4. An image link that will inline on export. For example:
9 |
10 | [[https://imgs.xkcd.com/comics/linux_user_at_best_buy.png]]
11 |
12 | * Comments
13 | We will be using various markdown dialects to combine text, references, code, data, and analyses in making reproducible research reports. The goal of this assignment is to get you started on discovering and using some of the markdown conventions that will enable you to do so. RStudio has a built in cheat sheet for markdown, but you can easily find [[https://en.wikipedia.org/wiki/Markdown][others]] on line. There are several different dialects of markdown.
14 |
--------------------------------------------------------------------------------
/chapters/assets/assessments/forLoopPythonAssessment.org:
--------------------------------------------------------------------------------
1 | #+Title: For Loop with Python
2 |
3 | * Task
4 | Write a function that will print a list of characters unsorted, sorted, and combined. To complete this task you will need to be familiar with how to write a *for loop*, use python's *indexing*, and also how to use the [[https://realpython.com/python-formatted-output/][print format command]] [fn:1]
5 |
6 | * What it should look like
7 | I run your function with "trib". It prints t, r, i, b, then prints b, i, r, t, and then prints something like "The first letter of list one is 't', but it is 'b' in the sorted list... and so on through all the letters.
8 |
9 | * Detailed Instructions
10 | 1. Create a list of at least 8 individual characters.
11 | 2. Make sure they are **not** in alphabetical order
12 | 3. Print the letters one at a time.
13 | 4. Print the letters sorted alphabetically one at a time, but /do not/ overwrite your original list.
14 | 5. Print the letters from both lists with a format command that says which position the letter is in.
15 |
16 | * Comments
17 | ** Hints
18 | Remember not to re-invent the wheel. For example, does python have a function for sorting lists? Can you turn a "string" into a python list that would allow you to use indices? Lastly, note that a for loop can use more than one variable at a time. For my version I have a line that reads,
19 |
20 | #+begin_src python :exports code :results never
21 | for i,l in enumerate(zip(myList,sorted(myList))):
22 | #+end_src
23 |
24 | ** How I Will Grade
25 | I will run your program from the command line e.g. =python firstLast2LstsSorted.py=. It will either spit out the correct lists or it won't. If it does you get full credit, and if not I will give partial credit and you can try to fix it for more points.
26 |
27 | * Footnotes
28 |
29 | [fn:1] Not shown in lecture, but explained in many [[https://realpython.com/python-formatted-output/][places]]. Look for the =string.format()= method.
30 |
--------------------------------------------------------------------------------
/chapters/assets/assessments/githubIDAssessment.org:
--------------------------------------------------------------------------------
1 | #+Title: GithubID - Assessment
2 |
3 | * Task
4 | 1. Create a [[https://github.com/][github account]].
5 | 2. *Fork* the two course related repositories.
6 | A. [[https://github.com/brittAnderson/Intro2Computing4Psychology][Intro2Computing4Psychology]]
7 | B. [[https://github.com/brittAnderson/psych363Practice][psych363Practice]]
8 | 3. Submit a screen short of your github account with appropriate respositories created to the Dropbox on Learn.
9 |
10 | * Comment
11 | This course makes use of [[https://github.com][github]] for practicing how to use the version control program git. To do that we will use a popular, public hosting site for sharing code.
12 |
--------------------------------------------------------------------------------
/chapters/assets/assessments/githubPullRequestAssmnt.org:
--------------------------------------------------------------------------------
1 | #+Title: Git Pull Request and Issues Assessment
2 |
3 | * Task
4 | 1. Generate a pull request for the [[https://github.com/brittAnderson/psych363Practice][psych363Practice]] repository on Github.
5 | 2. Generate an issue for the psych363Practice repository.
6 |
7 | * Comment
8 | This course makes use of [[https://github.com][github]] for practicing how to use the version control program git. An important part of collaborating on code (or other material hosted on github, which might include text files) is to be able to give back or to alert the owner to a problem. This requires that you can both generate a *pull request* and that you can *open an issue.*
9 |
10 | * Steps ([[https://vimeo.com/channels/i2c4p/456349516][video: steps illustrated]])
11 | 1. Previously you should have /forked/ the psych363Practice repository.
12 | 2. Next you will need to clone your fork to your laptop.
13 | 3. Check that you have your fork as a /remote./
14 | 4. Add *my original* version of the repository as a second remote.
15 | 5. To make sure you have the latest code, including all the other pulls generated by other students in the course you will want to:
16 | 1. /Pull/ from *my original* repo.
17 | 2. Accept and merge the changes if necessary.
18 | 3. /Push/ these new changes to *your fork* on github.
19 | 4. Verify the new changes made it there by looking at your fork in your browser. You may have to refresh your browser to see the changes.
20 | 5. Now, in the =gitnames= subdirectory add a file with