Description
Convert a supplied EEG pre-trigger duration to a rounded sample count.
Neurological signal records distinguish event markers, sampling rate, polarity, reference amplitude and physical units. A pre-trigger duration may not equal a whole sample count, so the rounding policy changes the represented interval. Scalar subtraction and timestamp arithmetic do not detect an event, validate a recording or establish a diagnosis.
Convert a supplied EEG pre-trigger duration to a rounded sample count.
When to use this tool
Use EEG Epoch Pre Trigger Samples when you already have pretriggerMilliseconds, sampleRateHz, rounding and need to convert a supplied EEG pre-trigger duration to a rounded sample count.
How to use the tool and how it works
- Enter pretriggerMilliseconds, sampleRateHz, rounding. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read rawSamples, samples, durationMilliseconds. Use the output convention below.
Require duration>=0, sampleRateHz>0 and rounding floor, ceil or nearest. rawSamples=milliseconds*Hz/1000; apply the selected integer rounding and return the count's realized duration as 1000*samples/Hz.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| pretriggerMilliseconds | Pretrigger Milliseconds | Required. Finite number; minimum 0. |
| sampleRateHz | Sample Rate Hz | Required. Finite number; strictly above 0. |
| rounding | floor, ceil or nearest; nearest uses Math.round and rounds nonnegative half ties upward. | Required. Text; one of "floor", "ceil", "nearest"; maximum UTF-16 length 8192. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| rawSamples | pretriggerMilliseconds*sampleRateHz/1000 before rounding. | Required. Finite number. |
| samples | Samples | Required. Safe integer. |
| durationMilliseconds | Duration Milliseconds | Required. Finite number. |
{
"input": {
"pretriggerMilliseconds": 125,
"sampleRateHz": 100,
"rounding": "nearest"
},
"output": {
"rawSamples": 12.5,
"samples": 13,
"durationMilliseconds": 130
}
} Limitations and assumptions
- Nearest uses Math.round with nonnegative midpoint ties upward. Unsafe sample counts are rejected; timing accuracy, acquisition feasibility and EEG validity are not established.
- Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
- Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.
Alternative or Complementary methods
Review the original signal, acquisition settings and annotation method when interpreting a recording. Use actual timestamps for variable timing and the complete reference/montage definition for signal analysis; preserve the local unit and rounding conventions.
References
Similar or alternative tools
- EEG Reference Scalar Subtraction
Subtract a supplied reference signal from one EEG channel value.
- EEG Electrode Impedance Unit
Convert a supplied electrode impedance between ohms and kiloohms.