Soil NIR/Vis Calibration (v1.0)


Saves the 'blackbody' reflection at each wavelength
var data = json.data_raw;
var output = {};

/* Pull out average value, skipping the first and last 2 points */
var blackbody_530 = MathROUND(MathMEDIAN(json.data_raw.slice(22,38)),0); 
var blackbody_650 = MathROUND(MathMEDIAN(json.data_raw.slice(42,58)),0); 
var blackbody_605 = MathROUND(MathMEDIAN(json.data_raw.slice(62,78)),0); 
var blackbody_420 = MathROUND(MathMEDIAN(json.data_raw.slice(82,98)),0); 
var blackbody_940 = MathROUND(MathMEDIAN(json.data_raw.slice(122,138)),0); 
var blackbody_850 = MathROUND(MathMEDIAN(json.data_raw.slice(142,158)),0); 
var blackbody_730 = MathROUND(MathMEDIAN(json.data_raw.slice(162,178)),0); 
var blackbody_880 = MathROUND(MathMEDIAN(json.data_raw.slice(182,198)),0); 



/*outputs*/
output["530nm"]=blackbody_530; 
output["650nm"]=blackbody_650; 
output["605nm"]=blackbody_605; 
output["420nm"]=blackbody_420; 
output["940nm"]=blackbody_940;
output["850nm"]=blackbody_850; 
output["730nm"]=blackbody_730; 
output["880nm"]=blackbody_880; 
 


output["toDevice"] = "set_user_defined+1+"+blackbody_530+"+2+"+blackbody_650+"+3+"+blackbody_605+"+4+"+blackbody_420+"+5+"+blackbody_940+"+6+"+blackbody_850+"+7+"+blackbody_730+"+8+"+blackbody_880+"+-1+";

return output;
{
  "time_offset": 300,
  "time": 1483640918369,
  "device_version": "1",
  "device_id": "d4:f5:00:00:00:02",
  "device_battery": 37,
  "device_firmware": "1.13",
  "firmware_version": "1.13",
  "device_time": 1478781814,
  "sample": [
    [
      {
        "time": 1483640918400,
        "protocol_id": 1,
        "message": [
          [
            "prompt",
            " Place main body lights over the soil",
            ""
          ],
          [
            "0",
            "0",
            ""
          ],
          [
            "0",
            "0",
            ""
          ],
          [
            "0",
            "0",
            ""
          ],
          [
            "0",
            "0",
            ""
          ],
          [
            "prompt",
            " Switch to clamp side",
            ""
          ],
          [
            "0",
            "0",
            ""
          ],
          [
            "0",
            "0",
            ""
          ],
          [
            "0",
            "0",
            ""
          ],
          [
            "0",
            "0",
            ""
          ]
        ],
        "data_raw": [
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          8389,
          14095,
          14105,
          14099,
          14107,
          14142,
          14163,
          14106,
          14103,
          14100,
          14117,
          14125,
          14118,
          14133,
          14102,
          14144,
          14142,
          14109,
          14130,
          14120,
          10518,
          16946,
          16997,
          17000,
          16999,
          17003,
          17007,
          17005,
          17009,
          17003,
          17004,
          17004,
          17003,
          17004,
          17007,
          17011,
          17008,
          17008,
          17014,
          17000,
          9455,
          14392,
          14415,
          14426,
          14423,
          14422,
          14424,
          14413,
          14427,
          14425,
          14431,
          14435,
          14430,
          14426,
          14423,
          14423,
          14422,
          14418,
          14423,
          14423,
          593,
          17699,
          17712,
          17619,
          17569,
          17535,
          17480,
          17454,
          17426,
          17375,
          17369,
          17333,
          17309,
          17269,
          17249,
          17249,
          17237,
          17233,
          17200,
          17185,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          38853,
          13766,
          13502,
          13465,
          13465,
          13454,
          13449,
          13445,
          13439,
          13439,
          13443,
          13427,
          13436,
          13432,
          13436,
          13438,
          13428,
          13430,
          13438,
          13428,
          43579,
          12475,
          12071,
          12035,
          12013,
          12008,
          12003,
          12003,
          11999,
          11995,
          11994,
          11990,
          11984,
          11990,
          11991,
          11990,
          11989,
          11978,
          11983,
          11989,
          26328,
          15161,
          14980,
          14972,
          14965,
          14959,
          14962,
          14960,
          14954,
          14955,
          14953,
          14953,
          14954,
          14946,
          14955,
          14955,
          14953,
          14952,
          14948,
          14953,
          25286,
          19780,
          19693,
          19685,
          19683,
          19682,
          19674,
          19676,
          19679,
          19669,
          19673,
          19665,
          19672,
          19674,
          19667,
          19668,
          19665,
          19666,
          19666,
          19661
        ]
      }
    ]
  ],
  "app_os": "win",
  "app_name": "PhotosynQ",
  "app_version": "0.3.5",
  "app_device": "x86-32",
  "location": [
    "42.7225811",
    "-84.4746721"
  ]
}
Sam 0645   copy   copy  2
Created by

Dan TerAvest


Protocol connections:
1
Latest Update:
Jan 2017