low_time
Builtin index · Signal processing
result = high_time(d, [hysteresis=0])
Input: d, hysteresis · Output: result
What it is
d: a Digital value.
Overloads
One call shape — this function is not overloaded.
| Code | Input | Output | Description |
result = high_time(d, [hysteresis=0]) | d —d: a Digital value.hysteresis optional (default 0)not documented yet | pulse_width —a mean, which errors with zero complete pulses | Returns a single number: the sum of the widths of every complete pulse above (high_time) or below (low_time) the threshold, in seconds for a Signal and samples otherwise. Unlike pulse_width (a mean, which errors with zero complete pulses), this is a sum, so a record with no complete pulse of that polarity returns 0.0 rather than erroring — there is a defined answer ("no time observed"), it's just zero. Deliberately not duty_cycle(d) * record_length, which would assume a clean periodic waveform the input isn't obligated to have. |
Examples
No documentation example calls this form yet. The Signal processing chapter is where one belongs.
How it works
high_time(d)/low_time(d) -- total time the digitized signal spent above/below its threshold, in seconds for a Signal and samples otherwise. Summed from the actual complete pulses (find_pulses), not duty_cycle(d) * record_length -- that would assume a clean periodic waveform, which a real captured signal is not obligated to be. A record with zero complete pulses of the requested polarity reports 0.0 (genuinely no time observed spent that way, inside a complete pulse), not an error -- unlike pulse_width, which errors on the same input because a mean over zero pulses has no defined value, high_time/ low_time are a SUM, and the sum over zero pulses is 0.
From the note above this builtin in the interpreter, where the reasoning was written down as it was built.
See also
high_time — documented in the same entry.