Python Tutorial: Difference between revisions

From Master of Neuroscience Wiki
No edit summary
Line 71: Line 71:
* [[Python Scopes and Namespaces]]
* [[Python Scopes and Namespaces]]
* [[Collection of distinct hashable objects -- set and frozenset]]
* [[Collection of distinct hashable objects -- set and frozenset]]
=== Numpy: The Basics of the basics ===
* [[The N-dimensional array (ndarray)]]
** [[set_printoptions]]
* [[Dimensions and shape]]
** [[Broadcasting: Automatic adaption of dimensions​|Broadcasting: Automatic adaption of dimensions]]​
* [[Making a matrix from numerical ranges]]
* [[Convert other data into numpy arrays e.g. asarray]]
* [[New matrix]]
* [[Save and load]]
* [[Reshape and flatten]]
* [[Slices and Views]]
* [[Concatenate Matrices and arrays]]
* [[Merging matrices]]
* [[Unique]]
* [[Where]]
** [[Piecewise]]
* [[Extending an existing matrix: tile, repeat, pad]]
* [[Boolean matricies and logic functions]]
* [[Advanced Indexing]]
** [[Ravel and UnRavel]]
* [[Available dtypes]]
* [[Constants]]
* [[Math functions]]
* [[Linear algebra]]
* [[Random numbers the non-legacy way]]
* [[Statistics]]
* [[FFT]]
** [[rfft and spectral power]]
** [[Spectral power and averaging over trials]]
* [[Meshgrid]]
* [[Flip, rot90, and roll a matrix]]
* Iterate
** [[ndenumerate]]
** [[ndindex]]
** [[flat]]
=== Numpy: Special topics ===
* [[Einstein summation]]
* [[Numba: Numpy just in time compiler -- speeding Numpy up]]
* [[Memory layout of Numpy matrices]]
* [[Stack and Split, Compress]]
* [[Beyond normal np.save]]
* [[Trim Zeros of a 1d array]]
* Iterating over an array / matrix
** [[nditer provides many ways to visit all the elements of one or more arrays]]
** [[Replacing an inner for loop with apply_along_axis]]
** [[nested_iters]]
* [[Manipulation of integers and their bits]]
* [[Numpy and JSON over Pandas]]
* [[Resize: Compensation for bad planning? Don't!]]
* [[Dealing with the main diagonal / triangles of a matrix]]
=== Numpy: Matlab topics ===
* [[Dealing with Matlab files]]
* [[Matlab is also just a Python package]]
* [[Running Python remotely from Matlab]]
In the case you know Matlab check here: [https://github.com/davrot/pytutorial/blob/main/numpy/matlab_guide/README.md NumPy for MATLAB users]

Revision as of 15:59, 16 October 2025

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

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