Skip to content

Instantly share code, notes, and snippets.

View jywarren's full-sized avatar

Jeffrey Warren jywarren

View GitHub Profile
@jywarren
jywarren / smooth_save.js
Last active August 29, 2015 14:06
Smooths in 10 rows of data below your current sample row, and averages them. Saves! No ability yet to choose how many rows to smooth, but not hard to add.
// based on http://spectralworkbench.org/macro/warren/smooth_nosave
setup: function() {
// code to run on startup
$W.dialog('Smooth your data',
'You can sample more than one row of your source image and average these rows to "smooth" your data. This can remove noise and make comparison easier. </p><p>The defaults are to average in the 10 rows just below your chosen cross-section.</p>',
[["Cancel","$('.modal').hide()"],
["Smooth","$W.macros['smooth_save']()"]]
)
@jywarren
jywarren / centroidish.js
Last active August 29, 2015 14:06
Calculate center of area for a graph -- draws a vertical line which bisects the area of the graph equally, on SpectralWorkbench.org
// calculate center of area for a graph -- draws a vertical line which bisects the area of the graph equally
setup: function() {
// code to run on startup
flotoptions.grid.markings = []
var color_count = 0
// go through each spectrum
$.each($W.data,function(index,spectrum){
@jywarren
jywarren / subset.js
Created September 23, 2014 03:03
Clip off the top and bottom 2% by area from each end of the data (averaging for multiple graphs) for a better use of graph real-estate on SpectralWorkbench.org
// clip off the top and bottom 2% by area from each end of the data (averaging for multiple graphs) for a better use of graph real-estate on SpectralWorkbench.org
setup: function() {
// code to run on startup
var area = 0, end = 0, start = 0
// go through each spectrum
$.each($W.data,function(index,spectrum){
// calculate total area:
@jywarren
jywarren / BP_2014_256_15_59_12.fos.rdb
Created September 23, 2014 17:11
Suspected BP crude illuminated by a 405 nanometer laser, on an Ocean Optics spectrometer
#
#=+=+=+=+=+=++=+=+=+=+=++=+=+=+=+=++=+=+=+=+=++=+=+=+=+=++=+=
# BEGIN PROCESS AUDIT HISTORY
# This file has been created or modified by the following process:
# Cmdline: fos2
# Description: Computes from existing rdb columns and writes output for each record.
# Run Time: Sat Sep 13 15:59:12 EDT 2014
# Machine: localhost.localdomain
# Runtime Directory: /home/jhc/fos-sad500
# Program Revision: 1.5
@jywarren
jywarren / detect_clipping.js
Last active August 29, 2015 14:07
Clipping detection adapted from older Spectral Workbench code
setup: function() {
// code to run on startup
// need to highlight the clipping; this just checks if it's happening
// i = pixel position
overexposure_recurse = function(data,i,count,color,threshold) {
if (count > threshold) {
return [true,i]
} else {
if (data[i][color] >= 255) {
return overexposure_recurse(data,i+2,count+2,color,threshold) // checks every 2 px
@jywarren
jywarren / centroidish_continuous.js
Last active August 29, 2015 14:07
continuous version of https://gist.github.com/jywarren/3791c67384c88d53f155 which draws a vertical line which bisects the area of the graph equally, on SpectralWorkbench.org -- for capture mode
// calculate center of area for a graph -- draws a vertical line which bisects the area of the graph equally
draw: function() {
// code to run every frame
flotoptions.grid.markings = []
// calculate total area:
var area = 0
$.each($W.data[0].data,function(i,v){
@jywarren
jywarren / centroidish_cutoff
Created October 21, 2014 00:23
Calculate center of area for a graph -- draws a vertical line which bisects the area of the graph equally, on SpectralWorkbench.org. This variant only counts data between 410-700nm.
// calculate center of area for a graph -- draws a vertical line which bisects the area of the graph equally
setup: function() {
// code to run on startup
flotoptions.grid.markings = []
var color_count = 0
// go through each spectrum
$.each($W.data,function(index,spectrum){
@jywarren
jywarren / contributors.json
Last active August 29, 2015 14:15
contributors.json example v0.0.1
{
"title": "Infragram",
"variant": "Point & Shoot",
"version": "v0.0.1",
"description": "A multispectral camera",
"documentation": "http://publiclab.org/wiki/infragram",
"license": "CERN OHL 1.1",
"license_link": "http://publiclab.org/licenses",
"contributors": [
{ "name": "Jeffrey Warren", "email": "jeff@unterbahn.com" },
@jywarren
jywarren / long-requests.log
Created March 2, 2015 21:01
Long requests on spectral workbench
Processing by AnalyzeController#spectrum as */*
Parameters: {"id"=>"44509"}
Rendered spectrums/_list.html.erb (33488.8ms)
Rendered spectrums/search.html.erb within layouts/application (34484.8ms)
Rendered spectrums/_list.html.erb (25461.5ms)
Rendered layouts/_header.html.erb (2.1ms)
Rendered spectrums/_search.html.erb (0.0ms)
Rendered spectrums/search.html.erb within layouts/application (25631.0ms)
Rendered layouts/_header.html.erb (2.2ms)
Rendered spectrums/_search.html.erb (0.0ms)
$ whois clintonemail.com
Whois Server Version 2.0
Domain names in the .com and .net domains can now be registered
with many different competing registrars. Go to http://www.internic.net
for detailed information.
Domain Name: CLINTONEMAIL.COM
Registrar: NETWORK SOLUTIONS, LLC.