Extract index from column value

DataGraph Forums Technical Support Support Desk Extract index from column value

Tagged: 

Viewing 10 posts - 1 through 10 (of 11 total)
  • Author
    Posts
  • #4707
    jordan
    Participant

      I am looking for a way to extract the index at which a column of data gets to 90% maximum. I can use global variables to calculate out the max and the 90% of max, but then I would like to program to find the value closest to 90% in the column and return the index. I see how to return a value from an index, but not the other way around. Any suggestions? Thanks for any help!

      Jordan

      #4709
      dgteam
      Moderator

        Hi Jordan,

        Try creating a column with an expression that will take the difference between the value you are interested (0.9 * Data.max) and the Data.  Also take the absolute value.

        Equation1

        Then you can use a variable to pull the minimum of that column and return the index.

        You can also use the returned index to pull the value from the data column.

        Equation2

        Is this what you wanted to do?

         

        #4711
        jordan
        Participant

          I think that will do, I will give it a go and report back in a bit. Thanks so much for the prompt and easy instructions!

          #4713
          jordan
          Participant

            This worked out perfectly. Thanks!

            #4717
            jordan
            Participant

              So I ran into a case where the supplied solution stops working. I have spent some time thinking through it, but I cannot think about how to solve this one. Any help would be appreciated.

               

              Here is an example of my normal case where the abs((0.9 * Data.max-Data) works and provides the point that I want to extract.

              Untitled

              but I do have some data sets where the data is a little different and it messes up the formula as shown here:

              Untitled1

              So I am really interested in the first time the data crosses the 90% max threshold. Any ideas on how to extract this point in these cases where there is a point that is closer to 90%, but is after the line crosses the threshold. Thanks for any help!

               

              #4718
              jordan
              Participant

                I have a simple work around that requires some assumptions: I am using a mask to only analyze the first half of the data. I would love to hear any other more sophisticated solutions.

                #4719
                petercreate
                Participant

                  Cool!

                  #4723
                  dgteam
                  Moderator

                    Here is one idea … add another expression that builds on the one that finds the minimums.

                    This will identify where you have more than one instance and return the index back.

                    CheckMultiple

                    The data would like something like this … where the minimum of the ‘DataCheckMultiple’ would be the index you want, and you can extract that using a variable.

                    CheckMultiple2

                    Here is a visual of this data.

                    Graph

                    This way you are still using all the data.  There are probably other ways to do this too but I think this will work.

                     

                    #4738
                    jordan
                    Participant

                      Thanks for the idea, but this doesn’t quite solve the issue. The issue is that I am interested in the first instance that the data passes 90%… the x axis is time, so how long it takes to get to 90% of the measurement. However, there may be data points subsequent to the first point past 90% that are actually closer to 90%. The absolute value equation will always return the closest point to the target, but I am not after that info. Your suggestion fixes exact matches, but my data pretty much never has an exact match at 90% or a match at the closest point to 90%. Thanks for the help though! I will keep thinking about it. This is an easy problem to program in python or other language… I may see if I can work out an automated way of getting the data. If you are interested, this may be a good use case of beefing up the command line interface…

                      #4739
                      dgteam
                      Moderator

                        So now I think I understand — The last idea was finding all the exact matches that were closest to the threshold, but you are correct that values below the threshold at the distance would also be found.

                        If you want the first instance that exceeds, do that in one step.  Use an if statement and return the index “#” when the values exceeds.

                        Equation_reply3

                        The minimum of the column DataCheck is the index you are looking for!  ( I think 🙂

                        You could also return the time column directly instead of the row index ‘#’.

                         

                      Viewing 10 posts - 1 through 10 (of 11 total)
                      • You must be logged in to reply to this topic.

                      DataGraph Forums Technical Support Support Desk Extract index from column value