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 / multiproc.ipynb
Created August 4, 2016 20:09
Multiprocessing with progress bar in iPython notebook Jupyter
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@joefutrelle
joefutrelle / fetch_scores_mat.py
Created August 4, 2016 17:01
fetch IFCB class scores from new mat endpoint
import requests
import pandas as pd
from scipy.io import loadmat
mat_url = 'http://ifcb-data.whoi.edu/mvco/IFCB1_2015_117_202220_class_scores.mat'
from tempfile import TemporaryFile
with TemporaryFile() as f:
@joefutrelle
joefutrelle / MVCO ocean data.ipynb
Created August 3, 2016 20:00
reading MVCO data endpoint and applying timestamp conversion
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@joefutrelle
joefutrelle / fast_csv.py
Created August 2, 2016 19:47
fast class scores CSV
from StringIO import StringIO
from numpy.core.defchararray import rjust, replace
bin_lid = 'foobar'
prefix = bin_lid + '_'
cols = scores['class2useTB'][:-1] # exclude last class: 'unclassified'
df = pd.DataFrame(scores['TBscores'], columns=cols)
p = scores['roinum'].astype(str)
p = replace(rjust(p,6,'0'),'0',prefix,1)
pid = pd.Series(p)
@joefutrelle
joefutrelle / progress bar.py
Last active August 5, 2016 16:24
ipython html / javascript progress bar
# machinery for a progress bar
import uuid
import time
from IPython.display import HTML, Javascript, display
PB_TEMPLATE = """
<div style="border: 1px solid black; width:500px">
<div id="%s" style="background-color:%s; width:0%%">&nbsp;</div>
</div>
"""
@joefutrelle
joefutrelle / Hausdorff KDTree.ipynb
Last active June 15, 2023 23:54
Hausdorff and Modified Hausdorff distance implemented using KDTree
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@joefutrelle
joefutrelle / Decision tree cubism.ipynb
Created May 3, 2016 13:58
Cubism using decision tree
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@joefutrelle
joefutrelle / islands.ipynb
Created April 19, 2016 13:32
Generate fractal topo map
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@joefutrelle
joefutrelle / utils.py
Created April 4, 2016 17:10
utilities for image processing talk
import tempfile
from IPython.core import display
from matplotlib import pyplot as plt
from skimage.io import imread, imsave
from skimage import img_as_float, img_as_ubyte
def _show_arr(arr):
with tempfile.NamedTemporaryFile(suffix='.png') as tf:
@joefutrelle
joefutrelle / unsharp mask.ipynb
Created April 4, 2016 16:01
Contrast enhancement using unsharp mask
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.