Skip to content

Instantly share code, notes, and snippets.

View smathot's full-sized avatar

Sebastiaan Mathot smathot

View GitHub Profile
@smathot
smathot / generate.py
Created October 1, 2014 12:47
Generate artificial shapes
#!/usr/bin/env python
#-*- coding:utf-8 -*-
import os
import numpy as np
from matplotlib import pyplot as plt
from scipy import ndimage, interpolate, misc
from exparser import TraceKit as tk
from skimage import draw
#!/usr/bin/env python
#-*- coding:utf-8 -*-
from exparser.DataMatrix import DataMatrix
from generate import edgeDetect
import os
import numpy as np
from matplotlib import pyplot as plt
from scipy import ndimage, interpolate, misc
from exparser import TraceKit as tk
@smathot
smathot / gist:3bb5e41e959aaef2be09
Created November 6, 2014 16:31
OpenSesame parallel example
# Generated by OpenSesame 2.9.1~pre2 (Hesitant Heisenberg)
# Thu Nov 06 16:30:44 2014 (nt)
# <http://www.cogsci.nl/opensesame>
set foreground "white"
set subject_parity "even"
set description "A template containing a practice and an experimental phase"
set title "Extended template"
set compensation "0"
set coordinates "relative"
@smathot
smathot / gist:e73bad4a37d424613c9f
Created November 17, 2014 18:35
OpenSesame flicker example
# Generated by OpenSesame 2.9.1 (Hesitant Heisenberg)
# Mon Nov 17 19:35:08 2014 (posix)
# <http://www.cogsci.nl/opensesame>
set mouse_backend "xpyriment"
set subject_parity "even"
set height "768"
set font_italic "no"
set canvas_backend "xpyriment"
set synth_backend "legacy"
@smathot
smathot / gist:2b41410ead97a1685c45
Created November 24, 2014 13:31
OpenSesame Expyriment test script
# Generated by OpenSesame 2.9.1 (Hesitant Heisenberg)
# Mon Nov 24 14:31:04 2014 (posix)
# <http://www.cogsci.nl/opensesame>
set mouse_backend "xpyriment"
set subject_parity "even"
set height "768"
set font_family "mono"
set font_italic "no"
set synth_backend "legacy"
#!/usr/bin/env python
from matplotlib import pyplot as plt
from exparser import TraceKit as tk
import numpy as np
def findPeak(a, searchRange, smoothing=201, N=1000, plot=False):
"""
desc:
Get the peak of a series of data.
#!/usr/bin/env python
import os
from matplotlib import pyplot as plt
import numpy as np
from scipy.optimize import curve_fit
from exparser import Fitting
def fitGEPPoly(x, y, thr=90, deg=2, res=100, plot=True):
@smathot
smathot / snippets.py
Created November 12, 2011 18:02
OpenSesame code snippets
# ***
# * Continuously poll the keyboard
# ***
from openexp.keyboard import keyboard
my_keyboard = keyboard(self.experiment, timeout=20)
start_time = self.time()
while True:
# Perform some task here
key, end_time = my_keyboard.get_key()
@smathot
smathot / correction_trials.opensesame
Created December 15, 2011 10:08
OpenSesame correction trials example
# Generated by OpenSesame 0.25 (Dashy Darwin)
# Thu Dec 15 11:06:26 2011 (posix)
#
# Copyright Sebastiaan Mathot (2010-2011)
# <http://www.cogsci.nl>
#
set foreground "white"
set subject_parity "even"
set description "A template containing a practice and an experimental phase"
set title "Repeat trials"
@smathot
smathot / backlight.sh
Created January 1, 2012 15:23
Script to fix backlight issue (dark screen) for HP g62 laptop on Ubuntu 11.10
#!/bin/bash
# Fix the backlight issue on Ubuntu 11.10 for
# a HP G62 laptop. Add this script to the startup
# applications. In addition, make sure to make
# /sys/class/backlight/intel_backlight
# world-writable (chmod 777), for example
# in /etc/rc.local
#
# Examples: