This file contains 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
# Nothing |
This file contains 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 os | |
import argparse | |
import nibabel as nib | |
def build_argparser(): | |
DESCRIPTION = "Convert tractograms (TRK -> TCK)." | |
p = argparse.ArgumentParser(description=DESCRIPTION) | |
p.add_argument('tractograms', metavar='bundle', nargs="+", help='list of tractograms.') | |
p.add_argument('-f', '--force', action="store_true", help='overwrite existing output files.') |
This file contains 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 os | |
import argparse | |
import nibabel as nib | |
from nibabel.streamlines import Field | |
from nibabel.orientations import aff2axcodes | |
def build_argparser(): | |
DESCRIPTION = "Convert tractograms (TCK -> TRK)." |
This file contains 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 theano | |
import theano.tensor as T | |
import numpy as np | |
A = theano.shared(np.array([1, 2, 3, 4, 5])) | |
print "Theano" | |
print T.sum(T.stack(A, A), axis=0).eval() | |
print T.sum(T.stack(A, A), axis=1).eval() |
This file contains 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 theano | |
import numpy as np | |
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams | |
theano_rng = RandomStreams(42) | |
# This one works fine | |
print np.sum(theano_rng.uniform(size=(10000, 784), dtype=theano.config.floatX, nstreams=10000).eval(), 1) | |
# This one produces NaN at the end | |
print np.sum(theano_rng.uniform(size=(10000, 784), dtype=theano.config.floatX, nstreams=10000*400).eval(), 1) |
This file contains 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 | |
import resource | |
import metric | |
def test_memory_leak(): | |
NB_LOOPS = 20 | |
NB_LINES = 10000 | |
NB_POINTS = 100 |
This file contains 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
ctypedef float[:,:] float2d | |
ctypedef double[:,:] double2d | |
ctypedef fused Line: | |
float2d | |
double2d | |
cdef class Metric: | |
cdef float dist(Metric self, Line line) nogil: | |
pass |
This file contains 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 dipy.viz import fvtk | |
import numpy as np | |
from numpy.testing import measure | |
from nose.tools import assert_equal, assert_almost_equal | |
from numpy.testing import assert_array_equal, assert_array_almost_equal | |
norm = lambda x: np.sqrt(np.sum(x**2)) |
This file contains 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 nibabel import trackvis as tv | |
from dipy.segment.quickbundles import QuickBundles | |
from dipy.data import get_data | |
fname = get_data('fornix') | |
streams, hdr = tv.read(fname) | |
streamlines = [i[0] for i in streams] | |
qb = QuickBundles(streamlines, dist_thr=10., pts=12) |
This file contains 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 | |
import theano | |
import theano.tensor as T | |
print "Version:", theano.version.version | |
print "=Theano=" | |
A = T.zeros((2,10)) | |
B = T.zeros((30, 10)) | |
print "Shape of A:", A.eval().shape |
NewerOlder