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 / ifcb_packing.js
Last active August 29, 2015 13:56
Lay out IFCB ROIs using JS impl of Jim Scott's rectangle packer
// now refactored as jquery plugin
(function($) {
$.fn.extend({
packedMultiImage: function(width, height) {
return this.each(function() {
var k = 4; // FIXME hardcoded
var $this = $(this);
// set up the rectangle packer
var rootNode = new Node();
rootNode.rect = new Rect(0, 0, width, height);
@joefutrelle
joefutrelle / sb.xml
Created February 12, 2014 20:49
resolver config for sb imgs
<resolvers>
<resolver name="pid">
<var name="root">/mnt/svalbard/dives</var>
<match var="pid" pattern="((([A-Z]+)\.)?((\d{6})\d\d)\.(\d+)\.(\d+))(\.(\w+))?"
groups="lid _ pfx ymd ym ts1 ts2 _ ext">
<!-- high-priority cruises -->
<match var="ym" value="200303">
<path var="dir" match="${root}/200303_OC387/processed/color_corrected/*">
<path match="${dir}/${lid}.jpeg"/>
</path>
@joefutrelle
joefutrelle / flatness3.ipynb
Created February 18, 2014 21:04
lightfield flatness metrics
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@joefutrelle
joefutrelle / radix.py
Created March 14, 2014 19:12
Example of conversion to non-base-10 base for Sean
DIGITS='0123456789ABCDEF'
k=34587
n=16
result = ''
while k > 0:
digit = k % n
result = DIGITS[digit] + result
k = (k-digit) / n
@joefutrelle
joefutrelle / flatness4.ipynb
Created March 17, 2014 19:41
large-scale lightmap flatness test and descriptive graphics
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@joefutrelle
joefutrelle / ifcb_segmentation.ipynb
Last active August 29, 2015 13:57
H. Sosik image segmentation workflow, Octave implementation
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@joefutrelle
joefutrelle / ns.py
Created July 25, 2014 14:36
example of (rather convoluted) way to parse prefixed tag names using etree
from StringIO import StringIO
import xml.etree.ElementTree as ET
mvco_ns = 'http://ifcb-data.whoi.edu/mvco/'
lid = 'IFCB5_2011_033_041857'
nsmap = {'mvco': mvco_ns}
def parse_id(pfx_id, nsmap={}):
ns_statements = ' '.join(['xmlns:%s="%s"' % (k,v) for k,v in nsmap.items()])
xml = '<%s %s/>' % (pfx_id, ns_statements)
@joefutrelle
joefutrelle / IFCB scatter.ipynb
Created October 23, 2014 17:16
IFCB scatterplot
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@joefutrelle
joefutrelle / product_reorg.xml
Created October 23, 2014 18:49
IFCB product reorg
<namespace name="ifcb.utils">
<rule name="reorg_products" include="src dest">
<invoke rule="ifcb.files.find_data_dirs"/>
<!-- directory=product root dir, product=product type -->
<any>
<test var="product" eq="blobs">
<path var="src" match="${directory}/[0-9]*/[0-9]*/*_blobs_v2.zip"/>
<match var="src" pattern=".*/((.*_blobs).*)" groups="product_filename pid"/>
<invoke rule="ifcb.pid"/>
</test>
import os
import re
import time
from urllib2 import urlopen
import json
FEED_URL='http://ifcb-data.whoi.edu/mvco/feed.json'
DATA_DIR='/data'
FORMATS=('hdr','adc','roi')