Presentation is loading. Please wait.

Presentation is loading. Please wait.

Subversion in the Sur lab A tool for organizing and sharing analysis code.

Similar presentations


Presentation on theme: "Subversion in the Sur lab A tool for organizing and sharing analysis code."— Presentation transcript:

1 Subversion in the Sur lab A tool for organizing and sharing analysis code

2 Why Subversion kicks ass The pre-Subversion code sharing nightmare scenario. Too scary for words. Alternative 1: everyone writes their own code, from scratch. – This is fine, but there are some things that everyone will need to do, like load their data into matlab and select regions of interest, that are so common that there’s no need for each person to “re-invent the wheel”. Alternative 2: version control. – Store code in a common repository. This allows all the code to be available in one place, in the most up-to-date form, and easily available to anyone who wants it (if they’re on the Surlab network). – It is like an ordinary file server, except that it remembers every change ever made to the files and directories (that have been ‘committed’) so you can easily recover older versions if needed. – This also allows any improvements that anyone makes to the code to be available to everyone, chaos-free, with minimal time and effort.

3 Getting the shared analysis code onto your computer Detailed directions are available on the wiki, at http://nw.mit.edu/surlab/index.php/Lab_Subversion_Repository. More info on TortoiseSVN (the version of SVN that works as an add-in to Windows Explorer) can be found at http://tortoisesvn.net/support. http://nw.mit.edu/surlab/index.php/Lab_Subversion_Repositoryhttp://tortoisesvn.net/support Step 1: Install Subversion on your computer. Step 2: ‘Check out’ the code (get your own private copy of it on your computer). You can stop there if you want, and modify the code for your own personal use as you would have if someone emailed you the code. Or, if you want to get bug fixes, new functionality, etc., that others have added, you can periodically run an ‘update.’ Furthermore, if you want to ROCK, you can contribute too! (more on that in a minute…) All of these processes are ridiculously simple and user-friendly using TortoiseSVN (just right-click and select ‘check out’ or ‘update’ or ‘commit’ in Windows Explorer, or on a Mac, in Finder).

4 Using the shared 2-photon analysis code Updated instructions will always be available in the file READ ME.txt in the repository, in the same directory as the code. To load 2-photon data into Matlab: 1) load_raw_data - loads across-file average data for the purpose of selecting ROIs 2) cell_selector - allows user to select ROIs and name cell groups interactively, saves everything in a.mat file 3) reload_raw_data - loads all data from all raw files, only in selected ROIs, appends that info to the previously created.mat file If you want to get tuning curves for your selected cells, you can use *4) plot_epis_tuning (for episodic data) - models raw time series with an amplitude-modulated sin wave - key module: sin_model or plot_ori_tuning (for periodic data) - models raw time series with a periodic AR model (developed by Wasim Malik & Emery Brown) - key module: get_ori_tuning If you want to compare the resulting tuning curves across your cell groups (make summary plots and run stats), you can use *5) analyze_epis_tuning (for episodic data) or analyze_ori_tuning (for periodic data) - key modules for both: plot_ave_tuning_curve, compare_params

5 Examples of share-worthy improvements Adding a new useful function Extracting a useful ‘module’ from a long function or script and making it into its own function, in its own m-file, so that it can easily be used elsewhere – Remember to delete that module from the old (outer) m-file, ‘add’ the new m-file containing the extracted function to subversion, and ‘commit’ both Adding outputs – Add them to end so the function will work exactly the same as it did before if the new outputs are not requested. Adding inputs for values that were previously hard-coded – Be sure it defaults to the original hard-coded value if the input is missing or empty: Making the function compatible with other platforms – E.g. directory path names contain \ on a PC but / on a mac. To write directory path names compatible with both, one could make a function slash.m that outputs the string \ if it’s running on a PC or / if it’s running on a mac, and replace all the hard-coded slashes in the path with the word slash : if ~exist('plot_style', 'var') || isempty(plot_style), plot_style = 'cartesian'; end function str_out = slash if ispc, str_out = '\'; else str_out = '/'; end

6 Before committing code to the repository Run an ‘SVN update’ before editing your copy to make sure you have the most recent version (if you try to commit but you don’t have the most recent version, SVN will tell you, and show you any ‘conflicts’ that you need to resolve, before you commit). Make sure your changes to existing functions are backwards-compatible (e.g. by following the guidelines on the last slide). If you have any questions or concerns, see me.


Download ppt "Subversion in the Sur lab A tool for organizing and sharing analysis code."

Similar presentations


Ads by Google