salaea.data package

class saleae.data.SaleaeTime

SaleaeTime(datetime: datetime, millisecond=0, *, microsecond=0, nanosecond=0, picosecond=0)

A high-precision wall clock time.

The primary way to use this type of value is to subtract two SaleaeTimes to produce a SaleaeTimeDelta. SaleaeTimeDeltas may be freely added and subtracted from each other, and converted to floating point seconds. They can also be added to or subtracted from SaleaeTimes to produce a suitable offset SaleaeTime.

__add__()

Add a SaleaeTimeDelta value to produce a new SaleaeTime.

__str__()

Converts SaleaeTime to an ISO 8601 string with picosecond precision.

Timezone is always UTC, using the Z suffix.

__sub__()

Subtract a SaleaeTime or SaleaeTimeDelta value.

When subtracting a SaleaeTime, produces a SaleaeTimeDelta.
When subtracing a SaleaeTimeDelta, produces a SaleaeTime.
as_datetime(self: SaleaeTime) datetime

Produces a datetime value that is as close as possible to the given value.

The produced datetime is always timezone aware an in the UTC timezone. Local time can be procured using the standard Python datetime conversion functions.

class saleae.data.SaleaeTimeDelta

SaleaeTimeDelta(second=0, millisecond=0, *, microsecond=0, nanosecond=0, picosecond=0)

A high-precision duration.

__add__()

Add a SaleaeTimeDelta value to produce a new SaleaeTimeDelta.

__eq__()

Determine if two SaleaeTimeDelta values are equal, up to a tolerance.

__float__()

Convert to a floating point number of seconds. Note that this can cause a loss of precision for values > 1ms.

__ge__()

Determine if the first SaleaeTimeDelta value is greater than or equal to the second, up to a tolerance.

__gt__()

Determine if the first SaleaeTimeDelta value is greater than the second, up to a tolerance.

__le__()

Determine if the first SaleaeTimeDelta value is less than or equal to the second, up to a tolerance.

__lt__()

Determine if the first SaleaeTimeDelta value is less than the second, up to a tolerance.

__ne__()

Determine if two SaleaeTimeDelta values are not equal, up to a tolerance.

__sub__()

Subtract a SaleaeTimeDelta value to produce a new SaleaeTimeDelta.

class saleae.data.SaleaeTimeInterval

SaleaeTimeInterval(SaleaeTime begin: SaleaeTime, SaleaeTime end: SaleaeTime)

Represents a time interval between 2 points.

__init__()

Create an interval between begin and end.

Parameters
  • begin – The beginning of the interval.

  • end – The end of the interval.

class saleae.data.analog_span.AnalogSpan

AnalogSpan() Collection of contiguous AnalogData objects

__new__(**kwargs)
acquisition_info

Return limit information about the underlying data.

find_ge(self, double value: float, *, start: Optional[int] = None, end: Optional[int] = None) Optional[int]

Greater than or equal

find_gt(self, double value: float, *, start: Optional[int] = None, end: Optional[int] = None) Optional[int]

Find and return the first sample value that is greater than value, searching forwards from the start sample index. Returns None if one cannot be found. :param value: the value to compare to :param start: the beginning of the sample index range to search (inclusive) - if omitted, this will be sample index 0 :param end: the end of the sample index range to search (exclusive) - if omitted, this will be the end of the data :return: the sample index of first sample value that is less than value

find_le(self, double value: float, *, start: Optional[int] = None, end: Optional[int] = None) Optional[int]

Less than or equal

find_lt(self, double value: float, *, start: Optional[int] = None, end: Optional[int] = None) Optional[int]

Less than

histogram(self) Tuple[np.array, np.array]

Generate a histogram and return an array with the count for each bin, and the voltage value at each bin edge.

max

Find the maximum sample value in this data set. :return: maximum sample value

min

Find the minimum sample value in this data set. :return: minimum sample value

rfind_ge(self, double value: float, *, start: Optional[int] = None, end: Optional[int] = None) Optional[int]

Greater than or equal

rfind_gt(self, double value: float, *, start: Optional[int] = None, end: Optional[int] = None) Optional[int]

Find and return the first sample value that is greater than value, searching backwards from the end sample index. Returns None if one cannot be found. :param value: the value to compare to :param start: the beginning of the sample index range to search (inclusive) - if omitted, this will be sample index 0 :param end: the end of the sample index range to search (exclusive) - if omitted, this will be the end of the data :return: the sample index of first sample value that is less than value

rfind_le(self, double value: float, *, start: Optional[int] = None, end: Optional[int] = None) Optional[int]

Less than or equal

rfind_lt(self, double value: float, *, start: Optional[int] = None, end: Optional[int] = None) Optional[int]

Less than

sample_index_to_time(self, SampleNumber index: SampleNumber)

Convert a sample index in this data set to a SaleaeTime value. :param index: sample index to convert to a time :return: the time of the sample at index

time_interval(self) SaleaeTimeInterval

Return the time interval of this span.

time_to_sample_index_ceil(self, SaleaeTime time: SaleaeTime) int

Convert a time to the nearest sample index in this data set. If time is before the first sample, 0 will be returned. If time is after the last sample, the last sample index will be returned. Rounds up to the nearest index :param time: time to convert to a sample index :return: the sample index at time time

time_to_sample_index_floor(self, SaleaeTime time: SaleaeTime)

Convert a time to the nearest sample index in this data set. If time is before the first sample, 0 will be returned. If time is after the last sample, the last sample index will be returned. Rounds down to the nearest index :param time: time to convert to a sample index :return: the sample index at time time

class saleae.data.analog_span.AnalogSampleIterator

AnalogSampleIterator() An iterator over a set of sample values

__new__(**kwargs)
class saleae.data.analog_span.AcquisitionInfo

Acquisition info

Variables
  • min_adc_code – The minimum ADC code of the underlying data.

  • max_adc_code – The maximum ADC code of the underlying data.

class saleae.data.analog_data.AnalogData
property sample_count: int

The number of samples contained in this instance.

Return type

int

property samples: numpy.ndarray

Samples after applying voltage scaling.

Return type

ndarray

slice_samples(r)

Allows creating an AnalogData from a subset of this one’s samples.

Return type

AnalogData