Skip to content

Instantly share code, notes, and snippets.

Young NeurolabNL @ Matrix

Get on board our new online community on Matrix:

  1. Enter the free, open and secure Matrix, for instance with Element
  2. Join us at #young-neurolabnl:matrix.org

More information and detailed instructions are available here.

@fladd
fladd / young_neurolabnl_matrix.md
Last active April 3, 2024 10:45
Young NeurolabNL on Matrix

Young NeurolabNL on Matrix

What is Matrix?

Matrix is a free standard and protocol for secure decentralised (real-time) communication. Think of it as the chat equivalent to email. As with email, decentralisation here means that there is no single provider/server who provides/owns the network (like with Slack for instance), but that there are multiple providers/servers on an open and interconnected network who can all talk to each other (just like you can send an email from your university email account to, for instance, a Google Gmail address). For more information have a look at the Matrix website.

The people who created Matrix also run the flagship implementationd of software to connect to the Matrix network, named Element (but there are many alternative implementations). Note that the Element website also provides professional/commercial hosting for Matrix servers (the equivalent to running your own email server), but this i

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fladd
fladd / changing_image_luminance.md
Last active February 2, 2022 01:42
Change the luminance of an image

Changing the luminance of an image

The following Python script allows to change the (overall) luminance of an image. This can be interesting when trying to match the luminance of several images (to their mean luminance for instance).

def change_image_luminance(image, luminance, precision=4):
    """Change the luminance of an image.

    Parameters
    ----------
class TreeviewTooltip:
def __init__(self, treeview, texts=[]):
self._treeview = treeview
self._texts = texts
self._tooltip_window = None
self._tooltip_x = self.tooltip_y = 0
self._last_idd = self._last_col = None
self._waittime = 500
self._id = None

Sorry I misunderstood before.

What you want to achieve is possible in two ways.

  1. Within Expyriment, by manually defining how to process control keys (e.g. ESC) in all wait functions you use:
def custom_process_control_keys():
    expyriment.io.Keyboard.process_control_keys(quit_confirmed_function=convert_variables)
@fladd
fladd / fladd_CM2.xrnc
Created October 8, 2020 23:06
fladd's Renoise theme (a variation on hlv_autumn_cm)
<?xml version="1.0" encoding="UTF-8"?>
<SkinColors doc_version="12">
<Main_Back>0,0,0</Main_Back>
<Main_Font>228,228,228</Main_Font>
<Alternate_Main_Back>121,156,199</Alternate_Main_Back>
<Alternate_Main_Font>217,217,217</Alternate_Main_Font>
<Body_Back>87,87,87</Body_Back>
<Body_Font>191,191,191</Body_Font>
<Strong_Body_Font>255,255,255</Strong_Body_Font>
<Button_Back>40,40,40</Button_Back>
@fladd
fladd / SPM_vs_FSL.ipynb
Last active February 6, 2024 11:48
Comparing GLM modelling approaches of SPM and FSL
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fladd
fladd / spm_vs_fsl.md
Last active September 23, 2020 13:06
Differences in GLM modelling approaches between SPM and FSL

Script demonstrating differences in GLM modelling approaches between SPM and FSL:

import numpy as np
from nipy.modalities.fmri.glm import GeneralLinearModel


# Simulated data (20 'rest' volumes followed by 20 'task' volumes)
Y = np.hstack((np.random.normal(4200, 50, size=20),
               np.random.normal(4300, 50, size=20)))
@fladd
fladd / licensing_info.py
Last active November 10, 2020 22:43
Get licencing information of packages and their dependencies from pip
from email import message_from_string
from pkg_resources import get_distribution
def get_pkg_info(package, extras=False):
"""Get information about an installed package.
This function will also attempt to get the licence text from a bundled
licence file, if available.
Parameters