VernierST / godirect-py

A Python module for reading from Vernier Go Direct® Sensors using USB or BLE.
GNU General Public License v3.0
8 stars 9 forks source link

Setting sample rate on GoDirect EKG #24

Closed sidneycadot closed 2 years ago

sidneycadot commented 2 years ago

Hello,

We recently purchased a GoDirect EKG to do EKG acquisition from Python. We found that the "godirect" package is very well done (thanks for that!).

Using the provided GUI (Graphical Analyst 4) it appears possible to change the sample rate for EKG acquisition. By default, the sensor acquires 100 samples/sec. My question is, how can we do the same from Python?

I did not find mention of this feature in the godirect source, the godirect-examples, or anywhere else. I could have missed it. If not, it may be useful to document this feature (if it is supported from Python).

sidneycadot commented 2 years ago

Okay I figured out that this is what the 'period' parameter to device.start() does, giving the sample interval in milliseconds.

From Python I can go up to 200 samples per second (5 ms interval) but above that things get dicy. Now I am curious why that is.

dvernier commented 2 years ago

Hello,

I am glad you are using our Python code.

I think the best way to answer your last question is that Graphical Analysis is being written by a team of professional software developers who use an enormous collection of code. What you are using is some simple subset that we offer to do basic data collection simply. Sampling a couple hundred times a second is about all I would expect.

Dave David L. Vernier Founder and Co-President Vernier Software & Technology 13979 SW Millikan Way Beaverton, OR 97005 503-277-2299 1-888-Vernier (1-888-837-6437) @.*** www.vernier.com

On Fri, Aug 6, 2021 at 3:43 AM Sidney Cadot @.***> wrote:

Okay I figured out that this is what the 'period' parameter to device.start() does, giving the sample interval in milliseconds.

From Python I can go up to 200 samples per second (5 ms interval) but above that things get dicy. Now I am curious why that is.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/VernierST/godirect-py/issues/24#issuecomment-894173581, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABN5U2Q3ZMLHXWDUK3KYFDDT3O4FTANCNFSM5BVOFTCA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

sswartley commented 2 years ago

Hello,

I'm glad you were able to determine how to modify the sample period using an argument in the start function. Setting the sample period with the start function is described in the Getting Started with Go Direct Sensors and Python document.

You might also note in the section titled About the Getting Started Examples that the examples are using the gdx functions, instead of talking directly to the godirect module. This should not slow down the sampling rate, but you certainly can skip these functions to test that for yourself. Take a look at this example that communicates directly with the godirect module.

All the best,

Sam

sidneycadot commented 2 years ago

Hello, I am glad you are using our Python code. I think the best way to answer your last question is that Graphical Analysis is being written by a team of professional software developers who use an enormous collection of code. What you are using is some simple subset that we offer to do basic data collection simply.

Ok that's clear. Being a software developer myself I figure I could deal with the complexity, but I can understand that you only offer and support a simplified API given the device's target audience.

sidneycadot commented 2 years ago

I'm glad you were able to determine how to modify the sample period using an argument in the start function. Setting the sample period with the start function is described in the Getting Started with Go Direct Sensors and Python document.

Thanks for the pointer. I am perhaps a bit more experienced with software than your average user with instrument control; I tend to prefer the lowest API layer available to me, which is the GoDirect class. The gdx layer doesn't really add a lot that I need - although it is useful to look at to see how things need to be done.

Also, I appreciate that the Getting Started document; but what seems to be lacking at the moment is reference documentation of the API. Fortunately the godirect code is well-written and quite nearly self-documenting, so it is not a big deal.

sswartley commented 2 years ago

Thanks for the feedback and I'm glad that you are finding the godirect code to be well-written and readable. Let us know how it goes with your project!

Sam

sidneycadot commented 2 years ago

Closing issue - answer is clear.