def process_data(self, data):will be called one or more times. This function takes a parameter
datawhich differs between analog and digital measurements.
process_datais called. Be sure to update the internal state of your class in such a way that this isn't a problem. For example, when computing the average analog value over a range, it would be best to hold the sum of all values passed to
process_dataand the total count of samples in data members, and only compute the average in the
datais an instance of
AnalogData, which is an
iterableclass with the properties
sample_countis a number, and is the number of analog samples in the data instance. Note - this might not be the total number of analog samples passed to your measurement, since
process_datamay be called more than once if the user selected range spans multiple chunks.
process_datafunction should not return a value. Instead, it should update the internal state of your class, such that the
measurefunction can produce your measurement's results.
dataparameter is an instance of the
DigitalData. Each iteration returns a pair of values - the current time, as a
GraphTimeclass instance, and the current bit state as a
True= signal high).
GraphTimehas one feature. One
GraphTimecan be subtracted from another to compute the difference in seconds, as a
GraphTimeDeltacan be converted to a float using
float(graph_time_delta). This allows your code to compute the time in between transitions, or the time duration between the beginning of the measurement and any transition inside of the measurement range, but it does not expose absolute timestamps.
DigitalDatacollection will first include the starting time and bit state, and then every transition that exists in the user selected range, if any. It also exposes the starting and ending time of the user-selected measurement range. Consult the API Documentation for details.
def measure(self):function will be called on your class once all data has been passed to
process_data. This will only be called once and should return a dictionary with one key for every
requested_measurementsentry that was passed into your class's constructor.