Phi2/NIR reflection v1.0


Measure Phi2 and NIR reflection (940nm) using a MultispeQ v1.0 without clamp
//============================================
// Macro for data evaluation on PhotosynQ.org
// created: 3/29/2017
//============================================

// calculate the ir baseline for LED 3 which is used as the measuring light.  This subtract IR generated by the LED from the IR generated by the plant
//----------------------------
var sample_cal = json.detector_read1;

var shinyness = (sample_cal-json.recall["ir_baseline_yint[5]"])/json.recall["ir_baseline_slope[5]"]; // where 0 is dull black electrical tape, and 1 is shiny aluminum
var baseline = json.recall["ir_baseline_slope[3]"]*shinyness+json.recall["ir_baseline_yint[3]"];

if (!baseline || !json.recall["ir_baseline_yint[5]"] || sample_cal == 65535) {						// if it hasn't been calibrated or there's an error or it's maxed, set baseline == 0
  baseline = 0;
}

var Fs = MathMEAN(data.slice(ps2_starts + 1,ps2_starts + 4)) - baseline; // take only the first 4 values in the Fs range, excluding the very first
var Fs_std = MathSTDEV(data.slice(ps2_starts + 1,ps2_starts + 4)); // create standard deviation for this value for error checking


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

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

	//Add key time and value to output
	output["time"] = json.time;
}

//Return data
return output;
{
  "time_offset": 240,
  "time": 1490819018386,
  "device_name": "MultispeQ",
  "device_version": "1",
  "device_id": "01:12:54:48",
  "device_battery": 74,
  "device_firmware": 1.17,
  "sample": [
    [
      {
        "time": 1490819018405,
        "protocol_id": 1,
        "detector_read1": 4282,
        "detector_read2": 38,
        "light_intensity": 17,
        "r": 11,
        "g": 5,
        "b": 3,
        "light_intensity_raw": 19,
        "contactless_temp": 29.69,
        "compass_direction": "E",
        "compass": "90.00",
        "angle": 5.25,
        "angle_direction": "W",
        "pitch": -1.72,
        "roll": -4.96,
        "recall": {
          "time": 1490819022022,
          "ir_baseline_slope[5]": 8697,
          "ir_baseline_yint[5]": 13695,
          "ir_baseline_slope[3]": 635,
          "ir_baseline_yint[3]": 861.5
        },
        "data_raw": [
          209,
          208,
          208,
          203,
          207,
          215,
          206,
          207,
          207,
          205,
          211,
          209,
          208,
          204,
          210,
          215,
          210,
          210,
          208,
          207,
          217,
          220,
          218,
          219,
          215,
          224,
          219,
          214,
          219,
          215,
          221,
          213,
          217,
          217,
          217,
          219,
          216,
          217,
          219,
          214,
          220,
          219,
          218,
          219,
          212,
          223,
          215,
          218,
          213,
          218,
          221,
          217,
          217,
          213,
          215,
          222,
          218,
          219,
          213,
          217,
          223,
          219,
          221,
          213,
          215,
          222,
          215,
          219,
          215,
          215,
          223,
          219,
          218,
          214,
          209,
          218,
          218,
          217,
          218,
          219,
          219,
          213,
          210,
          206,
          206,
          213,
          204,
          205,
          207,
          207,
          214,
          207,
          206,
          202,
          205,
          213,
          207,
          205,
          209,
          207,
          211,
          205,
          209,
          207,
          206,
          209,
          208,
          208,
          207,
          206,
          206,
          210,
          209,
          209,
          207,
          209,
          207,
          206,
          207,
          204,
          206,
          207,
          209,
          210,
          207,
          209,
          210,
          207,
          209,
          207,
          205,
          201,
          207,
          209,
          207,
          211,
          207,
          207,
          207,
          205,
          210,
          210,
          210,
          207,
          203,
          207,
          204,
          207,
          205,
          207,
          211,
          210,
          208,
          207,
          207,
          207,
          207,
          206,
          206,
          207,
          213,
          206,
          208,
          210,
          205,
          207,
          204,
          204,
          203,
          203,
          205,
          202,
          207,
          204,
          202,
          206,
          202,
          202,
          203,
          205,
          207,
          207,
          207,
          206,
          205,
          205,
          203,
          204,
          205,
          201,
          205,
          206,
          204,
          204,
          204,
          206,
          203,
          206,
          207,
          204,
          209,
          207,
          208,
          206,
          206,
          207,
          207,
          207,
          206,
          206,
          209,
          206,
          205,
          207,
          207,
          208,
          207,
          207,
          207,
          207,
          214,
          207,
          207,
          207,
          209,
          211,
          207,
          210,
          210,
          211,
          2715,
          2703,
          2707,
          2703,
          2699,
          2703,
          2697,
          2711,
          2705,
          2699,
          2703,
          2703,
          2703,
          2716,
          2703,
          2703,
          2709,
          2711,
          2711,
          2706
        ]
      }
    ]
  ],
  "app_os": "win",
  "app_name": "PhotosynQ",
  "app_version": "0.3.6",
  "app_device": "x86-32",
  "location": [
    "42.7225832",
    "-84.4746608"
  ],
  "ConsoleMacro": "214"
}
Sam 0645   copy   copy  2
Created by

Dan TerAvest


Protocol connections:
0
Latest Update:
Mar 2017