Multispeq_beta_soil_reflectance_calibration_macro


Baseline macro for use with soil reflectance protocols. Macro can be adjusted as needed for individual devices. REQUIREMENTS: firmware v0.38, switch detectors between main and add-on boards (34, and 35). Smoothing out pulses and normalizing to calibration black sheet.
var data = json.data_raw;
var output = {};

/* Pull out average value, skipping the first and last 40 points */
var blackbody_530 = MathROUND(MathMEAN(json.data_raw.slice(50,150)),2); 
var blackbody_605 = MathROUND(MathMEAN(json.data_raw.slice(250,350)),2); 
var blackbody_650 = MathROUND(MathMEAN(json.data_raw.slice(450,550)),2); 
var blackbody_720 = MathROUND(MathMEAN(json.data_raw.slice(650,750)),2); 
var blackbody_850 = MathROUND(MathMEAN(json.data_raw.slice(850,950)),2); 
var blackbody_940 = MathROUND(MathMEAN(json.data_raw.slice(1050,1150)),2); 

/*outputs*/
output["530nm"]=blackbody_530; 
output["605nm"]=blackbody_605;
output["650nm"]=blackbody_650; 
output["720nm"]=blackbody_720;  
output["850nm"]=blackbody_850; 
output["940nm"]=blackbody_940;

output ["toDevice"] = "1019+";
output ["toDevice"] += "0";
output ["toDevice"] += "+";
output ["toDevice"] += blackbody_530;
output ["toDevice"] += "+";
output ["toDevice"] += "1020+";
output ["toDevice"] += "0";
output ["toDevice"] += "+";
output ["toDevice"] += blackbody_605;
output ["toDevice"] += "+";
output ["toDevice"] += "1021+";
output ["toDevice"] += "0";
output ["toDevice"] += "+";
output ["toDevice"] += blackbody_650;
output ["toDevice"] += "+";
output ["toDevice"] += "1022+";
output ["toDevice"] += "0";
output ["toDevice"] += "+";
output ["toDevice"] += blackbody_720;
output ["toDevice"] += "+";
output ["toDevice"] += "1023+";
output ["toDevice"] += "0";
output ["toDevice"] += "+";
output ["toDevice"] += blackbody_850;
output ["toDevice"] += "+";
output ["toDevice"] += "1024+";
output ["toDevice"] += "0";
output ["toDevice"] += "+";
output ["toDevice"] += blackbody_940;
output ["toDevice"] += "+";
output ["toDevice"] += "-1+";



return output;
{
  "time_offset": 240,
  "time": 1465480702378,
  "device_id": 219,
  "firmware_version": "0.430",
  "sample": [
    {
      "time": 1465480702378,
      "protocol_id": 1,
      "data_raw": [
        3,
        2,
        5,
        3,
        6,
        5,
        3,
        4,
        1,
        2,
        2,
        2,
        6,
        5,
        3,
        5,
        4,
        2,
        2,
        5,
        4,
        2,
        5,
        4,
        1,
        4,
        5,
        3,
        2,
        6,
        5,
        2,
        6,
        7,
        1,
        2,
        3,
        0,
        3,
        5,
        4,
        0,
        4,
        5,
        4,
        2,
        3,
        4,
        2,
        4,
        5,
        1,
        4,
        3,
        5,
        2,
        4,
        1,
        6,
        3,
        5,
        2,
        6,
        5,
        5,
        3,
        1,
        4,
        4,
        3,
        4,
        6,
        4,
        6,
        6,
        3,
        2,
        4,
        2,
        4,
        5,
        6,
        5,
        2,
        3,
        1,
        0,
        3,
        4,
        5,
        3,
        7,
        6,
        2,
        6,
        5,
        4,
        4,
        4,
        3,
        4,
        7,
        5,
        4,
        5,
        4,
        4,
        4,
        6,
        4,
        2,
        5,
        2,
        2,
        3,
        4,
        1,
        2,
        6,
        3,
        4,
        3,
        5,
        2,
        4,
        7,
        6,
        4,
        5,
        5,
        4,
        4,
        6,
        1,
        3,
        5,
        5,
        0,
        3,
        7,
        4,
        4,
        6,
        7,
        2,
        5,
        4,
        3,
        5,
        2,
        3,
        0,
        4,
        2,
        6,
        5,
        1,
        3,
        3,
        4,
        3,
        0,
        4,
        4,
        3,
        7,
        2,
        5,
        0,
        7,
        3,
        5,
        6,
        5,
        3,
        3,
        4,
        6,
        5,
        4,
        2,
        4,
        2,
        5,
        5,
        4,
        3,
        6,
        4,
        5,
        7,
        4,
        8,
        4,
        4,
        5,
        6,
        4,
        2,
        4,
        4099,
        4188,
        4207,
        4184,
        4183,
        4176,
        4193,
        4207,
        4180,
        4206,
        4204,
        4187,
        4176,
        4175,
        4198,
        4189,
        4207,
        4203,
        4172,
        4192,
        4199,
        4195,
        4207,
        4212,
        4196,
        4187,
        4187,
        4205,
        4192,
        4193,
        4196,
        4218,
        4212,
        4179,
        4214,
        4205,
        4205,
        4210,
        4211,
        4197,
        4221,
        4206,
        4203,
        4200,
        4211,
        4210,
        4192,
        4189,
        4216,
        4194,
        4204,
        4199,
        4199,
        4204,
        4204,
        4211,
        4191,
        4182,
        4220,
        4198,
        4210,
        4195,
        4209,
        4201,
        4182,
        4189,
        4178,
        4182,
        4208,
        4175,
        4194,
        4194,
        4181,
        4175,
        4173,
        4169,
        4198,
        4213,
        4194,
        4211,
        4213,
        4199,
        4194,
        4191,
        4193,
        4194,
        4200,
        4185,
        4197,
        4204,
        4184,
        4200,
        4205,
        4204,
        4192,
        4220,
        4187,
        4202,
        4212,
        4197,
        4187,
        4187,
        4193,
        4203,
        4211,
        4193,
        4214,
        4216,
        4194,
        4216,
        4194,
        4209,
        4207,
        4201,
        4205,
        4205,
        4218,
        4205,
        4194,
        4215,
        4202,
        4195,
        4214,
        4192,
        4195,
        4218,
        4211,
        4209,
        4218,
        4223,
        4225,
        4186,
        4205,
        4204,
        4224,
        4203,
        4216,
        4201,
        4191,
        4203,
        4192,
        4208,
        4204,
        4223,
        4216,
        4188,
        4222,
        4219,
        4204,
        4191,
        4195,
        4209,
        4216,
        4214,
        4203,
        4205,
        4207,
        4216,
        4209,
        4191,
        4183,
        4191,
        4205,
        4201,
        4207,
        4222,
        4208,
        4196,
        4209,
        4218,
        4200,
        4189,
        4204,
        4213,
        4206,
        4220,
        4205,
        4209,
        4216,
        4214,
        4220,
        4210,
        4190,
        4218,
        4195,
        4225,
        4202,
        4205,
        4194,
        4213,
        4199,
        4206,
        4207,
        4197,
        4209,
        4202,
        4197,
        4204,
        4205,
        4202,
        2832,
        2361,
        1990,
        1635,
        1299,
        1010,
        745,
        508,
        301,
        129,
        24,
        6,
        5,
        2,
        3,
        5,
        3,
        5,
        5,
        3,
        3,
        4,
        5,
        4,
        3,
        4,
        5,
        5,
        5,
        7,
        0,
        1,
        4,
        4,
        5,
        6,
        3,
        5,
        5,
        5,
        5,
        5,
        5,
        3,
        4,
        4,
        6,
        2,
        4,
        4,
        5,
        3,
        3,
        6,
        5,
        5,
        5,
        1,
        6,
        3,
        5,
        6,
        5,
        5,
        6,
        5,
        4,
        3,
        3,
        4,
        7,
        6,
        3,
        4,
        4,
        5,
        4,
        4,
        1,
        4,
        4,
        3,
        4,
        4,
        6,
        4,
        4,
        4,
        4,
        5,
        4,
        4,
        4,
        4,
        5,
        4,
        5,
        2,
        4,
        2,
        4,
        8,
        3,
        6,
        6,
        0,
        4,
        5,
        4,
        1,
        4,
        4,
        2,
        4,
        4,
        6,
        5,
        5,
        5,
        6,
        6,
        8,
        3,
        2,
        5,
        5,
        3,
        3,
        6,
        4,
        1,
        5,
        5,
        5,
        5,
        6,
        5,
        6,
        5,
        4,
        6,
        3,
        6,
        4,
        6,
        7,
        2,
        5,
        3,
        3,
        5,
        5,
        6,
        6,
        2,
        3,
        6,
        6,
        5,
        5,
        2,
        5,
        6,
        3,
        4,
        5,
        6,
        2,
        5,
        4,
        5,
        7,
        7,
        4,
        6,
        8,
        4,
        4,
        6,
        4,
        5,
        4,
        5,
        1,
        4,
        8,
        3,
        2,
        3,
        4,
        5,
        5,
        4,
        5,
        7,
        5,
        2,
        3,
        6,
        3,
        6061,
        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,
        6,
        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,
        8,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        7,
        9,
        0,
        13,
        0,
        0,
        0,
        3,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        4,
        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,
        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,
        4262,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        26,
        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,
        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,
        0,
        0,
        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,
        1,
        0,
        12,
        0,
        0,
        0,
        0,
        2,
        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,
        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,
        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,
        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,
        3,
        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,
        0,
        0,
        0,
        0,
        3,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0
      ]
    }
  ],
  "app_os": "win",
  "app_name": "PhotosynQ",
  "app_version": "0.3.3",
  "app_device": "x86-32",
  "location": [
    "42.4482282",
    "-76.4766080"
  ]
}
Default avatar
Created by

Daniel Kane


Protocol connections:
4
Latest Update:
May 2017