Skip to content

Instantly share code, notes, and snippets.

View adler-j's full-sized avatar

Jonas Adler adler-j

View GitHub Profile
C:\Users\Jonas\Desktop> python -m line_profiler gadgetzan.py.lprof
Timer unit: 3.00191e-07 s
Total time: 8.63965 s
File: d:\github\odl\odl\util\phantom.py
Function: _phantom_3d at line 231
Line # Hits Time Per Hit % Time Line Contents
==============================================================
231 @profile
277 # Blank image
278 1 71 71.0 0.0 p = np.zeros(space.shape)
279
280 # Create the pixel grid
281 1 308 308.0 0.0 grid_in = space.grid.meshgr
id()
282 1 25 25.0 0.0 minp = space.grid.min()
283 1 18 18.0 0.0 maxp = space.grid.max()
284
285 # move points to [-1, 1]
277 # Blank image
278 1 71 71.0 0.0 p = np.zeros(space.shape)
279
280 # Create the pixel grid
281 1 318 318.0 0.0 grid_in = space.grid.meshgr
id()
282 1 26 26.0 0.0 minp = space.grid.min()
283 1 18 18.0 0.0 maxp = space.grid.max()
284
285 # move points to [-1, 1]
import odl
import numpy as np
# Discrete reconstruction space: discretized functions on the rectangle
# [-20, 20]^2 with 300 samples per dimension.
reco_space = odl.uniform_discr(
min_corner=[-1, -1], max_corner=[1, 1], nsamples=[256, 256],
dtype='float32')
# Make a parallel beam geometry with flat detector
@adler-j
adler-j / example.py
Created April 19, 2016 08:41
odl projection CPU/CUDA example
import odl
import numpy as np
# Discrete reconstruction space: discretized functions on the rectangle
# [-20, 20]^2 with 300 samples per dimension.
reco_space = odl.uniform_discr(
min_corner=[-1, -1], max_corner=[1, 1], nsamples=[256, 256],
dtype='float32')
# Make a parallel beam geometry with flat detector
@adler-j
adler-j / example.py
Last active February 22, 2017 09:07
Using odl projector, CPU vs CUDA
import odl
import numpy as np
# Discrete reconstruction space: discretized functions on the rectangle
# [-20, 20]^2 with 300 samples per dimension.
reco_space = odl.uniform_discr(
min_pt=[-1, -1], max_pt=[1, 1], shape=[256, 256])
# Make a parallel beam geometry with flat detector
"""Example of using the boolean ray transform with ODL.
This example is with the 2d ray transform, but you could easily change the
geometry to 3d and get the example you gave. See
github.com/odlgroup/odl/blob/master/examples/tomo/ray_trafo_parallel_3d.py
for an example.
Note that some rounding errors may occur.
# Copyright 2014-2016 The ODL development group
#
# This file is part of ODL.
#
# ODL is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# ODL is distributed in the hope that it will be useful,
import fnmatch
import os
matches = []
for root, dirnames, filenames in os.walk('E:/Github/ODL/odl'):
for filename in fnmatch.filter(filenames, '*.py'):
matches.append(os.path.join(root, filename))
for match in matches:
with open(match) as f:
#!/bin/bash
#set -x
# Shows you the largest objects in your repo's pack file.
# Written for osx.
#
# @see https://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/
# @author Antony Stubbs
export LC_ALL=C