Skip to content

proper way to sample at high speeds #16

@asafosci

Description

@asafosci

Suppose i want to sample at high rates ~1000 Hz and get a time series like array of [timestamp, measurement value] ? what is the proper way? Currently I'm using the following mechanism expanding on example.py:

while True:
raw_channels = ads.read_continue(CH_SEQUENCE)
data = [int(i*1000 * ads.v_per_digit) for i in raw_channels]
cur_time = datetime.utcnow()
...
and then i store the pair of cur_time, data in an array.

Unfortunately , this does not seem like a good method. there are fluctuations in the cur_time and samples are not evenly spaced. in addition, every additional code in the loop like, data checking, signalling to other threads to save the data etc, may cause loss of points or further inaccuracy in tiume measurements.

Is there a better way ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions