{ A Script measuring a very long lifetime
  of Frequenzy of 10 Hz is still too fast, and one needs
  a decay longer than 1 s.
  
  it fires a laser burst and then does a TimeTrace measurement
  afterwards.
}
def
  c: Curve;
  LengthOfLaserBurst: Float;
  IntegrationTime: Float;
  LengthOfMeasurement: Float;
  NumPoints: Int;
exec
  //########### User Variables to Set for the measurement
  Sample = "SampleName";
  Solvent = "Water";
  Comment = "a very long lifetime measurement";
  LengthOfLaserBurst = 1.0; // how long is the laser on before the measurement, in s
  IntegrationTime = 0.1; // per point (like TCSPC resolution, in s) must be >=0.1s
  LengthOfMeasurement = 30; // length of the measurement (like Sync Length, in s)
  //########### End User Variables

  DeleteAllCurves;
  LIGHTSOURCE_1.Intensity = 0;            // turn laser off
  LIGHTSOURCE_1.Mode = 1;                 // switch to CW
  LIGHTSOURCE_1.RepRate = 40.000*1.0E+6;  // reprate for the TCSPC intensity measurement
  // turn laser on as a Burst for the given time
  LIGHTSOURCE_1.Intensity = 10;
  Delay(LengthOfLaserBurst);
  LIGHTSOURCE_1.Intensity = 0;
  //
  // do the actual measurement for 30 seconds, 300 points = 100 ms per point
  NumPoints = LengthOfMeasurement / IntegrationTime;
  TimeScan(LengthOfMeasurement, NumPoints);
  // store as decay
  c = crv[0];
  DeleteAllCurves;
  StoreAsDecay(c);
  SaveToWorkspace("VeryLongLifetime");

end.