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 matplotlib.pyplot as plt | |
N = 1000 | |
H = N/2 | |
D = 2 | |
R_inner = 5 | |
R_outer = 10 |
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 | |
N = 100 | |
H = N/2 | |
D = 2 | |
# Generate a random point cloud. | |
X = np.random.randn(N, D) | |
# Create two classes with this data, centering the first class at (2, 2) and |
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
"""Crop a polygonal selection from an image.""" | |
import numpy as np | |
from PIL import Image | |
from shapely.geometry import Point | |
from shapely.geometry import Polygon | |
im = Image.open('bird.jpg').convert('RGBA') | |
pixels = np.array(im) | |
im_copy = np.array(im) |
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 matplotlib.pyplot as plt | |
import numpy as np | |
from skimage import io | |
raw_image = io.imread('test.jpg') | |
figure_grid = gridspec.GridSpec(1, 1) | |
ax0 = plt.subplot(figure_grid[0, 0]) | |
hist, bin_edges = np.histogram(raw_image, bins=np.arange(0, 256)) | |
ax0.bar(bin_edges[:-1], hist, width=1) | |
plt.show() |
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 matplotlib.pyplot as plt | |
from skimage import feature | |
from skimage import filters | |
from skimage import io | |
from skimage import measure | |
# Load the image. |
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 Adafruit_BBIO.UART as UART | |
import serial | |
UART.setup("UART1") | |
ser = serial.Serial(port="/dev/ttyO1", baudrate=9600, timeout=1) | |
ser.close() | |
ser.open() | |
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
(ns pingping.core | |
(:import [java.awt.event KeyEvent]) | |
(:require [quil.core :as q])) | |
(defn draw-rect [r] | |
(q/rect (:x r) (:y r) (:w r) (:h r))) | |
;; define left- and right-side rackets, as well as a ball and ball velocity |
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
web: java $JVM_OPTS -cp target/webdev.jar clojure.main -m webdev.core $PORT |
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
class Node(object): | |
"""A node referencing other nodes, forming a subtree.""" | |
def __init__(self, data): | |
self.left = None | |
self.right = None | |
self.data = data | |
def __repr__(self): | |
"""A (not-so-good) display.""" |
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
class Node(object): | |
def __init__(self, value): | |
self.value = value | |
self.next = None | |
def __repr__(self): | |
return 'Node %s' % self.value | |
class Queue(object): |