lightlab.util.characterize module

Timing is pretty important. These functions monitor behavior in various ways with timing considered. Included is strobeTest which sweeps the delay between actuate and sense, and monitorVariable for drift

Summary

Functions:

monitorVariable Monitors some process over time.
strobeTest Looks at a sense variable at different delays after calling an actuate function.
sweptStrobe Takes in a NdSweeper and looks at the effect of delaying between actuation from measurement.

Reference

strobeTest(fActuate, fSense, fReset=None, nPts=10, maxDelay=1, visualize=True)[source]

Looks at a sense variable at different delays after calling an actuate function. Good for determining the time needed to wait for settling. Calls each function once per delay point to construct a picture like the strobe experiment, or a sampling scope

Parameters:
  • fActuate (function) – no arguments, no return. Called first.
  • fSense (function) – no arguments, returns a scalar or np.array. Called after a given delay
  • fReset (function) – no arguments, no return. Called after the trial unless None. Usually of the same form as fActuate
Returns:

fSense values vs. delay

Return type:

(FunctionBundle)

sweptStrobe(varSwp, resetArg, nPts=10, maxDelay=1)[source]

Takes in a NdSweeper and looks at the effect of delaying between actuation from measurement. Does the gathering.

Starts by taking start and end baselines, for ease of visualization.

Parameters:
  • varSwp (NdSweeper) – the original, with 1-d actuation, any measurements, any parsers
  • resetArg (scalar) – argument passed to varSwp’s actuate procedure to reset and equilibrate
  • nPts (int) – number of strobe points
  • maxDelay (float) – in seconds, delay of strobe. Also the time to soak on reset
Returns:

the strobe sweep, with accessible data. It can be regathered if needed.

Return type:

(NdSweeper)

Todo

It would be nice to provide timeconstant analysis, perhaps by looking at 50%, or by fitting an exponential

monitorVariable(fValue, sleepSec=0, nReps=100, plotEvery=1)[source]

Monitors some process over time. Good for observing drift.

Parameters:
  • valueFun (function) – called at each timestep with no arguments. Must return a scalar or a 1-D np.array
  • sleepSec (scalar) – time in seconds to sleep between calls