DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Identifying the indicies at which an event occurs

Hi all. I think some help may be needed here assuming that the experience already exists on the forum.  I’ll try to be as succinct but as clear as possible. I have a signal which is depicted graphically as shown in figure 1 of the attached document. The figure shows a signal comprising a number of events which start and stop at various indicies. For example EVENT 1 has a starting index of 951 and a stop index of 1130. What I would like to do via a script is to identify the index at which an event starts and also the index at which an event finishes. In my simple example there would be 4 starting indicies (4 Events) and also 4 stopping indicies. I should add that the script needs to be able to cope with a variable number of events and also that the events in the real world are very unlikely to be nice rectangular pulses. I am taking the liberty of attaching a simple data set which mathematically describes the signal in figure 1. Has anyone already tackled a similar problem to the one I am describing? Would you be prepared to share your solution?

 

Thanks in advance for any help and I look forward to reading your replies.

 

Regards

 

 

Matthew

 

0 Kudos
Message 1 of 5
(3,599 Views)

Hi Matthew,

 

Yes, I can help with this.  The simplest approach is to identify a Y threshold above which the script can identify that a rising edge has occurred-- in your Word document that looks to be about Y=2.5.  Does such a threshold exist in your real data?  Bear in mind that we can smooth or digitally filter the raw data to remove noise on top of the signal.

 

Brad Turpin

DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 2 of 5
(3,586 Views)

Hi Brad,

 

I thought I could rely on you to reply. I managed to script a solution to this problem late yesterday afternoon but need to check it's robustness and tidy

it up a bit. As soon as I am confident that the functionality is correct I'll post the solution in this thread for others to use should they need to tackle a similar problem. The solution that I have arrived at is very simple.

 

Thanks for replying to the thread.

 

Regards

 

Matthew

 

0 Kudos
Message 3 of 5
(3,579 Views)

Hi Matthew,

 

It turns out I had something very like what you were asking for, but it took me a bit to remember where it was.  I tweaked it to work with your posted example data set, though with the SUDialog it should be pretty adaptable.

 

Brad Turpin

DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 4 of 5
(3,559 Views)

Hi Brad,

 

Thanks for the post and attachment. I've now tested the script I developed last week for functional accuracy and robustness and it all seems to

work fine. The script is very easy to understand and includes numerous comments to aid readability and comprehension. There are several arguments which are passed to a sub procedure which can be used to tweak the performance depending on the users application. The next step is to link it to a GUI I am developing so that the arguments can be received from edit boxes etc. If anyone should have any comments or questions on the code post in this thread and I'll try and answer as soon as possible.

 

Regards

 

 

Matthew

0 Kudos
Message 5 of 5
(3,540 Views)