Main public logs
From Master of Neuroscience Wiki
Combined display of all available logs of Master of Neuroscience Wiki. You can narrow down the view by selecting a log type, the username (case-sensitive), or the affected page (also case-sensitive).
- 14:03, 17 October 2025 Davrot talk contribs created page Matlab is also just a Python package (Created page with "== The goal == Remote controlling Matlab from Python using the Matlab engine package. (Note: A similar approach can be used with C/C++ instead of Python.) Questions to [mailto:davrot@uni-bremen.de David Rotermund] == Installing Matlab under Python == [https://de.mathworks.com/support/requirements/python-compatibility.html Versions of Python Compatible with MATLAB Products by Release] Obviously you need a working Matlab and Python installation first. Then… === Linux...") Tag: Visual edit
- 13:57, 17 October 2025 Davrot talk contribs created page Dealing with Matlab files (Created page with "== The goal == We want to read and write Matlab files under Python. Questions to [mailto:davrot@uni-bremen.de David Rotermund] Reminder: Learning Python as Matlab user Please read [https://numpy.org/doc/stable/user/numpy-for-matlab-users.html NumPy for MATLAB users] == Mat files under Python == === MATLAB < 7.3 format mat files === This is a job for [https://docs.scipy.org/doc/scipy/reference/io.html#module-scipy.io scipy.io] {| class="wikitable" |[https://docs....") Tag: Visual edit
- 13:56, 17 October 2025 Davrot talk contribs created page Dealing with the main diagonal / triangles of a matrix (Created page with "== Top == Questions to [mailto:davrot@uni-bremen.de David Rotermund] '''This is an optional topic!''' == [https://numpy.org/doc/stable/reference/generated/numpy.fill_diagonal.html numpy.fill_diagonal] == <syntaxhighlight lang="python">numpy.fill_diagonal(a, val, wrap=False)</syntaxhighlight><blockquote>Fill the main diagonal of the given array of any dimensionality. For an array a with a.ndim >= 2, the diagonal is the list of locations with indices a[i, …, i] a...") Tag: Visual edit
- 13:55, 17 October 2025 Davrot talk contribs created page Resize: Compensation for bad planning? Don't! (Created page with "== Top == Questions to [mailto:davrot@uni-bremen.de David Rotermund] '''Try to avoid using this function!''' Do better planning. Resize does its work on the linear memory segment. * If it is resized to a bigger array, the beginning of the original memory segment is copied into the new end segment. * If it is resized to a smaller array, the memory segment is shrunken by cutting of the end. == [https://numpy.org/doc/stable/reference/generated/numpy.resize.html numpy.res...") Tag: Visual edit
- 13:54, 17 October 2025 Davrot talk contribs created page Numpy and JSON over Pandas (Created page with "== The goal == Normally we can not use JSON with Numpy. However, if we use [https://pandas.pydata.org/ Pandas] as an intermediary then we can do it. Questions to [mailto:davrot@uni-bremen.de David Rotermund] '''Note: Pandas can also be used for many other formats beside JSON.''' == Writing JSON [https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.to_json.html#pandas-dataframe-to-json pandas.DataFrame.to_json] == <syntaxhighlight lang="python">DataFrame.to_js...") Tag: Visual edit
- 13:53, 17 October 2025 Davrot talk contribs created page Manipulation of integers and their bits (Created page with "== The goal == Manipulation of integers and their bits Questions to [mailto:davrot@uni-bremen.de David Rotermund] == [https://numpy.org/doc/stable/reference/generated/numpy.ndarray.byteswap.html numpy.ndarray.byteswap] == <syntaxhighlight lang="python">ndarray.byteswap(inplace=False)</syntaxhighlight><blockquote>Swap the bytes of the array elements Toggle between low-endian and big-endian data representation by returning a byteswapped array, optionally swapped in-plac...") Tag: Visual edit
- 13:52, 17 October 2025 Davrot talk contribs created page Nested iters (Created page with "== Top == Questions to [mailto:davrot@uni-bremen.de David Rotermund] '''This is an optional topic!''' == [https://numpy.org/doc/stable/reference/generated/numpy.nested_iters.html numpy.nested_iters] == <syntaxhighlight lang="python">numpy.nested_iters(op, axes, flags=None, op_flags=None, op_dtypes=None, order='K', casting='safe', buffersize=0)</syntaxhighlight><blockquote>Create nditers for use in nested loops Create a tuple of nditer objects which iterate in nested l...") Tag: Visual edit
- 13:50, 17 October 2025 Davrot talk contribs created page Replacing an inner for loop with apply along axis (Created page with "== The goal == Questions to [mailto:davrot@uni-bremen.de David Rotermund] '''This is an optional topic!''' == [https://numpy.org/doc/stable/reference/generated/numpy.apply_along_axis.html numpy.apply_along_axis] == <syntaxhighlight lang="python">numpy.apply_along_axis(func1d, axis, arr, *args, **kwargs)</syntaxhighlight><blockquote>Apply a function to 1-D slices along the given axis. Execute func1d(a, *args, **kwargs) where func1d operates on 1-D arrays and a is a 1-D...") Tag: Visual edit
- 13:48, 17 October 2025 Davrot talk contribs created page Nditer provides many ways to visit all the elements of one or more arrays (Created page with "== The goal == More iterating over an array… Questions to [mailto:davrot@uni-bremen.de David Rotermund] '''This is an optional topic!''' == [https://numpy.org/doc/stable/reference/generated/numpy.nditer.html numpy.nditer] == <syntaxhighlight lang="python">class numpy.nditer(op, flags=None, op_flags=None, op_dtypes=None, order='K', casting='safe', op_axes=None, itershape=None, buffersize=0)</syntaxhighlight><blockquote>Efficient multi-dimensional iterator object to i...") Tag: Visual edit
- 13:46, 17 October 2025 Davrot talk contribs created page Trim Zeros of a 1d array (Created page with "== Top == Questions to [mailto:davrot@uni-bremen.de David Rotermund] == [https://numpy.org/doc/stable/reference/generated/numpy.trim_zeros.html numpy.trim_zeros] == <syntaxhighlight lang="python">numpy.trim_zeros(filt, trim='fb')</syntaxhighlight><blockquote>Trim the leading and/or trailing zeros from a 1-D array or sequence.</blockquote><syntaxhighlight lang="python">import numpy as np a = np.arange(0, 10) b = np.zeros((5), dtype=np.int64) c = np.r_[b, a, b] print(c)...") Tag: Visual edit
- 13:40, 17 October 2025 Davrot talk contribs created page Beyond normal np.save (Created page with "== The goal == Let’s [https://numpy.org/doc/stable/reference/routines.io.html save and load data under numpy]. This can be more complicated than expected. Questions to [mailto:davrot@uni-bremen.de David Rotermund] == Normal [https://numpy.org/doc/stable/reference/generated/numpy.save.html np.save] and [https://numpy.org/doc/stable/reference/generated/numpy.load.html np.load] == A normal np.save and np.load cycle may look like this:<syntaxhighlight lang="python">impor...") Tag: Visual edit
- 13:39, 17 October 2025 Davrot talk contribs created page Stack and Split, Compress (Created page with "== The goal == Questions to [mailto:davrot@uni-bremen.de David Rotermund] '''This is an optional topic!''' == [https://numpy.org/doc/stable/reference/generated/numpy.column_stack.html numpy.column_stack] == <syntaxhighlight lang="python">numpy.column_stack(tup)</syntaxhighlight><blockquote>Stack 1-D arrays as columns into a 2-D array. Take a sequence of 1-D arrays and stack them as columns to make a single 2-D array. 2-D arrays are stacked as-is, just like with hstack...") Tag: Visual edit
- 13:35, 17 October 2025 Davrot talk contribs created page Memory layout of Numpy matrices (Created page with "== The goal == More information about the Numpy matrices and the memory structure behind it. Questions to [mailto:davrot@uni-bremen.de David Rotermund] == Memory layouts (row-major vs column-major) == C order (or row-major)<blockquote>In row-major order, the last dimension is contiguous, so that the memory-offset of this element is given by:</blockquote><math display="block"> n_{d}+N_{d}\cdot (n_{d-1}+N_{d-1}\cdot (n_{d-2}+N...") Tag: Visual edit
- 13:35, 17 October 2025 Davrot talk contribs created page File:2025-10-17 15-34.png
- 13:35, 17 October 2025 Davrot talk contribs uploaded File:2025-10-17 15-34.png
- 13:33, 17 October 2025 Davrot talk contribs created page Numba: Numpy just in time compiler -- speeding Numpy up (Created page with "== The goal == [https://numba.pydata.org/ “Numba is an open source JIT compiler that translates a subset of Python and NumPy code into fast machine code.”] Questions to [mailto:davrot@uni-bremen.de David Rotermund]<syntaxhighlight lang="shell">pip install numba</syntaxhighlight>[https://numba.pydata.org/numba-doc/latest/user/5minguide.html A ~5 minute guide to Numba] == [https://numba.pydata.org/numba-doc/dev/reference/types.html Numba basic types] == For the examp...") Tag: Visual edit
- 13:32, 17 October 2025 Davrot talk contribs created page Einstein summation (Created page with "== Top == Questions to [mailto:davrot@uni-bremen.de David Rotermund] == Examples == <math display="block">b = \sum_i a_{i,i}</math><syntaxhighlight lang="python">import numpy as np a = np.arange(0, 25).reshape(5, 5) print(a) print(a.shape) # -> (5, 5) print(np.einsum("ii", a)) # -> 60 print(np.einsum(a, [0, 0])) # -> 60 print(np.einsum(a, [0, 0], [])) # -> 60</syntaxhighlight>Output:<syntaxhighlight lang="python">[[ 0 1 2 3 4] [ 5 6 7 8 9] [10 11 12 13 14...") Tag: Visual edit
- 13:30, 17 October 2025 Davrot talk contribs created page Flat (Created page with "== Top == Questions to [mailto:davrot@uni-bremen.de David Rotermund] == [https://numpy.org/doc/stable/reference/generated/numpy.ndarray.flat.html numpy.ndarray.flat] == <syntaxhighlight lang="python">ndarray.flat</syntaxhighlight><blockquote>A 1-D iterator over the array. This is a numpy.flatiter instance, which acts similarly to, but is not a subclass of, Python’s built-in iterator object.</blockquote><syntaxhighlight lang="python">import numpy as np a = np.arange(...") Tag: Visual edit
- 13:30, 17 October 2025 Davrot talk contribs created page Ndindex (Created page with "== Top == Questions to [mailto:davrot@uni-bremen.de David Rotermund] == [https://numpy.org/doc/stable/reference/generated/numpy.ndindex.html numpy.ndindex] == <syntaxhighlight lang="python">class numpy.ndindex(*shape)[source]</syntaxhighlight><blockquote>An N-dimensional iterator object to index arrays. Given the shape of an array, an ndindex instance iterates over the N-dimensional index of the array. At each iteration a tuple of indices is returned, the last dimensio...") Tag: Visual edit
- 13:27, 17 October 2025 Davrot talk contribs created page Ndenumerate (Created page with " = ndenumerate = == Top == Questions to [mailto:davrot@uni-bremen.de David Rotermund] == [https://numpy.org/doc/stable/reference/generated/numpy.ndenumerate.html numpy.ndenumerate] == <syntaxhighlight lang="python">class numpy.ndenumerate(arr)</syntaxhighlight><blockquote>Multidimensional index iterator. Return an iterator yielding pairs of array coordinates and values.</blockquote><syntaxhighlight lang="python">import numpy as np a = np.arange(0, 12).reshape((4, 3))...") Tag: Visual edit
- 13:26, 17 October 2025 Davrot talk contribs created page Flip, rot90, and roll a matrix (Created page with "== The goal == Questions to [mailto:davrot@uni-bremen.de David Rotermund] == [https://numpy.org/doc/stable/reference/generated/numpy.flip.html numpy.flip] == <syntaxhighlight lang="python">numpy.flip(m, axis=None)</syntaxhighlight><blockquote>Reverse the order of elements in an array along the given axis. The shape of the array is preserved, but the elements are reordered. '''m''': array_like Input array. '''axis''': None or int or tuple of ints, optional Axis or a...") Tag: Visual edit
- 13:25, 17 October 2025 Davrot talk contribs created page Meshgrid (Created page with "== The goal == Questions to [mailto:davrot@uni-bremen.de David Rotermund] == [https://numpy.org/doc/stable/reference/generated/numpy.meshgrid.html numpy.meshgrid] == <syntaxhighlight lang="python">numpy.meshgrid(*xi, copy=True, sparse=False, indexing='xy')</syntaxhighlight><blockquote>Return a list of coordinate matrices from coordinate vectors. Make N-D coordinate arrays for vectorized evaluations of N-D scalar/vector fields over N-D grids, given one-dimensional coord...") Tag: Visual edit
- 13:22, 17 October 2025 Davrot talk contribs created page File:5 4.png
- 13:22, 17 October 2025 Davrot talk contribs uploaded File:5 4.png
- 13:21, 17 October 2025 Davrot talk contribs created page File:5 2.png
- 13:21, 17 October 2025 Davrot talk contribs uploaded File:5 2.png
- 13:21, 17 October 2025 Davrot talk contribs created page File:5 1.png
- 13:21, 17 October 2025 Davrot talk contribs uploaded File:5 1.png
- 13:20, 17 October 2025 Davrot talk contribs created page File:5 0.png
- 13:20, 17 October 2025 Davrot talk contribs uploaded File:5 0.png
- 13:11, 17 October 2025 Davrot talk contribs created page Spectral power and averaging over trials (Created page with "== Top == Questions to [mailto:davrot@uni-bremen.de David Rotermund] == The order is important == You are not allowed to average over the trials before calculating the power. This is the same for calculating the fft power as well as the wavelet power. The worst case senario would be two waves in anti-phase:<syntaxhighlight lang="python">import numpy as np import matplotlib.pyplot as plt t: np.ndarray = np.linspace(0, 1.0, 10000) f: float = 10 sinus_a = np.sin(f * t *...") Tag: Visual edit
- 13:10, 17 October 2025 Davrot talk contribs created page File:43897 3.png
- 13:10, 17 October 2025 Davrot talk contribs uploaded File:43897 3.png
- 13:10, 17 October 2025 Davrot talk contribs created page File:43897 2.png
- 13:10, 17 October 2025 Davrot talk contribs uploaded File:43897 2.png
- 13:10, 17 October 2025 Davrot talk contribs created page File:43897 1.png
- 13:10, 17 October 2025 Davrot talk contribs uploaded File:43897 1.png
- 13:09, 17 October 2025 Davrot talk contribs created page File:43897 0.png
- 13:09, 17 October 2025 Davrot talk contribs uploaded File:43897 0.png
- 13:08, 17 October 2025 Davrot talk contribs created page Rfft and spectral power (Created page with "== Goal == We want to calculate a well behaved power spectral density from a 1 dimensional time series. Questions to [mailto:davrot@uni-bremen.de David Rotermund] == Generation of test data == We will generate a sine wave with 10 Hz.<syntaxhighlight lang="python">import numpy as np time_series_length: int = 1000 dt: float = 1.0 / 1000.0 # time resolution is 1ms sampling_frequency: float = 1.0 / dt frequency_hz: float = 10.0 t: np.ndarray = np.arange(0, time_series_le...") Tag: Visual edit
- 13:07, 17 October 2025 Davrot talk contribs created page File:33897 3.png
- 13:07, 17 October 2025 Davrot talk contribs uploaded File:33897 3.png
- 13:07, 17 October 2025 Davrot talk contribs created page File:33897 2.png
- 13:07, 17 October 2025 Davrot talk contribs uploaded File:33897 2.png
- 13:07, 17 October 2025 Davrot talk contribs created page File:33897 1.png
- 13:07, 17 October 2025 Davrot talk contribs uploaded File:33897 1.png
- 13:04, 17 October 2025 Davrot talk contribs created page FFT (Created page with "== The goal == Fouriert transformations are an important part of data analysis. Questions to [mailto:davrot@uni-bremen.de David Rotermund] == [https://numpy.org/doc/stable/reference/routines.fft.html Numpy] vs [https://docs.scipy.org/doc/scipy/tutorial/fft.html#fourier-transforms-scipy-fft scipy] == <syntaxhighlight lang="shell">pip install scipy</syntaxhighlight>Numpy says [https://numpy.org/doc/stable/reference/routines.fft.html#discrete-fourier-transform-numpy-fft i...") Tag: Visual edit
- 13:04, 17 October 2025 Davrot talk contribs created page File:23897 4b.png
- 13:04, 17 October 2025 Davrot talk contribs uploaded File:23897 4b.png
- 13:03, 17 October 2025 Davrot talk contribs created page File:23897 4.png