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 mahotas | |
from scipy import ndimage | |
img = mahotas.imread('copy_cam1.jpg') | |
img = img.mean(2) | |
img = img.astype(float) | |
bead = img[433:443,495:512] | |
sy,sx = bead.shape |
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
\documentclass{article} | |
\usepackage{tikz} | |
\begin{document} | |
\begin{tikzpicture} | |
\node (theta) at (0,0) [circle, draw] {$\theta$}; | |
\node (z) at (2,0) [circle, draw] {$z$}; | |
\node (w) at (4,0) [circle, draw] {$w$}; | |
\node (alpha) at (1,2) [circle, draw] {$\alpha$}; |
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
# Load a sparse matrix. | |
import numpy as np | |
from scipy import sparse | |
def load_sparse(filename, dtype=np.float32): | |
with file(filename) as input: | |
ny,nx = input.readline().strip().split() | |
nelems = int(input.readline().strip()) |
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 | |
def insert_bit(array, index): | |
inner = (index % 64) | |
index //= 64 | |
array[index] |= (1 << inner) | |
def is_set(array, index): | |
inner = (index % 64) | |
index //= 64 |
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
[Script Info] | |
Title: Untitled | |
ScriptType: V4.00+ | |
Collisions: Normal | |
Timer: 100 | |
WrapStyle: 0 | |
[V4+ Styles] | |
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeThrough, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding | |
Style: Default, Sans, 16, &H00FFFFFF, &H00FFFFFF, &H00674436, &HFFFFFFF8, -1, 0, 0, 0, 100, 90, 0, 0, 1, 2.1, 0.5, 2, 15, 15, 15, 0 |
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 is_ascii(s): | |
''' | |
ascii = is_ascii(s) | |
Check whether a unicode string is ASCII | |
''' | |
try: | |
s = s.encode('ascii') | |
return True | |
except UnicodeError: |
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 os import path, mkdir, errno | |
def create_directories(dname): | |
''' | |
create_directories(dname) | |
Recursively create directories. | |
''' | |
if dname.endswith('/'): dname = dname[:-1] | |
head, tail = path.split(dname) |
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
Luis Pedro Coelho is a PhD candidate in computational biology at Carnegie | |
Mellon University. He is interested in computational biology that is both | |
theoretically well-grounded and yields insights into real systems. Luis has a | |
BS and MS in computer science from Instituto Superior Técnico. He is a | |
Fulbright Scholar and has won multiple awards for academic or research | |
excellence. | |
Outside academia, Luis has been involved in theatre (having produced the | |
student group at IST and starred in several productions), as well as received a | |
prize in a short story competition. He has taught computer usage in |
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 __future__ import division, with_statement | |
import signal | |
__all__ = ['TimeOutError', 'timeout'] | |
class TimeOutError(Exception): | |
def __init__(self): | |
Exception.__init__(self,'Timeout') | |
def _raise_TimeOut(sig, stack): |
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 settings | |
def add_globals(request): | |
return settings.TEMPLATE_GLOBALS | |