Skip to content

Instantly share code, notes, and snippets.

View thouis's full-sized avatar

Thouis (Ray) Jones thouis

  • Broad Institute
  • Cambridge, MA, USA
View GitHub Profile
@thouis
thouis / attempt at gridding
Created April 5, 2011 15:02
gridding lines
for count, gene in countgenes:
name = wx.StaticText(self, -1, gene)
name.BackgroundColour = '#ffffff'
self.grid_sizer.Add(name, 0, wx.EXPAND)
c = wx.StaticText(self, -1, "%d"%(count))
self.grid_sizer.Add(c, 0, wx.EXPAND)
b1 = wx.RadioButton(self, -1, style=wx.RB_GROUP)
b1.BackgroundColour = '#ffffff'
b1.Alignment = wx.ALIGN_CENTER_HORIZONTAL
self.grid_sizer.Add(b1, flag=wx.ALIGN_CENTER|wx.EXPAND)
@thouis
thouis / gist:977370
Created May 17, 2011 20:52
idle time in python
# http://thp.io/2007/09/x11-idle-time-and-focused-window-in.html
# http://www.freedesktop.org/software/ConsoleKit/doc/ConsoleKit.html#Session:idle-hint
import Xlib.display
display = Xlib.display.Display()
focus = display.get_input_focus()
print "WM Class: %s" % ( focus.focus.get_wm_class(), )
print "WM Name: %s" % ( focus.focus.get_wm_name(), )
@thouis
thouis / measurements.py
Created June 7, 2011 21:47
start rewrite of measurements.py
"""Measurements.py - storage for image and object measurements
CellProfiler is distributed under the GNU General Public License.
See the accompanying file LICENSE for details.
Copyright (c) 2003-2009 Massachusetts Institute of Technology
Copyright (c) 2009-2011 Broad Institute
All rights reserved.
Please see the AUTHORS file for credits.
@thouis
thouis / median_by_gene.py
Created June 11, 2011 20:53
median of medians sorted by gene, sorted by gene
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']])
@thouis
thouis / flypy.el
Created June 30, 2011 12:53
my flypy.el
;;; 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)))))
@thouis
thouis / gist:1056421
Created June 30, 2011 15:04
initial rewrite of recalculate_groups
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(
@thouis
thouis / build-cpdev-v1.sh
Created November 6, 2011 19:04
CellProfiler Mac Development Builder script
#!/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
@thouis
thouis / script.py
Created January 19, 2012 15:28 — forked from bennihepp/script.py
Example script for CellProfiler RunScript module
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
@thouis
thouis / filterbank.py
Created July 23, 2012 11:39 — forked from amueller/filterbank.py
Filterbank responses for low level vision
##########################################################################
# 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.