Time Weighted Step Mean
Integrate previous-sample hold over the observed time domain and divide by duration; not an arithmetic sample mean.
Description
Integrate previous-sample hold over the observed time domain and divide by duration; not an arithmetic sample mean.
A time-weighted step mean accounts for unequal observation spacing. Each earlier observation contributes for the duration until the next timestamp.
When to use this tool
Integrate previous-sample hold over the observed time domain and divide by duration; not an arithmetic sample mean.
- Prepare the supplied times, values fields for this operation.
- Compare the complete example with the representation used by your own input before carrying the result into another step.
How to use the tool and how it works
- Enter times, values. Use the exact text syntax, units and index conventions explained below.
- Run the tool. If input validation fails, correct the supplied fields before interpreting any result.
- Read result.integral, result.duration, result.mean. Interpret false, null and empty lists using the distinctions below; they can be valid outputs.
Require aligned values and strictly increasing times with at least two samples. Sum value[j] times (time[j+1]-time[j]), return the integral and total span, and divide to obtain the weighted mean.1
| Input field | Meaning and representation | Accepted input |
|---|---|---|
| times | times. | List of finite numbers; bounded by the operation |
| values | values. | List of finite numbers; bounded by the operation |
| Output field | Interpretation |
|---|---|
| result | Object containing the named outputs below. |
| result.integral | The integral value under the stated formula or text convention. |
| result.duration | The duration value under the stated formula or text convention. |
| result.mean | The mean value under the stated formula or text convention. |
{
"input": {
"times": [
0,
1,
3
],
"values": [
2,
4,
99
]
},
"output": {
"result": {
"integral": 10,
"duration": 3,
"mean": 3.3333333333333335
}
}
} Limitations and assumptions
- The final value has no following duration. This is an earlier-sample hold model, not trapezoidal interpolation or an ordinary arithmetic mean; use consistent units.
- Every declared top-level field is required and unexpected fields are rejected. Numeric inputs must be finite; ordinary text fields are bounded to 8,192 UTF-16 code units, with tighter operation-specific limits where stated.
- Ordinary string lists have at most 128 entries of at most 128 code units each; numeric lists and matrices have separate bounded size checks. Nonfinite results and excessively large serialized outputs are rejected.
- Indexes are zero-based and spans have an exclusive end unless explicitly stated otherwise. A valid false, null or empty-list result is distinct from malformed input.
Alternative or Complementary methods
Choose a sampling model before combining results. Earlier-sample hold, linear interpolation and index-only differences answer different questions; event cooldown, debounce and rolling limits also use different acceptance rules.
References
Similar or alternative tools
- Threshold Time Occupancy
Measure threshold occupancy over the observed time domain under previous-sample hold; the last sample has zero following duration.
- Two Point Threshold Time
Resolve the threshold time on one linear segment; retain flat threshold plateaus and out-of-range thresholds as distinct conditions.