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

Logs
(newest | oldest) View ( | ) (20 | 50 | 100 | 250 | 500)
  • 15:11, 16 October 2025 Davrot talk contribs created page Organizing parameters: dataclasses and dataconf (Created page with " == The goal == In data science we have a lot of parameters in our simulations. Often the parameters are distributed over the whole source code. The combination of dataclass and dataconf allows it very easily to put the parameters in to a config file. dataconf supports many different config types. Among those are json and yaml. Questions to [mailto:davrot@uni-bremen.de David Rotermund]<syntaxhighlight lang="shell">pip install dataconf</syntaxhighlight> == Defining the...") Tag: Visual edit
  • 15:10, 16 October 2025 Davrot talk contribs created page Dataclass (Created page with " == The goal == There is a new build-in [https://docs.python.org/3/library/dataclasses.html dataclass] class which is highly interesting for data scientists. Obviously it is a class for storing your data. Who would have guessed… Questions to [mailto:davrot@uni-bremen.de David Rotermund] '''Type annotations required!!!''' This is the first construct in Python that requires type annotation. If we do this, we get this nice error!<syntaxhighlight lang="python">from dat...") Tag: Visual edit
  • 15:09, 16 October 2025 Davrot talk contribs created page The Python Standard Library​ (Created page with " == The goal == More than the standard instruction set… Questions to [mailto:davrot@uni-bremen.de David Rotermund] == [https://docs.python.org/3/library/text.html​ Text Processing Services] == <blockquote>The modules described in this chapter provide a wide range of string manipulation operations and other text processing services.</blockquote> {| class="wikitable" |'''[https://docs.python.org/3/library/string.html ​string]''' |'''Common string operations'''​ |...") Tag: Visual edit
  • 15:28, 15 October 2025 Davrot talk contribs created page Pickle: save and load Python objects (Created page with " == The goal == How to store Python objects in files and how to restore them. Questions to [mailto:davrot@uni-bremen.de David Rotermund] '''Warning The pickle module is not secure. Only unpickle data you trust.''' == [https://docs.python.org/3/library/pickle.html#module-pickle pickle] == <blockquote>The [https://docs.python.org/3/library/pickle.html#module-pickle pickle] module implements binary protocols for serializing and de-serializing a Python object structure....") Tag: Visual edit
  • 13:46, 15 October 2025 Davrot talk contribs created page Built-in Keywords (Created page with " == The goal == You need to know the keywords for Python because you should not use them as variable, class, or function names. Questions to [mailto:davrot@uni-bremen.de David Rotermund] == [https://docs.python.org/3/library/keyword.html Keywords] == <syntaxhighlight lang="python">import keyword print(keyword.kwlist) print() print(keyword.softkwlist) # -> ['_', 'case', 'match']</syntaxhighlight>Output:<syntaxhighlight lang="python">['False', 'None', 'True', 'and', 'as...") Tag: Visual edit
  • 13:45, 15 October 2025 Davrot talk contribs created page Built-in Functions (Created page with " == The goal == Do I need to know what all these functions are doing? No, but you are shouldn’t use these function names for your own functions! However… I marked the one in bold font that you should know. Questions to [mailto:davrot@uni-bremen.de David Rotermund] {| class="wikitable" |[https://docs.python.org/3/library/functions.html#abs '''abs()'''] |Return the absolute value of a number. |- |[https://docs.python.org/3/library/functions.html#aiter aiter()] |Retur...") Tag: Visual edit
  • 13:44, 15 October 2025 Davrot talk contribs created page Importing Modules (Created page with " == The goal == Collections of functions can be organized into modules. These modules are then imported into a programm or another module. Questions to [mailto:davrot@uni-bremen.de David Rotermund] == [https://docs.python.org/3/tutorial/modules.html Basics] == <blockquote>A module is a file containing Python definitions and statements. The file name is the module name with the suffix .py appended. Within a module, the module’s name (as a string) is available as the v...") Tag: Visual edit
  • 13:39, 15 October 2025 Davrot talk contribs created page Exceptions (try / except) (Created page with " == The goal == The “modern” way (the concept is from the 1960) to deal with errors is to use exceptions. “Normal” errors just kill your program. Exceptions allow you to react to the error (if you want to). Plus, it is standardized and you don’t need to invent your own approach, which is important if source code is exchanged. An exception is thrown (i.e. raised under Python). And the program has to catch and deal with the exception. Questions to [mailto:davro...") Tag: Visual edit
  • 13:32, 15 October 2025 Davrot talk contribs created page Class (Created page with " == The goal == Class has a very important job as a core container type in Python. It is really hard to find a good overview how to use them in a good practice manner. Questions to [mailto:davrot@uni-bremen.de David Rotermund] == Basics == Class is the core component of object-oriented programming (OOP). A class is an [https://docs.python.org/3/reference/datamodel.html object] that can...") Tag: Visual edit
  • 13:29, 15 October 2025 Davrot talk contribs created page Finding files in a directory: glob (Created page with " == Goal == We want to deal with many files in a directory. What is an easy way to get the filename in a directory? Questions to [mailto:davrot@uni-bremen.de David Rotermund] == Creating test files == <syntaxhighlight lang="python">from pathlib import Path Path("Testfile_1.mat").touch() Path("Testfile_2.mat").touch() Path("Testfile_10.mat").touch() Path("Testfile_3.mat").touch()</syntaxhighlight> == Using glob in a for-loop == <syntaxhighlight lang="python">import gl...") Tag: Visual edit
  • 13:28, 15 October 2025 Davrot talk contribs created page Creating order via sub-directories: os.makedirs (Created page with " == The goal == How can I make sure that the directory for my output data is always there? We just create it automatically every time via [https://docs.python.org/3/library/os.html#os.makedirs os.makedirs]! Questions to [mailto:davrot@uni-bremen.de David Rotermund] == Creating a directory == <syntaxhighlight lang="python">import os some_path: str = "a_home_for_my_data" os.makedirs(some_path, exist_ok=True)</syntaxhighlight> == Creating a sub-sub-sub-directory == Firs...") Tag: Visual edit
  • 13:27, 15 October 2025 Davrot talk contribs created page JSON and dict for parameter files (Created page with " == The goal == A combination of JSON (JavaScript Object Notation) file and dictionaries allows to organize parameters in an external file. Questions to [mailto:davrot@uni-bremen.de David Rotermund] == [https://docs.python.org/3/library/json.html json – JSON encoder and decoder] == === [https://docs.python.org/3/library/json.html#json.dump dump] === <syntaxhighlight lang="python">import json a = dict(one=1, two=2, three=3) with open("data_out.json", "w") as file:...") Tag: Visual edit
  • 13:26, 15 October 2025 Davrot talk contribs created page Files (Created page with " == The goal == How to deal with (non-numpy) files under Python? Questions to [mailto:davrot@uni-bremen.de David Rotermund] == [https://docs.python.org/3/library/functions.html#open Open] a file == <syntaxhighlight lang="python">open(file, mode='r', buffering=- 1, encoding=None, errors=None, newline=None, closefd=True, opener=None)</syntaxhighlight>The available modes are: {| class="wikitable" !Character !Meaning |- |'''‘r’''' |'''open for reading (default)'''​ |...") Tag: Visual edit
  • 13:25, 15 October 2025 Davrot talk contribs created page Type annotations (Created page with " == Goal == We want to use static type checking and type annotations in our Python code for detecting errors we made. We will use the mypy extension in VS code for that.<syntaxhighlight lang="python">a: int = 0 b: float = 0.0 a = b Incompatible types in assignment (expression has type "float", variable has type "int")</syntaxhighlight>Questions to [mailto:davrot@uni-bremen.de David Rotermund] == Why [https://peps.python.org/pep-0484/ Type hints]? == Why we got type...") Tag: Visual edit
  • 13:25, 15 October 2025 Davrot talk contribs created page File:9087234 image0.png
  • 13:25, 15 October 2025 Davrot talk contribs uploaded File:9087234 image0.png
  • 13:17, 15 October 2025 Davrot talk contribs created page Functions (Created page with " == The goal == A function allows to separate a part of the code in a logical module that can be reused. Questions to [mailto:davrot@uni-bremen.de David Rotermund] '''Logic blocks need to be indented.​ Preferable with 4 spaces!''' == [https://docs.python.org/3/tutorial/controlflow.html#defining-functions Most simple function] == These three functions are equivalent:<syntaxhighlight lang="python">def my_function(): pass def my_function(): return def my_func...") Tag: Visual edit
  • 13:15, 15 October 2025 Davrot talk contribs created page Dict​ (Created page with " == The goal == Questions to [mailto:davrot@uni-bremen.de David Rotermund] == [https://docs.python.org/3/library/stdtypes.html#mapping-types-dict Mapping Types - dict​] == <blockquote>A mapping object maps hashable values to arbitrary objects. Mappings are mutable objects. There is currently only one standard mapping type, the dictionary. A dictionary’s keys are almost arbitrary values. Values that are not hashable, that is, values containing lists, dictionaries or...") Tag: Visual edit
  • 13:14, 15 October 2025 Davrot talk contribs created page Zip (Created page with " == Top == Questions to [mailto:davrot@uni-bremen.de David Rotermund] == [https://docs.python.org/3/library/functions.html#zip zip] == <syntaxhighlight lang="python">zip(*iterables, strict=False)</syntaxhighlight><blockquote>Iterate over several iterables in parallel, producing tuples with an item from each one.</blockquote><syntaxhighlight lang="python">a = zip([1, 2, 3], ["sugar", "spice", "everything nice"]) print(a) # -> <zip object at 0x7f34987f4380> for item in...") Tag: Visual edit
  • 13:13, 15 October 2025 Davrot talk contribs created page Tuple (Created page with " == The goal == Tuple are a non-mutable container which is typically used for heterogenic data types and is very important for functions with multiple return values. Questions to [mailto:davrot@uni-bremen.de David Rotermund] == [https://docs.python.org/3/library/stdtypes.html#tuple​ Tuples​] == <blockquote>Tuples are immutable sequences, typically used to store collections of heterogeneous data (such as the 2-tuples produced by the enumerate() built-in). Tuples are...") Tag: Visual edit
  • 13:12, 15 October 2025 Davrot talk contribs created page List Comprehensions​ (Created page with " == Top == Questions to [mailto:davrot@uni-bremen.de David Rotermund] == [https://docs.python.org/3/tutorial/datastructures.html#list-comprehensions List Comprehension] == <blockquote>List comprehensions provide a concise way to create lists. Common applications are to make new lists where each element is the result of some operations applied to each member of another sequence or iterable, or to create a subsequence of those elements that satisfy a certain condition.</b...") Tag: Visual edit
  • 13:06, 15 October 2025 Davrot talk contribs created page Lists (Created page with " == The goal == <blockquote>Lists are '''mutable''' sequences, '''typically''' used to store collections of '''homogeneous''' items (where the precise degree of similarity will vary by application).</blockquote>[https://docs.python.org/3/library/stdtypes.html#lists Quote] Questions to [mailto:davrot@uni-bremen.de David Rotermund] == Example Lists == With homogeneous items:<syntaxhighlight lang="python">primes = [2, 3, 5, 7] collection_of_strings = [ "AA", "BB"...") Tag: Visual edit
  • 11:02, 15 October 2025 Davrot talk contribs created page Flow Control: match case (Created page with " == The goal == There is a new flow control in town. A switch case replacement, called match case. Questions to [mailto:davrot@uni-bremen.de David Rotermund] == The [https://docs.python.org/3/reference/compound_stmts.html#the-match-statement match] statement == The match statement is used for pattern matching. Syntax:<syntaxhighlight lang="python">match_stmt ::= 'match' subject_expr ":" NEWLINE INDENT case_block+ DEDENT subject_expr ::= star_named_expression "," st...") Tag: Visual edit
  • 11:01, 15 October 2025 Davrot talk contribs created page Flow Control: while, pass, break, continue (Created page with " == The goal == While we wait… Questions to [mailto:davrot@uni-bremen.de David Rotermund] '''Logic blocks need to be indented.​ Preferable with 4 spaces!''' == [https://docs.python.org/3/reference/compound_stmts.html#the-while-statement The while statement] == <syntaxhighlight lang="python">i = 0​ while i < 3:​ print(i)​ i += 1</syntaxhighlight>Output<syntaxhighlight lang="python">0​ 1​ 2</syntaxhighlight> == The full statement == <syntaxhighlig...") Tag: Visual edit
  • 11:00, 15 October 2025 Davrot talk contribs created page Flow Control: for-loop (Created page with " == The goal == For what reason… Questions to [mailto:davrot@uni-bremen.de David Rotermund] '''Logic blocks need to be indented.​ Preferable with 4 spaces!''' == [https://docs.python.org/3/reference/compound_stmts.html#the-for-statement The for statement] == <blockquote>The for statement is used to iterate over the elements of a sequence (such as a string, tuple or list) or other iterable object</blockquote> === With range() === <syntaxhighlight lang="python">for...") Tag: Visual edit
  • 10:59, 15 October 2025 Davrot talk contribs created page Flow Control: if, elif, else (Created page with " == The goal == If I would have… Questions to [mailto:davrot@uni-bremen.de David Rotermund] '''Logic blocks need to be indented.​ Preferable with 4 spaces!''' == [https://docs.python.org/3/reference/compound_stmts.html#the-if-statement The if statement] == <syntaxhighlight lang="python">if i == 1:​ print("if")​ elif i == 2:​ print("elif brach A")​ elif i == 3:​ print("elif brach B")​ else:​ print("else -- default")​</syntaxhighlight...") Tag: Visual edit
  • 10:58, 15 October 2025 Davrot talk contribs created page Flow Control Overview (Created page with " == The goal == Let us look what kind of options we have for flow control in Python. Questions to [mailto:davrot@uni-bremen.de David Rotermund] '''Logic blocks need to be indented. Preferable with 4 spaces!''' There is called a so called [https://docs.python.org/3/reference/index.html The Python Language Reference] {| class="wikitable" !Selection statements |- |[https://docs.python.org/3/reference/compound_stmts.html#the-if-statement if, elif, else​] |- |[https://do...") Tag: Visual edit
  • 10:56, 15 October 2025 Davrot talk contribs created page Formatted String Literals (Created page with " == The goal == Using formated string literals is an easy way to produce formated strings from data / variables. Questions to [mailto:davrot@uni-bremen.de David Rotermund] == Basic Formatted String Literals == A formatted string literals starts with an f and the variables that you want to print are placed at their intended position embeded into { }. For example:<syntaxhighlight lang="python">import numpy as np a: str = "Hello" b: int = 1 c: float = np.pi mystring: st...") Tag: Visual edit
  • 10:52, 15 October 2025 Davrot talk contribs created page Truth Value Testing (Created page with "Questions to [mailto:davrot@uni-bremen.de David Rotermund] [https://docs.python.org/3/library/stdtypes.html#truth-value-testing “Any object can be tested for truth value, for use in an if or while condition or as operand of the Boolean operations below.”] = Common mistake to avoid = For True, False, None we use is and is not for comparisons. They are objects and not values thus we need to use is and is not. Correct<syntaxhighlight lang="python">if a: # "a is True"...") Tag: Visual edit
  • 10:34, 15 October 2025 Davrot talk contribs created page Basic Math Operations (Created page with "Questions to [mailto:davrot@uni-bremen.de David Rotermund] == Number is Python == In Python everything is a class. Numbers are classes as well. === Integer === <syntaxhighlight lang="python">a_number = 0​ print(type(a_number))​ # -> <class 'int'>​</syntaxhighlight> == FLOATing point number == <syntaxhighlight lang="python">a_second_number = 3.33​ print(type(a_second_number))​ # -> <class 'float'>​</syntaxhighlight> == Conversion (i.e. casts) between types...") Tag: Visual edit
  • 10:12, 15 October 2025 Davrot talk contribs changed group membership for Julia from (none) to administrator and bureaucrat
  • 10:12, 15 October 2025 User account Julia talk contribs was created by Davrot talk contribs
  • 09:56, 15 October 2025 Davrot talk contribs changed group membership for Meike from (none) to administrator and bureaucrat
  • 09:56, 15 October 2025 User account Meike talk contribs was created by Davrot talk contribs
  • 09:55, 15 October 2025 Davrot talk contribs changed group membership for Joscha from (none) to administrator, interface administrator and bureaucrat
  • 09:54, 15 October 2025 Davrot talk contribs changed group membership for Udo from (none) to administrator, interface administrator and bureaucrat
  • 09:54, 15 October 2025 Davrot talk contribs changed group membership for Sami from (none) to administrator and bureaucrat
  • 09:52, 15 October 2025 User account Sami talk contribs was created by Davrot talk contribs
  • 09:49, 15 October 2025 User account Udo talk contribs was created by Davrot talk contribs
  • 09:48, 15 October 2025 User account Joscha talk contribs was created by Davrot talk contribs
  • 16:04, 14 October 2025 Davrot talk contribs created page Assert (Created page with " == The goal == assert helps you to check your assumptions and stops the program if they are not met. Questions to [mailto:davrot@uni-bremen.de David Rotermund] == [https://docs.python.org/3/reference/simple_stmts.html#the-assert-statement The assert statement] == <blockquote>Assert statements are a convenient way to insert debugging assertions into a program:</blockquote><syntaxhighlight lang="python">assert_stmt ::= "assert" expression ["," expression]</syntaxhighli...") Tag: Visual edit
  • 16:02, 14 October 2025 Davrot talk contribs created page Programming Recommendations (Created page with " == The goal == We want to improve the quality of the code. Questions to [mailto:davrot@uni-bremen.de David Rotermund] = The recommendations = * Comparisons to singletons like None should always be done with is or is not, never the equality operators. *Use is not operator rather than not … is. While both expressions are functionally identical, the former is more readable and preferred: <syntaxhighlight lang="python"># Correct: if foo is not None:</syntaxhighlight>...") Tag: Visual edit
  • 16:00, 14 October 2025 Davrot talk contribs created page Style Rulez (Created page with " == The goal == Obviously, you can write your code as YOU want. However, if there is at least a small probability that you will exchange your code with someone (e.g. me!) or the source code is required to accompany a paper then… '''… you should NOT ignore PEP 8.''' A good source code editor (like Visual Studio Code) will try to enforce many of the PEP 8 rules on you automatically. You need to allow it to help you… Don’t work against it! This is one of the main...") Tag: Visual edit
  • 15:59, 14 October 2025 Davrot talk contribs created page Input, print, string, int, float (Created page with " == The goal == Questions to [mailto:davrot@uni-bremen.de David Rotermund] == Examples == === Input / Print === <syntaxhighlight lang="python">a = input() # <- test print(a) # -> test</syntaxhighlight> === String to int === <syntaxhighlight lang="python">a = int(5) print(a) # -> 5 print(type(a)) # -> <class 'int'> a = int(-5) print(a) # -> -5 print(type(a)) # -> <class 'int'> a = int("5") print(a) # -> 5 print(type(a)) # -> <class 'int'> a = int("-5") print(a)...") Tag: Visual edit
  • 15:58, 14 October 2025 Davrot talk contribs created page Hello, Python (Created page with " == The goal == This is the first step in running something in Python. Questions to [mailto:davrot@uni-bremen.de David Rotermund] == These are the same stings == <syntaxhighlight lang="python">some_string = "this is a string" some_string = 'this is a string'</syntaxhighlight><syntaxhighlight lang="python">print(some_string)​</syntaxhighlight>Output:<syntaxhighlight lang="python">this is a string​</syntaxhighlight> == These are comments == <syntaxhighlight lang="py...") Tag: Visual edit
  • 15:54, 14 October 2025 Davrot talk contribs created page Overview (Created page with " == The goal == We have to start somewhere. Why not with an overview? Questions to [mailto:davrot@uni-bremen.de David Rotermund] == [https://www.python.org/ Python​] == <blockquote>Python is a programming language that lets you work quickly and integrate systems more effectively.</blockquote> * There is an offical [https://docs.python.org/3/tutorial/ Python Tutorial] * YouTube: Socratica Channel [https://www.youtube.com/watch?v=bY6m6_IIN94&list=PLi01XoE8jYohWFPpC17Z...") Tag: Visual edit
  • 15:40, 14 October 2025 Davrot talk contribs created page File:2022-04-01 18-20 0.png
  • 15:40, 14 October 2025 Davrot talk contribs uploaded File:2022-04-01 18-20 0.png
  • 15:40, 14 October 2025 Davrot talk contribs created page File:2022-04-01 18-17 1.png
  • 15:40, 14 October 2025 Davrot talk contribs uploaded File:2022-04-01 18-17 1.png
(newest | oldest) View ( | ) (20 | 50 | 100 | 250 | 500)