Sample Hold Expander

Evaluate previous-sample hold at explicit query times within the sampled domain; exact sample timestamps use their new value.

Description

Evaluate previous-sample hold at explicit query times within the sampled domain; exact sample timestamps use their new value.

A sample-hold signal retains the most recent observation until another arrives. This is useful when expanding sparse state measurements onto requested timestamps.

When to use this tool

Evaluate previous-sample hold at explicit query times within the sampled domain; exact sample timestamps use their new value.

  • Prepare the supplied times, values, queryTimes 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

  1. Enter times, values, queryTimes. Use the exact text syntax, units and index conventions explained below.
  2. Run the tool. If input validation fails, correct the supplied fields before interpreting any result.
  3. Read result.heldValues. Interpret false, null and empty lists using the distinctions below; they can be valid outputs.

Validate aligned values and strictly increasing sample times. For every query within the inclusive first-to-last sample range, choose the value at the latest timestamp no later than that query.1

Input fieldMeaning and representationAccepted input
timestimes.List of finite numbers; bounded by the operation
valuesvalues.List of finite numbers; bounded by the operation
queryTimesquery times.List of finite numbers; bounded by the operation
Output fieldInterpretation
resultObject containing the named outputs below.
result.heldValuesThe held values list in the ordering and representation described above.
json
{
  "input": {
    "times": [
      0,
      2
    ],
    "values": [
      1,
      3
    ],
    "queryTimes": [
      0,
      1,
      2
    ]
  },
  "output": {
    "result": {
      "heldValues": [
        1,
        1,
        3
      ]
    }
  }
}

Limitations and assumptions

  • Queries preserve their own input order and need not be sorted. Values are held, not interpolated; queries outside the observed time range are rejected.
  • 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

  1. Tool behavior and example: Sample Hold Expander — tool.io

Similar or alternative tools

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies