Skip to content

Introductory Guide Part 1 — Welcome to the Neural ABC Lab and Linux!

Christopher J. Steele edited this page Jun 25, 2024 · 10 revisions

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):

  1. Getting you started: What are Linux commands and Jupyter Lab Notebook?
  2. What is Python? How do I use it?
  3. 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:

Chapter 1: Getting you started: What are Linux commands and Jupyter Lab 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):

Windows and Mac VPN Setup

  1. In order to access the VPN download log into your Concordia account on the following website: https://takeme2.concordia.ca/index.html?app=vpn
  2. Check off all the boxes and submit the user acceptance form by clicking "I agree"
  3. Select the Forticlient VPN Download that corresponds to your operating system (Linux, Windows or Mac)
  4. 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.
  5. 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

  1. You will need the network-manager-fortisslvpn-gnome (or your linux flavour variant) and openfortivpn, install with apt-get install
  2. You will likely need to restart the network manager, on Ubuntu-based systems: sudo service NetworkManager restart
  3. If not using gnome >=19.04 create a new vpn and customize the settings described above as you usually would
  4. 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:

  • Forward port from server for to ssh connection to Jupyter (or other) located on the side bar

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:

  1. To log onto computer and access files:
  1. Type in username and password (KEEP THEM SAFE)
  2. Go onto console
  3. 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_

  1. 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.

  1. cd DIRECTORY – brings you into the next region of your directory (follow the root).

  2. 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

  1. ls = list. Allows you to see all the files in a directory. To see the long list of details:

USE: ls -l

  1. To clear all previous text (to start fresh) use clear

  2. which – tells you where a program is on a computer. Also useful for a script – helps to create a path.

Write: which FILENAME

  1. 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.

  1. To stop a program use: ^C

  2. less

This is useful in that it helps to read files (txt).

To get out of a file, use q for quit.

  1. 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).

  2. 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.

  1. sudo reboot

Used to restart a system due to updates or if the desktop quits.

  1. 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

  1. 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. No man page (like a man cave for Linux commands...don't mind the pun too much) exists for all commands; i.e. cd.

  2. 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

  1. 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 use exit, 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!

Clone this wiki locally