CoralspeQ I Calibrate for Reference Spectra- White


Sending Reference calibration in two portions, this being the white portion.
//============================================
// Macro for data evaluation on PhotosynQ.org
// created: 4/20/2016
//============================================

//Define the output object here
var output = {};

// Number of pixel per spectrum
var pixels = 256;

// Number of spectra collected
var specNum = 3;

// Integration times
var intTimes = [100, 200, 400];

// Split the rawtrace up into separate spectra
var spectra = [];
for (i = 0, j = json.data_raw.length; i < j; i += pixels) {
	spectra.push(json.data_raw.slice(i, i + pixels));
}

if (spectra.length != specNum)
	danger('Insufficent number of spectra collected!', output);

//Spectrum to determine White
var SpectrumForWhite = 2;

// Pick a non saturated spectrum for White
if (MathMAX(spectra[SpectrumForWhite]) > 40000)
	SpectrumForWhite = 1;

if (MathMAX(spectra[SpectrumForWhite]) > 40000)
	SpectrumForWhite = 0;


output.White = SpectrumForWhite + 1;

// Correct for the integration times
var ReferenceSpectraWhite = [];

for (i = 0; i < pixels; i++) {
	ReferenceSpectraWhite.push(spectra[SpectrumForWhite][i]);
}


// Output an array with the reference spectra getting saved
// to the device
if (ReferenceSpectraWhite.length != pixels)
	danger('Merged spectra have the wrong number of values', output);

output.intTimeWhite = intTimes[SpectrumForWhite];

output.toDevice = "1078+";
output.toDevice += ReferenceSpectraWhite.join('+') + '+';
output.toDevice += "1021+";
output.toDevice += intTimes[SpectrumForWhite] + '+0+';
output.toDevice += "-1+";


//Return data
return output;
{
  "time_offset": 240,
  "time": 1461872646884,
  "device_id": 145,
  "firmware_version": "0.456",
  "sample": [
    [
      {
        "time": 1461872646897,
        "protocol_id": 1,
        "light_intensity": 0,
        "r": 0,
        "g": 0,
        "b": 0,
        "data_raw": [
          6363,
          6268,
          6162,
          6106,
          5203,
          6231,
          6154,
          6304,
          6288,
          6335,
          6364,
          6205,
          6244,
          6240,
          6281,
          6437,
          6404,
          6353,
          6402,
          6469,
          6594,
          6582,
          6603,
          6673,
          6429,
          6944,
          7396,
          7976,
          9161,
          11410,
          16642,
          44867,
          45927,
          46596,
          46991,
          47224,
          47381,
          47516,
          47543,
          47471,
          47288,
          47185,
          47079,
          46349,
          47022,
          46648,
          46135,
          45399,
          37474,
          21967,
          18024,
          15560,
          13698,
          12543,
          11744,
          11568,
          11554,
          11561,
          11722,
          11511,
          11160,
          10842,
          10003,
          9474,
          9535,
          9320,
          9274,
          9252,
          9088,
          9076,
          9087,
          9317,
          9590,
          9691,
          9932,
          10120,
          10285,
          10407,
          10591,
          10598,
          10701,
          10816,
          9609,
          10831,
          10878,
          10947,
          11185,
          11304,
          11369,
          11393,
          11548,
          11764,
          11960,
          12092,
          12273,
          12557,
          12749,
          12924,
          13295,
          13785,
          14391,
          14387,
          14981,
          15113,
          15042,
          14816,
          14978,
          14952,
          15056,
          15289,
          15556,
          15938,
          16315,
          16744,
          17080,
          17355,
          17785,
          18060,
          18234,
          18515,
          18856,
          19307,
          19435,
          19577,
          19772,
          20024,
          20067,
          20286,
          20357,
          20312,
          20259,
          20244,
          20371,
          20585,
          20712,
          20909,
          21012,
          20842,
          20605,
          20533,
          20207,
          20515,
          20335,
          19783,
          19469,
          18951,
          18441,
          18029,
          17541,
          17253,
          16825,
          16562,
          16480,
          16355,
          16109,
          15833,
          15489,
          15223,
          14910,
          14651,
          14299,
          13974,
          13745,
          13522,
          13197,
          12879,
          12659,
          12516,
          12216,
          11852,
          11688,
          11426,
          11151,
          10941,
          10643,
          10461,
          10297,
          10188,
          10030,
          8696,
          9658,
          9390,
          9236,
          9207,
          9090,
          8888,
          8907,
          8870,
          8633,
          8524,
          8413,
          8405,
          8197,
          7945,
          7874,
          7785,
          7568,
          7410,
          7217,
          6654,
          7007,
          7129,
          7116,
          7122,
          7146,
          7000,
          6900,
          6954,
          6914,
          6780,
          6818,
          6841,
          6787,
          6696,
          6713,
          6819,
          6829,
          6655,
          5305,
          6458,
          6327,
          6473,
          6397,
          6325,
          6280,
          6261,
          6408,
          6338,
          6284,
          6234,
          6136,
          6273,
          6259,
          6800,
          6835,
          6601,
          6602,
          6156,
          6061,
          6239,
          6321,
          6300,
          6305,
          6436,
          6122,
          6116,
          6074,
          5984,
          6024,
          5928,
          6042,
          6092,
          6151,
          6153,
          6015,
          5966,
          6663,
          6565,
          6696,
          6752,
          6994,
          7361,
          7041,
          7110,
          6826,
          6719,
          5409,
          6481,
          6604,
          6621,
          6814,
          6845,
          6927,
          6799,
          6834,
          6955,
          7011,
          7130,
          7377,
          7408,
          7689,
          8254,
          9036,
          10400,
          12854,
          30044,
          44457,
          45512,
          46129,
          46709,
          47147,
          47486,
          47726,
          47892,
          47869,
          47836,
          47688,
          47379,
          47213,
          47033,
          46751,
          46502,
          46145,
          45710,
          45164,
          43767,
          41521,
          24520,
          20963,
          18521,
          17096,
          16559,
          16347,
          16466,
          16580,
          16397,
          15820,
          14983,
          14100,
          13474,
          12955,
          12568,
          12221,
          12025,
          11342,
          11848,
          11927,
          12229,
          12650,
          13120,
          13819,
          14395,
          14819,
          15074,
          15267,
          15517,
          15555,
          15572,
          15635,
          15749,
          15750,
          15854,
          16051,
          16208,
          16718,
          16550,
          16780,
          16984,
          17299,
          17746,
          18110,
          18370,
          18677,
          19199,
          20656,
          21709,
          22601,
          23591,
          23945,
          24076,
          23570,
          23294,
          23214,
          22425,
          23611,
          23934,
          24554,
          25244,
          25896,
          26719,
          27384,
          28037,
          28777,
          29283,
          29733,
          30163,
          30660,
          31270,
          31770,
          32217,
          32857,
          33322,
          33660,
          33817,
          33868,
          33827,
          33698,
          33660,
          33780,
          34159,
          34661,
          35025,
          35074,
          34876,
          34518,
          34073,
          33800,
          33415,
          32740,
          32109,
          31444,
          30569,
          28716,
          28952,
          28193,
          27596,
          27058,
          26561,
          26099,
          25486,
          25102,
          24531,
          23867,
          23332,
          22703,
          22041,
          21441,
          20842,
          20352,
          19812,
          19344,
          18709,
          17735,
          17598,
          17207,
          16791,
          16419,
          15994,
          15570,
          15317,
          15055,
          14622,
          14243,
          13784,
          13403,
          13047,
          12608,
          12343,
          12144,
          11969,
          11660,
          10198,
          11190,
          11026,
          10967,
          10846,
          10684,
          10340,
          10883,
          10335,
          10138,
          9818,
          9450,
          9461,
          9255,
          9126,
          8874,
          8676,
          8544,
          8261,
          7742,
          7630,
          7686,
          7743,
          7533,
          7652,
          7567,
          7408,
          7388,
          7435,
          7377,
          7305,
          7109,
          7136,
          7074,
          7024,
          6942,
          6870,
          6967,
          6964,
          5953,
          6679,
          6541,
          6572,
          6520,
          6534,
          6552,
          6467,
          6453,
          6500,
          6569,
          6520,
          6340,
          6341,
          6344,
          6357,
          6427,
          6363,
          6274,
          5735,
          6388,
          6381,
          6410,
          6295,
          6289,
          6376,
          6229,
          6158,
          6071,
          6103,
          6101,
          6039,
          7409,
          7534,
          7547,
          7433,
          7525,
          7099,
          7385,
          7443,
          7385,
          7399,
          7355,
          7436,
          7543,
          7622,
          7594,
          7644,
          7812,
          7915,
          7978,
          8230,
          8385,
          8505,
          8780,
          9217,
          9837,
          11074,
          12458,
          17732,
          43689,
          44467,
          45109,
          45740,
          46153,
          46643,
          46976,
          47254,
          47445,
          47545,
          47525,
          47495,
          47409,
          47164,
          46970,
          46841,
          46239,
          46980,
          46445,
          46002,
          45436,
          45056,
          44699,
          44347,
          43643,
          36624,
          28179,
          26842,
          26457,
          26798,
          26923,
          26543,
          25352,
          23664,
          22007,
          20577,
          19551,
          18818,
          18151,
          17735,
          17397,
          17151,
          17394,
          17937,
          18666,
          19782,
          20942,
          21991,
          22844,
          23273,
          23767,
          24226,
          24287,
          24501,
          24674,
          23753,
          25019,
          25108,
          25433,
          25781,
          26082,
          26397,
          26877,
          27527,
          28258,
          28965,
          29440,
          30108,
          30824,
          31880,
          33433,
          35593,
          37983,
          39845,
          40522,
          40232,
          40256,
          39871,
          39747,
          39823,
          40312,
          41425,
          42767,
          43585,
          43953,
          44206,
          44149,
          44226,
          44293,
          44453,
          44542,
          44478,
          44558,
          44652,
          43496,
          44469,
          44562,
          44665,
          44760,
          44881,
          44804,
          44667,
          44670,
          44663,
          44617,
          44609,
          44479,
          44469,
          44552,
          44548,
          44444,
          44434,
          44576,
          44283,
          43992,
          44420,
          44428,
          44390,
          44457,
          44490,
          44434,
          44336,
          44303,
          44268,
          43978,
          43530,
          43147,
          42473,
          41370,
          40151,
          38833,
          37607,
          36365,
          34245,
          34115,
          33065,
          32132,
          31163,
          30163,
          29088,
          28021,
          27095,
          26355,
          25578,
          24769,
          24160,
          23526,
          22844,
          22093,
          21146,
          20480,
          19691,
          18521,
          18396,
          17869,
          17475,
          17047,
          16648,
          16391,
          16062,
          15571,
          15251,
          14742,
          14258,
          13918,
          13431,
          12906,
          12589,
          12309,
          12106,
          11838,
          11488,
          11551,
          11112,
          10748,
          10444,
          10203,
          9986,
          9787,
          9608,
          9377,
          9363,
          9216,
          9049,
          8916,
          8894,
          8833,
          8736,
          8588,
          8473,
          8376,
          8324,
          8762,
          8645,
          8496,
          8217,
          8225,
          7886,
          7739,
          7660,
          7492,
          7441,
          7361,
          7412,
          7292,
          7221,
          7244,
          7085,
          7107,
          7102,
          7073,
          7083,
          6967,
          6941,
          7007,
          6795,
          6817,
          6827,
          6909,
          6934,
          6751,
          6793,
          6755,
          6629,
          6556,
          6550,
          6580,
          6568
        ],
        "tcs_dac_values": [
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0
        ]
      }
    ]
  ],
  "app_os": "win",
  "app_name": "PhotosynQ",
  "app_version": "0.3.2",
  "app_device": "x86-32",
  "location": [
    "42.7224765",
    "-84.4747525"
  ],
  "ConsoleMacro": "160"
}
Img 20161024 131107688 hdr
Created by

Christopher


Protocol connections:
1
Latest Update:
Apr 2016