<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Extracting peak readings from a data set in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Extracting-peak-readings-from-a-data-set/m-p/813954#M99578</link>
    <description>&lt;P&gt;Hi Ben, the points I'm after are the ones nearing the top of each graph. I'm looking to take the maximum response from each unit as the gas is applied so that I can model the degradation over time. Ideally looking something like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AvgLlama27_0-1732022367399.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/70390i6DBB417F528414C8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AvgLlama27_0-1732022367399.png" alt="AvgLlama27_0-1732022367399.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;That could work! Is there an easy way to "e&lt;SPAN&gt;xtract the max value per time" in a formula column?&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 19 Nov 2024 13:31:04 GMT</pubDate>
    <dc:creator>AvgLlama27</dc:creator>
    <dc:date>2024-11-19T13:31:04Z</dc:date>
    <item>
      <title>Extracting peak readings from a data set</title>
      <link>https://community.jmp.com/t5/Discussions/Extracting-peak-readings-from-a-data-set/m-p/813901#M99569</link>
      <description>&lt;P&gt;I am currently running a longevity test with four units which are responding to an application of gas periodically (although the intervals between the gas applications are not consistent!). I have plotted the data into the graph below:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AvgLlama27_0-1732010325749.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/70383i00C4219B583742FC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AvgLlama27_0-1732010325749.png" alt="AvgLlama27_0-1732010325749.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Does anyone know of a way in which I can filter the peak readings so I can show a trend line and proceed with further analysis? Most of the data points are nearing the minimum readings of each unit, therefore any line of fit for the data set appear right at the bottom of the graph:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AvgLlama27_1-1732010605768.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/70384i3D58B886CEC0BCCA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AvgLlama27_1-1732010605768.png" alt="AvgLlama27_1-1732010605768.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I am able to do this manually, however as this needs to be repeated throughout the test it can get quite tedious. Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2024 13:44:06 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Extracting-peak-readings-from-a-data-set/m-p/813901#M99569</guid>
      <dc:creator>AvgLlama27</dc:creator>
      <dc:date>2024-11-19T13:44:06Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting peak readings from a data set</title>
      <link>https://community.jmp.com/t5/Discussions/Extracting-peak-readings-from-a-data-set/m-p/813929#M99574</link>
      <description>&lt;P&gt;What trend lines are you hoping to pick out? Obviously you have a lot of noise in the data, but I can see potentially some areas 'in the noise' that resembles a trend line. If you just want to pull out the maximum value (i.e. the top line) you could extract the max value per time? Another option could be to look at a Moving Average (&lt;A href="https://community.jmp.com/t5/Discussions/Moving-Average/td-p/87647" target="_blank"&gt;https://community.jmp.com/t5/Discussions/Moving-Average/td-p/87647&lt;/A&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2024 12:52:19 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Extracting-peak-readings-from-a-data-set/m-p/813929#M99574</guid>
      <dc:creator>Ben_BarrIngh</dc:creator>
      <dc:date>2024-11-19T12:52:19Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting peak readings from a data set</title>
      <link>https://community.jmp.com/t5/Discussions/Extracting-peak-readings-from-a-data-set/m-p/813954#M99578</link>
      <description>&lt;P&gt;Hi Ben, the points I'm after are the ones nearing the top of each graph. I'm looking to take the maximum response from each unit as the gas is applied so that I can model the degradation over time. Ideally looking something like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AvgLlama27_0-1732022367399.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/70390i6DBB417F528414C8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AvgLlama27_0-1732022367399.png" alt="AvgLlama27_0-1732022367399.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;That could work! Is there an easy way to "e&lt;SPAN&gt;xtract the max value per time" in a formula column?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2024 13:31:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Extracting-peak-readings-from-a-data-set/m-p/813954#M99578</guid>
      <dc:creator>AvgLlama27</dc:creator>
      <dc:date>2024-11-19T13:31:04Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting peak readings from a data set</title>
      <link>https://community.jmp.com/t5/Discussions/Extracting-peak-readings-from-a-data-set/m-p/813955#M99579</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/60571"&gt;@AvgLlama27&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you provide an example of your dataset to look at?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Ben&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2024 13:40:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Extracting-peak-readings-from-a-data-set/m-p/813955#M99579</guid>
      <dc:creator>Ben_BarrIngh</dc:creator>
      <dc:date>2024-11-19T13:40:30Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting peak readings from a data set</title>
      <link>https://community.jmp.com/t5/Discussions/Extracting-peak-readings-from-a-data-set/m-p/813957#M99581</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/51054"&gt;@Ben_BarrIngh&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have attached the data set to the original post.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Cameron&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2024 13:44:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Extracting-peak-readings-from-a-data-set/m-p/813957#M99581</guid>
      <dc:creator>AvgLlama27</dc:creator>
      <dc:date>2024-11-19T13:44:52Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting peak readings from a data set</title>
      <link>https://community.jmp.com/t5/Discussions/Extracting-peak-readings-from-a-data-set/m-p/814017#M99583</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/60571"&gt;@AvgLlama27&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I got some good success with the script attached - I don't think you could easily do this with a formula column. The script below works by:&lt;/P&gt;
&lt;P&gt;1) Taking 'Slices' of a set width (number of rows) per serial number - in the example below it samples 600 rows&lt;/P&gt;
&lt;P&gt;2) Find the maximum value for that 'slice'&lt;/P&gt;
&lt;P&gt;3) Store the maximum value alongside the first and last 'elapsed time' and 'time stamp' values for the first and last row.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You will have to adapt the 'windowsize' variable and mess around to find a good fit, but a quick go at 600 rows worked well.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Before&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ben_BarrIngh_1-1732026386334.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/70394iAB4CDBD9F7C0F876/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ben_BarrIngh_1-1732026386334.png" alt="Ben_BarrIngh_1-1732026386334.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ben_BarrIngh_0-1732026349556.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/70393iC824D4B189E11DD8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ben_BarrIngh_0-1732026349556.png" alt="Ben_BarrIngh_0-1732026349556.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;Ben&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// Get the current data table
dt = Current Data Table();

Windowsize = 600; //Set this to the 'width' you want to evaluate

// Initialize an empty table to store the results
dt_summary = New Table( "Summary Table",
    New Column( "Serial No", Character ),
    New Column( "Batch No", Numeric ),
    New Column( "Max Value", Numeric ),
    New Column( "Min Elapsed Time", Numeric ),
    New Column( "Max Elapsed Time", Numeric ),
    New Column( "Start Timestamp", "Numeric", "Nominal", Format("m/d/y h:m:s", 23, 0) ),
    New Column( "End Timestamp", "Numeric", "Nominal", Format("m/d/y h:m:s", 23, 0) )
);

// Iterate over unique "Serial No"/identifier column
serials = Associative Array( dt:SerialNo ) &amp;lt;&amp;lt; Get Keys();//removes duplicate values

//Run a loop to pull out the max row values for each 'window'
For( i = 1, i &amp;lt;= N Items( serials ), i++,
    serial = serials[i];
    
    // Get rows for the current Serial No
    rows = dt &amp;lt;&amp;lt; Get Rows Where( dt:SerialNo == serial );
    
    // Loop through every [windowsize] rows
    For( j = 1, j &amp;lt;= N Items( rows ), j += windowsize,
        // Determine the range of rows for the current batch
        batch_rows = rows[j :: Min( j + (windowsize-1), N Items( rows ) )];
        
        // Get the max value for this batch
        max_val = Max( dt:VOCVoltage[batch_rows] );
        
        // Get the range of 'Elapsed Time'
        min_elapsed_time = Min( dt:"Elapsed Time,hours"n[batch_rows] );
        max_elapsed_time = Max( dt:"Elapsed Time,hours"n[batch_rows] );
        
        // Get the start and end 'Timestamp'
        start_timestamp = dt:Timestamp[batch_rows[1]];
        end_timestamp = dt:Timestamp[batch_rows[N Items( batch_rows )]];
        
        // Add a row to the summary table
        dt_summary &amp;lt;&amp;lt; Add Rows( 1 );
        dt_summary:Serial No[N Row( dt_summary )] = serial;
        dt_summary:Batch No[N Row( dt_summary )] = Ceiling( j / windowsize );
        dt_summary:Max Value[N Row( dt_summary )] = max_val;
        dt_summary:Min Elapsed Time[N Row( dt_summary )] = min_elapsed_time;
        dt_summary:Max Elapsed Time[N Row( dt_summary )] = max_elapsed_time;
        dt_summary:Start Timestamp[N Row( dt_summary )] = start_timestamp ;
        dt_summary:End Timestamp[N Row( dt_summary )] = end_timestamp ;
    );
);

// Show the summary table
dt_summary &amp;lt;&amp;lt; Show Window;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 19 Nov 2024 14:26:45 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Extracting-peak-readings-from-a-data-set/m-p/814017#M99583</guid>
      <dc:creator>Ben_BarrIngh</dc:creator>
      <dc:date>2024-11-19T14:26:45Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting peak readings from a data set</title>
      <link>https://community.jmp.com/t5/Discussions/Extracting-peak-readings-from-a-data-set/m-p/814539#M99594</link>
      <description>&lt;P&gt;That works perfectly,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your help&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/51054"&gt;@Ben_BarrIngh&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Nov 2024 16:39:07 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Extracting-peak-readings-from-a-data-set/m-p/814539#M99594</guid>
      <dc:creator>AvgLlama27</dc:creator>
      <dc:date>2024-11-19T16:39:07Z</dc:date>
    </item>
  </channel>
</rss>

