Skip to content

Instantly share code, notes, and snippets.

View maedoc's full-sized avatar

marmaduke woodman maedoc

  • now
  • here
View GitHub Profile
@maedoc
maedoc / logp.py
Created April 19, 2017 08:14
Optimizing log probability by hand
print('importing')
import numpy as np
import sympy as sp
import scipy.optimize
import random
print('functions')
def gen_trace(n_time, sig, dt, a):
x = random.gauss(0, 3)
@maedoc
maedoc / setup.bat
Created March 29, 2017 06:03
Simplified TVB library Git setup
conda create -n tvb python=2 numba scipy matplotlib jupyter numexpr scikit-learn
activate tvb
pip install networkx
git clone https://github.com/the-virtual-brain/tvb-library
git clone https://github.com/the-virtual-brain/tvb-data
set PYTHONPATH=%CD%\tvb-library;%CD%\tvb-library;%PYTHONPATH%
jupyter notebook
@maedoc
maedoc / Closed Loop.ipynb
Created March 22, 2017 20:39
Example of closed loop stimulation in TVB
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@maedoc
maedoc / Closed Loop.ipynb
Created March 22, 2017 20:39
Example of closed loop stimulation in TVB
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@maedoc
maedoc / loopy-ctypes.py
Created February 21, 2017 15:08
Automate loading Loopy kernels as ctypes functions
import os
import numpy as np
import ctypes
import loopy as lp
from loopy.target import c
import cgen
import subprocess
import tempfile
@maedoc
maedoc / test-numba-autovec.asm
Created December 20, 2016 21:29
testing autovec in numba
.text
.file "f"
.globl "__main__.f$3.array(float32,_1d,_C).array(float32,_1d,_C)"
.align 16, 0x90
.type "__main__.f$3.array(float32,_1d,_C).array(float32,_1d,_C)",@function
"__main__.f$3.array(float32,_1d,_C).array(float32,_1d,_C)":
.cfi_startproc
pushq %r14
.Ltmp0:
.cfi_def_cfa_offset 16
@maedoc
maedoc / notify-slack.sh
Created November 25, 2016 13:53
Notify Slack from Jenkins build script
# don't stop on error so we can catch and notify
set +x +e
# custom bot api token
export SLACK_API_SECRET=foo-bar-baz
# notify start
python<<EOF
import slackclient as sc, os
c = sc.SlackClient(os.environ['SLACK_API_SECRET'])

Keybase proof

I hereby claim:

  • I am maedoc on github.
  • I am maedoc (https://keybase.io/maedoc) on keybase.
  • I have a public key ASDlVtu0WFbheTc4JDcQhznLEaxWGKxIikO5NNomUNdD_go

To claim this, I am signing this object:

@maedoc
maedoc / cymex.pyx
Created April 8, 2016 08:33
MATLAB interface to Python via MEX function written in Cython
"""
This Cython module forms the basis of a MATLAB interface to TVB.
It is necessary to redirect MATLAB's libgfortran link as found in
$MATLAB/sys/os/glnxa64/libgfortran.so.3 to the one to which your NumPy's
extension module was linked, if it's a newer version than MATLAB's.
You might also try starting MATLAB like so
LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0 matlab
@maedoc
maedoc / site.cfg
Created April 6, 2016 10:44
NumPy/SciPy site.cfg for building against MATLAB BLAS/LAPACK
[ALL]
libraries = mwblas mwlapack
library_dirs = /usr/local/MATLAB/R2016a/bin/glnxa64
runtime_library_dirs = /usr/local/MATLAB/R2016a/bin/glnxa64
include_dirs = /usr/local/MATLAB/R2016a/extern/include
extra_compile_args = -fexceptions -fPIC -fno-omit-frame-pointer -pthread -D_GNU_SOURCE -DMATLAB_MEX_FILE
extra_link_args = -L/usr/local/MATLAB/R2016a/bin/glnxa64 -lmx -lmex -lmat -lm