# Neuroscience Tutorials

The goal of this page is to provide beginning neuroscience students with resources that will help them prepare for the first-year graduate course work in Neuroscience at the University of Washington.

Written and curated by Dr. Mike Manookin

#### Code-Based Tutorials

I have created a public repository containing Matlab and Python tutorials designed to teach statistics and neuroscience concepts in the context of code that you can use in your own research. These tutorials can be accessed in a browser HERE or it can be cloned on your computer with the following terminal command:

git clone https://github.com/mikemanookin/NeuroscienceTeachingCode.git

I will continue to upload tutorials to this repository, so running ‘git pull‘ periodically will keep you up to date.

#### Programming Resources

Proficiency in programming languages such as MATLAB, Python, or R has become an essential tool for neuroscience research. Developing programming skills requires years of consistent work. We have compiled some resources to help you learn to program. We also provide more advanced resources. The Allen Brain Institute has kindly provided resources for learning Python.

#### Linear Algebra

Linear algebra is a very important tool in neuroscience and machine learning. Below, are some resources for learning these concepts. I recommend starting with the videos from Grant Sanderson illustrating the basic concepts of linear algebra. In preparation for the neuroscience course work, gaining a solid conceptual understanding of matrix multiplication will help in understanding the more advanced topics covered in the course work such as eigendecomposition and singular value decomposition.

#### Differential Equations

Derivatives are important for modeling several neural processes and phenomena such as neural network behaviors. Taking some time to familiarize yourself with these concepts will prepare you for coursework and research that applies mathematical concepts to biological systems. Eric Shea-Brown runs a very nice course on computational neuroscience (highly recommended) that uses differential equations in this way.

#### Statistics

Videos introducing basic ideas in statistics.

Methods for determining the differences between two distributions.

Information Theory

#### General Resources

Adrienne Fairhall and Raj Rao here at UW have put together a very nice online introduction to computational neuroscience, which can be accessed HERE. This course is a very nice overview of computational neuroscience concepts and does not take much time to complete.

Steve Brunton’s YouTube channel contains many excellent videos that cover many topics that are useful to neuroscience research including linear algebra and Fourier analysis.

Here is a nice resource for learning computational neuroscience concepts:

#### Programming Basics: MATLAB

You will find it useful to store your data in arrays and matrices. This will allow you to compute values, etc, and save you a lot of time. Matlab and Python are powerful tools for working with arrays and matrices. Gaining proficiency with one of these languages will likely save you a lot of time in the long run.

## Defining arrays.

``````      % Define a numerical vector
x = [7, 9, 12, 5, 2, 13, 9];

% Define a cell containing strings.
c = {'seven', 'nine', 'twelve', 'five', 'two', 'thirteen', 'nine'};
``````

## For loops.

``````      %% For-loop examples

% Go through the values defined in a for loop and print the values to the
% command line.
for j = 1 : 10
disp(j);
end

% Let's loop through all of the values in the numerical array and display
% what we've found to the command line.
for j = 1 : length(x)
disp(x(j));
end

% Now, let's do the same for the cell containing our strings.
for j = 1 : length(c)
disp(c{j});
end
``````

## While loops.

``````      %% While-loop examples
done = false;
count = 0;
while ~done
count = count + 1;
disp(x(count));
if count >= length(x)
done = true;
end
end
``````

## If-then-else statements.

``````
%% If-then-else statement examples

% Let's loop through all of the values in the numerical array and display
% what we've found to the command line.
for j = 1 : length(x)
if (x(j) == 5)
disp('I found 5!');
elseif (x(j) == 7)
disp('I found 7!');
else
disp(['I found ',num2str(x(j)),'!']);
end
end

% Now, let's do the same for the cell containing our strings.
for j = 1 : length(c)
if strcmp(c{j}, 'five')
disp('I found five!');
elseif strcmp(c{j}, 'seven')
disp('I found seven!');
else
disp(['I found ',c{j},'!']);
end
end
``````

## switch-case-otherwise statements.

``````
%% switch-case-otherwise statement examples

% Let's loop through all of the values in the numerical array and display
% what we've found to the command line.
for j = 1 : length(x)
switch x(j)
case 5
disp('I found 5!');
case 7
disp('I found 7!');
otherwise
disp(['I found ',num2str(x(j)),'!']);
end
end

% Now, let's do the same for the cell containing our strings.
for j = 1 : length(c)
switch c{j}
case 'five'
disp('I found five!');
case 'seven'
disp('I found seven!');
otherwise
disp(['I found ',c{j},'!']);
end
end
``````

## Searching for values in an array.

``````      %% Searching for values in an array.

% Now, let's search for specific values in our array. I'll show you two
% ways of doing this.

% 1) Logical indices. This technique returns a true/1 if the index in the
% array matches the desired value and false/0 for all other indices.

tf = (x == 9); % For the numerical array; find values equal to 9
tf2 = (x >= 7); % Find all of the values greater than or equal to 7.

% Now for the cell containing strings: strcmp
tf3 = strcmp(c, 'nine');
% If you want to find matches while ignoring upper/lower case: strcmpi
tf4 = strcmpi(c, 'Nine');

% 2) The second way is to search for the index numbers in the array that
% contain the desired values. If the value isn't there, it will return
% empty.
tf5 = find(x == 9);

tf6 = find(strcmpi(c, 'nine'));
``````

#### Programming Basics: Python

You will find it useful to store your data in arrays and matrices. This
will allow you to compute values, etc, and save you a lot of time. Matlab
and Python are powerful tools for working with arrays and matrices.
Gaining proficiency with one of these languages will likely save you a
lot of time in the long run.

## Defining arrays.

``````
# Define a numerical array
x = [7, 9, 12, 5, 2, 13, 9];

# Define an array containing strings.
c = ['seven', 'nine', 'twelve', 'five', 'two', 'thirteen', 'nine'];
``````

## For loops.

``````      ## For-loop examples

# Go through the values defined in a for loop and print the values to the
# command line.
for j in range(0, 10):
print(j)

# Let's loop through all of the values in the numerical array and display
# what we've found to the command line.
for value in x:
print(value)

# Now, let's do the same for the cell containing our strings.
for value in c:
print(value)
``````

## While loops.

``````     ## While-loop examples.
done = False;
count = 0;
while count < len(x):
print(x[count])
count += 1;
``````

## If-then-else statements.

``````
## If-then-else statement examples

# Let's loop through all of the values in the numerical array and display
# what we've found to the command line.
for j in range(0, len(x)):
if (x[j] == 5):
print("I found 5!")
elif (x[j] == 7):
print("I found 7!")
else:
print("I found %d!" % x[j])

# Now, let's do the same for the cell containing our strings.
for j in range(0, len(c)):
if (c[j] == "five"):
print("I found five!")
elif (c[j] == "seven"):
print("I found seven!")
else:
print("I found %s!" % c[j])``````

## Searching for values in an array.

``````     ## Searching for values in an array.

# Search for the index numbers in the array that contain the desired
# values. If the value isn't there, it will return empty.
# For the numerical array; find values equal to 9.
tf = [i for i in range(len(x)) if x[i] == 9]
print tf

# Find all of the values greater than or equal to 7.
tf2 = [i for i in range(len(x)) if x[i] >= 7]
print tf2

tf3 = [i for i in range(len(c)) if c[i] == "nine"]
print tf3``````