Skip to content

Instantly share code, notes, and snippets.

View joefutrelle's full-sized avatar

Joe Futrelle joefutrelle

  • Falmouth, MA
View GitHub Profile
@joefutrelle
joefutrelle / Vagrantfile.rb
Created December 3, 2015 19:42
iPython notebook Vagrantfile
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.provider "virtualbox" do |vb|
vb.memory="2048"
end
config.vm.network :forwarded_port, host: 8888, guest: 8888,
auto_correct: true
config.vm.provision :shell, inline: <<-SHELL
sudo apt-get update
sudo apt-get install -y ipython-notebook
@joefutrelle
joefutrelle / fix_timestamps.py
Created December 10, 2015 20:35
Fix timestamps of IFCB dashboard
from oii.ifcb2.session import session
from oii.ifcb2.identifiers import parse_pid, get_timestamp
from oii.ifcb2.orm import Bin, TimeSeries
page_size = 5000
tses = session.query(TimeSeries).all()
for ts in tses:
@joefutrelle
joefutrelle / bwmorph_thin.py
Last active April 3, 2023 02:47
bwmorph('thin') in Python
import numpy as np
from scipy import ndimage as ndi
# lookup tables for bwmorph_thin
G123_LUT = np.array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1,
0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0,
1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
@joefutrelle
joefutrelle / gist:526e1f8aac4252a3ec26
Created January 5, 2016 20:46 — forked from andrewgiessel/gist:4635563
simple numpy based 2d gaussian function
import numpy as np
def makeGaussian(size, fwhm = 3, center=None):
""" Make a square gaussian kernel.
size is the length of a side of the square
fwhm is full-width-half-maximum, which
can be thought of as an effective radius.
"""
@joefutrelle
joefutrelle / random_forest.py
Created January 19, 2016 17:33
skeletal random forest classifier in sklearn
import numpy as np
from sklearn import datasets
D = datasets.load_digits()
from sklearn.ensemble import RandomForestClassifier
split = D.target.size // 2
rfc = RandomForestClassifier()
rfc.fit(D.data[:split], D.target[:split])
@joefutrelle
joefutrelle / ifcb-blob-whitebox.ipynb
Created January 27, 2016 19:03
IFCB segmentation, Python implementation, "whiteboxed"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@joefutrelle
joefutrelle / freaky.ipynb
Created February 12, 2016 20:25
Freaky plot of arctan function
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@joefutrelle
joefutrelle / gray world.ipynb
Created April 4, 2016 15:58
Gray world algorithm
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@joefutrelle
joefutrelle / image-kmeans.ipynb
Created April 4, 2016 15:59
Quantizing image colors using K-means
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@joefutrelle
joefutrelle / saturation.ipynb
Created April 4, 2016 15:59
Using color models to increase saturation of image
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.