-
Notifications
You must be signed in to change notification settings - Fork 0
Introductory Guide Part 1 — Welcome to the Neural ABC Lab and Linux!
Introductory Guide to Neural ABC Lab, Jupiter Notebook and Python Coding
Hello World! Welcome to the Neural ABC(Architecture, Behaviour and Connectivity) laboratory led by Dr. Christopher Steele!
The goal of the following page is to create a reference guide that can help others with their coding knowledge and knowhow.
This page is created as a form of 'living document' in that individuals are encouraged to add any code, references or findings that they find are helpful while working in this lab, as they examine any and all cool, new (and maybe even surprising) questions and ideas within the field of computational/cognitive neuroscience and computer science.
We hope that you find this resource useful!
The guide is separated into the following chapters (with the hope that more sections will by added by lab members over time):
- Getting you started: What are Linux commands and Jupyter Notebook?
- What is Python? How do I use it?
- Reference sites for modules, functions, and other pages or "what do I do now?"
NB: The following information derives from the work conducted by those at the following websites/links with some modified examples:
- https://www.howtogeek.com/412055/37-important-linux-commands-you-should-know/
- https://www.youtube.com/watch?v=vAdR-M9H_1w
- https://www.geeksforgeeks.org/python-programming-language/
- https://www.youtube.com/watch?v=rfscVS0vtbw
- https://swcarpentry.github.io/python-novice-inflammation/
- https://towardsdatascience.com/jypyter-notebook-shortcuts-bf0101a98330 (CHECK THIS OUT FOR COOL JUPYTER NOTEBOOK Tricks of the Trade!)
- https://www.dataquest.io/blog/jupyter-notebook-tips-tricks-shortcuts/ (REALLY GOOD RESOURCE FOR Tips and Tricks in Python)
- As well as notes from Data Scientifique (Nov, 2019)
Chapter 1: Getting you started: What are Linux commands and Jupyter Notebook?
To begin with, one can access the NeuralABC lab both using the computers in the stations (3 labs) at the university or at home. How can one access this at home? Well, using a VPN of course. To set up VPN, follow these steps (based on a real email from IITS Concordia 2019 and 2020):
- Download the VPN from the Forticlient website: https://forticlient.com/downloads
- Click on the gear in the top right corner -> Add a new Connection
- Then for VPN select: SSL-VPN
- Add settings:
- Connection Name: Concordia VPN
- Description select: (blank)
- Remote Gateway type: vpn.concordia.ca
- Customize port type: 443
- Client Certificate select: None
- Authentication select: Prompt on login (click on that)
- Hit Save
Following these steps, click on network and add the following information (under advanced settings):
Under DNS, add the values: 132.205.7.51 and 132.205.1.1 (in DNS servers under iPv4 or iPv6 addresses) and concordia.ca (under Search Domains)
Click on OK, and SAVE your settings. Disconnect and Reconnect YOUR WIFI NOW (only need to do so once)
Then, sign into your account (NETNAME and password) from home. To access the computer system from a personal laptop or at home, go onto your konsole(Linux) or Terminal (Mac) and write:
ssh your_file_lab_name@neuralabccs01
Then type in your password.
You can now access your files. FOR MORE INFORMATION ON HOW TO ACCESS JUPYTER NOTEBOOK FROM THE VPN SEE:
Now, say that you want to add a file:
To change your password write:
passwd
; then select a new password.
To access Python language right away, be sure to type:
ipython
To exit ipython, write exit
Cool Linux commands:
- To log onto computer and access files:
- Type in username and password (KEEP THEM SAFE)
- Go onto console
- Type:
-
cd /data
-
cd neuralabc/
-
cd (YOUR_FILE_NAME)
-
ll
(Find your file). -
cd FILE/
-
module load anaconda3
-
module load MODULE_OF_INTEREST
(i.e DFA) - if you're working with a -
jupyter notebook
-
Note: To go back, write =
cd ..
-
To stop = control Z
-
To bring back into foreground =
fg
-
If at any time you need to quit a program = control C
Cool Linux Commands Part 2_
-
killall
– used to forcequit any applications. i.e.killall INSERT_PROGRAM_NAME_HERE
.
This is a last resort – why? Killall literally quits everything. The program has to be running under your account. If it’s opened using a root, can use sudo killall
.
*For our purposes however, killall and kill CAN DAMAGE THE SYSTEM - so use Control C to be on the safe side.
-
cd
DIRECTORY – brings you into the next region of your directory (follow the root). -
touch
– used to create files. i.e. file1.txt
Can also create multiple files. i.e. touch file2.txt file3.txt
*There is however an easier way to make a file(s); see below in Linux command #15
Touch can also modify the access time on a file. This can be useful when using backup programs.
To touch multiple files, use touch *.FILE TYPE
(i.e. txt).
Touch can also be used to create flag files – namely files that tell the system to do something. It is just a file with a name. But can be helpful to do “fsck” procedure at bootup – to check that all the files in a directory are safe.
i.e. sudo touch
or sudo forcefsck
-
ls
= list. Allows you to see all the files in a directory. To see the long list of details:
USE: ls -l
-
To clear all previous text (to start fresh) use
clear
-
which
– tells you where a program is on a computer. Also useful for a script – helps to create a path.
Write: which FILENAME
- To look for a browser: “ping www.WEBPAGE NAME.com -c 3”.
What does c3 do? Well, if you just run ping, it’ll continue multiple times.
-
To stop a program use:
^C
-
less
This is useful in that it helps to read files (txt).
To get out of a file, use q
for quit.
-
To list a drive to find whether a drive is connected to a system use: “Sudo blkid”. To reuse sudo (to act as the admin proviledges for the file) – use “sudo -s”. But this is dangerous, so be careful (you are loged as root, but if you use the wrong command, i.e. like messing up a letter in a command, can make a lot of damage).
-
To switch and become another user:
su NAME_OF_PERSON
. Then use password.
To get into account fully, use cd ~
. To return to yourself, use exit
.
sudo reboot
Used to restart a system due to updates or if the desktop quits.
-
sudo shutdown -h now
– shuts down the system.
Useful – can give a time to shutdown.
i.e. if you want 15 mins: sudo shutdown -h 15
To get out of this: sudo shutdown -c
-
An often useful command =
man
. This opens up the entire manual page for any command on your system. Gives you the basic information for a process for reference. This can be useful for syntax. Noman
page (like a man cave for Linux commands...don't mind the pun too much) exists for all commands; i.e. cd. -
To rename a file or move things: Use:
mv ORIGINAL_FILE_NAME NEW_NAME
a. To remove an empty file = rmdir FILE_NAME
b. To create a new file (similar to touch mentioned earlier) = mkdir FILE_NAME
- To exit from your files in ssh, use:
control c, control c
— this serves to wipe the memory and log out all of everything. Can also useexit
, if all kernels on Jupyter notebook are closed.
What is Jupiter Notebook?
One can think of Jupiter notebook as a platform for running Python code. Where does the script in Python code live? It’s saved on my computer on my root folder. Files are organized in a hierarchical structure (like roots of a tree). The biggest structure is known as the root. However, one can also file save as wherever you want (creating other paths to get to all your stored data).
Want to get more infomation about Python? We've got you covered! Please be sure to check out our CrashCourse on Part 2 of the Guide!