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 functools | |
import importlib | |
import logging | |
import os | |
import pickle | |
import sys | |
import time | |
import timeit | |
import h5py |
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 pyevtk | |
np_data = np.load('/Users/fangdali/Code/DEBATR/results/wFBP/freect/bag_no_5' | |
'/whole_bag.npz')['arr_0'] | |
print np_data.shape | |
w, h, l = np_data.shape | |
x = np.arange(0, w + 1) | |
y = np.arange(0, h + 1) | |
z = np.arange(0, l + 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
from pylab import * | |
def quick_imshow(nrows, ncols, images, titles=None, colorbar=True, vmax=None, | |
vmin=None, figsize=None, figtitle=None): | |
"""------------------------------------------------------------------------- | |
Desc.: convenience function that make subplots of imshow | |
Args.: nrows - number of rows | |
ncols - number of cols | |
images - list of images | |
titles - list of titles |
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
class Buddy(object): | |
def __init__(self): | |
super(Buddy, self).__init__() | |
# 1024, 512, 256 | |
self.lists = [[0],[],[]] | |
def get(self, req): | |
print "Requesting %d bytes" % (1024/2**req) | |
print "Lists before request:" | |
print self.lists |
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
class Node(object): | |
def __init__(self, parent, depth, nodeID): | |
super(Node, self).__init__() | |
self.parent = parent | |
self.depth = depth | |
self.nodeID = nodeID | |
self.left = None | |
self.right = None | |
self.used = False |