03-27-2017 12:02 PM - edited 03-27-2017 12:30 PM
Hi Community,
I'm looking to create a series of "cycle" channels from a parent channel, where each cycle channel represents a fixed number of sequential samples of the parent channel interpolated by some fraction of an array index where (0 <= InterpWidth < 1). I've manually coded this and it works, although slower than I'd like. Does DIAdem have a particular funciton for doing this more quickly?
Please see the SplitCycles() routine in the attached script.
03-27-2017 12:34 PM
Attached script to this post.
03-27-2017 05:28 PM
Hello Chris,
I don't think anyone will be able to run the code you posted easily without the data file structure that the Script is based on.
That said, I have two suggestions for you:
This image shows two sections of the DIAdem help system that might be useful to you:
I hope that these tips will get you a step closer to increasing your Script performance,
Otmar
03-29-2017 09:04 AM
Hi Otmar,
Thank you for all the useful information. From the script profiler, it looks like my script spends a lot of time reading/writing channel values if I understand this correctly. I will try to figure out a way to streamline this process.
03-31-2017 08:09 AM
Hello Chris,
It does look like the individual channel value reading/writing is the portion of the Script that uses the largest amount of processing time in your application.
Have you had a look at the "Event finding" functions in the DIAdem Analysis panel? These allow you to search for definable events, and then use data block copy functions instead of individual data value copy functions, which might be able to speed up your Script considerably.
If you can share some data (if you prefer to not do that on a public forum, you can send them to my personal gmail account) I can take a look at that and see if using the event finder functions will give you a boost in performance. (My Gmail address is FirstName DOT LastName AT gmail DOT com - No middle initial in the address, or you can ZIP the data file and upload it here. TDMS format is preferred a it's compact and easy to read without an extra DataPlugin.
The channel event functions all start with "ChnEvent..." in DIAdem, and there are more functions in DIAdem than the ones you can access from the ANALYSIS panel dialog in DIAdem. Here is a list of the 2015 functions:
04-05-2017 07:25 PM - edited 04-05-2017 07:28 PM
Otmar,
Thanks to you and Brad T. for providing a much speedier verion of my SplitCycles() sub. It's definitely more than twice as fast now on my antique computer:
I attached the full script here in case it's usefule to anyone. In this version, the original SplitCycles() sub is commented out for comparison.
Thanks,
Chris