DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Using ChnMapLinCalc with repeating values

Hi,

   I use ChnMultipleSort function to sort two channels(sort one and rearrange the second accordingly). The channels are then used for Linear Mapping using ChnMapLinCalc function to get second channel values corresponding to some whole number values of the first channel. Now, this function is returning DIFFERENT VALUES when I run it for one set of the above channels and another set of copies of the same channels(in fact, the whole file is copied into another group in data portal). The reason is that the first channel has 2 or more repeating values close to the whole number that we are looking for, with different corresponding values in the second channel. It seems to be randomly picking up any of the multiple values in the second channel for the linear mapping. Is there any way that we can get the ChnMapLinCalc function to return the SAME VALUES for both sets of channels, consistently ?

 

Thanks

Venkatesh Murthy.

0 Kudos
Message 1 of 6
(4,320 Views)

Hi Venkatesh,

 

Would you please post an example data set and VBScript that exhibits this inconsistency?  That would help us to reproduce the problem and figure out what can be done.

 

Thanks,

Brad Turpin
DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 2 of 6
(4,304 Views)

Hi Brad,

     Thanks for your reply. I am sending a set of .TDM, .TDX and .VBS files wherein I use the Channel Sorting and Linear mapping functions. Kindly note the discrepancies in the values in Linear1 and Linear2, generated with Channels 2 and 6 and their copies - Channels 3 and 7 respectively. The sorted channels are also there.

 

Thanks and regards,

Venkatesh Murthy.

0 Kudos
Message 3 of 6
(4,293 Views)

Hi Venkatesh,

 

I just got through trading emails with Priya on this same topic (the XY data she emailed and you posted below are identical in values if not in channel names).  For everyone else reading this, the X values and Y values are being read over time, but the X values are a different quantity from time that effectively is acquired in random order.  They need to sort those XY pairs by the X values, but frequently there are multiple Y values for the same X value.  After sorting, they want to interpolate these results onto a standard progression of X values.  For this last step I would recommend the "Reducing Classification" function in the "Statistics" palette.

 

ChnCRedIP = 0

ClassRed2Params = 0

ClassDontUseNV = 0

Call ChnClassXRedXY("[3]/SortedX1","[3]/Interpolate","[3]/SortedY2","Channel","Mean",0,0,0)

 

 

Brad Turpin
DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 4 of 6
(4,265 Views)

Hi Brad,

    Thanks for the reply. I tried out the function you have recommended. But it generates Y channel values for the class means only, and hence, one less than the number of values required. For eg. instead of values corresponding to the ten values 20,30,40 through 110, it generates values corresponding to 25,35, through 105, i.e. only 9 values. And the values also do not seem to match the actual values in the SortedY2 channel. I am attaching the tdm file with the channels generated by the code:

ChnCRedIP = 0
ClassRed2Params = 0
ClassDontUseNV = 0
ClassNVReplace = 0
Call ChnClassXRedXY("[1]/SortedX1","[1]/XData","[1]/SortedY2","Channel","Mean",ChnCRedIP,ClassDontUseNV,ClassNVReplace)

 

Please clarify.

 

Thanks and regards

Venkatesh Murthy.

0 Kudos
Message 5 of 6
(4,253 Views)

Hi Venkatesh,

 

You're right, we can't use the existing "XData" channel as-is.  Instead, you need to create a new "XData-1" channel that contains N+1 bins that exactly bracket the N target values in the original "XData" channel.  You could do this programmatically, but for now I just did it by hand in VIEW.  When I run the Reducing Classification analysis with these corrected bins, I do indeed get for each X target value the average Y value for all the Y values in that target X range, and both the copied data sets give identical answers for both X and Y values.

 

Why do you ignore all those negative X values?

Brad Turpin
DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 6 of 6
(4,240 Views)