DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

StatBlockCalc without creating data channels for results

Solved!
Go to solution

I am trying to create the min, max, and mean for a group of channels (3 of them) but I do not want to create/store them in new data channels - I would rather use the StatMin, StatMax, and StatArithMean variables.  For example, using the script

 

StatClipCopy = 0

StatClipValue = 0

StatFormat = ""

StatResChn = 1

Call StatBlockCalc("Channel","2-254","'[1]/Amp-Hours' - '[1]/Temperature A1'") '... StatDirec,RowNoStr,ChnNoStr

 

causes 3 new channels (min/max/avg) with 3 items in each channelto be created in the data portal.  Rather than creating channels, I change the StatResChn = 0 which I thought should only store the values in the variables StatMin, StatMax, and StatArithMean  

 

 

StatClipCopy = 0

StatClipValue = 0

StatFormat = ""

StatResChn = 0

Call StatBlockCalc("Channel","2-254","'[1]/Amp-Hours' - '[1]/Temperature A1'") '... StatDirec,RowNoStr,ChnNoStr

 

However this only appears to work is using a single channel (i.e. Amp-Hours or Temperature A1)

 

Is there a way to get multiple Statistics values (statmin, statmax, etc) over multiple channels without creating separate channels in the data portal?

0 Kudos
Message 1 of 11
(5,877 Views)

Hello JimNoel,

 

When you calulate these values, they are automatically stoed as channel properties, so you can easily access them through the following variables in DIAdem:

 

This code works for a channel called "[1]/Temp_D"

 

 

msgbox(Data.GetChannel("[1]/Temp_D").Properties("minimum").Value) msgbox(Data.GetChannel("[1]/Temp_D").Properties("maximum").Value) msgbox(Data.Root.ChannelGroups(1).Channels("Temp_D").Properties("ResultStatArithMean").Value)

 

 

The maximum and minimum values are actually always available, even when you don't perform the statistics calculation.  They are part of the standard channel properties that DIAdem makes available by default.

 

Does that help?

 

Otmar D. Foehner
0 Kudos
Message 2 of 11
(5,875 Views)

Otmar

 

I know the min/max value are available for the entire channel but I am looking at obtaining the min/max/avg for a subset of the entire dataset for a couple channels - i.e. rows 2-254 for 3 of my channels. 

 

However, when using the StatblockCalc function with StatResChn = 1 it creates 3 new channels which contain the statistical values.  I do not wish to create additional channels and would rather use the variables StatMin, StatMax, and StatAvg but those values only seem to only work if I am performing the StatBlockCalc on a single channel (i.e. Amp-Hours or TemperatureA1)

 

I thought the values may be put into an array (i.e. StatMin(1), StatMin(2), etc) but that does not appear to be the case.  Any thoughts?

 

0 Kudos
Message 3 of 11
(5,872 Views)

Ok you helped me more then initially thought.

 

The last command you typed 

 

  msgbox(Data.Root.ChannelGroups(1).Channels("Temp_D").Properties("ResultStatArithMean").Value)

 

ResultStatArithMean returns the correct mean value for each of my channels but I cannot figure out what the text should be for the maximum and minimim values. 

 

Do you know the text?

 

 

0 Kudos
Message 4 of 11
(5,867 Views)

Jim,

 

They should be 

 

ResultStatMin

ResultStatMax

 

and for your application (subset statistics) they are the correct approach vs. the regular min and max values which are calculated based on the complete data channel.

 

 

Otmar D. Foehner
0 Kudos
Message 5 of 11
(5,860 Views)
Solution
Accepted by topic author JimNoel

Otmar

 

That is exactly what I was looking for.  I tried it and it works great.  Thank you very much!!!

 

 

I do have one additonal question - is there any sort of documentation available that describes those properties/values such as ResultMin, etc?

 

 

0 Kudos
Message 6 of 11
(5,852 Views)

JimNoel wrote:

 

I do have one additonal question - is there any sort of documentation available that describes those properties/values such as ResultMin, etc?

 

 


The easiests way I have found those is to calculate the values (in the statistics menu) and then click onto the properties of the channel I did the calculation for. The new properties will show up in the channels with their correct names. I will talk to our documentation group to integrate them better with the help system!

Otmar D. Foehner
0 Kudos
Message 7 of 11
(5,827 Views)

For the sake of completeness (i.e. if someone finds this thread in a search), here is a list of all the property names of the statistics values. The names should be self explanatory (they all start with ResultStat...)

 

ResultStatArithMean:
ResultStatAvDevMean:
ResultStatAvDevMedian:
ResultStatDeviation:
ResultStatGeoMean:
ResultStatHarMean:
ResultStatKurtosis:
ResultStatLowQuantil:
ResultStatMax:
ResultStatMedian:
ResultStatMin:
ResultStatQuartilDist:
ResultStatRange:
ResultStatRelVarCoeff:
ResultStatSkew:
ResultStatSqrMean:
ResultStatStdError:
ResultStatSum:
ResultStatSumSqr:
ResultStatUppQuantil:
ResultStatVarCoeff:
ResultStatVariance:

 

I also asked for the property names to be added to a more obvious place in the DIAdem online help system, so they should be more easy to find in future releases of DIAdem.

Message Edited by Otmar on 05-21-2009 05:25 PM
Otmar D. Foehner
0 Kudos
Message 8 of 11
(5,820 Views)

That works for channels but what if you have a group of channels and want the maximum from those

 

For example:

 

Call StatBlockCalc("Channel","1-","'[1]/Cycle', '[7]/Cycle', '[13]/Cycle', '[19]/Cycle', '[25]/Cycle', '[31]/Cycle', '[37]/Cycle', '[43]/Cycle')

 

According to above you specify which channel you want the value for along with the respective valuename (ResultStatMax).  However, for a group of channels where can I access the result without creating another channel

0 Kudos
Message 9 of 11
(5,660 Views)

Jim,

 

When you calculate the statistics for a block of channels, the result cannot be stored in one of the channels. Instead, it goes into one of the result variables for the statistics calculation function:

 

The maximum would be stored in the StatTxt2(5) variable, a complete list of the result variables is below:

 

StatTxt2(1) Index number
StatTxt2(2) Measurement value sum
StatTxt2(3) Measured value square sum
StatTxt2(4) Minimum
StatTxt2(5) Maximum
StatTxt2(6) Arithmetic mean
StatTxt2(7) Root mean square
StatTxt2(8) Geometric mean
StatTxt2(9) Harmonic mean
StatTxt2(10) 0.25 quantile (lower quartile)
StatTxt2(11) 0.50 quantile (median)
StatTxt2(12) 0.75 quantile (upper quartile)
StatTxt2(13) Range
StatTxt2(14) Standard deviation
StatTxt2(15) Variance
StatTxt2(16) Variation coefficient
StatTxt2(17) Quartile distance
StatTxt2(18) Relative variation coefficient
StatTxt2(19) Average absolute deviation from mean
StatTxt2(20) Average absolute deviation from median
StatTxt2(21) Skewness
StatTxt2(22) Kurtosis
StatTxt2(23) Standard error

 

Hope that helps,

Otmar D. Foehner
Message 10 of 11
(5,655 Views)