v1.0 CALIBRATION: Light box to LiCOR PAR


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 intensityArray = [100,200,300,600,1200,2400];  // DAC intensities set in the protocol for red LED (light 2)
var intensities = intensityArray.length; 

// Prepare the array of LiCOR PAR responses to the DAC intensity settings from the "message" parameter.

var licorParArray = [];

for (var i = 0; i < intensities; i++) {
  licorParArray[i] = Number(json.message[i+1][2]);  
}

//output["licorParArray"] = licorParArray;
//output["intensityArray"] = intensityArray;
output["licorParArray_numbers"] = "";
output["intensityArray_numbers"] = "";

for (var i = 0; i < licorParArray.length; i++) {
  output["licorParArray_numbers"] += licorParArray[i] + ",";
}

for (var i = 0; i < intensityArray.length; i++) {
  output["intensityArray_numbers"] += intensityArray[i] + ",";
}

// Now run a linear regression to correlate DAC value to LiCOR PAR value.  This allow us to check the quality of the calibration
var model = MathLINREG(licorParArray, intensityArray);

output["slope"] = MathROUND(model.m,7);
output["y-int"] = MathROUND(model.b,7);
output["rsquared"] = MathROUND(model.r,7);

// now we output the results to the device (each value for each reading, 1 - 6).  We'll save them in the userdefined slots 1 - 6
output["toDevice"] = "set_user_defined+1+";
output["toDevice"] += MathROUND(licorParArray[0])+"+";
output["toDevice"] += "2+";
output["toDevice"] += MathROUND(licorParArray[1])+"+";
output["toDevice"] += "3+";
output["toDevice"] += MathROUND(licorParArray[2])+"+";
output["toDevice"] += "4+";
output["toDevice"] += MathROUND(licorParArray[3])+"+";
output["toDevice"] += "5+";
output["toDevice"] += MathROUND(licorParArray[4])+"+";
output["toDevice"] += "6+";
output["toDevice"] += MathROUND(licorParArray[5])+"+";
output["toDevice"] += "-1+";

return output;
{
  "time_offset": 240,
  "time": 1475244839688,
  "device_version": "1",
  "device_id": "d4:f5:00:00:00:00",
  "device_battery": 92,
  "device_firmware": "1.07",
  "firmware_version": "1.07",
  "device_time": 1473256494,
  "sample": [
    [
      {
        "time": 1475244839704,
        "protocol_id": 1,
        "message": [
          [
            "0",
            "0",
            ""
          ],
          [
            "prompt",
            " enter PAR value",
            "15.86"
          ],
          [
            "prompt",
            " enter PAR value",
            "50.46"
          ],
          [
            "prompt",
            " enter PAR value",
            "85.77"
          ],
          [
            "prompt",
            " enter PAR value",
            "193.54"
          ],
          [
            "prompt",
            " enter PAR value",
            "405.1"
          ],
          [
            "prompt",
            " enter PAR value",
            "821.4"
          ]
        ],
        "data_raw": [

        ]
      }
    ]
  ],
  "app_os": "linux",
  "app_name": "PhotosynQ",
  "app_version": "0.3.5",
  "app_device": "x86-64",
  "location": [
    "42.7225879",
    "-84.4746949"
  ],
  "ConsoleMacro": "201"
}
012409 pbi 160 low low res headshot
Created by

Greg Austic


Protocol connections:
3
Latest Update:
Oct 2016