Skip to content

Instantly share code, notes, and snippets.

@nathanathan
nathanathan / FastieEmissionAbsorbtion.js
Last active Dec 28, 2015 — forked from jywarren/smooth.js
Implementation of Fastie's macro for identifying emission or absorption lines. see: https://github.com/jywarren/spectral-workbench/issues/184
View FastieEmissionAbsorbtion.js
//Implementation of Fastie's macro for identifying emission or absorption lines
//see: https://github.com/jywarren/spectral-workbench/issues/184
/*
Description:
To objectively determine the wavelengths of emission or absorption lines,
you have to separate signal from noise in a graph of wavelength intensities.
Especially when looking for peaks or valleys that disrupt a continuous (black body radiation) spectrum,
the low frequency (maybe > 20 nm) information becomes noise.
To eliminate it, fit a cubic spline or other easily adjustable curve to each color channel separately.
Compute the deviations of each channel from its curve and average the three new curves into a single curve,
View XLSForm.js
/* Requires underscore.js */
var SERVER_URL = "http://ec2-50-16-84-43.compute-1.amazonaws.com/xlsform/2/json_workbook/";
/*
//The ideal approach would be to send the workbook as an xlsx blob
//and process it the same way as user uploads.
//Unfortunately I can't figure out how to generate such a blob.
function sendBlob() {
var file = DocsList.getFileById(SpreadsheetApp.getActiveSpreadsheet().getId());