Skip to content

Instantly share code, notes, and snippets.

View smathot's full-sized avatar

Sebastiaan Mathot smathot

View GitHub Profile
@smathot
smathot / bawsfactor.py
Created April 13, 2017 10:46
A script to calculate the Baws Factor from the JASP model comparison tabel.
#!/usr/bin/env python3
# coding=utf-8
import sys
from datamatrix import io, DataMatrix
INPUTCSV = sys.argv[-1]
---
API: 2
OpenSesame: 3.0.6
Platform: posix
---
set width 1024
set transparent_variables "no"
set title "KidsTest"
set synth_backend "legacy"
set subject_parity "even"
@smathot
smathot / xytouv.py
Last active February 22, 2016 11:24
import numpy as np
def uvtoxy(u, v, Bu=1.4, A=3., Bv=1.8):
u = np.array(u, dtype=float)
v = np.array(v, dtype=float)
R = A * np.sqrt(np.exp(2*u/ Bu) - (2*np.exp(u/Bu)*np.cos(v/Bv)) + 1)
phi = np.arctan2(
(np.exp(u/Bu)*np.sin(v/Bv)),
((np.exp(u/Bu)*np.cos(v/Bv))-1)
@smathot
smathot / atom-locale
Created January 3, 2016 10:55
Script to start Atom with non-English spellchecking on Linux
#!/bin/bash
# Usage:
# atom-locale [locale]
# Example (for French):
# atom-locale fr_FR
# Important note:
# This permanently changes the locale for atom spellchecker.
# To reset back to English, start with en_US locale.
ATOM_HUNSPELL_FOLDER="/opt/atom/resources/app.asar.unpacked/node_modules/spell-check/node_modules/spellchecker/vendor/hunspell_dictionaries"
HUNSPELL_FOLDER="/usr/share/hunspell"
@smathot
smathot / voicekey.py
Created November 23, 2015 09:36
OpenSesame voicekey
import pyaudio
import wave
import sys
import struct
import math
TAP_THRESHOLD = 0.050
FORMAT = pyaudio.paInt16
SHORT_NORMALIZE = (1.0/32768.0)
CHANNELS = 2
#!/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):
#!/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.
@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"
@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: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"