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 xlrd | |
import sys | |
import numpy as np | |
book = xlrd.open_workbook(sys.argv[1]) | |
sheet = book.sheet_by_name('Normalization 1') | |
headers = [c.value for c in sheet.row(0)] | |
# find columns | |
colidx = dict([(name, headers.index(name)) for name in ['Gene', 'rep1', 'rep2', 'rep3']]) |
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 http://richardriley.net/projects/emacs/dotprogramming#sec-1.5 | |
(when (load "flymake" t) | |
(defun flymake-pycheckers-init () | |
(let* ((temp-file (flymake-init-create-temp-buffer-copy | |
'flymake-create-temp-inplace)) | |
(local-file (file-relative-name | |
temp-file | |
(file-name-directory buffer-file-name)))) | |
(list "/Users/tjones/elisp/pycheckers.sh" (list local-file))))) |
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
def recalculate_group(self, workspace, indexes): | |
'''Recalculate all measurements once post_group has run | |
workspace - the workspace being operated on | |
indexes - the indexes of the group's image sets' measurements | |
''' | |
m = workspace.measurements | |
object_name = self.object_name.value | |
assert isinstance(m, cpmeas.Measurements) | |
parent_object_numbers = m.get_all_measurements( |
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
#!/bin/sh | |
# TODO: check for virtualenv | |
# TODO: verify python is universal 32+64 bit | |
virtualenv -p /Library/Frameworks/Python.framework/Versions/2.7/bin/python --no-site-packages ${1}/cpdev | |
. ${1}/cpdev/bin/activate | |
pip install -U pip # to get git+https |
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 cpscript | |
from scipy import ndimage | |
labels = cpscript.Cells.segmented | |
background_labels = np.array(labels == 0, dtype=int) | |
dt_labels = ndimage.distance_transform_edt(background_labels) | |
imVSVG_pixels = cpscript.imVSVG.pixel_data | |
imVSVG_dt_pixels = imVSVG_pixels * dt_labels |
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
########################################################################## | |
# Maximum Response filterbank from | |
# http://www.robots.ox.ac.uk/~vgg/research/texclass/filters.html | |
# based on several edge and bar filters. | |
# Adapted to Python by Andreas Mueller amueller@ais.uni-bonn.de | |
# Share and enjoy | |
# | |
import numpy as np | |
import matplotlib.pyplot as plt |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
local grad = require 'autograd' | |
local nn = require 'nn' | |
local W1 = torch.FloatTensor(1, 1, 10, 10):normal() | |
local pooler = nn.SpatialMaxPooling(2, 2, 2, 2) | |
local unpooler = nn.SpatialMaxUnpooling(pooler) | |
-- not sure why these lines are necessary. | |
pooler.indices = torch.FloatTensor() | |
pooler.output = torch.FloatTensor() |
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 sys | |
import h5py | |
import numpy as np | |
def pygame(h5, name, board, moves): | |
for idx in range(board.shape[0]): | |
for plane in range(board.shape[1]): | |
if plane < 44: | |
# different board orderings | |
f = board[idx, plane, ...].T[:, ::-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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |