User Tools

Site Tools


analysis:course:week2

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:course:week2 [2013/09/20 11:52]
mvdm [Step-by-step]
analysis:course:week2 [2018/07/07 10:19] (current)
Line 46: Line 46:
 Create a folder with today'​s date and ''​cd''​ to it. This will be your "​scratch"​ working directory with stuff that you don't necessarily intend to push to GitHub (although you are welcome to if it's easier or you would like me to be able to see what you did). At the end of this module you will have something to push, but this will go in the ''​shared''​ folder under ''​BIOL680''​ once you are satisfied with your work. Create a folder with today'​s date and ''​cd''​ to it. This will be your "​scratch"​ working directory with stuff that you don't necessarily intend to push to GitHub (although you are welcome to if it's easier or you would like me to be able to see what you did). At the end of this module you will have something to push, but this will go in the ''​shared''​ folder under ''​BIOL680''​ once you are satisfied with your work.
  
-Grab the folder ''​R042-2013-08-18''​ from the lab database, making sure you login with ''​BIOL680''​ credentials so we all have the same version. As before, place the data in a sensible local location. This data set was collected from the dorsal CA1 region of the hippocampus of a rat performing a T-maze task, using a drive with 16 independently movable tetrodes. Spike and LFP data was recorded from each tetrode; possible spike events were detected online and stored for offline spike-sorting,​ and LFPs were sampled at 2kHz and bandpass filtered between 1-475Hz. ​+Grab the folder ''​R042-2013-08-18''​ from the lab database, making sure you login with ''​BIOL680''​ credentials so we all have the same version. As before, place the data in a sensible local location. This data set was collected from the dorsal CA1 region of the hippocampus of a rat performing a T-maze task, using a drive with 16 independently movable tetrodes. Spike and LFP data was recorded from each tetrode; possible spike events were detected online and stored for offline spike-sorting,​ and LFPs were sampled at 2kHz and bandpass filtered between 1-475Hz. ​(A quirk of this particular data set is that certain time intervals are cut out of the spike data, but not the LFP. So you may notice some odd looking gaps in the rasterplot.)
  
 Create a ''​sandbox.m''​ file in your daily folder. In this file, use cell mode to load some spike trains, a LFP, and position data as follows (recall you can use Ctrl+Enter to execute the code in a cell): Create a ''​sandbox.m''​ file in your daily folder. In this file, use cell mode to load some spike trains, a LFP, and position data as follows (recall you can use Ctrl+Enter to execute the code in a cell):
Line 92: Line 92:
 ==== Plotting with handles ==== ==== Plotting with handles ====
  
-☛ Plot the LFP (time against voltage) for the segment between 5950 and 6950 s. Remember to do this using a cell in your ''​sandbox.m''​ file so that it's easy to make changes later and you keep a record of what you did.+☛ Plot the LFP (time against voltage) for the segment between 5950 and 6050 s. Remember to do this using a cell in your ''​sandbox.m''​ file so that it's easy to make changes later and you keep a record of what you did.
  
 Any MATLAB figure is actually a collection of objects, all with their own properties which you can access and edit. For instance, to change the figure background to black, do Any MATLAB figure is actually a collection of objects, all with their own properties which you can access and edit. For instance, to change the figure background to black, do
Line 100: Line 100:
 </​code>​ </​code>​
  
-''​gcf''​ is MATLAB'​s name for "the current figure"​. The above command set its '''​Color'''​ property to ''​[0 0 0]''​ which is black (zero red, zero green, zero blue in the RGB world).+''​gcf''​ is MATLAB'​s name for "get current figure"​. The above command set its '''​Color'''​ property to ''​[0 0 0]''​ which is black (zero red, zero green, zero blue in the RGB world).
  
 ☛ Set the background of the current /axes/ to black (''​gca''​ is MATLAB'​s name for the current axes object; notice that the axes background is currently white, which looks ugly). ☛ Set the background of the current /axes/ to black (''​gca''​ is MATLAB'​s name for the current axes object; notice that the axes background is currently white, which looks ugly).
Line 164: Line 164:
 ☛ Create a keypress function that moves the x-limits of the current figure'​s axes to the left or right by 50% (i.e. if the current axes are from 1 to 2s, then pressing the right arrow key takes it to 1.5-2.5 s. It will be easier to do this with a ''​.m''​ file given the length of what you need to do. ☛ Create a keypress function that moves the x-limits of the current figure'​s axes to the left or right by 50% (i.e. if the current axes are from 1 to 2s, then pressing the right arrow key takes it to 1.5-2.5 s. It will be easier to do this with a ''​.m''​ file given the length of what you need to do.
  
-Hint: model your ''​.m''​ file on the template in the example given in the KeyPressFcn section of the [[http://​www.mathworks.com/​help/​matlab/​ref/​figure_props.html|Figure properties ]] page, and define it thus: ''​f_hdl = figure('​KeyPressFcn',​@your_function);''​ if your function is called ''​your_function.m''​.+Hint: model your ''​.m''​ file on the template in the example given in the KeyPressFcn section of the [[http://​www.mathworks.com/​help/​matlab/​ref/​figure_props.html|Figure properties ]] page, and define it thus: ''​f_hdl = figure('​KeyPressFcn',​@your_function);''​ if your function is called ''​your_function.m''​. Please keep in mind of the difference between ”==” and “strcmp” operators. The former treats two strings as vectors and does letter-wise comparison. Thus the two strings ought to be of the same dimension. The latter operator does lexical comparison and returns “1” if the two strings are identical, “0” otherwise
  
 ==== Varargins ==== ==== Varargins ====
Line 237: Line 237:
   * Don't test on the full data set. Things will be faster if you use restricted data for testing.   * Don't test on the full data set. Things will be faster if you use restricted data for testing.
   * Plot everything in a single set of axes, i.e. without using ''​subplot()''​ or ''​axes()'';​ this means you have to rescale and add a baseline offset (a.k.a. DC component) to the LFP signals so that they don't overlap. ​   * Plot everything in a single set of axes, i.e. without using ''​subplot()''​ or ''​axes()'';​ this means you have to rescale and add a baseline offset (a.k.a. DC component) to the LFP signals so that they don't overlap. ​
-  * Develop in the ''​sandbox''​ file so that can use cell mode and have easy access to the workspace. Only when everything is basically working, move to putting everything inside a function.+  * Develop in the ''​sandbox''​ file so that you can use cell mode and have easy access to the workspace. Only when everything is basically working, move to putting everything inside a function.
analysis/course/week2.1379692352.txt.gz · Last modified: 2018/07/07 10:19 (external edit)