🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

hyperstudy function

MIN_21722User: "MIN_21722"
Altair Community Member
Updated by MIN_21722

I want to get the X coordinate of maximum value with a graph,which function is available .thank you

 

Find more posts tagged with

Sort by:
1 - 10 of 101

    Use file assistant for extracting responses. Refer attached video.

    Unable to find an attachment - read this blog

    MIN_21722User: "MIN_21722"
    Altair Community Member
    OP
    Updated by MIN_21722

    thank you very much

     

    AutumnUser: "Autumn"
    Altair Community Member
    Updated by Autumn

    When defining output responses is it possible to determine the index of a specific value that isn't the minimum or maximum?

    For example, I'm interested in knowing when the displacement of an element reaches a specific value that isn't necessarily the minimum/maximum, so the functions 'indexofmin' and 'indexofmax' aren't useful in this situation.

    AutumnUser: "Autumn"
    Altair Community Member
    Updated by Autumn

    When defining output responses is it possible to determine the index of a specific value that isn't the minimum or maximum?

    For example, I'm interested in knowing when the displacement of an element reaches a specific value that isn't necessarily the minimum/maximum, so the functions 'indexofmin' and 'indexofmax' aren't useful in this situation.

    (SOLUTION)

    I was able to define two .py files and load them using a .mvw preferences file in HyperStudy to achieve this.

    The first .py function found the value in the list closest to a specific value:
    > def closest(list, val):
    >     return list[min(range(len(list)), key = lambda i: abs(list[i]-val))]

    The next .py function simply utilizes the index() function in Python:
    > def indexofval(list, val):
    >     return list.index(val)

    I then created a .mvw preferences file following the steps outlined in HS-1040 being sure to use *RegisterPythonFunction in the file twice to properly load both functions.

    Example: If I am then interested in finding the index of when the displacement of a node (list = disp) reaches 0.03 (=val) I can use the expression: "indexofval(disp, closest(disp, 0.03))". Since the displacement might not actually ever equal 0.03 exactly, I needed the "closest" function.

    I also used the pre-defined function "getval2" to find other values (e.g. internal energy) associated with this specific displacement point. More information on these pre-defined functions in HyperStudy can be found in the HyperWorks online help page (HyperWorks Desktop Ref Guide > Templex & Math Ref Guide > Math Ref > Functions & Operators    - AND -    HyperWorks Desktop Ref Guide > Templex & Math Ref Guide > Templex Ref > Templex Statements)

    When defining output responses is it possible to determine the index of a specific value that isn't the minimum or maximum?

    For example, I'm interested in knowing when the displacement of an element reaches a specific value that isn't necessarily the minimum/maximum, so the functions 'indexofmin' and 'indexofmax' aren't useful in this situation.

    Hello,

    I see your request without response along this thread.

    The easiest way I see is to first identify the index of interest in the data source and then define a response to extract the value at this index. Fon instance in the example below the response is defined with Displacement value at index 6505.

    Can this work in your case?

    image

    AutumnUser: "Autumn"
    Altair Community Member
    Updated by Autumn

    Hello,

    I see your request without response along this thread.

    The easiest way I see is to first identify the index of interest in the data source and then define a response to extract the value at this index. Fon instance in the example below the response is defined with Displacement value at index 6505.

    Can this work in your case?

    image

    Hello,

    Thank you for this information. I ended up creating two functions using Python and uploading a preferences file to HyperStudy (details in my response above titled with "(SOLUTION)" for anyone interested). This approach you've outlined would work, it would just be quite tedious in my case as I'm looking for a specific value that may not be at the same index for each run and I have quite a number of runs.

    I really appreciate your feedback!

    Hello,

    Thank you for this information. I ended up creating two functions using Python and uploading a preferences file to HyperStudy (details in my response above titled with "(SOLUTION)" for anyone interested). This approach you've outlined would work, it would just be quite tedious in my case as I'm looking for a specific value that may not be at the same index for each run and I have quite a number of runs.

    I really appreciate your feedback!

    Thanks for sharing your solution!

    For information, in HyperStudy 2021 there is a simpler way to register python function through the GUI.

    image

    image

    AutumnUser: "Autumn"
    Altair Community Member
    Updated by Autumn

    Thanks for sharing your solution!

    For information, in HyperStudy 2021 there is a simpler way to register python function through the GUI.

    image

    image

    Thank you for the tip!

    Thank you for the tip!

    You are welcome.

    User: "Michael Herve"
    Altair Employee
    Updated by Michael Herve

    Hello Automn,

     

    let's say you have a stress vs plastic strain function for which you want to extract some information

    You first need to create 2 data sources:

    plastic strain, data source ds_1: {0 .1 .2 .3 .4 .5}

    stress, data_source ds_2: {200 220 230 235 248}

     

    let's say that you want the stress for plastic strain = .25, which is not available

    You can then use lininterp command to get the value : lininterp(ds_1, ds_2, .25)

     

    Best Regards,

    Michael