-
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, Jupyter Lab 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 Lab 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)
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):
Windows and Mac VPN Setup
- In order to access the VPN download log into your Concordia account on the following website: https://takeme2.concordia.ca/index.html?app=vpn
- Check off all the boxes and submit the user acceptance form by clicking "I agree"
- Select the Forticlient VPN Download that corresponds to your operating system (Linux, Windows or Mac)
- Once the installation package is downloaded, download the Forticlient software onto your computer 5.a. On Windows click on the 3 bars to the right of "VPN Name" -> Add a new connection. b. Mac click on remote connection -> the 3 bars to the right of "VPN Name" -> add new connection.
- Enter the following settings:
- VPN: SSL-VPN
- Connection Name: Concordia VPN
- Description: (leave blank)
- Remote Gateway: vpn.concordia.ca
- Check Box for "Customize port" then enter: 443
- Check Box for "Enable Single Sign On (SSO) for VPN Tunnel"
- Do not check box for "Use external browser as user-agent for saml user authentication"
- Hit Save
Linux-based VPN setup
- You will need the
network-manager-fortisslvpn-gnome
(or your linux flavour variant) andopenfortivpn
, install withapt-get install
- You will likely need to restart the network manager, on Ubuntu-based systems:
sudo service NetworkManager restart
- If not using gnome >=19.04 create a new vpn and customize the settings described above as you usually would
- If using gnome >=19.04, edit with
nm-connection-editor
- vpn config files are available in
/etc/NetworkManager/system-connections
if you need to set them manually
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/Windows) 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 LAB 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 anaconda
-
module load MODULE_OF_INTEREST
(i.e DFA) - if you're working with any additional modules -
jupyter lab
-
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 lab notebook are closed.
What is Jupiter Lab Notebook?
One can think of Jupiter lab 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!