Skip to content

Main content

EEG Epoch Pre Trigger Samples

Convert a supplied EEG pretrigger duration to a sample count under an explicit rounding convention.

Loading tool…

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

  1. Enter pretriggerMilliseconds, sampleRateHz, rounding. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. 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 fieldMeaning and unitsAccepted input
pretriggerMillisecondsPretrigger MillisecondsRequired. Finite number; minimum 0.
sampleRateHzSample Rate HzRequired. Finite number; strictly above 0.
roundingfloor, 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 fieldInterpretationReturned shape
rawSamplespretriggerMilliseconds*sampleRateHz/1000 before rounding.Required. Finite number.
samplesSamplesRequired. Safe integer.
durationMillisecondsDuration MillisecondsRequired. Finite number.
json
{
  "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

  1. Calculation and input contract: neurology/eeg-epoch-pre-trigger-samples — tool.io

Similar or alternative tools