DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Finding the very first peak in data channel

Solved!
Go to solution

Hey guys,

 

I need a little help. I have written a script to process some data. Basically what the script does is calculate peak linear accelerations, peak angular velocities, HIC and SI values. But there is one problem with my script that I need help with. In my script, I use the command ChnPeakFind to find the peaks in my channels. This command works very well at finding the maximum peak but what I want to do is find the very FIRST peak in the data, regardless if it is a maximum or not. I always come across data that varies in which my first peak (the impact I am analysing) may or may not be the highest peak in the channel. As you can see in the Graphs.png that I attached, the ChnPeakFind command found the 2nd peak (red circle #2) in my angular velocity channel (ARS resultant). But what I want to report is the first peak value (red circle #1). I have also attached a screenshot of the section in my code where I calculate angular velocity. The 'i' in the calculation is just the channel group number. In this case it is 1. Does anyone know how to modify the code or have another suggestion of how to find the very first peak in a channel, without having to stop and go into the analysis tab to manually find the peak?

 

Thanks!

Download All
0 Kudos
Message 1 of 9
(5,367 Views)

Hi,

could you increase the total number of peaks to find to somthing well above the number of peakes you have? This would find all peaks in your dataset, then you could  use the minimum of  the returned peak x channelnfor the location of the earliest peak.

 

hopefully that helps some

 

 

0 Kudos
Message 2 of 9
(5,354 Views)

Thanks for the reply Artemis125.

 

I've tried that. As you can see in the screenshot, it becomes a little more challenging. With a closer look at the graph, you can see that there are many small peaks throughout the curve (which is just noise in the data) so I will not be able to search for a minimum beacuse the ChnPeakFind command returns the values in descending order of amplitude size, and they are just all over the curve.

 

For my current example, the arrow is placed on the value I aim to return (779.1159...). I can't think of a way to write a script that will automatically search for and return the very first real peak.

0 Kudos
Message 3 of 9
(5,326 Views)

Could you limit your search to peaks above a certain threshold? You could run one of the event search functions to find ranges within a window above those smaller peaks, then search for peaks only within that range? Alternaively you could try smoothing the function before searching for peaks so that those smaller peaks are no longer there.

0 Kudos
Message 4 of 9
(5,319 Views)

Looking at the graph, I think you need to filter the data first to find the peak you are looking for. Perhaps you even need to do some smoothing after that. You will find all the required functions in ANALYSIS. If you need help with that, you probably want to post the data (if possible) so that we can experiment with the data to find the right parameters

0 Kudos
Message 5 of 9
(5,295 Views)

Thanks for the reply AndreasH_Ha,

 

The graph you are looking at is post offestting and post filtering. For the type of impact that it is and in order to filter according to SAE J211, I filtered the data with CFC 1000. Now you did mention smoothing after filtering, that I may need help with. I am posting the data as requested.

 

My goal is to have my script find the first peak automatically without having to do any analysis myself. I process a lot of this type od data so my results vary.

 

 

0 Kudos
Message 6 of 9
(5,284 Views)

Artemis125,

 

I see how that could work, but I'm not sure that I can limit the search to be above a certain threshold. My goal is to have my script automate all the analysis for me. I process a lot of this kind of data so my results always vary, therefore, the threshold will always be changing.

0 Kudos
Message 7 of 9
(5,283 Views)
Solution
Accepted by topic author rvillalta319

Hello

Please see my littl escript below and let me know whether this might work for you

Dim     oChnResultant
Call Data.Root.Clear()
Call DataFileLoad("E:\Customer_Examples\01_Head_Impact\Head Impact Data.tdm","TDM","Load")
Set oChnResultant = data.Root.ActiveChannelGroup.Channels.Add("Resultant",DataTypeChnFloat64)
Call ChnXYZAbsValue("[1]/ARS X","[1]/ARS Y","[1]/ARS Z",oChnResultant)
' Use Filter twice to get rid of jitter
Call ChnSavitzkyGolayFilter(oChnResultant,oChnResultant,1,12)
Call ChnSavitzkyGolayFilter(oChnResultant,oChnResultant,1,12)
' Remove little maxima's at teh beginninf of the signal
Call Calculate("R=IIF(R<50,0,R)",Array("R"),Array(oChnResultant))
' Search for first peak
Call ChnPeakFind("[1]/Time axis","[1]/Resultant","/PeakX","/PeakY",1,"Max.Peaks","Time")
Message 8 of 9
(5,264 Views)

Thank you!

 

It worked great.

0 Kudos
Message 9 of 9
(5,210 Views)