Add Measurements to python?

Post general discussions on using our drivers to write your own software here
Post Reply
strangequark
User
User
Posts: 2
Joined: Tue Mar 05, 2019 2:48 pm

Add Measurements to python?

Post by strangequark »

I am trying to set up a way to measure and get the pulse width values in python. In the Picoscope software, this would be done by adding a measurement, but how is this done with programming languages?

I've been trying to decode the pico.measurements.dll file to see the source code as a means of using that to call the functions necessary in python, but it is written in Assembly and doesn't not translate fully when I try to decode into utf-8/text.

Is there a way I can have the source code for the .dll extension translated into text so I can read the commands? I do not see this option in the manual.

Martyn
Site Admin
Site Admin
Posts: 4491
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Add Measurements to python?

Post by Martyn »

We can't release any of our PicoScope code, however you should be able to code this easily. Look for max and min values in a buffer and then search for midpoint crossings and count the samples between them.
Martyn
Technical Support Manager

strangequark
User
User
Posts: 2
Joined: Tue Mar 05, 2019 2:48 pm

Re: Add Measurements to python?

Post by strangequark »

Thank you, I will try that!

strangequark
User
User
Posts: 2
Joined: Tue Mar 05, 2019 2:48 pm

Re: Add Measurements to python?

Post by strangequark »

Pardon, but I am honestly not sure where to start here... what values exactly am I getting from the buffer for the max and min? I can't find any examples of this ... this all seems very vague

strangequark
User
User
Posts: 2
Joined: Tue Mar 05, 2019 2:48 pm

Re: Add Measurements to python?

Post by strangequark »

Is no one going to answer or?

Martyn
Site Admin
Site Admin
Posts: 4491
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Add Measurements to python?

Post by Martyn »

The values you get in the buffers will be ADC counts, unless you have selected downsampling you only need to consider the Max buffer as this will contain all the sample points that make up your signal. If you parse through this firstly to find the maximum and minimum ADC counts, and then re-parse to find the points at which the trace crosses the mid point values you should be able to work out the number of samples per half cycle of the waveform. Number of samples multiplied by the sample interval will give the pulse width.

If you post your code trying to do this we can advise if it is correct.
Martyn
Technical Support Manager

Post Reply