11-09-2021 05:18 AM
Hello,
I have a problem with Diadem...
I tried to find the maximum value from a specific channel (in my case, the channel is Motor current).
I followed these steps: tdms files uploaded in Data Portal, the Diadem Analysis - Channel Functions - Find Peaks -
In the following window:
X-channel: Time;
Y-channel: Motor current;
Search criterion: Maxima;
Specify peaks: By size of the amplitudes;
Maximum number of peaks: 1, I did not check Store result in original channel and then I pressed OK.
But in Data portal I see no result channel, allthough I read in Diadem manual that
"DIAdem generates two result channels. The first result channel contains the x-values of the peaks. The second result channel contains the y-values of the peaks".
Have you had this problem so far?
Thank you in advance and have a nice day.
Solved! Go to Solution.
11-10-2021 01:40 AM
Hi arcasdaniel,
To check whether there is a general problem, please can you calculate the maximum in the same way but with any channel of the example dataset?
If this works fine, use “Refresh values” with your dataset before calculating the maximum.
If this does not work, we can have a look at your dataset to check what happens.
Greetings
Walter
11-10-2021 02:52 AM
Hello Walter,
Thank you for your response.
Unfortunately, I don't have refresh icon on Data Portal (I use Diadem 2017):
I tried to calculate the maximum value on another dataset, but without success: no result channel shown.
Also, I tried a script to refresh Data portal, but nothing. The script used is:
Call Portal.Refresh
Call Portal.Structure.Selection.Add(Data.Root.ChannelGroups(1))
I will try to find a solution to my problem by just writing a script and running it.. hope to work.
Thank you!
Best regards,
Daniel
11-10-2021 03:19 AM
Hello Daniel,
Yes, this icon was added in one of the latest versions and I have tested in DIAdem 2021 SP1. The script command behind this icon is ChnCharacterAll.
I have also tested this in DIAdem 2017 SP1 with the example dataset. The results of the ChnPeakFind function are stored in the Default channel group. The names are PeakX and PeakY. The function works fine on my side.
By the way, if you are only interested in the max value, you can find it in the channel properties. There is the min and max value of a channel stored.
Greetings
Walter
11-10-2021 03:05 PM - edited 11-10-2021 03:56 PM
Hello Walter,
Thank you for your time.
I finally managed to make channel result appear in Data Portal, after using the same script as I had previously mentioned it:
Call Portal.Refresh
Call Portal.Structure.Selection.Add(Data.Root.ChannelGroups(1))
Now, in Data Portal, I can see the result channels (PeakX and PeakY). I attach here the entire script:
Dim i
For i = 1 to groupcount
Dim oGroupChns, oMyChn
Set oGroupChns = Data.Root.ChannelGroups(i).Channels
If not oGroupChns.Exists("PeakX") Then
Set oMyChn = oGroupChns.Add("PeakX",DataTypeChnFloat64)
Else
Set oMyChn = oGroupChns("PeakX")
End If
If not oGroupChns.Exists("PeakY") Then
Set oMyChn = oGroupChns.Add("PeakY",DataTypeChnFloat64)
Else
Set oMyChn = oGroupChns("PeakY")
End If
'Set ChnResult = ChnPeakFind(XW, Y, ResultChannel, ResultChannel, PeakNo, PeakType, PeakSort)
Set ChnResult = ChnPeakFind("Time", "Motor current", "PeakX", "PeakY", 1, "Max.Peaks", "Amplitude")
Call ChnPeakFind("Time", "Motor current", "PeakX", "PeakY", 1, "Max.Peaks", "Amplitude")
Next
Call Portal.Refresh
Call Portal.Structure.Selection.Add(Data.Root.ChannelGroups(1))
This script provides a PeakX and a PeakY channel in every group in Data Portal, and that is exactly what I wanted.
But I encountered another problem: As I run script, minimum and maximum value are store only in the first group in Data portal..
For the other groups (starting with the second), no data is available in PeakX or PeakY channel:
I am looking for a solution to have data stored in PeakX and PeakY channel from every group.
As I am new in this forum, I ask: is this another topic and should I start another discussion or could you (or anybody else) help me with this here?
Thank you one more time Walter for all your help.
Best regards
Daniel
11-11-2021 01:15 AM
Hi Daniel,
In your script the results of all ChnPeakFind call are always stored in the first channel group. With a few modifications it will work as expected. (By the way the variable groupcount is marke das obsolete)
Example 1:
Dim i, oGroups, oGroupChns, oChnResX, oChnResY
set oGroups = Data.Root.ChannelGroups
For i = 1 to oGroups.Count
Set oGroupChns = oGroups(i).Channels
If not oGroupChns.Exists("PeakX") Then
Set oChnResX = oGroupChns.Add("PeakX",DataTypeChnFloat64) ' create a channel in a certain group
Else
Set oChnResX = oGroupChns("PeakX")
End If
If not oGroupChns.Exists("PeakY") Then
Set oChnResY = oGroupChns.Add("PeakY",DataTypeChnFloat64) ' create a channel in a certain group
Else
Set oChnResY = oGroupChns("PeakY")
End If
'Set ChnResult = ChnPeakFind(XW, Y, ResultChannel, ResultChannel, PeakNo, PeakType, PeakSort)
call ChnPeakFind("Time", "Motor current", oChnResX, oChnResY, 1, "Max.Peaks", "Amplitude")
Next
Alternatively, you can let the function create the result channels and check whether the source channels are available.
Example 2:
Dim i, oGroups, oGroupChns, oChnX, oChnY
set oGroups = Data.Root.ChannelGroups
For i = 1 to oGroups.Count
call oGroups(i).Activate ' set the default group
Set oGroupChns = oGroups(i).Channels
If not oGroupChns.Exists("Time") Then
call MsgBox("No >Time< channel.")
exit for
Else
Set oChnX = oGroupChns("Time")
End If
If not oGroupChns.Exists("Motor current") Then
call MsgBox("No >Motor current< channel.")
exit for
Else
Set oChnY = oGroupChns("Motor current")
End If
'Set ChnResult = ChnPeakFind(XW, Y, ResultChannel, ResultChannel, PeakNo, PeakType, PeakSort)
Call ChnPeakFind(oChnX, oChnY, "/PeakX", "/PeakY", 1, "Max.Peaks", "Amplitude") ' / means: create result channels in the default group
Next
(And of course, create a combination of both.)
Greetings
Walter
11-11-2021 02:46 AM
Hello Walter,
This script works, it is exactly what I have been looking for.
I want to thank you for all support.
Wish you all the best!
Daniel