actbleed1


Building a new RIDES_light_potential macro with integrated ECS.
/**
 * Macro for data evaluation of RIDES1_light_potential 
 * data on PhotosynQ.org
 * by: David M. Kramer
 * created: 2017-05-09 @ 18:15:27
 *   
 * The concept for the protocol came out of discussions between myself
 * and Gonzalo Estavillo during a PhotosynQ workshop (and subsequent 
 * beers). The idea is: what would be the instantaneous increase in
 * LEF if the light intensity suddently increased to a certain point
 * near saturation. To estmate this value, we started with RISES1_3_1
 * but in additiopn to the steady-state (ambient) light Fs valuies
 * taken before the saturation pulse, we added a second, ~10-s 
 * illumination with 1000 uE. We assumed that the 10s was not sufficient
 * change NPQ by a substantial amount, so that the Fv/FM' and NPQ
 * parameters were taken with the sole saturation pulses.
   
/* Note: Special thanks to Sebastian Kuhlgert for the curve fitting routines!
*    
* The following variables are for fitting the ECS decay curves when the 
* procedure written by Kevin and Greg often fails. Fortunately, Sebastian added 
* a really important new feature that allows for very flexible and useful 
* nonlinear curve fitting.  
*/    
  
// Define the output object here
var output = {}; //dictionary to hold results
n_sets=json.set.length;
output.n_sets=json.set.length; 

actbleed=GetProtocolByLabel( "act", json );

output.dr=actbleed[0].data_raw; //.data_raw.length;
var bleed=[];

var det1 =[];
var det3 =[];
var det_1_2_offset=[];
var det_1_7_offset=[];

var det_3_2_offset=[];
var det_3_7_offset=[];


var offset_upper_beg=30;
var offset_upper_end=60;

var offset_upper_7_beg=60;
var offset_upper_7_end=90;
var trace_end_end=120;

var offset_lower_beg=60;
var offset_lower_end=90;

var act_settings=json.v_arrays[0];

for (var i =0; i<act_settings.length; i++){
	if (act_settings[i]<0){
    	act_settings[i]=-1*act_settings[i];
    }
}
output.act_settings=act_settings;

for (var i=0; i<actbleed.length;i++){
    bleed.push(actbleed[i].bleed);
    var d1t = ArrayNth(actbleed[i].data_raw, 2, 1 );
	det1.push(d1t ); 
    var meanb=MathMEAN( d1t.slice(0,offset_upper_beg));
    var meana=MathMEAN( d1t.slice(offset_upper_beg,offset_upper_end)); 
  	det_1_2_offset.push(MathROUND(meana-meanb+0.001,2)); 

    var meanb=MathMEAN( d1t.slice(offset_upper_7_end,trace_end_end));
    var meana=MathMEAN( d1t.slice(offset_upper_7_beg,offset_upper_7_end));
  	det_1_7_offset.push(MathROUND(meana-meanb,2));

   
	var d3t = ArrayNth( actbleed[i].data_raw, 2, 0 );
  	det3.push(d3t);
  	var meanb=MathMEAN( d3t.slice(0,offset_upper_beg));
    var meana=MathMEAN( d3t.slice(offset_upper_beg,offset_upper_end));
	det_3_2_offset.push(MathROUND(meana-meanb,2));

    var meanb=MathMEAN( d3t.slice(offset_upper_7_end,trace_end_end));
    var meana=MathMEAN( d3t.slice(offset_upper_7_beg,offset_upper_7_end));
  	det_3_7_offset.push(MathROUND(meana-meanb,2));

}  

output.det1=det1;
output.det3=det3;
output.det_1_2_offset="[" + det_1_2_offset.join() + "]";
output.det_1_7_offset="[" +det_1_7_offset.join()+ "]";
output.det_3_2_offset="[" +det_3_2_offset.join()+ "]";
output.det_3_7_offset="[" +det_3_7_offset.join()+ "]";

linfit_det_1=MathLINREG(act_settings.slice(1,act_settings.length-1),det_1_2_offset.slice(1,act_settings.length-1));
output.det_1_m=MathROUND(linfit_det_1.m,5);
output.det_1_b=MathROUND(linfit_det_1.b,5);
output.det_1_r2=MathROUND(linfit_det_1.r2,4);

linfit_det_1_7=MathLINREG(act_settings.slice(1,act_settings.length-1),det_1_7_offset.slice(1,act_settings.length-1));
output.det_1_7_m=MathROUND(linfit_det_1_7.m,5);
output.det_1_7_b=MathROUND(linfit_det_1_7.b,5);
output.det_1_7_r2=MathROUND(linfit_det_1_7.r2,4);


linfit_det_3=MathLINREG(act_settings.slice(1,act_settings.length-1),det_3_2_offset.slice(1,act_settings.length-1));
output.det_3_m=MathROUND(linfit_det_3.m,5);
output.det_3_b=MathROUND(linfit_det_3.b,5);
output.det_3_r2=MathROUND(linfit_det_3.r2,4);

output.toDevice="bleed+";
output.toDevice += output.det_1_m + "+" + output.det_3_m + "+";

output.bleed=bleed;
output.xxxx=det1[0];
output.bleedxxx=bleed[3];

corr1=[];
for (var i=0; i<det1.length; i++){
  corr1.push(TransformTrace( "subtract", det1[i], bleed[i]));
}

output.corr1=corr1;

return output;
{
  "time": 1547404885606,
  "device_name": "MultispeQ",
  "device_version": "2",
  "device_id": "32:11:48:18",
  "device_battery": 27,
  "device_firmware": 2.008,
  "sample": [
    [
      {
        "time": 1547404885606,
        "v_arrays": [
          [
            "0",
            "-500",
            "-1000",
            "-2000",
            "-4000"
          ],
          [
            "1000"
          ]
        ],
        "set_repeats": 5,
        "protocol_id": 1,
        "set": [
          {
            "time": 1547404885613,
            "autogain": [
              [
                1,
                3,
                15,
                291,
                25270
              ],
              [
                6,
                1,
                15,
                1083,
                28128
              ]
            ],
            "data_raw": [

            ]
          },
          {
            "time": 1547404888552,
            "label": "act",
            "data_raw": [
              17786,
              5985,
              17793,
              5983,
              17796,
              5982,
              17786,
              5981,
              17792,
              5981,
              17792,
              5978,
              17792,
              5980,
              17789,
              5983,
              17791,
              5980,
              17789,
              5979,
              17792,
              5980,
              17791,
              5979,
              17794,
              5980,
              17793,
              5981,
              17788,
              5980,
              17787,
              5981,
              17789,
              5980,
              17790,
              5980,
              17786,
              5981,
              17792,
              5980,
              17792,
              5981,
              17792,
              5979,
              17790,
              5979,
              17791,
              5981,
              17793,
              5979,
              17793,
              5982,
              17792,
              5979,
              17790,
              5978,
              17795,
              5979,
              17790,
              5981,
              17795,
              5983,
              17798,
              5979,
              17795,
              5981,
              17791,
              5982,
              17790,
              5982,
              17791,
              5983,
              17789,
              5981,
              17795,
              5981,
              17789,
              5981,
              17787,
              5979,
              17794,
              5983,
              17793,
              5980,
              17792,
              5981,
              17787,
              5981,
              17798,
              5981,
              17796,
              5982,
              17797,
              5981,
              17790,
              5979,
              17792,
              5978,
              17794,
              5981,
              17794,
              5980,
              17799,
              5980,
              17794,
              5979,
              17795,
              5979,
              17785,
              5981,
              17786,
              5981,
              17792,
              5983,
              17792,
              5980,
              17790,
              5980,
              17791,
              5978,
              17791,
              5985,
              17798,
              5982,
              17792,
              5983,
              17794,
              5981,
              17791,
              5982,
              17787,
              5982,
              17792,
              5980,
              17789,
              5980,
              17790,
              5982,
              17794,
              5981,
              17786,
              5981,
              17790,
              5982,
              17797,
              5982,
              17789,
              5982,
              17792,
              5982,
              17789,
              5982,
              17794,
              5982,
              17788,
              5981,
              17792,
              5981,
              17793,
              5982,
              17789,
              5981,
              17794,
              5977,
              17789,
              5979,
              17792,
              5978,
              17788,
              5981,
              17792,
              5980,
              17790,
              5980,
              17796,
              5980,
              17792,
              5981,
              17791,
              5981,
              17794,
              5983,
              17793,
              5980,
              17794,
              5983,
              17788,
              5982,
              17795,
              5981,
              17794,
              5980,
              17791,
              5980,
              17790,
              5979,
              17793,
              5981,
              17794,
              5981,
              17793,
              5980,
              17795,
              5978,
              17789,
              5980,
              17797,
              5980,
              17795,
              5978,
              17796,
              5980,
              17801,
              5980,
              17797,
              5983,
              17793,
              5981,
              17790,
              5978,
              17791,
              5980,
              17799,
              5980,
              17797,
              5979,
              17790,
              5981,
              17795,
              5980,
              17798,
              5982,
              17795,
              5982,
              17795,
              5980,
              17791,
              5982,
              17793,
              5979
            ]
          },
          {
            "time": 1547404895515,
            "data_raw": [

            ]
          },
          {
            "time": 1547404895521,
            "skipped": 1
          },
          {
            "time": 1547404895521,
            "label": "act",
            "data_raw": [
              17784,
              5987,
              17789,
              5983,
              17788,
              5980,
              17788,
              5981,
              17793,
              5980,
              17792,
              5981,
              17790,
              5980,
              17791,
              5983,
              17792,
              5981,
              17789,
              5981,
              17793,
              5982,
              17790,
              5981,
              17790,
              5978,
              17791,
              5981,
              17796,
              5983,
              17792,
              5980,
              17791,
              5981,
              17790,
              5982,
              17795,
              5982,
              17791,
              5981,
              17790,
              5978,
              17794,
              5982,
              17790,
              5982,
              17792,
              5981,
              17791,
              5982,
              17788,
              5980,
              17794,
              5979,
              17788,
              5981,
              17790,
              5980,
              17791,
              5980,
              17798,
              5993,
              17791,
              5988,
              17796,
              5989,
              17794,
              5989,
              17796,
              5991,
              17795,
              5989,
              17797,
              5990,
              17793,
              5991,
              17796,
              5990,
              17794,
              5990,
              17793,
              5990,
              17804,
              5988,
              17792,
              5989,
              17797,
              5992,
              17794,
              5991,
              17793,
              5989,
              17797,
              5992,
              17797,
              5990,
              17796,
              5990,
              17798,
              5988,
              17797,
              5992,
              17796,
              5989,
              17791,
              5990,
              17795,
              5991,
              17791,
              5989,
              17795,
              5990,
              17792,
              5990,
              17795,
              5991,
              17792,
              5990,
              17799,
              5990,
              17796,
              5993,
              17807,
              5989,
              17799,
              5987,
              17805,
              5990,
              17804,
              5989,
              17808,
              5987,
              17798,
              5989,
              17800,
              5992,
              17798,
              5986,
              17805,
              5988,
              17799,
              5989,
              17800,
              5988,
              17807,
              5989,
              17801,
              5989,
              17802,
              5988,
              17798,
              5987,
              17801,
              5988,
              17797,
              5988,
              17795,
              5989,
              17796,
              5989,
              17798,
              5991,
              17796,
              5989,
              17796,
              5988,
              17800,
              5990,
              17801,
              5990,
              17801,
              5987,
              17799,
              5990,
              17800,
              5988,
              17804,
              5988,
              17796,
              5990,
              17801,
              5983,
              17781,
              5981,
              17786,
              5982,
              17785,
              5981,
              17787,
              5983,
              17788,
              5980,
              17786,
              5983,
              17786,
              5980,
              17786,
              5982,
              17782,
              5982,
              17788,
              5980,
              17784,
              5979,
              17786,
              5983,
              17788,
              5981,
              17781,
              5980,
              17786,
              5984,
              17784,
              5982,
              17786,
              5981,
              17784,
              5979,
              17786,
              5980,
              17782,
              5981,
              17786,
              5979,
              17785,
              5980,
              17782,
              5982,
              17787,
              5982,
              17786,
              5979,
              17791,
              5983,
              17788,
              5982,
              17785,
              5982,
              17784,
              5980
            ]
          },
          {
            "time": 1547404902483,
            "data_raw": [

            ]
          },
          {
            "time": 1547404902489,
            "skipped": 2
          },
          {
            "time": 1547404902489,
            "label": "act",
            "data_raw": [
              17779,
              5986,
              17780,
              5983,
              17782,
              5984,
              17783,
              5983,
              17784,
              5982,
              17782,
              5981,
              17783,
              5982,
              17784,
              5981,
              17781,
              5984,
              17793,
              5983,
              17781,
              5981,
              17794,
              5981,
              17789,
              5983,
              17786,
              5980,
              17793,
              5980,
              17784,
              5983,
              17791,
              5979,
              17792,
              5981,
              17795,
              5981,
              17791,
              5982,
              17789,
              5983,
              17791,
              5981,
              17790,
              5983,
              17788,
              5979,
              17787,
              5983,
              17790,
              5983,
              17789,
              5983,
              17785,
              5982,
              17785,
              5981,
              17784,
              5981,
              17804,
              6004,
              17801,
              6000,
              17799,
              6000,
              17804,
              6000,
              17805,
              5999,
              17804,
              6000,
              17804,
              6000,
              17802,
              5999,
              17802,
              5999,
              17800,
              6000,
              17797,
              6000,
              17802,
              6002,
              17799,
              6001,
              17800,
              6000,
              17800,
              5998,
              17803,
              6003,
              17799,
              5998,
              17794,
              6000,
              17799,
              5998,
              17797,
              6000,
              17801,
              6000,
              17799,
              6000,
              17799,
              6001,
              17798,
              5999,
              17800,
              6000,
              17803,
              6000,
              17799,
              6001,
              17799,
              6000,
              17801,
              6001,
              17798,
              6001,
              17797,
              6001,
              17828,
              5997,
              17824,
              5997,
              17825,
              5997,
              17825,
              5997,
              17821,
              5996,
              17823,
              5996,
              17820,
              5999,
              17821,
              5997,
              17816,
              5998,
              17814,
              5994,
              17817,
              5996,
              17815,
              5995,
              17821,
              5998,
              17818,
              5996,
              17816,
              5994,
              17820,
              5997,
              17818,
              5997,
              17819,
              5996,
              17823,
              5995,
              17822,
              5995,
              17820,
              5997,
              17821,
              5997,
              17821,
              5995,
              17820,
              5995,
              17822,
              5996,
              17819,
              5996,
              17825,
              5995,
              17820,
              5996,
              17824,
              5995,
              17822,
              5983,
              17777,
              5984,
              17780,
              5980,
              17787,
              5980,
              17781,
              5981,
              17785,
              5982,
              17781,
              5984,
              17783,
              5980,
              17783,
              5983,
              17780,
              5983,
              17782,
              5981,
              17793,
              5981,
              17786,
              5981,
              17791,
              5984,
              17789,
              5982,
              17785,
              5982,
              17785,
              5981,
              17790,
              5981,
              17791,
              5983,
              17788,
              5983,
              17789,
              5981,
              17783,
              5981,
              17782,
              5979,
              17786,
              5980,
              17785,
              5981,
              17788,
              5982,
              17782,
              5982,
              17784,
              5981,
              17790,
              5982,
              17787,
              5981
            ]
          },
          {
            "time": 1547404909451,
            "data_raw": [

            ]
          },
          {
            "time": 1547404909457,
            "skipped": 3
          },
          {
            "time": 1547404909457,
            "label": "act",
            "data_raw": [
              17779,
              5986,
              17782,
              5985,
              17783,
              5980,
              17784,
              5979,
              17781,
              5981,
              17781,
              5982,
              17780,
              5984,
              17779,
              5981,
              17781,
              5984,
              17781,
              5982,
              17781,
              5982,
              17776,
              5983,
              17781,
              5983,
              17787,
              5982,
              17782,
              5983,
              17784,
              5982,
              17784,
              5982,
              17788,
              5982,
              17784,
              5983,
              17780,
              5981,
              17785,
              5979,
              17782,
              5982,
              17784,
              5980,
              17785,
              5982,
              17787,
              5981,
              17785,
              5982,
              17784,
              5985,
              17789,
              5981,
              17785,
              5980,
              17781,
              5983,
              17811,
              6021,
              17807,
              6021,
              17811,
              6020,
              17816,
              6020,
              17809,
              6020,
              17812,
              6020,
              17807,
              6021,
              17809,
              6022,
              17810,
              6019,
              17812,
              6019,
              17810,
              6019,
              17814,
              6021,
              17812,
              6019,
              17816,
              6019,
              17815,
              6019,
              17811,
              6019,
              17817,
              6019,
              17810,
              6019,
              17818,
              6019,
              17810,
              6018,
              17811,
              6018,
              17811,
              6019,
              17808,
              6020,
              17812,
              6020,
              17814,
              6020,
              17809,
              6018,
              17810,
              6017,
              17812,
              6019,
              17812,
              6018,
              17809,
              6019,
              17814,
              6017,
              17876,
              6016,
              17866,
              6014,
              17864,
              6012,
              17862,
              6012,
              17857,
              6012,
              17860,
              6013,
              17854,
              6009,
              17856,
              6012,
              17851,
              6014,
              17856,
              6014,
              17858,
              6013,
              17858,
              6011,
              17855,
              6014,
              17859,
              6011,
              17851,
              6013,
              17860,
              6014,
              17852,
              6012,
              17848,
              6009,
              17854,
              6014,
              17856,
              6013,
              17848,
              6014,
              17853,
              6012,
              17851,
              6013,
              17857,
              6011,
              17849,
              6010,
              17854,
              6010,
              17849,
              6011,
              17852,
              6011,
              17855,
              6011,
              17854,
              5983,
              17763,
              5980,
              17770,
              5979,
              17773,
              5981,
              17775,
              5982,
              17777,
              5982,
              17775,
              5979,
              17775,
              5982,
              17775,
              5981,
              17784,
              5981,
              17779,
              5985,
              17782,
              5981,
              17782,
              5984,
              17782,
              5983,
              17782,
              5980,
              17780,
              5981,
              17784,
              5981,
              17780,
              5978,
              17780,
              5982,
              17787,
              5980,
              17784,
              5980,
              17783,
              5982,
              17783,
              5982,
              17784,
              5981,
              17782,
              5981,
              17781,
              5981,
              17782,
              5981,
              17783,
              5982,
              17780,
              5979,
              17783,
              5981
            ]
          },
          {
            "time": 1547404916419,
            "data_raw": [

            ]
          },
          {
            "time": 1547404916425,
            "skipped": 4
          },
          {
            "time": 1547404916425,
            "label": "act",
            "data_raw": [
              17769,
              5981,
              17768,
              5978,
              17766,
              5977,
              17766,
              5977,
              17766,
              5976,
              17770,
              5978,
              17769,
              5976,
              17769,
              5977,
              17766,
              5977,
              17766,
              5979,
              17767,
              5980,
              17768,
              5979,
              17769,
              5980,
              17767,
              5978,
              17765,
              5979,
              17770,
              5981,
              17770,
              5977,
              17765,
              5978,
              17767,
              5980,
              17767,
              5976,
              17769,
              5978,
              17770,
              5976,
              17767,
              5979,
              17766,
              5979,
              17769,
              5978,
              17772,
              5977,
              17767,
              5977,
              17769,
              5977,
              17774,
              5980,
              17774,
              5979,
              17819,
              6056,
              17818,
              6055,
              17824,
              6056,
              17819,
              6054,
              17818,
              6056,
              17818,
              6053,
              17821,
              6054,
              17819,
              6055,
              17821,
              6053,
              17817,
              6055,
              17817,
              6057,
              17822,
              6054,
              17816,
              6056,
              17822,
              6054,
              17823,
              6053,
              17819,
              6055,
              17820,
              6054,
              17822,
              6055,
              17819,
              6055,
              17819,
              6054,
              17824,
              6054,
              17817,
              6053,
              17824,
              6054,
              17823,
              6055,
              17823,
              6054,
              17822,
              6052,
              17818,
              6055,
              17820,
              6053,
              17827,
              6053,
              17823,
              6055,
              17819,
              6045,
              17892,
              6041,
              17879,
              6043,
              17872,
              6041,
              17869,
              6038,
              17880,
              6040,
              17873,
              6038,
              17869,
              6039,
              17872,
              6040,
              17869,
              6039,
              17872,
              6037,
              17873,
              6038,
              17870,
              6038,
              17872,
              6039,
              17867,
              6038,
              17874,
              6040,
              17874,
              6040,
              17870,
              6038,
              17871,
              6040,
              17865,
              6039,
              17859,
              6038,
              17865,
              6039,
              17867,
              6037,
              17868,
              6040,
              17865,
              6037,
              17871,
              6039,
              17863,
              6035,
              17864,
              6038,
              17867,
              6039,
              17864,
              6038,
              17865,
              5974,
              17738,
              5974,
              17749,
              5974,
              17753,
              5974,
              17756,
              5972,
              17757,
              5974,
              17754,
              5974,
              17765,
              5974,
              17763,
              5974,
              17761,
              5974,
              17761,
              5974,
              17760,
              5974,
              17755,
              5975,
              17762,
              5974,
              17759,
              5975,
              17765,
              5975,
              17763,
              5974,
              17760,
              5975,
              17759,
              5975,
              17758,
              5974,
              17759,
              5977,
              17764,
              5975,
              17765,
              5977,
              17765,
              5977,
              17765,
              5975,
              17768,
              5974,
              17767,
              5976,
              17765,
              5974,
              17766,
              5977,
              17762,
              5975
            ]
          },
          {
            "time": 1547404923388,
            "data_raw": [

            ]
          }
        ],
        "data_raw": [

        ]
      }
    ]
  ],
  "app_os": "macOS 18.0.0",
  "app_name": "PhotosynQ",
  "app_version": "1.0.4",
  "app_device": "x64",
  "location": false,
  "time_offset": "America/Detroit"
}
Dave in cap img 4615
Created by

David M. Kramer


Protocol connections:
3
Latest Update:
Jan 2019