User Tools

Site Tools


analysis:nsb2017:week1

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
analysis:nsb2017:week1 [2017/07/06 18:53]
mvdm [Module 1: Setting up]
analysis:nsb2017:week1 [2020/01/26 22:08]
mvdm
Line 1: Line 1:
 ~~DISCUSSION~~ ~~DISCUSSION~~
  
-=== Module 1: Setting up ===+==== Module 1: Setting up ====
  
 Goals: Goals:
Line 22: Line 22:
 === Installing MATLAB === === Installing MATLAB ===
  
-At MBL, MATLAB should already be installed on lab computers. Verify it starts correctly; you should see its main window open up, including a panel called "​Command Window"​ greeting you with a prompt (''>>''​).+At MBL, MATLAB should already be installed on lab computers. Verify it starts correctly; you should see its main window open up, including a panel called "​Command Window"​ greeting you with a prompt (''>>''​). At Dartmouth, follow [[https://​tech.dartmouth.edu/​itc/​services-support/​help-yourself/​knowledge-base/​matlab|these instructions]] to install MATLAB. Release 2018a seems to work.
  
 === Setting up GitHub === === Setting up GitHub ===
Line 38: Line 38:
 === Cloning the module codebase === === Cloning the module codebase ===
  
-Now we are ready to use Git to create a local copy ("​clone"​) of the module codebase. If this is your first time using git, I recommend you open a Git Shell, which you can do by typing ''​Git Shell''​ in the search box of the Start menu. Once open, note your working directory (displayed at the prompt of your now opened shell) and type ''​git clone https://​github.com/​mvdm/​nsb2017'',​ which will create a new folder ''​nsb2017''​ in your working directory.+Now we are ready to use Git to create a local copy ("​clone"​) of the module codebase. If this is your first time using git, I recommend you open a Git Shell, which you can do by typing ''​Git Shell''​ in the search box of the Start menu. Once open, note your working directory (displayed at the prompt of your now opened shell) and type ''​git clone https://​github.com/​mvdm/​nsb2018'',​ which will create a new folder ''​nsb2018''​ in your working directory.
  
 As an alternative,​ you can navigate to the course repository [[https://​github.com/​mvdm/​nsb2017|web page]] on %%GitHub%%. There, click the button "Clone in desktop",​ and your %%GitHub%% client should prompt you to accept the clone (tested successfully with Chrome, %%YMMV%%). If this fails, you can [[http://​joe.blog.freemansoft.com/​2014/​04/​github-clone-to-desktop-with-windows.html|drag]] the URL from your browser into your %%GitHub%% client. As an alternative,​ you can navigate to the course repository [[https://​github.com/​mvdm/​nsb2017|web page]] on %%GitHub%%. There, click the button "Clone in desktop",​ and your %%GitHub%% client should prompt you to accept the clone (tested successfully with Chrome, %%YMMV%%). If this fails, you can [[http://​joe.blog.freemansoft.com/​2014/​04/​github-clone-to-desktop-with-windows.html|drag]] the URL from your browser into your %%GitHub%% client.
  
-Now, verify that the above steps have resulted in the creation of a ''​nsb2017''​ folder with various subfolders and files in it, indicating that you have a local copy of the codebase. Because Git is tracking the contents of this folder, it is now easy to "​pull"​ the latest version from %%GitHub%%, either from the command line (after you ''​cd''​ into the ''​nsb2017''​ folder):+Now, verify that the above steps have resulted in the creation of a ''​nsb2018''​ folder with various subfolders and files in it, indicating that you have a local copy of the codebase. Because Git is tracking the contents of this folder, it is now easy to "​pull"​ the latest version from %%GitHub%%, either from the command line (after you ''​cd''​ into the ''​nsb2018''​ folder):
  
 <​code>​ <​code>​
Line 52: Line 52:
 This "​pull"​ should do nothing, because you already have the latest version. The basic idea is that you can stay up-to-date easily as well as contribute to the codebase so that everyone else can benefit. As you might expect, that part is known as a "​push",​ which we will do in the next step. This "​pull"​ should do nothing, because you already have the latest version. The basic idea is that you can stay up-to-date easily as well as contribute to the codebase so that everyone else can benefit. As you might expect, that part is known as a "​push",​ which we will do in the next step.
  
-=== A first commit and push === +=== A first commit and push (optional) ​===  
 + 
 +This section shows you how to make changes to the GitHub repository. You can skip it if you just want to get things up and running, and come back to it later if you ever want to change anything.
  
 First, if you haven'​t "done a pull" recently, do one now before starting the next step. First, if you haven'​t "done a pull" recently, do one now before starting the next step.
  
-Open the ''​README.md''​ file in the ''​nsb2017''​ folder. The ''​.md''​ extension is for %%Markdown%%,​ a lightweight set of commands to format text (syntax reference is [[https://​help.github.com/​articles/​markdown-basics | here]]).+Open the ''​README.md''​ file in the ''​nsb2018''​ folder. The ''​.md''​ extension is for %%Markdown%%,​ a lightweight set of commands to format text (syntax reference is [[https://​help.github.com/​articles/​markdown-basics | here]]).
  
 Add your name, affiliation and a brief description of your interests to the list, and save the file. Then go to your git shell (open one with the gear icon in the top right of your client'​s %%GUI%%, or use the desktop icon) and type ''​git status''​. Git has noticed the change, but it says that this change is not yet "​staged for commit"​. In other words, git is not tracking this file. Let's fix this: Add your name, affiliation and a brief description of your interests to the list, and save the file. Then go to your git shell (open one with the gear icon in the top right of your client'​s %%GUI%%, or use the desktop icon) and type ''​git status''​. Git has noticed the change, but it says that this change is not yet "​staged for commit"​. In other words, git is not tracking this file. Let's fix this:
Line 81: Line 83:
 === Using GitHub to acquire the FieldTrip toolbox === === Using GitHub to acquire the FieldTrip toolbox ===
  
-Using your experience from the previous section, create a local clone of the [[https://​github.com/​fieldtrip/​fieldtrip|FieldTrip toolbox]]. If you are using the command line, make sure that you ''​cd''​ to your %%GitHub%% folder, i.e. that you are not within some other project such as ''​nsb2017'',​ before cloning. If things worked correctly you should have ''​fieldtrip''​ and ''​nsb2017''​ folders within your %%GitHub%% folder; **not** a ''​fieldtrip''​ folder within your ''​nsb2017''​ folder!+Using your experience from the previous section, create a local clone of the [[https://​github.com/​fieldtrip/​fieldtrip|FieldTrip toolbox]]. If you are using the command line, make sure that you ''​cd''​ to your %%GitHub%% folder, i.e. that you are not within some other project such as ''​nsb2018'',​ before cloning. If things worked correctly you should have ''​fieldtrip''​ and ''​nsb2018''​ folders within your %%GitHub%% folder; **not** a ''​fieldtrip''​ folder within your ''​nsb2018''​ folder!
  
 We will use this toolbox extensively for the analysis of local field potential (LFP) data. Be aware that it is about 1.2GB in size! We will use this toolbox extensively for the analysis of local field potential (LFP) data. Be aware that it is about 1.2GB in size!
Line 89: Line 91:
 === Configuring MATLAB to use the code from GitHub === === Configuring MATLAB to use the code from GitHub ===
  
-Now, we need to tell MATLAB where to find all this code we have just obtained. Open MATLAB and [[http://​www.mathworks.com/​help/​matlab/​matlab_env/​create-matlab-shortcuts-to-rerun-commands.html | create a shortcut]] titled something like "​Neural Data Analysis"​. The code for the shortcut should be+Now, we need to tell MATLAB where to find all this code we have just obtained. Open MATLAB and [[http://​www.mathworks.com/​help/​matlab/​matlab_env/​create-matlab-shortcuts-to-rerun-commands.html | create a shortcut]] ​(2017b and earlier) or a [[https://​www.mathworks.com/​help/​matlab/​matlab_env/​create-matlab-favorites-to-rerun-commands.html?​searchHighlight=Favorite%20Commands&​s_tid=doc_srchtitle | Favorite]] (2018a+) ​titled something like "​Neural Data Analysis"​. The code for the shortcut should be
  
 <code matlab> <code matlab>
 restoredefaultpath;​ clear classes; % start with a clean slate restoredefaultpath;​ clear classes; % start with a clean slate
  
-cd('​D:​\My_Documents\GitHub\nsb2017\code-matlab\shared'​);​ % or, wherever your code is located -- NOTE \shared subfolder!+cd('​D:​\My_Documents\GitHub\nsb2018\code-matlab\shared'​);​ % or, wherever your code is located -- NOTE \shared subfolder!
 p = genpath(pwd);​ % create list of all folders from here p = genpath(pwd);​ % create list of all folders from here
 addpath(p); addpath(p);
Line 101: Line 103:
 % cd('​D:​\My_Documents\GitHub\FieldTrip'​);​ % or whatever you chose, obviously % cd('​D:​\My_Documents\GitHub\FieldTrip'​);​ % or whatever you chose, obviously
 % ft_defaults;​ % ft_defaults;​
 +% rmpath('​D:​\My_Documents\GitHub\GitHub\fieldtrip\external\signal\'​) % needed to preserve use of MATLAB filtfilt.m
 </​code>​ </​code>​
  
 This ensures that whenever you click this button, you have a clean **path** (the set of folders, other than the current working directory, whose contents MATLAB can access) of only the MATLAB default plus your local versions of the two %%GitHub%% repositories. This ensures that whenever you click this button, you have a clean **path** (the set of folders, other than the current working directory, whose contents MATLAB can access) of only the MATLAB default plus your local versions of the two %%GitHub%% repositories.
  
-:!: When setting your path in MATLAB to add the ''​shared''​ folder only and //not// a parent folder such as ''​nsb2017''​. Adding the entire ''​nsb2017''​ folder will result in an error when you try to run the LoadCSC command later in the module!+:!: When setting your path in MATLAB to add the ''​shared''​ folder only and //not// a parent folder such as ''​nsb2018''​. Adding the entire ''​nsb2018''​ folder will result in an error when you try to run the LoadCSC command later in the module!
  
 Optional: if you don't like the ''​.git''​ folders in your path, you can get clever with [[http://​www.mathworks.com/​help/​matlab/​matlab_prog/​regular-expressions.html|regular expressions]] to remove these: Optional: if you don't like the ''​.git''​ folders in your path, you can get clever with [[http://​www.mathworks.com/​help/​matlab/​matlab_prog/​regular-expressions.html|regular expressions]] to remove these:
Line 133: Line 136:
 === Grab an example data session === === Grab an example data session ===
  
-Next, let's get some data! Go to the NS&B share and find the ''​ExampleData''​ folder (within the MouseHippocampus ​folder).+Next, let's get some data! At MBL, go the NS&B share and find the ''​tutorial_data''​ folder (within the MouseStriatum ​folder). At Dartmouth or elsewhere, you'll need to connect to the lab server. E-mail MvdM for instructions on how to do that.
  
 For this module you will need the ''​R016-2012-10-08''​ folder (containing data from one recording session), which you can find in the ''​\promoted\R016''​ folder on the share. Copy this folder onto your own computer. A good place to put it is in something like ''​D:​\data\promoted\''​ (Rxxx indicate different rats, followed by the date of each session). As mentioned, in general you want to keep your data separate from your code; for instance, multiple analysis projects may use the same data, so you don't want to duplicate it. For this module you will need the ''​R016-2012-10-08''​ folder (containing data from one recording session), which you can find in the ''​\promoted\R016''​ folder on the share. Copy this folder onto your own computer. A good place to put it is in something like ''​D:​\data\promoted\''​ (Rxxx indicate different rats, followed by the date of each session). As mentioned, in general you want to keep your data separate from your code; for instance, multiple analysis projects may use the same data, so you don't want to duplicate it.
analysis/nsb2017/week1.txt · Last modified: 2023/04/13 12:21 (external edit)