CALIBRATION: PAR LED factory


Each of the LEDs is calibrated to determine the light intensity it produces in the chamber (measured in uE of Photosynthetically Active Radiation, PAR) for all lights on main board and leaf clip. This calibration is performed at the factory, and saves the original calibration of the intensities using a LiCOR PAR meter. This serves as the basis for later user calibrations of the LED PAR which do not require an additional PAR sensor, but instead measure drift from the original calibration and adjust based on the size of that drift. Note that for the actinic lights (LEDs 20 and 2 on the main and leaf clip boards, respectively), this macro forces the y-intercept to 0. This is because the actinic LEDs should be off at 0 intensity (otherwise, at 0 intensity the LED would still be on!). Negative values for the y intercept are acceptable. You must have a independent PAR sensor to perform this calibration!
//Define your variables here...
    var output = {};

    //Check if the value exists in json
    if (json.time !== undefined) {

        var leds = [];
        var par_data = [];
        var intensity = [];
        var message = json.message;
        // Number of points in a single fitted calibration
        var points_per_fit = 4;

        // Pull out the LEDs, intensities, and data for each of the calibration points
        for (var x = 1; x < message.length; x++) {
            var split_message = message[x][1].split(/[\s]+/);
          if (Number(split_message[split_message.length-2])) {
            leds.push(Number(split_message[split_message.length-2]));
            intensity.push(Number(split_message[split_message.length-1]));
            par_data.push(Number(message[x][2]));
          }
          }

        var leds_unique = [];
        for (var i = 0; i < leds.length; i++) {
            if (leds_unique.indexOf(leds[i]) == -1)
                leds_unique.push(leds[i]);
        }
        var leds_unique_data = [];
        var leds_unique_intensity = [];

        // make a list of the unique LEDs, and subarrays for the data and intensities for each LED
        for (var x = 0; x < leds_unique.length; x++) {
            leds_unique_data[x] = [];
            leds_unique_intensity[x] = [];
            for (var y = 0; y < points_per_fit; y++) {
                leds_unique_data[x].push(par_data[points_per_fit * x + y]);
                leds_unique_intensity[x].push(intensity[points_per_fit * x + y]);
            }
        }

//      output the results
//      output ["all data"] = leds_unique_data; 
//      output ["all leds"] = leds; 
        output ["toDevice"] = "1016+";
        output['unique LEDs'] = "";	

      	for (i in leds_unique) {
         	output['unique LEDs'] += leds_unique[i];
         	if (i < leds_unique.length-1) {
	         	output['unique LEDs'] += ",";
        	}
	    }
//      perform linear regression, calculate mx+b for each light
        for (var x = 0; x < leds_unique_data.length; x++) {
            var reg = MathLINREG(leds_unique_intensity[x], leds_unique_data[x]);
          if (reg.m) {
            output["slope " + leds_unique[x]] = MathROUND(reg.m, 3);
            if (!(reg.b > 0 && (leds_unique[x] != 2 | leds_unique[x] != 20))) { // force y int to 0 if greater than zero on actinic lights which must be off when intensity = 0.
            	output["yint " + leds_unique[x]] = MathROUND(reg.b, 1);
            }
            else {	// if actinic light y intercept is > 0, then make it zero.
            	output["yint " + leds_unique[x]] = 0;
            }
            output["r2 " + leds_unique[x]] = MathROUND(reg.r, 3);
            output ["toDevice"] += leds_unique[x];
            output ["toDevice"] += "+";
            output ["toDevice"] += Number(MathROUND(reg.m, 3));
            output ["toDevice"] += "+";
            output ["toDevice"] += Number(MathROUND(reg.b, 1));
            output ["toDevice"] += "+";
          }
        }
        output ["toDevice"] += "-1+";
    }

    //Return data
    return output;
{
  "time_offset": 300,
  "time": 1420068579812,
  "device_id": 56,
  "firmware_version": "0.360",
  "sample": [
    [
      {
        "time": 1420068579818,
        "protocol_id": 1,
        "message": [
          [
            "alert",
            "Please place LiCOR PAR sensor facing the main MultispeQ bodyou will have 3 seconds to mark the LiCOR value once you press ok",
            "ok"
          ],
          [
            "prompt",
            "enter PAR sensor value 15 1775",
            "7.18"
          ],
          [
            "prompt",
            "enter PAR sensor value 15 1875",
            "70.35"
          ],
          [
            "prompt",
            "enter PAR sensor value 15 1975",
            "208.4"
          ],
          [
            "prompt",
            "enter PAR sensor value 15 2075",
            "377.3"
          ],
          [
            "prompt",
            "enter PAR sensor value 16 2125",
            "11.5"
          ],
          [
            "prompt",
            "enter PAR sensor value 16 2175",
            "39.52"
          ],
          [
            "prompt",
            "enter PAR sensor value 16 2225",
            "100.08"
          ],
          [
            "prompt",
            "enter PAR sensor value 16 2275",
            "203.9"
          ],
          [
            "prompt",
            "enter PAR sensor value 20 10",
            "61.79"
          ],
          [
            "prompt",
            "enter PAR sensor value 20 75",
            "552.6"
          ],
          [
            "prompt",
            "enter PAR sensor value 20 125",
            "913.7"
          ],
          [
            "prompt",
            "enter PAR sensor value 20 175",
            "1276.2"
          ],
          [
            "prompt",
            "enter PAR sensor value 14 1000",
            "0"
          ],
          [
            "prompt",
            "enter PAR sensor value 14 2000",
            "0"
          ],
          [
            "prompt",
            "enter PAR sensor value 14 3000",
            "0"
          ],
          [
            "prompt",
            "enter PAR sensor value 14 4000",
            "0"
          ],
          [
            "alert",
            "Now change the location of the LiCOR PAR sensor so it is facing the top of the leaf clip",
            "ok"
          ],
          [
            "prompt",
            "enter PAR sensor value 11 1775",
            "2.12"
          ],
          [
            "prompt",
            "enter PAR sensor value 11 1875",
            "3.14"
          ],
          [
            "prompt",
            "enter PAR sensor value 11 1975",
            "4.26"
          ],
          [
            "prompt",
            "enter PAR sensor value 11 2075",
            "5.44"
          ],
          [
            "prompt",
            "enter PAR sensor value 12 1775",
            "0"
          ],
          [
            "prompt",
            "enter PAR sensor value 12 1875",
            "0"
          ],
          [
            "prompt",
            "enter PAR sensor value 12 1975",
            "0"
          ],
          [
            "prompt",
            "enter PAR sensor value 12 2075",
            "0"
          ],
          [
            "prompt",
            "enter PAR sensor value 2 10",
            "69.65"
          ],
          [
            "prompt",
            "enter PAR sensor value 2 75",
            "614.9"
          ],
          [
            "prompt",
            "enter PAR sensor value 2 125",
            "1016.5"
          ],
          [
            "prompt",
            "enter PAR sensor value 2 175",
            "1417.7"
          ],
          [
            "prompt",
            "enter PAR sensor value 10 1000",
            "0"
          ],
          [
            "prompt",
            "enter PAR sensor value 10 2000",
            "0"
          ],
          [
            "prompt",
            "enter PAR sensor value 10 3000",
            "0"
          ],
          [
            "prompt",
            "enter PAR sensor value 10 4000",
            "0"
          ]
        ],
        "data_raw": [
          -276,
          0,
          5,
          4,
          1,
          7,
          -264,
          2,
          6,
          5,
          4,
          3,
          -278,
          2,
          -1,
          5,
          6,
          7,
          -277,
          7,
          0,
          0,
          4,
          -6,
          -274,
          11,
          5,
          0,
          3,
          0,
          -275,
          0,
          3,
          -3,
          -1,
          5,
          -275,
          0,
          -6,
          -1,
          -2,
          2,
          -276,
          -3,
          0,
          -1,
          0,
          -3,
          -274,
          11,
          6,
          4,
          4,
          -1,
          -269,
          4,
          6,
          -2,
          6,
          2,
          -277,
          4,
          6,
          0,
          4,
          5,
          -274,
          3,
          4,
          1,
          2,
          1,
          -269,
          7,
          -3,
          5,
          0,
          4,
          -277,
          0,
          9,
          7,
          3,
          3,
          -274,
          5,
          8,
          2,
          4,
          -1,
          -275,
          2,
          6,
          0,
          12,
          2,
          -260,
          1,
          -3,
          4,
          -5,
          0,
          -280,
          -2,
          3,
          0,
          3,
          12,
          -273,
          0,
          -8,
          4,
          3,
          -13,
          -272,
          -1,
          5,
          12,
          -1,
          9,
          -280,
          -1,
          -8,
          12,
          0,
          -2,
          -271,
          5,
          9,
          10,
          13,
          1,
          -260,
          6,
          3,
          -8,
          7,
          2,
          -282,
          5,
          3,
          -3,
          4,
          2,
          -271,
          -5,
          -1,
          -1,
          -1,
          10,
          -282,
          11,
          10,
          7,
          2,
          4,
          -273,
          8,
          10,
          -6,
          3,
          10,
          -277,
          11,
          4,
          8,
          2,
          3,
          -276,
          15,
          3,
          3,
          7,
          9,
          -272,
          1,
          0,
          1,
          4,
          4,
          -279,
          8,
          11,
          9,
          1,
          9,
          -273,
          7,
          2,
          8,
          0,
          2,
          -270,
          10,
          9,
          5,
          -8,
          6,
          -272,
          9,
          -1,
          -2,
          5,
          4
        ]
      }
    ]
  ]
}
012409 pbi 160 low low res headshot
Created by

Greg Austic


Protocol connections:
3
Latest Update:
Feb 2015