Showing results for
Did you mean:

## Re: How to calculate knee point without using cursor

Hi Andreas,

Yes I think this is exactly what I've been looking for ;-). It's particularly interesting to see the "Finding a kneedle in a haystack..." paper. I wish I had asked this question a lot earlier. It could have saved me a lot of heartache.

Looking at your code I like the professional way it is structured.

Thanks very much.

Regards

Matthew

Message 11 of 24 (1,096 Views)

## Re: How to calculate knee point without using cursor

Matthew,

regarding the frequency for the filter function, I simply used the preview in the dialog to find a reasonable value. I defined a variable in the script for that frequency s that I can change the frequency without searching in the script where it is used.This is a very "low tech" approach, but sufficient for most cases.

Message 12 of 24 (1,090 Views)

## Re: How to calculate knee point without using cursor

Matthew,

one last question: What is the purpose of finding this knee point. What physical phenomenon is represented by this point ?

Andreas

Message 13 of 24 (1,089 Views)

## Re: How to calculate knee point without using cursor

Hi Andreas,

As I understand things (all I ever get to see is large volumes of numbers after they have been logged) the purpose of finding the kneepoint is to provide a metric of the running clearance in a brake assembly. Running clearance refers to the physical space between the pads and the diisc.

Could I ask you another question regarding the filter frequency? Say for example that no filtering is required, how do I adapt the code?

Should LowPassFrequency be increased/decreased or are there some other subtleties that I'm missing?

If the dataset was to contain only one hyteresis curve do you envisage that the code will still be able to compute the kneepoint without any error?

Good luck always.

Matthew

Message 14 of 24 (1,086 Views)

## Re: How to calculate knee point without using cursor

Hello Matthew,

I changed the script so that if you set LowPassFrequency to 0, the script skips the filtering step. The change is kind of brute force: If filtering is not required, the script simply copies the data. Not the most efficient way performance wise, but the smallest change to the flow in the script. And for most datasets, I assume filtering will be required.

I created a new dataset based on your example which only contains one hysteresis and the script still works. That's not really a comprehensive test. Depending on you data, it might be necessary to implement the "single hysteresis" as a special case.

Hope that helps

Message 15 of 24 (1,080 Views)

## Re: How to calculate knee point without using cursor

Hi Andreas,

Thanks a lot for your input into this thread. It's definitely given me a lot to think about.

I found in the script I wrote myself that sometimes I would have to perform filtering on a dataset and on other times filtering would not be appropriate. The goal is to have a script which does not involve the analyst have to look at the data and produce results with a high degree of accuracy. I think the method you have implemented is probably going to be a lot more reliable than what I "cobbled" together on the fly.

The real eye-opener was seeing in print "How to find a kneedle in a haystack..."

Once again thanks very much for your input.

Good luck always.

Matthew

Message 16 of 24 (1,075 Views)

## Re: How to calculate knee point without using cursor

H there I'm very rusty with my programming.

I'm an engineering student.

Am I right, if I say that this program can also be used in determining Voltage and Current Ct's kneepoints.

When I run your Examplke_KneePoint.vbs script, I get this error. It seems that the data varaiable should be declared, but as what and how? And where and how do I insert my own set of data to determine the knee point?

Message 17 of 24 (1,046 Views)

## Re: How to calculate knee point without using cursor

The script is designed to run with a newer version of DIAdem. What version are you currently using ?

"Data" is the main entry point for the scripting API to handle data in the dataportal.

Andreas

Message 18 of 24 (1,042 Views)
Highlighted

## Re: How to calculate knee point without using cursor

Hi,

Regarding your question how to insert your own data set, look for the following line in the script and edit it accordingly:

Alternatively a couple of lines above it you should see a line which says:

Call Data.Root.Clear()

Comment out both these lines and load your dataset manually. Currently the script looks like it is designed to load a file called "knee_point_data_one_cycle.TDM"

Hope this helps.

Matthew

Message 19 of 24 (1,034 Views)

## Re: How to calculate knee point without using cursor

Hi Andreas,

This is a very late reply with regards to the post, but trying since you have the solution! I am currently working on a respiratory research project and have come across a problem for which part of the solution is very similar to the one you suggested here. I actually read the Kneedle algorithm paper and think that is where the solution to the problem I have lies. However I was not able to fully understand the algorithm - specially the local maxima part - I am able to calculate the difference curve but then I don't completely understand the next step which is calculating the local maxima of the difference curve - how is that carried out and how the sensitivity parameter is applied afterwards is a little bit confusing to me - would you mind explaining that part to me please? Thank you very much. Regards, Anoop.

Message 20 of 24 (899 Views)