This article applies to:
E-Prime Go 1.0
Detail
To verify timing of the participant's machine, please insert an InLine Object at the beginning of SessionProc with the following script.
Sleep
50
'nTestDuration controls how long to run the test
Const
nTestDuration As Long = 2000Const
cMAXBINS As Long = 100
Dim
StartTime As Long
'log the current time
StartTime = Clock.Read
' Declare and initialize counter array
Dim
i As LongDim
nBinCnt(cMAXBINS) As LongFor
i = 0 To cMAXBINSnBinCnt(i) =
0Next
i
Dim
nThisTime As LongDim
nLastTime As LongDim
nEndTime As LongDim
nDiff As LongDim
nStartMicro As LongDim
nStopMicro As Long
Dim
nAnalysisStartTime As LongDim
nAnalysisStopTime As Long
Dim
nTotalSamples As LongDim
nBinSumError As LongDim
nBinSumErrorLarge As LongDim
nMaxBin As LongDim
nErrorSamples As Long
' Error Handler
On
Error GoTo BinError
' Loop until we get a transition
' to allow us to start the test
' as close to transition as possible
nThisTime = Clock.Read
Do
While nThisTime = Clock.Read ' DO NOTHINGLoop
nLastTime = nThisTime +
1nEndTime = nLastTime +
nTestDuration
nStartMicro = Clock.ReadMicrosec
Do
' Read the clocknThisTime = Clock.Read
' Determine the timing error on this read (if any).nDiff = nThisTime - nLastTime
' Update the count for this bin ' NOTE: If the diff is < 0 or > cMAXBINS then ' a runtime error will occur and will be trapped belownBinCnt(nDiff) = nBinCnt(nDiff) +
1 ' Update for next iterationnLastTime = nThisTime
Loop
While nThisTime < nEndTime
nStopMicro = Clock.ReadMicrosec
nAnalysisStartTime = Clock.Read
' Log results
For
i = 0 To cMAXBINSnTotalSamples = nTotalSamples + nBinCnt(i)
If i > 1 ThennErrorSamples = nErrorSamples + nBinCnt(i)
nBinSumError = nBinSumError + (nBinCnt(i) * (i -
1)) If nBinCnt(i) > 0 Then nMaxBin = i If i > 11 Then nBinSumErrorLarge = nBinSumErrorLarge + (nBinCnt(i) * (i - 1)) End IfNext
i
c.SetAttrib
"StartMicro", nStartMicroc.SetAttrib
"StopMicro", nStopMicroc.SetAttrib
"TotalSamples", nTotalSamplesc.SetAttrib
"ValidClock", nBinCnt(1)c.SetAttrib
"ValidClockPercent", Format(CDbl(nBinCnt(1)) / CDbl(nTestDuration), "0.0000%")c.SetAttrib
"ValidSamples", nBinCnt(0) + nBinCnt(1)c.SetAttrib
"ValidSamplesPercent", Format(CDbl(nBinCnt(0) + nBinCnt(1)) / CDbl(nTotalSamples), "0.0000%")c.SetAttrib
"ErrorSamples", nErrorSamplesc.SetAttrib
"ErrorSamplesPercent", Format(CDbl(nErrorSamples) / CDbl(nTotalSamples), "0.0000%")c.SetAttrib
"SampleRate", Format(CDbl(nTotalSamples) / CDbl(nTestDuration), "0.0000")c.SetAttrib
"BinNSumError", nBinSumErrorc.SetAttrib
"BinNSumErrorPercent", Format(CDbl(nBinSumError) / CDbl(nTestDuration), "0.0000%")c.SetAttrib
"BinNSumErrorLarge", nBinSumErrorLargec.SetAttrib
"BinNSumErrorLargePercent", Format(CDbl(nBinSumErrorLarge) / CDbl(nTestDuration), "0.0000%")c.SetAttrib
"MaxBin", nMaxBinnAnalysisStopTime = Clock.Read
'Flag if data needs reviewed
Dim
bNeedReview As BooleanbNeedReview =
FalseIf
nMaxBin > 10 Then bNeedReview = TrueIf
(CDbl(nBinCnt(1)) / CDbl(nTestDuration)) < 0.99 ThenbNeedReview =
TrueEnd
IfIf
(CDbl(nBinSumErrorLarge) / CDbl(nTestDuration)) > 0.01 ThenbNeedReview =
TrueEnd
IfIf
(CDbl(nBinSumError) / CDbl(nTestDuration)) > 0.01 ThenbNeedReview =
TrueEnd
IfIf
(CDbl(nTotalSamples) / CDbl(nTestDuration)) < 4 ThenbNeedReview =
TrueEnd
Ifc.SetAttrib
"ReviewStatus", IIf(bNeedReview, "Needs Review", "OK")
GoTo
BinTestComplete
BinError:
c.SetAttrib
"ERROR", "Error happened in bin test and the diff was " & nDiffc.SetAttrib
"ReviewStatus", "FAIL"
Resume
BinTestComplete
BinTestComplete:
The script runs a test for 2 seconds to see if a machine meets our requirements. A quick way to verify if the data is good is to review the ReviewStatus column in the resulting .edat3 file. If the column states "OK", the machine meets our requirements. If it states "Needs Review", you need to examine the data more in depth to see if the data can be used. Review the following if Needs Review is found:
- SampleRate - If it is less than 4, the machine fails and the data should not be used. If greater than 4, continue to the next step.
- BinNSumErrorLargePercent - Note the percentage value in the data file. This is the percentage of error above 11ms. If this is above 0.01%, we do not recommend using the data.
NOTE: It is up to the researcher to determine how much error is inconsequential.
If the ReviewStatus column states "FAIL", a bin error greater than 100ms occurred. The amount of error for the failed bin can be found under the ERROR column. We do not recommend using the data.
See Also:
Comments
0 comments
Please sign in to leave a comment.