File MIES_TestPulse.ipf¶
TP Basic Testpulse related functionality
Functions
-
variable TP_IsValidBaselineFraction(variable value)¶
Check if the value is a valid baseline fraction.
Comment in for debugging of TP_TSAnalysis
For visualising the evaluation ranges from the returned DFREF:
Duplicate/O dfr:data, root:data Duplicate/O dfr:colors, root:colors ModifyGraph zColor(data)={colors,*,*,Rainbow,1}
-
static variable TP_CalculateTestPulseLength(variable pulseDuration, variable baselineFrac)¶
Return the total length of a single testpulse with baseline.
Static on purpose as all users during DAQ/TP should prefer GetTPSettingsCalculated()
- Parameters:
pulseDuration – duration of the high portion of the testpulse in points or time
baselineFrac – fraction, not percentage, of the baseline
-
variable TP_CalculateBaselineFraction(variable pulseDuration, variable totalLength)¶
Inverse function of TP_CalculateTestPulseLength.
Can be used when reconstructing the baseline fraction from epoch information.
-
variable TP_StoreTP(string device, wave TPWave, variable tpMarker, string hsList)¶
Stores the given TP wave.
The stored test pulse waves will have column dimension labels in the format
HS_X
.- Parameters:
device – device
TPWave – reference to wave holding the TP data, see GetOscilloscopeWave()
tpMarker – unique number for this set of TPs from all TP channels
hsList – list of headstage numbers in the same order as the columns of TPWave
-
wave TP_GetStoredTPs(string device, variable tpMarker, variable number)¶
Return a number of consecutive test pulses ending with the TP identified by tpMarker.
The wave reference wave will have as many columns as active headstages were used.
-
variable TP_SplitStoredTestPulseWave(string device)¶
Split the stored testpulse wave reference wave into single waves for easier handling.
-
variable TP_ROAnalysis(ASYNC_ReadOutStruct *ar)¶
Receives data from the async function TP_TSAnalysis(), buffers partial results and puts complete results back to main thread, results are base line level, steady state resistance, instantaneous resistance and their positions collected results for all channels of a measurement are send to TP_RecordTP(), DQ_ApplyAutoBias() when complete.
- Parameters:
ar – ASYNC_ReadOutStruct structure with dfr with input data
-
static wave TP_CreateOverrideResults(string device, variable type)¶
-
static wave TP_GetTPWaveForAutoTP(string device, variable marker)¶
Return a 2D wave with two testpulses concatenated.
Rows:
TPs
Columns:
Active headstages
-
static variable TP_AutoBaseline(string device, variable headstage, wave TPResults, wave TPs)¶
-
static std::tuple<variable, variable, variable> TP_AutoFitBaseline(wave data, variable pulseLengthMS)¶
Fit the tail of the first TP with an expontential and return it’s time constant.
/// /// +----+ +----+ /// | | | | /// | | | | /// | | | | /// | | | | /// ----+ +--------+ +---- /// /// <--------> /// Fitting range /// /// <------------> /// One TP /// /// <----> /// Pulse /// ///
@param data input data @param pulseLengthMS length of the pulse (high part) of the testpulse [ms] @retval result One of @ref TPBaselineFitResults @retval tau time constant of the decay [ms] @retval baseline baseline length of one pulse (same as the fitting range) [ms]
-
static variable TP_AutoAmplitudeAndBaseline(string device, wave TPResults, variable marker)¶
Automatically tune the Testpulse amplitude and baseline.
Decision logic flowchart:
-
variable TP_AutoTPActive(string device)¶
-
static variable TP_AutoTPTurnOff(string device, wave autoTPEnable, variable headstage, variable QC)¶
-
static variable TP_AutoDisableIfFinished(string device, wave TPStorage)¶
Disable Auto TP if it passed
TP_AUTO_TP_CONSECUTIVE_PASSES
times in a row.
-
variable TP_AutoTPGenerateNewCycleID(string device, variable headstage = defaultValue, variable first = defaultValue, variable last = defaultValue)¶
Generate new auto TP cycle IDs.
This is required everytime we lock a device or toggle Auto TP for a headstage
- Parameters:
device – device
headstage – [optional, default to all headstages] only update it for a specific headstage
first – [optional, default to all headstages] only update the range [first, last]
last – [optional, default to all headstages] only update the range [first, last]
-
wave TP_GetValuesFromTPStorage(wave TPStorage, variable headstage, string entry, variable numReqEntries, variable options = defaultValue)¶
Return the last
numReqEntries
non-NaN values from layerentry
ofheadstage
- Parameters:
TPStorage – TP results wave, see GetTPStorage()
headstage – Headstage
entry – Name of the value to search
numReqEntries – Number of entries to return, supports integer values and inf
options – [optional, default to nothing] One of TPStorageQueryingOptions
-
dfref TP_TSAnalysis(dfref dfrInp)¶
This function analyses a TP data set. It is called by the ASYNC frame work in an own thread. currently six properties are determined.
- Parameters:
dfrInp – input data folder from the ASYNC framework, parameter input order therein follows the setup in TP_SendToAnalysis()
-
static variable TP_CalculateAverage(wave TPResultsBuffer, wave TPResults)¶
Calculates running average [box average] for all entries and all headstages.
-
static variable TP_RecordTP(string device, wave TPResults, variable now, variable tpMarker)¶
Records values from TPResults into TPStorage at defined intervals.
Used for analysis of TP over time.
-
static variable TP_FitResistance(wave TPStorage, variable startRow, variable endRow, variable headstage)¶
Threadsafe wrapper for performing CurveFits on the TPStorage wave.
-
static variable TP_AnalyzeTP(string device, WaveOrNull TPStorage, variable endRow)¶
Determine the slope of the steady state resistance over a user defined window (in seconds)
- Parameters:
device – locked device string
TPStorage – test pulse storage wave
endRow – last valid row index in TPStorage
-
variable TP_StopTestPulseOnAllDevices()¶
Stop running background testpulse on all locked devices.
-
variable TP_StopTestPulseFast(string device)¶
See also
-
variable TP_StopTestPulse(string device)¶
See also
-
static variable TP_StopTestPulseWrapper(string device, variable fast = defaultValue)¶
Stop any running background test pulses.
- Parameters:
device – device
fast – [optional, defaults to false] Performs only the totally necessary steps for tear down.
- Returns:
One of TestPulseRunModes
-
variable TP_RestartTestPulse(string device, variable testPulseMode, variable fast = defaultValue)¶
Restarts a test pulse previously stopped with TP_StopTestPulse.
-
variable TP_Setup(string device, variable runMode, variable fast = defaultValue)¶
Prepare device for TestPulse.
- Parameters:
device – device
runMode – Testpulse running mode, one of TestPulseRunModes
fast – [optional, defaults to false] Performs only the totally necessary steps for setup
-
variable TP_SetupCommon(string device)¶
Common setup calls for TP and TP during DAQ.
-
variable TP_Teardown(string device, variable fast = defaultValue)¶
Perform common actions after the testpulse.
-
variable TP_TeardownCommon(string device)¶
Common teardown calls for TP and TP during DAQ.
-
variable TP_GetNumDevicesWithTPRunning()¶
Return the number of devices which have TP running.
-
variable TP_CheckIfTestpulseIsRunning(string device)¶
Check if the testpulse is running.
Can not be used to check for foreground TP as during foreground TP/DAQ nothing else runs.
-
variable TP_TestPulseHasCycled(string device, variable cycles)¶
See if the testpulse has run enough times to create valid measurements.
- Parameters:
device – DA_Ephys panel name
cycles – number of cycles that test pulse must run
-
variable TP_UpdateHoldCmdInTPStorage(string device, variable headStage)¶
Save the amplifier holding command in the TPStorage wave.
-
variable TP_CreateTestPulseWave(string device, variable dataAcqOrTP)¶
Create the testpulse wave with the current settings.
-
variable TP_CreateTestPulseWaveImpl(wave tp, variable totalLength, variable pulseStart, variable pulseLength)¶
device independent test pulse wave creation
-
std::tuple<variable, variable, variable> TP_GetCreationPropertiesInPoints(wave TPSettingsCalc, variable dataAcqOrTP)¶
-
dfref TP_PrepareAnalysisDF(string device, TPAnalysisInput *tpInput)¶
Prepares a TP data set data folder to the asynchroneous analysis function TP_TSAnalysis.
- Parameters:
device – [in] title of panel that ran this test pulse
tpInput – holds the parameters send to analysis
- Returns:
data folder that can be pushed for execution by the async frame work
-
variable TP_SendToAnalysis(string device, TPAnalysisInput *tpInput)¶
Send a TP data set to the asynchroneous analysis function TP_TSAnalysis.
- Parameters:
device – [in] title of panel that ran this test pulse
tpInput – holds the parameters send to analysis
-
variable TP_UpdateTPSettingsCalculated(string device)¶
-
variable TP_UpdateTPSettingsCalculatedImpl(wave TPSettings, wave samplingIntervals, wave tpCalculated)¶
Device and globals independent calculcation of TPSettingsCalculated.
-
string TP_AutoTPLabelToLabnotebookName(string lbl)¶
Convert from row names of GetTPSettings()/GetTPSettingsCalculated() to GetTPSettingsLBN() column names.
-
variable TP_UpdateTPLBNSettings(string device)¶
Update the Testpulse labnotebook wave.
DAQ:
TPSettings holds the current GUI values
TPSettingsLabnotebook holds the settings which were active when the sweep started
TP:
TPSettings holds the current GUI values
TPSettingsLabnotebook is cleared when TP is started and filled from TPSettings when TP is stopped This means we only have the latest values for the TP settings which don’t restart TP. For entries which do restart TP we always have the current values. See also the DAEPHYS_TP_CONTROLS_XXX constants.
See also
DAP_TPGUISettingToWave() for the special auto TP entry handling.
-
static variable TP_GetTPCycleID(string device)¶
Return the TP cycle ID for the given device.
-
variable TP_GetPowerSpectrumLength(variable tpLength)¶
Return the length in points of the power spectrum generated via FFT.
Variables
-
static const double TP_MAX_VALID_RESISTANCE = 3000¶
Units MΩ
-
static const double TP_TPSTORAGE_EVAL_INTERVAL = 0.18¶
-
static const double TP_FIT_POINTS = 5¶
-
static const double TP_PRESSURE_INTERVAL = 0.090¶
[s]
-
static const double TP_EVAL_POINT_OFFSET = 5¶
-
static const double TP_BASELINE_FITTING_INSET = 0.3¶
-
static const double TP_SET_PRECISION = 2¶