Skip to content

Instantly share code, notes, and snippets.

View sylvchev's full-sized avatar

Sylvain Chevallier sylvchev

View GitHub Profile
@sylvchev
sylvchev / README
Last active August 29, 2015 14:10 — forked from leandrosilva/README
$ python xlogd.py sample.log
parsed: {'appname': 'test.app', 'timestamp': '2012-09-06 15:19:32', 'hostname': 'codezone.local', 'pid': '68898', 'priority': '132', 'message': 'bla bla bla warn'}
parsed: {'appname': 'test.app', 'timestamp': '2012-09-06 15:19:32', 'hostname': 'codezone.local', 'pid': '68902', 'priority': '131', 'message': 'bla bla bla error'}
parsed: {'appname': 'Dock', 'timestamp': '2012-09-06 15:19:32', 'hostname': 'codezone.local', 'pid': '154', 'priority': '11', 'message': 'CGSReleaseWindowList: called with 5 invalid window(s)'}
parsed: {'appname': 'WindowServer', 'timestamp': '2012-09-06 15:19:32', 'hostname': 'codezone.local', 'pid': '79', 'priority': '11', 'message': 'CGXSetWindowListAlpha: Invalid window 0'}
@sylvchev
sylvchev / sanity_check.ipynb
Last active August 29, 2015 14:24
Sanity check
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sylvchev
sylvchev / scipy_benchmark.py
Last active November 29, 2015 00:07
Benchmarking scipy and numpy, to be measured with MKL, OpenBLAS and Netlib.
from __future__ import print_function
import sys
from numpy import array
from numpy.random import rand
from timeit import Timer
import pickle
from os import system
if len(sys.argv) is not 2:
print ("usage: numpy_benchmark.py whichpython")
@sylvchev
sylvchev / scipy_plot_benchmark.py
Last active November 30, 2015 13:48
Plotting a numpy/scipy benchmark between Canopy (MKL), Anaconda (Netlib) and my Gentoo python (OpenBLAS)
import matplotlib.pyplot as plt
import pickle
from numpy import arange
with open("scipy_canopy.pck", 'r') as f:
o = pickle.load(f)
canopy_dot = o['dot']
canopy_chol = o['chol']
canopy_svd = o['svd']
with open("scipy_anaconda.pck", 'r') as f:
@sylvchev
sylvchev / scatter_iris.py
Last active December 17, 2015 08:49
Scatter plot matrix for Iris dataset
from sklearn.datasets import load_iris
from numpy import array
from pandas import DataFrame
from pandas.tools.plotting import scatter_matrix
iris = load_iris()
df = DataFrame(iris.data, columns=iris.feature_names)
colors=array(50*['r']+50*['g']+50*['b'])
scatter_matrix(df, alpha=0.2, figsize=(10,10), color=colors)
@sylvchev
sylvchev / test_numpy_multiply_dot.py
Last active January 21, 2016 13:08
Testing numpy computation speed up for numpy.multiply vs numpy.dot in special case: for $V \in R^{n \times n}$ and $U \in R^n$, compare the speed up for numpy.dot(V, numpy.diag(U)) and numpy.multiply(V, U)
import numpy as np
from pyriemann.estimation import Covariances
from timeit import Timer
n, t = 1500, 3000
n_repeat = 100
X = np.random.rand(1, n, t)
U = np.random.rand(n)
cov = Covariances()
@sylvchev
sylvchev / EEG_covariance_example.ipynb
Created February 10, 2016 14:42
Some simple code to classify EEG BCI task based on their covariance matrix
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sylvchev
sylvchev / covarianceSSVEPextraction.ipynb
Last active April 15, 2022 14:16
Building extended SSVEP covariance matrices for EEG-based cerebral interfaces
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sylvchev
sylvchev / covarianceSSVEPclassification.ipynb
Last active November 21, 2020 22:49
Classifying SSVEP extended covariance matrices with MDM algorithm
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sylvchev
sylvchev / plotCovarianceMNE.py
Created February 29, 2016 23:11
Opening and plotting coavriance matrices estimated from SSVEP dataset
import numpy as np
import mne
from sklearn.cross_validation import cross_val_score, KFold
from pyriemann.estimation import covariances
import matplotlib.pyplot as plt
tmin, tmax = 2., 5.
event_id = dict(resting=1, stim13=2, stim17=3, stim21=4)
data_path = './'
fname = 'subject12/record-[2014.03.10-19.17.37]'