Python support for Frequency Counting + PicoScope 4225A

Post any questions related to the new PicoScope 7 software
Post Reply
river
Newbie
Posts: 0
Joined: Fri Feb 23, 2024 5:52 pm

Python support for Frequency Counting + PicoScope 4225A

Post by river »

4225A owner here. I've enjoyed learning how to use the PicoScope and I'm very happy that you all have built frequency counting into this model. I'm wondering however if there are any commands or ways for outputting frequency counting data using Python.

I haven't found anything in the picoscope-4000-series-a-api-programmers-guide or on the Pico Technology GitHub. So far I've been outputting frequency counter data as CSV because I don't have a good way of processing .mat files. It's been clunky however and I'd like to find a way to access that data using python.

bennog
Advanced User
Advanced User
Posts: 208
Joined: Mon Nov 26, 2012 9:16 am
Location: Netherlands

Re: Python support for Frequency Counting + PicoScope 4225A

Post by bennog »

Short google search gives below link.
So you can process the data in the file.

https://stackoverflow.com/questions/874 ... -in-python

P.S. the counting of frequency should be done in python on the data read from the mat file.
so the number of rising / faling edges over the sample timestamps from the mat file.

Benno

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

Re: Python support for Frequency Counting + PicoScope 4225A

Post by Martyn »

There is a function in the API to set the frequency counter although there are currently no examples to show this

Code: Select all

PREF0 PREF1 PICO_STATUS PREF2 PREF3 (ps4000aSetFrequencyCounter)
(
    int16_t                                handle,
    PS4000A_CHANNEL                        channel,
    int16_t                                enabled,
    PS4000A_FREQUENCY_COUNTER_RANGE        range,
    int16_t                                thresholdMajor,
    int16_t                                thresholdMinor
);

typedef enum enPS4000AFrequencyCounterRange
{
  PS4000A_FC_2K,
  PS4000A_FC_20K,
  PS4000A_FC_20,
  PS4000A_FC_200,
  PS4000A_FC_MAX
}PS4000A_FREQUENCY_COUNTER_RANGE;
Please email support@picotech.com and they will help you add this into your code.
Martyn
Technical Support Manager

river
Newbie
Posts: 0
Joined: Fri Feb 23, 2024 5:52 pm

Re: Python support for Frequency Counting + PicoScope 4225A

Post by river »

@bennog

I should have added in my original post that the .mat files are unreadable because they seem to be corrupted. I'm already in touch with support to try and resolve this.

@Martyn

Thank you for the code. Is there a way to export data through Python? I haven't had any issues with setting the frequency counter, just getting data out of it.

Post Reply