Skip to content

Instantly share code, notes, and snippets.


Florian Krause fladd

View GitHub Profile
fladd /
Last active Feb 2, 2022
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.

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():
fladd / fladd_CM2.xrnc
Created Oct 8, 2020
fladd's Renoise theme (a variation on hlv_autumn_cm)
View fladd_CM2.xrnc
<?xml version="1.0" encoding="UTF-8"?>
<SkinColors doc_version="12">
fladd / SPM_vs_FSL.ipynb
Last active Sep 24, 2020
Comparing GLM modelling approaches of SPM and FSL
View SPM_vs_FSL.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
fladd /
Last active Sep 23, 2020
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 /
Last active Nov 10, 2020
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.
fladd /
Last active Oct 19, 2021
Show the progress of a process with a simple text-based progress bar


Show the progress of a process with a simple text-based progress bar


def show_progress(progress, info="", length=40, symbols="[= ]", decimals=1):
    """Show the progress of a process with a simple text-based progress bar.

fladd /
Last active Apr 3, 2020
Detailed step-by-step tutorial on how to fix Zoom security issues

Steps to fix Zoom security issues:

  1. Don't use Zoom
fladd /
Created Mar 15, 2020
Python style guide
#!/usr/bin/env python
"""Summary of module.
Description of module.
Can contain multiple lines.
__author__ = 'Name Surname <Email address>'