Skip to content

Instantly share code, notes, and snippets.

View larsoner's full-sized avatar

Eric Larson larsoner

View GitHub Profile
@larsoner
larsoner / gist:4739735
Last active December 12, 2015 07:49
CUDA DC component mismatch
import numpy as np
from scipy.signal import resample
import pycuda.autoinit
from pycuda import gpuarray
from scikits.cuda import fft as cudafft
from scipy.fftpack import fft, ifft
try:
import pyfftw
except Exception:
have_fftw = False
@larsoner
larsoner / Output
Created January 3, 2014 15:03
SOS tests for scipy
========================== BESSELF =========================
z =
Empty matrix: 0-by-1
p =
-3.000000000000000e-01
k =
3.000000000000000e-01
z =
Empty matrix: 0-by-1
p =
@larsoner
larsoner / gist:8428867
Created January 15, 2014 00:48
Output2
clear all; close all; clc
format long e
format compact
[z, p, k] = ellip(5, 1, 40, [201 240], 'stop', 's')
[z, p, k] = cheby2(5, 20, [2010 2100], 'stop', 's')
[z, p, k] = cheby1(23, 0.8, 0.3, 'high') % high odd order
[z, p, k] = besself(1, 1)
[z, p, k] = besself(24, 100)
[z, p, k] = besself(23, 1000)
@larsoner
larsoner / gltest.py
Last active August 29, 2015 14:01
Testing use of OpenGL 3.2 and 2.1 shaders simultaneously
# -*- coding: utf-8 -*-
import numpy as np
from vispy.gloo import gl
from vispy.app import Canvas
v1 = """
#version 120
attribute vec2 pos; attribute vec3 color; varying vec4 f_color;
void main() {
gl_Position = vec4(pos, 0, 1.0);
@larsoner
larsoner / covtest.py
Last active August 29, 2015 14:15
cov test
# -*- coding: utf-8 -*-
"""
Test covariance generation
"""
from __future__ import print_function
from os import path as op
import warnings
import numpy as np
larsoner@bunk:~/python/scitran$ sudo cat data/log/api.log
*** Starting uWSGI 2.0.9 (64bit) on [Fri Feb 27 23:36:18 2015] ***
compiled with version: 4.8.2 on 13 February 2015 21:55:28
os: Linux-3.16.0-31-generic #41-Ubuntu SMP Tue Feb 10 15:24:04 UTC 2015
nodename: 255bd8853797
machine: x86_64
clock source: unix
detected number of CPU cores: 12
current working directory: /
detected binary path: /usr/local/bin/uwsgi
# -*- coding: utf-8 -*-
"""
================================================
Compare dipole fits between MNE-C and mne-python
================================================
This creates a small grid of source locations and performs dipole
fits using both MNE-C and mne-python.
"""
# Author: Eric Larson <larson.eric.d@gmail.com>
@larsoner
larsoner / gist:bbac101d50176611136b
Last active August 29, 2015 14:16
SavGol test
# -*- coding: utf-8 -*-
"""
Examine if a 2x window length is appropriate for savgol filtering.
"""
from scipy.signal import savgol_filter
from scipy import fftpack
import numpy as np
import matplotlib.pyplot as plt
plt.ion()
@larsoner
larsoner / gist:09813f4c7a9449d940cc
Created March 24, 2015 22:10
Modified line visual example
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 24 22:53:59 2015
@author: larsoner
"""
from __future__ import division
from collections import namedtuple
import numpy as np
@larsoner
larsoner / gist:c245574a1eaea65348a3
Created May 8, 2015 20:12
Script to determine the drift of the PyXID box
# -*- coding: utf-8 -*-
"""Script to determine the drift of the PyXID box"""
import numpy as np
import pyxid
import time
import matplotlib.pyplot as plt
n_run = 50
dur = 60. # seconds