How to compute the standard deviation of a curve in hypergraph through tcl script.

Shirdi_Partha_Sai_P
Shirdi_Partha_Sai_P Altair Community Member
edited February 23 in Community Q&A

How to compute the standard deviation of a curve in hypergraph through tcl script. Are there any other statistical parameters which can be computed using tcl script. If any sample scripts are available please support

Answers

  • Michael Herve_21439
    Michael Herve_21439
    Altair Employee
    edited February 22
    Hello @ P S Partha Sai,

    Please correct me if I'm wrong but you recently commented a script which extract some statistics

    (Not standard deviation) and we provided you some guidance (in addition of the script faq) to complete the existing script.

    Are you facing any issue adding the extra lines to adapt the script to your needs?

    Best Regards,

    Michael

    Best Regards,

    Michael

  • Venkata Chittala_22019
    Venkata Chittala_22019
    Altair Employee
    edited February 22

    here is the curve statistics using templex functions in HG statistics panel

    {
    ' HWVERSION_2023.1.0.13-28210_Dec 02 2023_22:51:49
    ' Copyright (c) 2023 Altair Engineering, Inc. All rights reserved.
    ' Contains trade secrets of Altair Engineering, Inc.
    ' Copyright notice does not imply publication.
    }
    Curve Name : {label}
    Num Pts.   : {min({numpts(x), numpts(y)})}
    Length     : {curvelength(x,y), %-10.3f}
    Signed Area: {signedarea(x,y), %-10.4f}
    Abs. Area  : {absarea(x,y), %-10.3f}


                          X               Y
                    -------------   ------------- 
    RMS             {rms(x), % 1.6e}   {rms(y), % 1.6e}
    Min             {min(x), % 1.6e}   {min(y), % 1.6e}
    Max             {max(x), % 1.6e}   {max(y), % 1.6e}
    Median          {median(x), % 1.6e}   {median(y), % 1.6e}
    Delta           {delta(x), % 1.6e}   {delta(y), % 1.6e}
    Centroid        {centroid(x,y)[0], % 1.6e}   {centroid(x,y)[1], % 1.6e}
    Mean            {mean(x), % 1.6e}   {mean(y), % 1.6e}
    Variance        {variance(x), % 1.6e}   {variance(y), % 1.6e}
    Skewness        {skewness(x), % 1.6e}   {skewness(y), % 1.6e}
    Std. Dev.       {sqrt(variance(x)), % 1.6e}   {sqrt(variance(y)), % 1.6e}
    Avg Dev.        {avgdev(x), % 1.6e}   {avgdev(y), % 1.6e}
    Zero-Crossings  {zerocrossings(x), % 1.6e}   {zerocrossings(y), % 1.6e}
    =============================================

    we can use templex eval in tcl script 

    $templexHandle Evaluate "{sqrt(variance(x))" true

     

    hwi GetSessionHandle sess

    sess GetProjectHandle p

    p

    % p GetTemplexHandle t

    t

    % t Evaluate "{sqrt(variance(p1w1c1.x))" true

    43.734

  • Shirdi_Partha_Sai_P
    Shirdi_Partha_Sai_P Altair Community Member
    edited February 23

    here is the curve statistics using templex functions in HG statistics panel

    {
    ' HWVERSION_2023.1.0.13-28210_Dec 02 2023_22:51:49
    ' Copyright (c) 2023 Altair Engineering, Inc. All rights reserved.
    ' Contains trade secrets of Altair Engineering, Inc.
    ' Copyright notice does not imply publication.
    }
    Curve Name : {label}
    Num Pts.   : {min({numpts(x), numpts(y)})}
    Length     : {curvelength(x,y), %-10.3f}
    Signed Area: {signedarea(x,y), %-10.4f}
    Abs. Area  : {absarea(x,y), %-10.3f}


                          X               Y
                    -------------   ------------- 
    RMS             {rms(x), % 1.6e}   {rms(y), % 1.6e}
    Min             {min(x), % 1.6e}   {min(y), % 1.6e}
    Max             {max(x), % 1.6e}   {max(y), % 1.6e}
    Median          {median(x), % 1.6e}   {median(y), % 1.6e}
    Delta           {delta(x), % 1.6e}   {delta(y), % 1.6e}
    Centroid        {centroid(x,y)[0], % 1.6e}   {centroid(x,y)[1], % 1.6e}
    Mean            {mean(x), % 1.6e}   {mean(y), % 1.6e}
    Variance        {variance(x), % 1.6e}   {variance(y), % 1.6e}
    Skewness        {skewness(x), % 1.6e}   {skewness(y), % 1.6e}
    Std. Dev.       {sqrt(variance(x)), % 1.6e}   {sqrt(variance(y)), % 1.6e}
    Avg Dev.        {avgdev(x), % 1.6e}   {avgdev(y), % 1.6e}
    Zero-Crossings  {zerocrossings(x), % 1.6e}   {zerocrossings(y), % 1.6e}
    =============================================

    we can use templex eval in tcl script 

    $templexHandle Evaluate "{sqrt(variance(x))" true

     

    hwi GetSessionHandle sess

    sess GetProjectHandle p

    p

    % p GetTemplexHandle t

    t

    % t Evaluate "{sqrt(variance(p1w1c1.x))" true

    43.734

    Thank you very much, as this could give me fair idea on how to proceed further.  

  • Shirdi_Partha_Sai_P
    Shirdi_Partha_Sai_P Altair Community Member
    edited February 23

    Hello @ P S Partha Sai,

    Please correct me if I'm wrong but you recently commented a script which extract some statistics

    (Not standard deviation) and we provided you some guidance (in addition of the script faq) to complete the existing script.

    Are you facing any issue adding the extra lines to adapt the script to your needs?

    Best Regards,

    Michael

    Best Regards,

    Michael

    Hi Michael,

    The comments by Mr Venkata Chittala, were useful and I could modify the script to compute the parameters which I need.

    How ever I would request for one more help, to obtain the stats over the plot area. Are there any scripts for this. Thanks in advance.

    Regards,

    Partha Sai P S

  • Michael Herve_21439
    Michael Herve_21439
    Altair Employee
    edited February 23

    Hi Michael,

    The comments by Mr Venkata Chittala, were useful and I could modify the script to compute the parameters which I need.

    How ever I would request for one more help, to obtain the stats over the plot area. Are there any scripts for this. Thanks in advance.

    Regards,

    Partha Sai P S

    hello @P S Partha Sai ,

     

    that is great you were able to get the code for your statistics needs! For the note, did you hve a look at some scripts in community? At first glance the script below should help:

    https://community.altair.com/community/en/add-user-defined-text-as-note-to-the-visible-curves?id=kb_article&sysparm_article=KB0119442

    Did you already try it?

    Regards,

    Michael