I have a 3D wave, waveA, where some of its elements are NaN. How can I replace all of these NaN elements with a numerical value, e.g. 100.0, without using loop?
where v_val is the value you want to change the NaNs to (i.e. 99 in this case).
I don't know how the snippet is optimized internally by the igor pro interpreter, so it may be slower than using matrixop. But the snippet above allows you to build other logical functions/ filters for wave elements.
Thanks for you both, it seems like matrixop is faster but it's also good to have other form of codes which does the same and can be generalized to another wave filtering operation.
where v_val is the value you want to change the NaNs to (i.e. 99 in this case).
I don't know how the snippet is optimized internally by the igor pro interpreter, so it may be slower than using matrixop. But the snippet above allows you to build other logical functions/ filters for wave elements.
best,
_sk
Great!!
with mutithread key word,that is why Igor so powerfull!
Hey,
sorry for leaving this thread for one day without updating. So I what I want is actually to use interpolate3D to get the 3D wave and for points lying outside the domain of the source wave this command will return NaN. That's why in the end my 3D wave will contain some NaN elements. However, yesterday I noticed that with my source wave for triangulate3D (I need the output from this command to run the subsequent interpolate3D) being very large (2050401 rows and 4 cols), the execution time exceeded 24 hours until I aborted it before finish. I see someone mentioning MultiThread, looks like some parallel computation related term. Will it help speeding up triangulate3D?
Hey,
sorry for leaving this thread for one day without updating. So I what I want is actually to use interpolate3D to get the 3D wave and for points lying outside the domain of the source wave this command will return NaN. That's why in the end my 3D wave will contain some NaN elements. However, yesterday I noticed that with my source wave for triangulate3D (I need the output from this command to run the subsequent interpolate3D) being very large (2050401 rows and 4 cols), the execution time exceeded 24 hours until I aborted it before finish. I see someone mentioning MultiThread, looks like some parallel computation related term. Will it help speeding up triangulate3D?
It is not practical to use triangulate3D operation for very large data sets.
In your case, I think you should think of other ways to do your work. Say, pay attention to the speciality of your data and find a spcial method just suited to your need!
The triangulation process is O(N^2) so you are really looking at a very long computation. Depending on your application you might consider reducing the amount of data that is being triangulated, grouping parts of the data, triangulating and interpolating in smaller groups and similar approaches where you simply reduce the size of N.
Matrixop destwave=replaceNaNs(your3Dwave,100)
Andy
July 9, 2017 at 06:55 am - Permalink
matrixop
does behind the scenes but I suspect it is something like this, in other words, a hidden loop:waveA = (numtype(waveA[p]) == 2) ? v_val : waveA[p]
where
v_val
is the value you want to change theNaNs
to (i.e.99
in this case).I don't know how the snippet is optimized internally by the igor pro interpreter, so it may be slower than using
matrixop
. But the snippet above allows you to build other logical functions/ filters for wave elements.best,
_sk
July 10, 2017 at 01:57 am - Permalink
July 10, 2017 at 04:07 am - Permalink
waveA = (numtype(waveA[p][q][r]) == 2) ? 99 : waveA
best,
_sk
July 10, 2017 at 04:19 am - Permalink
MultiThread
on wave assignments with large waves.July 10, 2017 at 07:28 am - Permalink
Great!!
with mutithread key word,that is why Igor so powerfull!
July 11, 2017 at 04:48 am - Permalink
sorry for leaving this thread for one day without updating. So I what I want is actually to use
interpolate3D
to get the 3D wave and for points lying outside the domain of the source wave this command will return NaN. That's why in the end my 3D wave will contain some NaN elements. However, yesterday I noticed that with my source wave fortriangulate3D
(I need the output from this command to run the subsequentinterpolate3D
) being very large (2050401 rows and 4 cols), the execution time exceeded 24 hours until I aborted it before finish. I see someone mentioningMultiThread
, looks like some parallel computation related term. Will it help speeding uptriangulate3D
?July 11, 2017 at 06:45 pm - Permalink
It is not practical to use triangulate3D operation for very large data sets.
In your case, I think you should think of other ways to do your work. Say, pay attention to the speciality of your data and find a spcial method just suited to your need!
July 11, 2017 at 07:22 pm - Permalink
July 12, 2017 at 11:01 am - Permalink