MultispeQ_Beta_soil_reflectance_macro


Baseline macro for use with soil reflectance protocols. Macro can be used for all multispeq beta devices designed to be used for reflectance measurements on soils. 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 = {};

/* Define blackbody calibration values */

var blackbody_530 = json.get_userdef0[1];
var blackbody_605 = json.get_userdef1[1];
var blackbody_650 = json.get_userdef2[1];
var blackbody_720 = json.get_userdef3[1];
var blackbody_850 = json.get_userdef4[1];
var blackbody_940 = json.get_userdef5[1];


/* Pull out average value, skipping the first and last 40 points */
var response_530 = MathROUND(MathMEAN(json.data_raw.slice(50,150)),2); 
var response_605 = MathROUND(MathMEAN(json.data_raw.slice(250,350)),2); 
var response_650 = MathROUND(MathMEAN(json.data_raw.slice(450,550)),2); 
var response_720 = MathROUND(MathMEAN(json.data_raw.slice(650,750)),2); 
var response_850 = MathROUND(MathMEAN(json.data_raw.slice(850,950)),2); 
var response_940 = MathROUND(MathMEAN(json.data_raw.slice(1050,1150)),2); 


/* Adjust wavelength responses based on calibration*/
var adj_response_530 = MathROUND((response_530 / blackbody_530),4);
var adj_response_605 = MathROUND((response_605 / blackbody_605),4);
var adj_response_650 = MathROUND((response_650 / blackbody_650),4); 
var adj_response_720 = MathROUND((response_720 / blackbody_720),4);
var adj_response_850 = MathROUND((response_850 / blackbody_850),4);
var adj_response_940 = MathROUND((response_940 / blackbody_940),4);

/*outputs*/
output["530nm"]=adj_response_530; 
output["605nm"]=adj_response_605; 
output["650nm"]=adj_response_650; 
output["720nm"]=adj_response_720; 
output["850nm"]=adj_response_850; 
output["940nm"]=adj_response_940; 

output["Raw 530nm"]=response_530; 
output["Raw 605nm"]=response_605; 
output["Raw 650nm"]=response_650; 
output["Raw 720nm"]=response_720; 
output["Raw 850nm"]=response_850; 
output["Raw 940nm"]=response_940;

output["blackbody_530"]=blackbody_530;
output["blackbody_605"]=blackbody_605;
output["blackbody_650"]=blackbody_650;
output["blackbody_720"]=blackbody_720;
output["blackbody_850"]=blackbody_850;
output["blackbody_940"]=blackbody_940;

return output;	



{
  "time_offset": 240,
  "time": 1496019244838,
  "device_id": 167,
  "firmware_version": "0.450",
  "sample": [
    {
      "time": 1496019244838,
      "protocol_id": 1,
      "get_userdef0": [
        0,
        12.43
      ],
      "get_userdef1": [
        0,
        5075.279785
      ],
      "get_userdef2": [
        0,
        7110.740234
      ],
      "get_userdef3": [
        0,
        2158.570068
      ],
      "get_userdef4": [
        0,
        15545.94043
      ],
      "get_userdef5": [
        0,
        10001.900391
      ],
      "data_raw": [
        11454,
        3657,
        3637,
        3629,
        3586,
        3605,
        3578,
        3564,
        3589,
        3505,
        3494,
        3527,
        3532,
        3477,
        3473,
        3446,
        3472,
        3413,
        3413,
        3408,
        3387,
        3373,
        3336,
        3335,
        3342,
        3346,
        3343,
        3315,
        3274,
        3310,
        3304,
        3285,
        3263,
        3240,
        3244,
        3237,
        3214,
        3219,
        3161,
        3156,
        3131,
        3121,
        3131,
        3115,
        3132,
        3084,
        3067,
        3099,
        3051,
        3091,
        3051,
        3036,
        3006,
        2989,
        2979,
        2972,
        2979,
        2967,
        2952,
        2917,
        2953,
        2905,
        2928,
        2872,
        2879,
        2885,
        2862,
        2839,
        2841,
        2825,
        2847,
        2834,
        2824,
        2812,
        2808,
        2801,
        2781,
        2774,
        2784,
        2760,
        2754,
        2756,
        2745,
        2755,
        2701,
        2724,
        2697,
        2700,
        2654,
        2659,
        2673,
        2656,
        2607,
        2616,
        2616,
        2643,
        2613,
        2606,
        2544,
        2565,
        2552,
        2552,
        2547,
        2541,
        2515,
        2536,
        2537,
        2513,
        2525,
        2512,
        2484,
        2485,
        2491,
        2459,
        2442,
        2439,
        2448,
        2436,
        2403,
        2431,
        2404,
        2403,
        2393,
        2380,
        2398,
        2386,
        2405,
        2378,
        2357,
        2358,
        2344,
        2333,
        2385,
        2317,
        2362,
        2330,
        2289,
        2300,
        2273,
        2269,
        2275,
        2250,
        2255,
        2238,
        2231,
        2232,
        2221,
        2219,
        2201,
        2228,
        2225,
        2232,
        2245,
        2183,
        2185,
        2172,
        2184,
        2140,
        2149,
        2170,
        2136,
        2161,
        2111,
        2135,
        2148,
        2087,
        2106,
        2131,
        2125,
        2121,
        2079,
        2059,
        2042,
        2069,
        2054,
        2069,
        2080,
        2050,
        2034,
        2018,
        2003,
        2006,
        1977,
        2034,
        2004,
        1968,
        1988,
        1939,
        1981,
        1944,
        1939,
        1959,
        1928,
        1947,
        1940,
        1925,
        1925,
        1904,
        1925,
        1891,
        20106,
        20111,
        20091,
        20132,
        20123,
        20094,
        20106,
        20091,
        20084,
        20117,
        20134,
        20165,
        20129,
        20131,
        20139,
        20120,
        20114,
        20128,
        20156,
        20138,
        20135,
        20091,
        20118,
        20092,
        20141,
        20138,
        20141,
        20140,
        20116,
        20119,
        20133,
        20286,
        20259,
        20114,
        20148,
        20108,
        20166,
        20157,
        20257,
        20232,
        20281,
        20292,
        20287,
        20291,
        20279,
        20298,
        20283,
        20268,
        20282,
        20289,
        20294,
        20284,
        20294,
        20283,
        20289,
        20286,
        20280,
        20268,
        20249,
        20230,
        20286,
        20279,
        20279,
        20294,
        20303,
        20305,
        20292,
        20305,
        20293,
        20316,
        20281,
        20296,
        20299,
        20275,
        20272,
        20293,
        20294,
        20290,
        20289,
        20268,
        20294,
        20283,
        20285,
        20261,
        20299,
        20282,
        20279,
        20290,
        20297,
        20285,
        20280,
        20300,
        20291,
        20286,
        20295,
        20276,
        20291,
        20293,
        20295,
        20311,
        20268,
        20289,
        20285,
        20300,
        20261,
        20276,
        20310,
        20283,
        20284,
        20267,
        20244,
        20243,
        20266,
        20272,
        20274,
        20314,
        20286,
        20280,
        20267,
        20289,
        20281,
        20355,
        20279,
        20302,
        20261,
        20262,
        20292,
        20299,
        20289,
        20290,
        20311,
        20272,
        20271,
        20273,
        20267,
        20266,
        20275,
        20300,
        20332,
        20264,
        20264,
        20268,
        20289,
        20284,
        20271,
        20306,
        20290,
        20279,
        20287,
        20308,
        20272,
        20282,
        20311,
        20282,
        20280,
        20261,
        20268,
        20270,
        20289,
        20279,
        20293,
        20216,
        20240,
        20269,
        20269,
        20261,
        20272,
        20266,
        20270,
        20284,
        20276,
        20272,
        20282,
        20270,
        20282,
        20286,
        20292,
        20277,
        20283,
        20284,
        20280,
        20257,
        20285,
        20293,
        20271,
        20260,
        20267,
        20257,
        20281,
        20280,
        20284,
        20148,
        20084,
        20138,
        20121,
        20137,
        20144,
        20089,
        20145,
        20123,
        13204,
        13258,
        13222,
        13200,
        13195,
        13166,
        13127,
        13082,
        13099,
        13053,
        13036,
        13028,
        13030,
        13001,
        12926,
        12947,
        12929,
        12908,
        12899,
        12836,
        12825,
        12805,
        12785,
        12765,
        12743,
        12721,
        12689,
        12693,
        12678,
        12673,
        12625,
        12624,
        12560,
        12585,
        12568,
        12502,
        12510,
        12479,
        12477,
        12440,
        12428,
        12383,
        12393,
        12376,
        12345,
        12327,
        12342,
        12319,
        12284,
        12281,
        12237,
        12201,
        12187,
        12183,
        12145,
        12124,
        12115,
        12095,
        12123,
        12034,
        12042,
        12035,
        12008,
        12017,
        11980,
        11952,
        11939,
        11895,
        11887,
        11868,
        11841,
        11842,
        11788,
        11808,
        11777,
        11760,
        11749,
        11745,
        11725,
        11695,
        11682,
        11666,
        11637,
        11619,
        11604,
        11592,
        11574,
        11543,
        11511,
        11523,
        11522,
        11473,
        11474,
        11444,
        11407,
        11430,
        11380,
        11366,
        11378,
        11339,
        11344,
        11302,
        11283,
        11283,
        11259,
        11235,
        11206,
        11228,
        11163,
        11179,
        11165,
        11117,
        11136,
        11115,
        11070,
        11075,
        11053,
        11033,
        11044,
        11026,
        10979,
        10969,
        10975,
        10926,
        10929,
        10921,
        10875,
        10861,
        10872,
        10863,
        10817,
        10809,
        10773,
        10783,
        10797,
        10741,
        10740,
        10693,
        10681,
        10684,
        10647,
        10645,
        10639,
        10579,
        10607,
        10571,
        10574,
        10536,
        10535,
        10529,
        10526,
        10472,
        10456,
        10445,
        10433,
        10425,
        10395,
        10418,
        10394,
        10382,
        10381,
        10327,
        10319,
        10276,
        10283,
        10276,
        10265,
        10261,
        10225,
        10218,
        10209,
        10191,
        10180,
        10157,
        10162,
        10128,
        10130,
        10120,
        10055,
        10099,
        10037,
        10038,
        10028,
        9996,
        10017,
        9983,
        9958,
        9965,
        9950,
        9946,
        9898,
        9897,
        9889,
        9866,
        9848,
        9825,
        9804,
        9779,
        9796,
        9774,
        0,
        6045,
        6188,
        6257,
        6276,
        6235,
        6239,
        6266,
        6261,
        6310,
        6307,
        6278,
        6301,
        6291,
        6299,
        6295,
        6273,
        6321,
        6292,
        6290,
        6300,
        6301,
        6290,
        6309,
        6322,
        6322,
        6303,
        6310,
        6332,
        6276,
        6315,
        6297,
        6315,
        6330,
        6317,
        6314,
        6325,
        6358,
        6290,
        6329,
        6293,
        6310,
        6297,
        6316,
        6326,
        6306,
        6283,
        6305,
        6285,
        6330,
        6311,
        6322,
        6317,
        6333,
        6308,
        6299,
        6310,
        6291,
        6327,
        6309,
        6290,
        6387,
        6305,
        6344,
        6303,
        6308,
        6293,
        6308,
        6312,
        6321,
        6317,
        6311,
        6306,
        6301,
        6305,
        6342,
        6311,
        6330,
        6325,
        6355,
        6351,
        6356,
        6311,
        6298,
        6327,
        6302,
        6288,
        6325,
        6335,
        6328,
        6327,
        6312,
        6314,
        6314,
        6287,
        6321,
        6329,
        6324,
        6330,
        6306,
        6315,
        6341,
        6329,
        6315,
        6320,
        6349,
        6327,
        6336,
        6309,
        6336,
        6321,
        6300,
        6326,
        6309,
        6308,
        6268,
        6274,
        6287,
        6318,
        6295,
        6301,
        6306,
        6290,
        6299,
        6297,
        6302,
        6278,
        6307,
        6287,
        6301,
        6299,
        6297,
        6299,
        6300,
        6311,
        6320,
        6286,
        6289,
        6277,
        6293,
        6308,
        6295,
        6297,
        6310,
        6292,
        6287,
        6286,
        6279,
        6321,
        6294,
        6296,
        6298,
        6275,
        6286,
        6332,
        6297,
        6318,
        6300,
        6288,
        6281,
        6272,
        6302,
        6293,
        6292,
        6304,
        6289,
        6273,
        6317,
        6269,
        6283,
        6278,
        6304,
        6273,
        6265,
        6302,
        6292,
        6265,
        6298,
        6298,
        6317,
        6322,
        6301,
        6297,
        6295,
        6320,
        6316,
        6306,
        6338,
        6309,
        6310,
        6297,
        6310,
        6325,
        6320,
        6326,
        6320,
        6343,
        6325,
        6302,
        6313,
        0,
        17,
        14,
        12,
        18,
        21,
        21,
        15,
        15,
        16,
        20,
        15,
        12,
        15,
        15,
        15,
        15,
        19,
        18,
        15,
        17,
        19,
        11,
        13,
        14,
        17,
        17,
        11,
        15,
        14,
        15,
        14,
        14,
        13,
        15,
        12,
        14,
        14,
        17,
        14,
        15,
        15,
        17,
        12,
        19,
        13,
        16,
        17,
        15,
        13,
        17,
        17,
        18,
        13,
        17,
        15,
        18,
        11,
        12,
        16,
        15,
        11,
        14,
        16,
        14,
        12,
        13,
        13,
        16,
        15,
        16,
        14,
        12,
        17,
        13,
        13,
        14,
        12,
        18,
        13,
        15,
        14,
        16,
        13,
        14,
        20,
        14,
        15,
        19,
        16,
        14,
        15,
        17,
        11,
        18,
        20,
        19,
        13,
        13,
        15,
        14,
        16,
        15,
        15,
        14,
        20,
        14,
        12,
        13,
        14,
        12,
        14,
        14,
        15,
        15,
        20,
        13,
        17,
        16,
        11,
        17,
        13,
        17,
        16,
        14,
        16,
        13,
        16,
        17,
        15,
        18,
        11,
        15,
        19,
        13,
        11,
        16,
        14,
        15,
        15,
        15,
        13,
        15,
        14,
        14,
        14,
        15,
        15,
        21,
        17,
        18,
        15,
        14,
        16,
        16,
        16,
        16,
        18,
        12,
        16,
        18,
        14,
        17,
        14,
        13,
        14,
        16,
        15,
        20,
        21,
        15,
        13,
        15,
        17,
        17,
        15,
        15,
        15,
        11,
        13,
        20,
        13,
        15,
        13,
        12,
        16,
        15,
        15,
        13,
        15,
        19,
        14,
        12,
        17,
        11,
        16,
        17,
        12,
        12,
        17,
        8388,
        9210,
        9292,
        9375,
        9306,
        9290,
        9260,
        9279,
        9271,
        9257,
        9243,
        9299,
        9197,
        9395,
        9218,
        9282,
        9206,
        9302,
        9287,
        9287,
        9244,
        9270,
        9263,
        9263,
        9267,
        9277,
        9316,
        9266,
        9292,
        9275,
        9299,
        9064,
        9001,
        9156,
        9201,
        9161,
        9142,
        9036,
        9151,
        9109,
        9135,
        9091,
        9080,
        9147,
        9096,
        9079,
        9101,
        9055,
        9122,
        9103,
        9110,
        8997,
        9163,
        9061,
        9049,
        9061,
        9141,
        9150,
        9147,
        8982,
        8972,
        9131,
        9108,
        9083,
        9041,
        9068,
        9158,
        9107,
        9100,
        9149,
        9051,
        9156,
        9153,
        9113,
        9086,
        9045,
        9001,
        9127,
        9038,
        9091,
        9035,
        9142,
        8998,
        9139,
        9058,
        9038,
        8964,
        9095,
        9109,
        8991,
        9088,
        8988,
        9107,
        9021,
        9057,
        9171,
        9071,
        9145,
        9017,
        9105,
        9146,
        9009,
        9059,
        9094,
        9124,
        9201,
        9076,
        9062,
        9118,
        9105,
        9108,
        9070,
        9166,
        9081,
        9073,
        9151,
        9108,
        9136,
        9087,
        9171,
        9113,
        9019,
        9055,
        9054,
        9113,
        9164,
        9070,
        9091,
        9126,
        8995,
        9226,
        9078,
        9097,
        9045,
        9074,
        9072,
        9131,
        9054,
        9083,
        9136,
        9166,
        9085,
        9100,
        9039,
        9060,
        9051,
        8986,
        9079,
        9018,
        9034,
        9055,
        9067,
        9108,
        8975,
        9142,
        9130,
        9052,
        9057,
        9131,
        9116,
        9093,
        9080,
        9115,
        9098,
        9104,
        9159,
        9146,
        9056,
        9336,
        9053,
        9212,
        9094,
        9050,
        9075,
        9118,
        9165,
        9065,
        9164,
        9052,
        9105,
        9056,
        9088,
        9065,
        9062,
        9100,
        9133,
        8972,
        9146,
        8932,
        9113,
        9090,
        9260,
        9117,
        9035,
        9080,
        8957,
        9112,
        9169,
        9200,
        9345
      ]
    }
  ],
  "app_os": "mac",
  "app_name": "PhotosynQ",
  "app_version": "0.3.7",
  "app_device": "x86-64",
  "ConsoleMacro": "209",
  "notes": "testing 6\n"
}
Default avatar
Created by

Daniel Kane


Protocol connections:
5
Latest Update:
May 2017