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.ndimage.filters import generic_filter | |
from random import random | |
import matplotlib.pyplot as pp | |
import matplotlib | |
grid = np.random.rand(128, 128) | |
weights = [ 1, 2, 1, | |
2, 3, 2, |
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
# dedict, aka "double-ended dict" | |
# A data structure allowing for bidirectional lookups | |
# | |
# Syntax for lookups: | |
# By key: | |
# myDedict[key] OR myDedict[key:] | |
# By value: | |
# myDedict[:value] | |
# This is meant to evoke the dict literal syntax of key: value. | |
# |
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 inspect | |
# Decorator | |
def curry(func): | |
sig = inspect.signature(inspectable(func)) | |
@functools.wraps(func) | |
def wrapper(*args, **kwargs): | |
try: | |
sig.bind(*args, **kwargs) |