Python Tutorial: Difference between revisions

From Master of Neuroscience Wiki
No edit summary
 
(17 intermediate revisions by the same user not shown)
Line 1: Line 1:
== How to Python in computational neuroscience, data mining, and more ==
== How to Python in computational neuroscience, data mining, and more ==
All the tutorials are tested with Python 3.11.x. Older version might have a problem with the new versions of type anotations.
All the tutorials are tested with Python 3.11.x. Older version might have a problem with the new versions of type anotations.
[https://www.youtube.com/playlist?list=PLK_Ujz7qXyqMhAlJcTke-qq5hytk7djCc Anna Förster: German Python Videos from the FB1 ComCast Team]
[https://atticlectures.net/scipro/python-2024/ Bálint Aradi (FB1): Attic Lectures (English python course)]


=== Flow chart ===
=== Flow chart ===
Line 79: Line 85:
* [[Dimensions and shape]]
* [[Dimensions and shape]]
** [[Broadcasting: Automatic adaption of dimensions​|Broadcasting: Automatic adaption of dimensions]]​
** [[Broadcasting: Automatic adaption of dimensions​|Broadcasting: Automatic adaption of dimensions]]​
* [[Making a matrix from numerical ranges]]
*[[Making a new matrix]]
**[[Making a matrix from numerical ranges]]
* [[Convert other data into numpy arrays e.g. asarray]]
* [[Convert other data into numpy arrays e.g. asarray]]
* [[New matrix]]
* [[New matrix]]
Line 185: Line 192:


=== PyTorch ===
=== PyTorch ===
* PyTorch lecture
** [https://mscneuro.neuro.uni-bremen.de/images/e/e3/PyTorch-Part0_and_4-Training_a_network.pdf Part 0 and 4]
** [https://mscneuro.neuro.uni-bremen.de/images/5/5f/PyTorch-Part1-a_stroll_through_the_zoo.pdf Part 1]
** [https://mscneuro.neuro.uni-bremen.de/images/8/83/PyTorch-Part2-Tensors_et_al.pdf Part 2]
** [https://mscneuro.neuro.uni-bremen.de/index.php/File:PyTorch-Part3-Training_a_network.pdf Part 3]


* [[Get CUDA ready!]]
* [[Get CUDA ready!]]
Line 222: Line 235:


* [[Basics with Python / Matlab]]
* [[Basics with Python / Matlab]]
=== Matlab: Basics ===
* [[Basic Commands and Variables]]
* [[Matlab Graphics]]
* [[Vectorization and Vector Calculus in Matlab]]
* [[Matlab Data Analysis]]
=== Other topics ===
* [[Open Source Tools]]
* [[Machine Learning Resources]]
* [[Datasets]]




Line 230: Line 257:
* [[Task 2 -- Collective coherent cortices: Data analysis]]
* [[Task 2 -- Collective coherent cortices: Data analysis]]
* Neuron Models Equations
* Neuron Models Equations
  - For detailed descriptions, please see: ['Neuronal Dynamics' textbook](https://neuronaldynamics.epfl.ch/online) ['Theoretical Neuroscience' textbook](https://boulderschool.yale.edu/sites/default/files/files/DayanAbbott.pdf)
** For detailed descriptions, please see:  
*** [https://neuronaldynamics.epfl.ch/online 'Neuronal Dynamics' textbook]
*** [https://boulderschool.yale.edu/sites/default/files/files/DayanAbbott.pdf 'Theoretical Neuroscience' textbook]
 
* Neuron Models Equations -- Rate-based neurons
* Neuron Models Equations -- Rate-based neurons
  - [[DivInE-model for MT neurons]]
** [[DivInE-model for MT neurons]]
 
* Neuron Models Equations -- Spiking neurons without explicit spike generation mechanism
* Neuron Models Equations -- Spiking neurons without explicit spike generation mechanism
  - [[Leaky Integrate-and-Fire]]
** [[Leaky Integrate-and-Fire]]
  - [[Exponential Integrate-and-Fire]]
** [[Exponential Integrate-and-Fire]]
  - [[Quadratic Integrate-and-Fire]]
** [[Quadratic Integrate-and-Fire]]
  - [[Connor Stevens]]
** [[Connor Stevens]]
 
* [[References]]
* [[References]]
* Task 1 -- Pictures for comparision
* Task 1 -- Pictures for comparision
  - [[Task 1 --Mandatory Tasks]]
** [[Task 1 --Mandatory Tasks]]
 
* Task 2 -- Pictures for comparision
* Task 2 -- Pictures for comparision
  - [[Task 2 -- Mandatory Tasks]]
** [[Task 2 -- Mandatory Tasks]]
  - [[Task 2 -- Voluntary Tasks: Preprocessing]]
** [[Task 2 -- Voluntary Tasks: Preprocessing]]
  - [[Task 2 -- Voluntary Tasks: More Information!]]
** [[Task 2 -- Voluntary Tasks: More Information!]]
 
=== Advanced Studies ===
=== Advanced Studies ===
* Material from ages past
* Material from ages past
  - [[2022: Preparation -- Python class with and without classes]]
** [[2022: Preparation -- Python class with and without classes]]
  - [[2022: Deep Networks and Pytorch]]
** [[2022: Deep Networks and Pytorch]]
  - [[2022: Divisive inhibition: a dynamical circuit for change detection]]
** [[2022: Divisive inhibition: a dynamical circuit for change detection]]
  - [[2022: Synchronization and dynamic oscillations in the visual system]]
** [[2022: Synchronization and dynamic oscillations in the visual system]]
  - [[2020: Deep Networks and Tensor Flow]]
** [[2020: Deep Networks and Tensor Flow]]
  - [[2020: Divisive Normalization -- a Universal Concept for Adaptive Dynamics and Function of Cortical Circuits]]
** [[2020: Divisive Normalization -- a Universal Concept for Adaptive Dynamics and Function of Cortical Circuits]]
  - [[2020: Recurrent networks: Temporal dynamics and synchronization]]
** [[2020: Recurrent networks: Temporal dynamics and synchronization]]
  - [[2017: Oscillations and information routing: CTC model]]
** [[2017: Oscillations and information routing: CTC model]]
  - [[2017: Change detection: The DivInE-Model]]
** [[2017: Change detection: The DivInE-Model]]
  - [[2017: Contour Integration]]
** [[2017: Contour Integration]]
  - [[2017: Computation Spike by Spike]]
** [[2017: Computation Spike by Spike]]
  - [[2017: Natural scenes and sparse coding in visual cortex]]
** [[2017: Natural scenes and sparse coding in visual cortex]]

Latest revision as of 17:21, 23 October 2025

How to Python in computational neuroscience, data mining, and more

All the tutorials are tested with Python 3.11.x. Older version might have a problem with the new versions of type anotations.


Anna Förster: German Python Videos from the FB1 ComCast Team

Bálint Aradi (FB1): Attic Lectures (English python course)

Flow chart

Workflow

Important VS Code notes:

  • You can mark segments of source node with your mouse (or keyboard) and use the TAB key to increase the level of the indentation or use SHIFT + TAB do decrease the indentation level.
  • Linux: CTRL + SHIFT + 7 toggles between comment and normal source code.
  • The function key F2 allows you to change variable and function names. VS Code goes through all the node in your Project directory and changes all occurrences of the function or variable name accordingly. The same is true if you change a file name in a project directory.

Python: The Basics of the basics

Python: Special topics

Numpy: The Basics of the basics

Numpy: Special topics

Numpy: Matlab topics

In the case you know Matlab check here: NumPy for MATLAB users

Matplotlib.pyplot

Pandas

Machine learning: Sci-kit Learn

Machine learning: Pure numpy

SciPy

Python: Questions of spectral nature

Python: Daily little helper

OpenCV2 and Python

PyTorch

PyBind11

Tensorflow / Keras

Sympy

Numerical Integration, Differentiation, and Differential Equations

Arduino

Matlab: Basics

Other topics


S1: Advanced Programming (last update 16.02.2024)

Advanced Studies