AnalogSpan
A contiguous span of analog sample data.
Provides indexed and iterated access to voltage samples, along with search methods for finding samples that meet threshold criteria and statistical properties.
AnalogSpan cannot be constructed from Python — instances are provided
by the runtime when processing captured data.
Supports integer indexing, slicing, iteration, and len().
# Iterate over all samples
for voltage in data:
process(voltage)
# Index and slice
first = data[0]
subset = data[100:200]
# Search
idx = data.find_gt(1.5)
Attributes
| Name | Type | Description |
|---|---|---|
min | float | The minimum voltage value in this span. |
max | float | The maximum voltage value in this span. |
acquisition_info | AcquisitionInfo | Information about the underlying data acquisition limits. |
Methods
time_interval() -> SaleaeTimeInterval
Return the time interval covered by this span.
sample_index_to_time(index: int) -> SaleaeTime
Convert a sample index to a SaleaeTime.
index- The sample index to convert.
- Returns
- The time corresponding to that sample.
time_to_sample_index_floor(time: SaleaeTime) -> int
Convert a time to the nearest sample index, rounding down.
Clamps to valid range: returns 0 if before the first sample, or the last index if after the last sample.
time- The time to convert.
- Returns
- The sample index at or before the given time.
time_to_sample_index_ceil(time: SaleaeTime) -> int
Convert a time to the nearest sample index, rounding up.
Clamps to valid range: returns 0 if before the first sample, or the last index if after the last sample.
time- The time to convert.
- Returns
- The sample index at or after the given time.
Find the first sample greater than value, searching forward.
value- The threshold voltage to compare against.
start- Start of search range (inclusive). Defaults to 0.
end- End of search range (exclusive). Defaults to end of data.
- Returns
- Sample index, or
Noneif not found.
Find the first sample greater than or equal to value, searching forward.
value- The threshold voltage to compare against.
start- Start of search range (inclusive). Defaults to 0.
end- End of search range (exclusive). Defaults to end of data.
- Returns
- Sample index, or
Noneif not found.
Find the first sample less than value, searching forward.
value- The threshold voltage to compare against.
start- Start of search range (inclusive). Defaults to 0.
end- End of search range (exclusive). Defaults to end of data.
- Returns
- Sample index, or
Noneif not found.
Find the first sample less than or equal to value, searching forward.
value- The threshold voltage to compare against.
start- Start of search range (inclusive). Defaults to 0.
end- End of search range (exclusive). Defaults to end of data.
- Returns
- Sample index, or
Noneif not found.
Find the first sample greater than value, searching backward.
value- The threshold voltage to compare against.
start- Start of search range (inclusive). Defaults to 0.
end- End of search range (exclusive). Defaults to end of data.
- Returns
- Sample index, or
Noneif not found.
Find the first sample greater than or equal to value, searching backward.
value- The threshold voltage to compare against.
start- Start of search range (inclusive). Defaults to 0.
end- End of search range (exclusive). Defaults to end of data.
- Returns
- Sample index, or
Noneif not found.
Find the first sample less than value, searching backward.
value- The threshold voltage to compare against.
start- Start of search range (inclusive). Defaults to 0.
end- End of search range (exclusive). Defaults to end of data.
- Returns
- Sample index, or
Noneif not found.
Find the first sample less than or equal to value, searching backward.
value- The threshold voltage to compare against.
start- Start of search range (inclusive). Defaults to 0.
end- End of search range (exclusive). Defaults to end of data.
- Returns
- Sample index, or
Noneif not found.
histogram() -> Tuple[np.ndarray, np.ndarray]
Generate a histogram of sample values.
Returns a tuple of (counts, bin_edges) where counts has one entry per ADC code and bin_edges contains the voltage value at each bin edge.
- Returns
- A
(counts, edges)tuple of numpy arrays.
raw_chunks() -> Iterator[AnalogData]
Iterate over the underlying raw AnalogData chunks.
This is targeted at power users who need direct access to the raw sample buffers. Because sample data is stored in separate buffers, the chunks may be non-uniform in size.
- Returns
- An iterator of
AnalogDataobjects.