Skip to content

Instantly share code, notes, and snippets.

Avatar

Jeffrey Warren jywarren

View GitHub Profile
@jywarren
jywarren / smooth_save.js
Last active Aug 29, 2015
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.
View smooth_save.js
// 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 Aug 29, 2015
Calculate center of area for a graph -- draws a vertical line which bisects the area of the graph equally, on SpectralWorkbench.org
View centroidish.js
// 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 Sep 23, 2014
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
View subset.js
// 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 Sep 23, 2014
Suspected BP crude illuminated by a 405 nanometer laser, on an Ocean Optics spectrometer
View BP_2014_256_15_59_12.fos.rdb
#
#=+=+=+=+=+=++=+=+=+=+=++=+=+=+=+=++=+=+=+=+=++=+=+=+=+=++=+=
# 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 Aug 29, 2015
Clipping detection adapted from older Spectral Workbench code
View detect_clipping.js
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_cutoff
Created Oct 21, 2014
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.
View centroidish_cutoff
// 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 / centroidish_continuous.js
Last active Aug 29, 2015
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
View centroidish_continuous.js
// 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 / contributors.json
Last active Aug 29, 2015
contributors.json example v0.0.1
View contributors.json
{
"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 Mar 2, 2015
Long requests on spectral workbench
View long-requests.log
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)
View whois.log
$ 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.