v1.0 CALIBRATION: visible LEDs (manual confirm)


goes with protocol of same name
// Set our initial variables and conditions
var data = json.data_raw;
var output = {};   // location to save output variables
var lights = [1,2,3,4];   // define the lights to be calibrated
// set the DAC values (intensities) for each of the lights (lights 1 - 7)
var intensityArray = [0,20,60,100,140,500,800,2000];
var intensities = intensityArray.length;

// First we get the user inputted PAR values from the LiCOR
var parValues = [];
for (var i = 0; i < json.message.length; i++) {
  parValues[i] = json.message[i][2];
}

// get rid of the first value (it's junk)
parValues.splice(0,1);

// par values for each light
var par1 = [];
var par2 = [];
var par3 = [];
var par4 = [];
var par7 = [];

// difference between actual and returned par for each light
var dif1 = [];
var dif2 = [];
var dif3 = [];
var dif4 = [];
var dif7 = [];

var dif1abs = [];
var dif2abs = [];
var dif3abs = [];
var dif4abs = [];
var dif7abs = [];

var dif1absPerc = [];
var dif2absPerc = [];
var dif3absPerc = [];
var dif4absPerc = [];
var dif7absPerc = [];


for (var i = 0; i < intensities; i++) {
  _i = i;
  par1[i] = parValues[_i];
  dif1[i] = MathROUND(parValues[_i] - intensityArray[i],2);  
  dif1abs[i] = Math.abs(MathROUND(parValues[_i] - intensityArray[i],2));  
  if (intensityArray[i] != 0) dif1absPerc[i] = 100*dif1abs[i] / intensityArray[i];
  else dif1absPerc[i] = 0;

  _i = i + intensities;
  par2[i] = parValues[_i];
  dif2[i] = MathROUND(parValues[_i] - intensityArray[i],2);  
  dif2abs[i] = Math.abs(MathROUND(parValues[_i] - intensityArray[i],2));  
  if (intensityArray[i] != 0)   dif2absPerc[i] = 100*dif2abs[i] / intensityArray[i];  
  else dif2absPerc[i] = 0;

  _i = i + intensities*2;
  par3[i] = parValues[_i];
  dif3[i] = MathROUND(parValues[_i] - intensityArray[i],2);  
  dif3abs[i] = Math.abs(MathROUND(parValues[_i] - intensityArray[i],2));  
  if (intensityArray[i] != 0)   dif3absPerc[i] = 100*dif3abs[i] / intensityArray[i];  
  else dif3absPerc[i] = 0;

  _i = i + intensities*3;
  par4[i] = parValues[_i];
  dif4[i] = MathROUND(parValues[_i] - intensityArray[i],2);
  dif4abs[i] = Math.abs(MathROUND(parValues[_i] - intensityArray[i],2));  
  if (intensityArray[i] != 0)   dif4absPerc[i] = 100*dif4abs[i] / intensityArray[i];  
  else dif4absPerc[i] = 0;

  _i = i + intensities*4;
  par7[i] = parValues[_i];
  dif7[i] = MathROUND(parValues[_i] - intensityArray[i],2);
  dif7abs[i] = Math.abs(MathROUND(parValues[_i] - intensityArray[i],2));  
  if (intensityArray[i] != 0)   dif7absPerc[i] = 100*dif7abs[i] / intensityArray[i];  
  else dif7absPerc[i] = 0;
}

output["parValues"] = parValues;
//output["par1"] = par1;
//output["par2"] = par2;
//output["par3"] = par3;
//output["par4"] = par4;
//output["par7"] = par7;

output["light 1 all error %"] = dif1absPerc;
output["light 2 all error %"] = dif2absPerc;
output["light 3 all error %"] = dif3absPerc;
output["light 4 all error %"] = dif4absPerc;
output["light 7 all error %"] = dif7absPerc;

output["light 1 avg error uE"] = MathROUND(MathSUM(dif1abs)/intensityArray.length,2);
output["light 2 avg error uE"] = MathROUND(MathSUM(dif2abs)/intensityArray.length,2);
output["light 3 avg error uE"] = MathROUND(MathSUM(dif3abs)/intensityArray.length,2);
output["light 4 avg error uE"] = MathROUND(MathSUM(dif4abs)/intensityArray.length,2);
output["light 7 avg error uE"] = MathROUND(MathSUM(dif7abs)/intensityArray.length,2);

output["light 1 avg error %"] = MathROUND(MathSUM(dif1absPerc)/intensityArray.length,3);
output["light 2 avg error %"] = MathROUND(MathSUM(dif2absPerc)/intensityArray.length,3);
output["light 3 avg error %"] = MathROUND(MathSUM(dif3absPerc)/intensityArray.length,3);
output["light 4 avg error %"] = MathROUND(MathSUM(dif4absPerc)/intensityArray.length,3);
output["light 7 avg error %"] = MathROUND(MathSUM(dif7absPerc)/intensityArray.length,3);

return output;
{
  "time_offset": 240,
  "time": 1478187032918,
  "device_version": "1",
  "device_id": "d4:f5:00:00:00:00",
  "device_battery": 71,
  "device_firmware": "1.11",
  "firmware_version": "1.11",
  "device_time": 1478111506,
  "sample": [
    [
      {
        "time": 1478187032937,
        "protocol_id": 1,
        "message": [
          [
            "0",
            "0",
            ""
          ],
          [
            "prompt",
            "enter par",
            "0"
          ],
          [
            "prompt",
            "enter par",
            "12.1"
          ],
          [
            "prompt",
            "enter par",
            "51.25"
          ],
          [
            "prompt",
            "enter par",
            "96.6"
          ],
          [
            "prompt",
            "enter par",
            "143.3"
          ],
          [
            "prompt",
            "enter par",
            "540.5"
          ],
          [
            "prompt",
            "enter par",
            "861.1"
          ],
          [
            "prompt",
            "enter par",
            "2148"
          ],
          [
            "prompt",
            "enter par",
            "0"
          ],
          [
            "prompt",
            "enter par",
            "25.9"
          ],
          [
            "prompt",
            "enter par",
            "64.85"
          ],
          [
            "prompt",
            "enter par",
            "107.19"
          ],
          [
            "prompt",
            "enter par",
            "150.33"
          ],
          [
            "prompt",
            "enter par",
            "548"
          ],
          [
            "prompt",
            "enter par",
            "872"
          ],
          [
            "prompt",
            "enter par",
            "2307"
          ],
          [
            "prompt",
            "enter par",
            "0"
          ],
          [
            "prompt",
            "enter par",
            "17.45"
          ],
          [
            "prompt",
            "enter par",
            "72"
          ],
          [
            "prompt",
            "enter par",
            "120.5"
          ],
          [
            "prompt",
            "enter par",
            "167"
          ],
          [
            "prompt",
            "enter par",
            "562"
          ],
          [
            "prompt",
            "enter par",
            "897"
          ],
          [
            "prompt",
            "enter par",
            "1279"
          ],
          [
            "prompt",
            "enter par",
            "0"
          ],
          [
            "prompt",
            "enter par",
            "21.1"
          ],
          [
            "prompt",
            "enter par",
            "61.55"
          ],
          [
            "prompt",
            "enter par",
            "105.48"
          ],
          [
            "prompt",
            "enter par",
            "150.6"
          ],
          [
            "prompt",
            "enter par",
            "561.9"
          ],
          [
            "prompt",
            "enter par",
            "888.7"
          ],
          [
            "prompt",
            "enter par",
            "2202"
          ]
        ],
        "data_raw": [
          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,
          1,
          0,
          0,
          0,
          0,
          0,
          0,
          4,
          0,
          0,
          0,
          0,
          0,
          0,
          3,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          4,
          3,
          5,
          3,
          0,
          6,
          4,
          5,
          3,
          6,
          5,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          5,
          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,
          5,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          1,
          0,
          0,
          0,
          0,
          1,
          0,
          0,
          1,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          1,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          3,
          0,
          0,
          0,
          0,
          0,
          3,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          3,
          0,
          0,
          0,
          0,
          0,
          0,
          1,
          0,
          0,
          0,
          4,
          10,
          7,
          4,
          1,
          3,
          2,
          3,
          0,
          3,
          10,
          13,
          14,
          13,
          11,
          11,
          9,
          14,
          12,
          26,
          20,
          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,
          5,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          6,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          1,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          3,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0
        ]
      }
    ]
  ],
  "app_os": "linux",
  "app_name": "PhotosynQ",
  "app_version": "0.3.5",
  "app_device": "x86-64",
  "location": [
    "42.3080798",
    "-83.7141338"
  ],
  "ConsoleMacro": "254"
}
012409 pbi 160 low low res headshot
Created by

Greg Austic


Protocol connections:
2
Latest Update:
Nov 2016