This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from scipy import weave | |
def openmpSum(in_array): | |
""" | |
Performs fast sum of an array using openmm | |
""" | |
a = np.asarray(in_array) | |
b = np.array([1.]) | |
N = int(np.prod(a.shape)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package trainableSegmentation.metrics; | |
/** | |
* | |
* License: GPL | |
* | |
* This program is free software; you can redistribute it and/or | |
* modify it under the terms of the GNU General Public License 2 | |
* as published by the Free Software Foundation. | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from scipy import misc | |
from skimage.transform import swirl | |
import connectomics_data as cd | |
def random_swirls(X, Y, n_swirls=1, order=0, rseed=None): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scipy import ndimage | |
from scipy import misc | |
import numpy as np | |
import connectomics_data as cd | |
def get_mask(shape, p=0.999, sigma=10, th=0.2): | |
r = np.random.binomial(1, p, size=shape).astype('f') | |
r2 = ndimage.gaussian_filter(r, sigma) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from scipy.optimize import brent | |
def steepest_descent(func, X0, grad, maxiter= 100, verbose = False, | |
project=None, alpha_0=1.0, gtol = 1e-5, **args): | |
def func_one(X,dir_): | |
def inner(alpha): | |
if project is None: | |
return func(X + alpha*dir_) |

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 1999-2011 Gentoo Foundation | |
# Distributed under the terms of the GNU General Public License v2 | |
# $Header: /var/cvsroot/gentoo-x86/dev-lang/perl/perl-5.12.3.ebuild,v 1.1 2011/01/22 09:41:54 tove Exp $ | |
EAPI=3 | |
inherit eutils alternatives flag-o-matic toolchain-funcs multilib | |
PATCH_VER=1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from scipy import ndimage | |
#from pylab import quiver | |
from scipy import misc | |
l = misc.lena() | |
yy, xx = np.indices(l.shape) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from skimage.util.shape import view_as_windows, view_as_blocks | |
from sthor.util import filter_pad2d | |
def f_g(x): | |
xr = view_as_windows(x, (2, 2)).copy() | |
#print xr | |
loss = 0.5 * (xr**2.).sum() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
def test_mcc_bug(): | |
np.random.seed(42) | |
# 64 classes with different "scale variation" | |
# 100 samples per class, 1000 dimensions | |
C = np.random.randn(100, 64, 1000) + np.arange(64)[np.newaxis, :, np.newaxis] | |
# single test point with 1000 dimensions | |
x = np.random.randn(1000) |