1 of 21

Your computer & you: a primer on command-line interfaces & IDEs

Python for Psychologists - Winter term 2022

Peer Herholz (he/him)

Research affiliate - NeuroDataScience-ORIGAMI lab at MNI, MIT, McGill & BRAMS

Member - BIDS, ReproNim, Brainhack, UNIQUE, CNeuroMod

@peerherholz

28/10/2022

Michael Ernst

Phd student - Neurocognitive Psychology at Goethe University Frankfurt

M-earnest

2 of 21

Recap of the last session

  • Academia is in a somewhat bad place
    • We maneuver challenges and shortcomings by being open and transparent about our work, aiming for reproducibility in all aspects of research
  • skills & expertise in computational work more & more needed for research (& beyond)
    • programming beneficial (sometimes necessary) in all parts of research workflow
    • programming tremendously important wrt open & reproducible science, as well as FAIR principles
    • open source & community-based approaches for the win!
  • aim of the course is to combine these aspects to build you up as capable researchers
    • three blocks that build upon each other: introduction (to programming) - experimentation - analyzes
    • from examples to real word data
    • get experience via assignments, participation, finals - grading depends on exam regulation

3 of 21

Your expectations for this session

What are your expectations for this session?

https://i.imgflip.com/2w2rmv.jpg

4 of 21

Objectives for this session

https://media.makeameme.org/created/look-at-the-25f4b725ed.jpg

  • Learn about different ways of interacting with computers
  • GUI, CLI, IDEs
  • test different options on your machines
  • Ask and answer questions
  • Have a great time

5 of 21

Outline for this session

  • GUI vs. CLI
  • How & and where to use

CLI/programming?

    • shell
    • Jupyter notebook
    • IDEs
  • Outro/Q&A

https://twitter.com/OfficeMemes_/status/1298982572848869380/photo/1

6 of 21

GUI vs. CLI - interacting with machines

User (you)

- input -

machine

- data processing -

result(s)

- output -

Nature

7 of 21

GUI vs. CLI - an example

https://giphy.com/gifs/colbertlateshow-stephen-colbert-surprise-late-show-l0HlO3BJ8LALPW4sE

We will dive right in!

Everyone gets 5 min to do the following:

  • create a directory structure (folders/subfolders) on your desktop

“addams_family/pugsley”

“addams_family/gomez”

“addams_family/fester”

  • within each subfolder create 10 text files called “scooby_doo_[1-10].txt”
  • move text files with even numbers to a new folder called “the_new_yorker” and add their origin folder to their name (e.g. scooby_doo_2_pugsley.txt)

8 of 21

GUI vs. CLI - the frustration

https://giphy.com/gifs/computer-ron-swanson-parks-and-recreation-ktcUyw6mBlMVa

These tasks are anything but fun...now imagine you have to do this for hundreds of data samples/task/etc. … isn’t there a different way that is more feasible, faster, less prone to errors?

Well, say no more!

9 of 21

GUI vs. CLI - the old question: why programming?

https://giphy.com/gifs/the-simpsons-computer-confused-citBl9yPwnUOs

https://giphy.com/gifs/error-WhFfFPCEDXpBe

vs.

10 of 21

GUI vs. CLI - the old question: why programming?

11 of 21

GUI vs. CLI - the old question: why programming?

interaction

mouse/keyboard

application windows

keyboard

response in CL

ease of use

(mostly) easy across levels of expertise

easy if experienced

memory

high memory usage due to rendering, etc.

low memory usage given directness

precision

low

high

speed

low

high

vs.

12 of 21

GUI vs. CLI - the old question: why programming?

advantages

easier for beginners

ok for simple one-time tasks

more control

faster/more efficient

complex & repetitive task

reproducibility (if done right)

scripting/programming

stability

disadvantages

vs.

limited capacities

slow/less efficient

not reproducible

cumbersome to perform complex/repetitive tasks

(steep) learning curve

13 of 21

Outline for this session

  • GUI vs. CLI
  • How & where to use

CLI/programming?

    • shell
    • Jupyter notebook
    • IDEs
  • Outro/Q&A

https://twitter.com/OfficeMemes_/status/1298982572848869380/photo/1

14 of 21

How & where to use CLI/programming? - shell

By Emx - Wikimedia Foundation, GPL, https://commons.wikimedia.org/w/index.php?curid=509725

Von Chealer - Eigenes Werk, GPL, https://commons.wikimedia.org/w/index.php?curid=2945062

https://www.fullstackpython.com/img/logos/zsh.jpg

http://www.kornshell.com/kornshell.gif

…...

15 of 21

How & where to use CLI/programming? - jupyter notebooks

  • a community of people

  • an ecosystem of open tools and standards for interactive computing
  • language-agnostic and modular

  • empower people to use other open tools

16 of 21

How & where to use CLI/programming? - jupyter notebooks

17 of 21

How & where to use CLI/programming? - Integrated development environment

Microsoft, Public domain, via Wikimedia Commons

BY Serogen (Diskussion) - Own work, MIT, https://commons.wikimedia.org/w/index.php?curid=95805188

Visual Studio Code

18 of 21

Recap for this session

  • different ways of interacting with computer
    • GUI vs. CLI
    • dependent on task but CLI generally preferred/better
      • speed/performance/reliability/capabilities
  • different ways of CLI usage/coding
    • dependent on task/project
    • shells
    • jupyter notebooks/lab
    • IDEs

19 of 21

Were your expectations for this session fulfilled?

20 of 21

Questions you could/should ask based on this session

Are there cases where GUI based point-and-click is sufficient?

How can I incorporate the different tools into my research workflow?

When should shell, jupyter notebooks/lab or IDEs be utilized?

Can different tools be combined across/within workflows?

21 of 21

https://giphy.com/gifs/season-17-the-simpsons-17x6-xT5LMB2WiOdjpB7K4o