10-05-2023 12:22 PM
Again assuming we just want to average a set of ROIs over z, here's what might work:
(Note that adding arrays in a shift register is a known transform and allowed in a parallel loop)
10-05-2023 01:55 PM
It is as stated indeed a s(u)implified version of the snippet I uploaded a few posts earlier. The heavy lifting is indeed a placeholder for the Magnitude/Frequency calculation from the 'Advanced Signal Processing Toolkit' that is happenin in the real code. The importance of a well designed minimal example get obvious again. Thank you for all your contributions to this thread so far. My takeaway is that there is no nice way to 'autoindex-like' iterate over the second index and third index in my specific case.
10-06-2023 10:02 AM - edited 10-06-2023 10:42 AM
@Quiztus2 wrote:
It is as stated indeed a s(u)implified version of the snippet I uploaded a few posts earlier. The heavy lifting is indeed a placeholder for the Magnitude/Frequency calculation from the 'Advanced Signal Processing Toolkit' that is happenin in the real code. The importance of a well designed minimal example get obvious again. Thank you for all your contributions to this thread so far. My takeaway is that there is no nice way to 'autoindex-like' iterate over the second index and third index in my specific case.
I still think there is a lot of slack left. For example the "detrend" function is NOT reentrant! Similarly, your FFT could be done directly, without all the detours over waveforms and cluster, etc. Especially since you seem to be only interested in exactly one point in the frequency domain, doing a full FFT seems way overkill! All you probably need is multiplication with a complex sine of the desired frequency. Since all dt's are the same (?), that sine can even be calculated before the loop. (start reading here for a simple example)
Shouldn't you init the unwrap phase when i=0 of the inner loop?
Can you strip down your full example to the code in the inner loop with a typical "extracted signal" as diagram constant so I can try a few things to see how to get the same result with significantly less effort. My guess is that we can gain an order of magnitude, but no guarantees, of course. 😄
10-12-2023 01:55 AM
Thanks for your suggestions. I will compare them and come up with the results here.
10-13-2023 12:03 PM
Even the "detrend" could be done directly on the 3D array by iterating over the planes and maintaining a few planes of various sums to get a 2D array of slopes and intercepts to be applied to the 3D array for correction.