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
license: gpl-3.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
import numpy as np | |
from scipy.linalg import solveh_banded | |
def als_baseline(intensities, asymmetry_param=0.05, smoothness_param=1e6, | |
max_iters=10, conv_thresh=1e-5, verbose=False): | |
'''Computes the asymmetric least squares baseline. | |
* http://www.science.uva.nl/~hboelens/publications/draftpub/Eilers_2005.pdf | |
smoothness_param: Relative importance of smoothness of the predicted response. |
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 | |
from scipy.sparse.csgraph import minimum_spanning_tree | |
from sklearn.metrics import pairwise_distances | |
def perturbed_mst(X, num_perturbations=20, jitter=None): | |
'''Builds a graph as the union of several MSTs on perturbed data. | |
Reference: http://ecovision.mit.edu/~sloop/shao.pdf, page 8 | |
jitter refers to the scale of the gaussian noise added for each perturbation. | |
When jitter is None, it defaults to the 5th percentile interpoint distance.''' |
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
#!/usr/bin/env python | |
from scipy.optimize import curve_fit | |
import re | |
from math import * | |
from numpy import * | |
from sys import stdin | |
from optparse import OptionParser | |
op = OptionParser(usage='%prog [options] <function_of_x> [input_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
#!/usr/bin/env python | |
from sys import argv, exit | |
from glob import glob | |
from matplotlib.pyplot import show, imshow, subplot, gray | |
from matplotlib.image import imread | |
from numpy import zeros,dot,sum,arange,savez,load,flipud,array | |
from scipy.linalg import eig | |
ATT = False | |
CLIP = False |
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
#!/usr/bin/env python | |
import stereogram as s | |
import numpy as np | |
from sys import argv,exit | |
from os import system | |
from os.path import splitext | |
from PIL import Image,ImageSequence | |
# axis: 0 is up/down, 1 is left/right |
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
#!/usr/bin/env python | |
from PIL import Image | |
import numpy as np | |
from sys import argv,exit | |
from random import randint | |
from time import time | |
from math import ceil | |
try: | |
from weave import inline,converters |
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
#!/usr/bin/env ruby | |
# the stack | |
$stack = [] | |
def pop() $stack.pop || ufe end | |
def push(f) $stack<<f end | |
# poor man's Exception class | |
def ufe() raise("Stack underflow") end | |
# lambda constructor helpers |