Skip to content

Instantly share code, notes, and snippets.

@thesamovar
thesamovar / gist:7491262
Created November 15, 2013 20:44
Brian 2 cythonspikequeue win32
/* Generated by Cython 0.17.2 on Fri Nov 15 15:43:56 2013 */
#define PY_SSIZE_T_CLEAN
#include "Python.h"
#ifndef Py_PYTHON_H
#error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x02040000
#error Cython requires Python 2.4+.
#else
#include <stddef.h> /* For offsetof */
/* Generated by Cython 0.17.2 on Fri Nov 15 18:37:55 2013 */
#define PY_SSIZE_T_CLEAN
#include "Python.h"
#ifndef Py_PYTHON_H
#error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x02040000
#error Cython requires Python 2.4+.
#else
#include <stddef.h> /* For offsetof */
import sys
import brian2
# Modified from http://code.activestate.com/recipes/496741-object-proxying/
class Proxy(object):
__slots__ = ["_obj", "__weakref__"]
def __init__(self, obj):
object.__setattr__(self, "_obj", obj)
#
from pylab import *
from scipy import weave
# in increasing size
int_types = ['int32_t', 'int64_t']
float_types = ['float', 'double']
all_types = int_types+float_types
support_code = '''
#ifdef _MSC_VER == 1500
typedef __int32 int32_t;
@thesamovar
thesamovar / hatching_and_imshow.ipynb
Created May 26, 2016 13:47
Hatching and imshow with masked values
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@thesamovar
thesamovar / Synaptic scaling hack.ipynb
Last active June 6, 2017 11:00
Synaptic scaling hack for Brian 2
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import numpy as np
from scipy import stats
def measure(n):
"Measurement model, return two coupled measurements."
m1 = np.random.normal(size=n)
m2 = np.random.normal(scale=0.5, size=n)
return m1+m2, m1-m2
m1, m2 = measure(20)
C:\Anaconda\python.exe D:/programming/brian2/dev/tools/run_nose_tests_long_and_standalone.py
INFO Cache size for target "cython": 1594 MB.
You can call "clear_cache('cython')" to delete all files from the cache or manually delete files in the "C:\Users\dgoodman\.cython\brian_extensions" directory. [brian2]
Running tests in D:\programming\brian2\brian2 for targets numpy, weave, cython (including long tests)
Testing standalone
Testing codegen-independent code
Resetting to default preferences
Setting dtype for floating point variables to: float32
Running tests that do not use code generation
@thesamovar
thesamovar / playing_with_pybind11.ipynb
Created January 31, 2020 16:35
/playing_with_pybind11.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.