{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Tutorial 02 - Setting up" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Goals\n", "\n", "- Establish a sensible folder structure\n", "- Install python and nept\n", "- Introduction to git and GitHub\n", "- Download a data set and test your path setup" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Establish a sensible folder structure\n", "\n", "So far, you have a local nept repository, with code common to many analyses.\n", "As you work on your own project, you will write your own analysis code that may not be relevant to others.\n", "You will also have data files for each project.\n", "We can now consider where all of these files can go and how you will manage them. \n", "We recommend using two main locations:\n", "\n", "- **Code.**\n", "Repositories (folders) here are linked to remote GitHub repositories (either public or private).\n", "This may mean that some project code repositories depend on other repositories, \n", "which is fine. \n", "Just be aware that you need to keep your code up-to-date in every location \n", "where it is used (by doing `git pull`).\n", "\n", "- **Data.**\n", "Data should not be put on GitHub because it takes up a lot of space and never changes, \n", "so it does not benefit from being tracked with the version control of git.\n", "Raw data should be in a separate location on your computer than where your code lives,\n", "but processed data and intermediate files can be in a folder within your project code \n", "_as long as you specify git to ignore that location within your .gitignore file_.\n", "\n", "If you are an owner or collaborator of a GitHub repository, \n", "such as when you make a repository for your own project,\n", "you will be able to push changes you make and manage the repository as you like.\n", "Generally, when you want to contribute to another repository, \n", "you can make your changes in a Fork of the repository and create a \n", "[pull request](https://help.github.com/articles/about-pull-requests/).\n", "These pull requests allows the maintainers to see your code and ask for changes before it is merged into master,\n", "which helps to ensure that the code in master is working and stable." ] }, { "cell_type": "markdown", "metadata": { "ExecuteTime": { "end_time": "2017-06-16T10:06:06.150424", "start_time": "2017-06-16T10:06:06.143406" } }, "source": [ "## Install python and nept\n", "\n", "Python is a free and open-source programming language, \n", "with a core language and many additional useful scientific libraries.\n", "Follow the getting started directions in [nept](https://github.com/vandermeerlab/nept),\n", "our lab's codebase, if you wish to make this tutorial interactive.\n", "Any code in this tutorial can be modified and run in the \n", "[Jupyter notebook](http://jupyter-notebook-beginner-guide.readthedocs.io/en/latest/execute.html)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Introduction to git and GitHub\n", "\n", "[GitHub](https://github.com/) is a platform for distributed version control. \n", "So, you can get access to the latest codebase and it provides a \n", "[platform](https://github.com/vandermeerlab/nept/blob/master/CONTRIBUTING.rst) for you to submit changes \n", "should you find any bugs or desire improvements to what is currently available.\n", "\n", "If you don't already have an account, you can make one [here](https://github.com/).\n", "And GitHub provides some (free) benefits to educators and students,\n", "check out if you qualify for them [here](https://education.github.com/).\n", "\n", "There are [many](https://git-scm.com/book/en/v2/Git-Basics-Getting-a-Git-Repository)\n", "[excellent](http://readwrite.com/2013/09/30/understanding-github-a-journey-for-beginners-part-1/#awesm=~ov691XRLABIiU0)\n", "[resources](http://product.hubspot.com/blog/git-and-github-tutorial-for-beginners) \n", "dedicated to showing beginners how to effective use git and GitHub,\n", "so take a moment to go through those if they're unfamiliar to you.\n", "After going through those, you should be familiar with the commands \n", "`status`, `push`, `pull`, `add`, `commit`,\n", "and have some idea of how git and GitHub track changes so you know when your code is saved under version control." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Get a data session from the vandermeerlab server\n", "\n", "Use a FTP client such as [Filezilla](https://filezilla-project.org/) \n", "to connect to the lab FTP server, using the following settings:\n", "\n", "- Host: **LAB SERVER IP**\n", "- Protocol: \"FTP - File Transfer Protocol\"\n", "- Encryption: \"Use explicit FTP over TLS if available\"\n", "- Logon Type: \"Normal\"\n", "- User: **LAB USER NAME**\n", "- Passwork: **LAB PASSWORD**\n", "\n", "_Note, contact us for the lab server ip, user, and password._\n", "\n", "If you cannot log in to the server, send me your IP address and I will enable access for you. \n", "If you still can't login, try changing the Filezilla login settings to use \"FTP\" as the Protocol, \n", "\"Use explicit FTP over TLS if available\", and Logon Type \"Normal\".\n", "\n", "For these tutorials you will need the /datavault/nept-tutorials data files copied into the data folder in your copy of nept/tutorials/data. \n", "In general, you will want to keep your data separate from your code,\n", "but for simplicity for these tutorials we ensure these folders are NOT \n", "tracked by git and can be accessed the same for everyone \n", "by putting them in a common relative location (nept/tutorials/data/). \n", "A reason to generally keep your data separate from your code is that multiple analysis projects may use the same data \n", "and you don't want to duplicate it." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "ExecuteTime": { "end_time": "2017-07-26T17:37:03.270509Z", "start_time": "2017-07-26T17:37:02.313829Z" }, "collapsed": true }, "outputs": [], "source": [ "# import necessary packages\n", "%matplotlib inline\n", "import os\n", "import sys\n", "import nept\n", "import matplotlib.pyplot as plt\n", "\n", "# Define where your data folder is located\n", "data_path = os.path.join(os.path.abspath('.'), 'data')\n", "data_folder = os.path.join(data_path, 'R016-2012-10-03')" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "ExecuteTime": { "end_time": "2017-07-26T17:37:03.279015Z", "start_time": "2017-07-26T17:37:03.272010Z" }, "collapsed": true }, "outputs": [], "source": [ "# Load the info file, which contains experiment-specific information\n", "sys.path.append(data_folder)\n", "import r016d3 as info" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "ExecuteTime": { "end_time": "2017-07-26T17:37:04.063035Z", "start_time": "2017-07-26T17:37:03.746320Z" }, "collapsed": true }, "outputs": [], "source": [ "# Load LFP (.ncs) from rat ventral striatum\n", "lfp = nept.load_lfp(os.path.join(data_folder, info.lfp_theta_filename))\n", "\n", "# Slice the LFP to [2000, 2001]\n", "sliced_lfp = lfp.time_slice(2000, 2001)\n", "\n", "# Plot the data\n", "plt.plot(sliced_lfp.time, sliced_lfp.data)\n", "plt.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If you see the local field potential (LFP) plotted, then great job!\n", "Next, let's get more into how we represent our neural data." ] } ], "metadata": { "anaconda-cloud": {}, "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.4.5" }, "toc": { "colors": { "hover_highlight": "#DAA520", "running_highlight": "#FF0000", "selected_highlight": "#FFD700" }, "moveMenuLeft": true, "nav_menu": { "height": "281px", "width": "252px" }, "navigate_menu": true, "number_sections": true, "sideBar": true, "threshold": 4, "toc_cell": false, "toc_section_display": "block", "toc_window_display": true } }, "nbformat": 4, "nbformat_minor": 1 }