<?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: JMP Workflow Challenge 1: Motif Extraction and Identification from Continuous Power Data in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/JMP-Workflow-Challenge-1-Motif-Extraction-and-Identification/m-p/477810#M72234</link>
    <description>&lt;P&gt;I have been thinking about my initial approach to this challenge and thought I could do it better so I have made a second attempt.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This time, I have defined several target shapes and then search through the data looking for regions where the shapes match reasonably well. My defined target shapes are:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ngambles_2-1649647745230.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/41646i4575510B90D576E1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ngambles_2-1649647745230.png" alt="ngambles_2-1649647745230.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This method requires fewer tuning parameters, and allows for more flexibility by allowing additional target shapes to be added easily.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have added a column (watts modified) that performs a linear extrapolation when the watts value drops out during a run.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have also added a column (Row State Formula) that automatically hides and excludes data points that are not associated with a motif ID.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my opinion, this is an improvement over my initial solution to the challenge.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This method identifies 41 runs from the "2022_03_28 Strava Sprinting Training Data Set 5 Runs.jmp" data set&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ngambles_3-1649648614234.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/41647iC4F5D812DF133750/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ngambles_3-1649648614234.png" alt="ngambles_3-1649648614234.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;The JSL code to process the Strava data is:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);
&lt;BR /&gt;// uncomment the following two lines if you have installed the Strava - Get Activities add-in and want to automatically download the Strava data prior to identifying motifs&lt;BR /&gt;// include("$ADDIN_HOME(com.caes.ngambles.strava-get-activities)\main.jsl");&lt;BR /&gt;// wait(0);&lt;BR /&gt;
dt = current data table();

// Find Regions that match target shapes
dt &amp;lt;&amp;lt; New Column( "Shape Match",
	Numeric,
	nominal,
	Formula(
		thresh = 12500;
		shapeList = {{221, 245, 289, 327, 374, 431, 477, 518, 535, 518, 491, 451, 401, 350, 304, 238, 178, 161, 156, 106, 96, 96, 87, 85, 81, 79, 76,
		74, 73, 72, 73, 72, 72, 72, 72, 72, 71, 70, 70, 70}, {306, 321, 347, 384, 429, 476, 515, 546, 579, 582, 576, 542, 489, 442, 375, 348, 295,
		275, 242, 185, 152, 121, 106, 98, 93, 89, 89, 85, 84, 83, 82, 82, 81, 80, 79, 79, 78, 78, 78, 78}, {357, 390, 401, 428, 475, 505, 558, 604,
		619, 634, 634, 625, 581, 530, 483, 444, 378, 357, 324, 282, 214, 186, 162, 153, 137, 132, 124, 109, 104, 97, 94, 90, 90, 89, 88, 87, 87, 85,
		85, 86}};
		minErr = Empty();
		For( k = 1, k &amp;lt;= N Items( shapeList ), k++,
			err = 0;
			For( n = 0, n &amp;lt; N Items( shapeList[k] ), n++,
				For( m = 1, m &amp;lt;= N Items( shapeList[k] ), m++,
					err += (:watts[(Row() + m) - n - 1] - shapeList[k][m]) ^ 2
				);
				err /= N Items( shapeList[k] ) - 1;
				minErr = Minimum( minErr, err );
			);
		);
		If( minErr &amp;lt;= thresh,
			flag = 1,
			flag = 0
		);
	)
);

// Run Region - helps clean up regions found by shape match
dt &amp;lt;&amp;lt; New Column( "Run Region",
	Numeric,
	"Continuous",
	Formula(
		regionCount = Summation( k = 0, 5, Lag( :Shape Match, k ) );
		If( regionCount &amp;lt; 6 &amp;amp; region Count &amp;gt; 0 &amp;amp; :Shape Match == 1,
			nearStart = 1,
			nearStart = 0
		);
		If( nearStart == 0,
			ans = :Shape Match;
			,
			ans = 0;
			If( :watts[row()] &amp;gt; 0 &amp;amp; :watts[row() +1] &amp;gt; 0,
				ans = :Shape Match;
			)
		);
		ans;
	)
);

// motif ID
dt &amp;lt;&amp;lt; New Column( "Motif ID",
	Numeric,
	Nominal,
	Formula( 
		mID = 0;
		For( k = 1, k &amp;lt;= Row(), k++,
			If( :Run Region[k - 1] == 0 &amp;amp; :Run Region[k] == 1,
				mID++		
			)
		);
		If( :Run Region == 1, mID );	
	)
);

// row state formula column
dt &amp;lt;&amp;lt; New Column("Row State Formula", 
	Row State, 
	Row State, 
	Formula(
		If(
			Is Missing(:Motif ID), 
			Row State() = Combine States(Hidden State(1), Excluded State(1)),
			Row State()		
		)		
	)		
);

// linear interpolation of zero values within motif ID
dt &amp;lt;&amp;lt; New Column( "watts modified",
	Numeric,
	Continuous,
	Formula(
		If( Is Missing( :Motif ID ),
			Empty(),
			If( :watts &amp;gt; 0,
				:watts,
				rb = Row();
				ra = Row();
				For( k = Row(), k &amp;gt;= 1, k--,
					If( :watts[k] != 0,
						rb = k;
						Break();
					)
				);
				For( k = Row(), k &amp;lt;= N Rows(), k++,
					If( :watts[k] != 0,
						ra = k;
						Break();
					)
				);
				deltaPower = :watts[rb] - :watts[ra];
				deltaTime = rb - ra;
				:watts[rb] + (deltaPower / deltaTime) * (Row() - rb); 
			)
		)
	)
);

// rank timestamp, Motif ID - x axis values to help graph each motif
dt &amp;lt;&amp;lt; New Column( "X",
	Numeric,
	Continuous,
	Formula( Col Rank( :timestamp, :Motif ID ) )
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 16 Apr 2022 03:22:14 GMT</pubDate>
    <dc:creator>ngambles</dc:creator>
    <dc:date>2022-04-16T03:22:14Z</dc:date>
    <item>
      <title>JMP Workflow Challenge 1: Motif Extraction and Identification from Continuous Power Data</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Workflow-Challenge-1-Motif-Extraction-and-Identification/m-p/470773#M71494</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PowerCurve.png" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/40910i1EEC00F02871B0D8/image-size/large?v=v2&amp;amp;px=999" role="button" title="PowerCurve.png" alt="PowerCurve.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Calling JMP workflow and JSL wizards. Here's a Thursday challenge for you. The attached data set is set of power data off my running power meter. What we want to do is identify and correctly tag the 8 motifs that occur during this ~1000 point signal data set attached to this post, create a new column with function ID and write it in a way that it can be used to automate the tagging of future data that follows this same envelope.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The data collection assumptions for this data set and the future are:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Prior to the start of a motif the power is 0.&lt;/LI&gt;
&lt;LI&gt;There is a period before and after the motifs that will be non-zero (warm-up and warm-down). This is not part of the system under test and should not be tagged.&lt;/LI&gt;
&lt;LI&gt;Each motif has an attack, sustain, decay and release. The shape of the function is identical from motif to motif. It goes from 0 to some peak over a period of samples and then ramps down to the baseline noise floor (walking power). The motif ID is over when the power reads 0 again.&lt;/LI&gt;
&lt;LI&gt;There will be an unknown number of functions to identify in the future. There are 8 in the data set. The solution needs to be invariant to that.&lt;/LI&gt;
&lt;LI&gt;The overall length of the functions as well as the peak can vary.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;We are working on the left edge of the &lt;A href="http://jmp.com/workflow" target="_self"&gt;analytic workflow&lt;/A&gt; today (shown in green below). The data comes from a file (.csv), and eventually when we automated this workflow a folder of&amp;nbsp;&lt;EM&gt;n&amp;nbsp;&lt;/EM&gt;.csv files. The Data Access is being used, and what the task is today is to perform the Data Blending and Cleaning tasks on this example file to have the data ready to expand the workflow to other analytic capabilities in the future.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DataWorkflowChallenge.png" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/40915iE2106EB3872C0C44/image-size/large?v=v2&amp;amp;px=999" role="button" title="DataWorkflowChallenge.png" alt="DataWorkflowChallenge.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Leave your solutions in the comments.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 18:13:33 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Workflow-Challenge-1-Motif-Extraction-and-Identification/m-p/470773#M71494</guid>
      <dc:creator>Daniel_Valente</dc:creator>
      <dc:date>2023-06-09T18:13:33Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Workflow Challenge 1: Motif Extraction and Identification from Continuous Power Data</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Workflow-Challenge-1-Motif-Extraction-and-Identification/m-p/470959#M71522</link>
      <description>&lt;P&gt;It is surprising how far you can get with a single formula column:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt &amp;lt;&amp;lt; new column("Motif ID", nominal, formula(Col Cumulative Sum(
	Row() &amp;gt; 6 &amp;amp; Summation( i = 1, 6, Abs( Lag( :power, i ) ) ) == 0 &amp;amp; :power != 0
)));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;However, there is still some cleanup to do... this approach creates a "0" group ID, which is the leading data, and does not cut off the last motif where we'd like. The "6" in the summation is because I designate a new group if at least 6 consecutive zeros are encountered prior to a power change.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are of course many other ways to do this that are more sophisticated, involving comparisons to the background floors, attacks/decays, etc... but if a simple approach like this one works, great.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The script below incorporates this idea, but cleans up the dataset, as well. Ideally the values in the last few lines would be parameterized.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);

dt = current data table();

dtSub = dt &amp;lt;&amp;lt; subset(selected rows(0), selected columns(0));

//create ID column
dtSub &amp;lt;&amp;lt; new column("Motif ID", nominal, formula(Col Cumulative Sum(
	Row() &amp;gt; 6 &amp;amp; Summation( i = 1, 6, Abs( Lag( :power, i ) ) ) == 0 &amp;amp; :power != 0
)));
dtSub:MotifID &amp;lt;&amp;lt; delete formula;

//the next 2 loops truncate the dataset, assuming it ends like the sample dataset ended.
for(i  = nrow(dtSub), abs(dtSub:power[i] - dtSub:power[i-1]) &amp;lt; 20, i--,
	dtSub &amp;lt;&amp;lt; Delete Rows(i)
);

for(i  = nrow(dtSub), abs(dtSub:power[i] - dtSub:power[i-1]) &amp;gt; 5, i--,
	dtSub &amp;lt;&amp;lt; Delete Rows(i)
);

//delete ID 0 group
dtSub &amp;lt;&amp;lt; select where(:Motif ID == 0) &amp;lt;&amp;lt; delete rows;

//delete 0 power rows, but not when they lie within a group
i = nrow(dtSub)-1;
while (i &amp;gt; 1,
	if(dtSub:Motif ID[i] &amp;lt; dtSub:MotifID[i+1] &amp;amp; dtSub:power[i] == 0,
		while( dtSub:power[i] == 0,
			dtSub &amp;lt;&amp;lt; delete rows(i--);
		)
	);
	i--
);
	&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="brady_brady_0-1647542630658.png" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/40921i659695AB995E1AD3/image-size/large?v=v2&amp;amp;px=999" role="button" title="brady_brady_0-1647542630658.png" alt="brady_brady_0-1647542630658.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Mar 2022 18:45:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Workflow-Challenge-1-Motif-Extraction-and-Identification/m-p/470959#M71522</guid>
      <dc:creator>brady_brady</dc:creator>
      <dc:date>2022-03-17T18:45:54Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Workflow Challenge 1: Motif Extraction and Identification from Continuous Power Data</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Workflow-Challenge-1-Motif-Extraction-and-Identification/m-p/471024#M71533</link>
      <description>Nice, Brady! Great work. It’s interesting that there is some data quality problems, too, I can fit a peak model to smooth that out. Maybe those could be marked as missing because they are not really 0, or interpolated?</description>
      <pubDate>Thu, 17 Mar 2022 21:59:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Workflow-Challenge-1-Motif-Extraction-and-Identification/m-p/471024#M71533</guid>
      <dc:creator>Daniel_Valente</dc:creator>
      <dc:date>2022-03-17T21:59:56Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Workflow Challenge 1: Motif Extraction and Identification from Continuous Power Data</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Workflow-Challenge-1-Motif-Extraction-and-Identification/m-p/471229#M71553</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/3552"&gt;@brady_brady&lt;/a&gt;&amp;nbsp;That's a pretty slick method for solving the problem.&lt;/P&gt;
&lt;P&gt;I did it with three simple column formulas.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Byron_JMP_0-1647612669075.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/40949i536102928065B561/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Byron_JMP_0-1647612669075.png" alt="Byron_JMP_0-1647612669075.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;new column("time point", formula(If( Row() == 1,
	1,
	If( :power == 0 &amp;amp; Lag( :time point, 1 ) &amp;lt;= 50,
		Lag( :time point, 1 ) + 1,
		If( :power == 0,
			1,
			Lag( :time point, 1 ) + 1
		)
	)
)));

new column("segments", formula(
If(
	Row() == 1, 0,
	:time point == 1, Lag( :segments, 1 ) + 1,
	Lag( :segments, 1 )
)));


new column("cycle", formula(
If( :time point &amp;gt; 70 | :segments == 0,
	.,
	:segments
)));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 Mar 2022 14:16:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Workflow-Challenge-1-Motif-Extraction-and-Identification/m-p/471229#M71553</guid>
      <dc:creator>Byron_JMP</dc:creator>
      <dc:date>2022-03-18T14:16:54Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Workflow Challenge 1: Motif Extraction and Identification from Continuous Power Data</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Workflow-Challenge-1-Motif-Extraction-and-Identification/m-p/471234#M71555</link>
      <description>&lt;P&gt;Uh oh! Problem when I am trying to scale this. We now have two days of data. Ran Brady's script to identify hopefully 16 Motifs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have new data coming in now and ran the script&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/3552"&gt;@brady_brady&lt;/a&gt;&amp;nbsp;wrote. Correctly identified 16 motifs. But there is some oddity in the 8th one now. Looks like the algorithm is confused by the new data. I do have the time stamp, maybe that could help in making this scale?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Warmup Of 2nd Day Problem.png" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/40950i132E229EB3E4BB5A/image-size/large?v=v2&amp;amp;px=999" role="button" title="Warmup Of 2nd Day Problem.png" alt="Warmup Of 2nd Day Problem.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2days of Power.png" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/40951iBC04B9F9C3D6E826/image-size/large?v=v2&amp;amp;px=999" role="button" title="2days of Power.png" alt="2days of Power.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Off to try&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/4386"&gt;@Byron_JMP&lt;/a&gt;&amp;nbsp;'s solution.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2022 14:38:09 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Workflow-Challenge-1-Motif-Extraction-and-Identification/m-p/471234#M71555</guid>
      <dc:creator>Daniel_Valente</dc:creator>
      <dc:date>2022-03-18T14:38:09Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Workflow Challenge 1: Motif Extraction and Identification from Continuous Power Data</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Workflow-Challenge-1-Motif-Extraction-and-Identification/m-p/471236#M71556</link>
      <description>&lt;P&gt;Ooo! Nice&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/4386"&gt;@Byron_JMP&lt;/a&gt;&amp;nbsp;. I like the formula column solution. Just tried to scale it. It fails in a different way than&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/3552"&gt;@brady_brady&lt;/a&gt;&amp;nbsp;'s solution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Motif 9 looks a little suspect...&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2daysPowerByron.png" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/40952iDA9AE30DBD220580/image-size/large?v=v2&amp;amp;px=999" role="button" title="2daysPowerByron.png" alt="2daysPowerByron.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2022 14:42:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Workflow-Challenge-1-Motif-Extraction-and-Identification/m-p/471236#M71556</guid>
      <dc:creator>Daniel_Valente</dc:creator>
      <dc:date>2022-03-18T14:42:47Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Workflow Challenge 1: Motif Extraction and Identification from Continuous Power Data</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Workflow-Challenge-1-Motif-Extraction-and-Identification/m-p/471266#M71560</link>
      <description>&lt;P&gt;Here it is with the third file concatenated with&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/4386"&gt;@Byron_JMP&lt;/a&gt;&amp;nbsp;'s script. Looks like the same thing occurs. We're tagging part of the area to exclude as a motif. Good thing is that it seems to fail in the same spot or using the same failure mode. You can see it in the cycle group 9 and 18 and also in the sample/power plot.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="3files.png" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/40954i6D4A42022F5A1DEE/image-size/large?v=v2&amp;amp;px=999" role="button" title="3files.png" alt="3files.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="TimeSeriew9and18.png" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/40955i37B7CCA40A23708F/image-size/large?v=v2&amp;amp;px=999" role="button" title="TimeSeriew9and18.png" alt="TimeSeriew9and18.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2022 17:16:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Workflow-Challenge-1-Motif-Extraction-and-Identification/m-p/471266#M71560</guid>
      <dc:creator>Daniel_Valente</dc:creator>
      <dc:date>2022-03-18T17:16:30Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Workflow Challenge 1: Motif Extraction and Identification from Continuous Power Data</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Workflow-Challenge-1-Motif-Extraction-and-Identification/m-p/471291#M71563</link>
      <description>&lt;P&gt;Assumptions matter. What are you willing to assume about the data? There's where your issues will lie.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) how many cooldown/warmups are possible? Do you know the mean power for these? Does it vary?&lt;/P&gt;
&lt;P&gt;2) Motifs can vary in length... will they, however, always be of similar length, whatever that is? In the sample data thus far, this has been the case... will it remain the case going forward?&lt;/P&gt;
&lt;P&gt;3) What about zeros? Should they be included as the leading part of the motif, or not? All of them, a certain number of them, none of them?&lt;/P&gt;
&lt;P&gt;4) What about zeros that occur mid-motif? Are these legitimate? What about non-zero points mid-motif? How can we tell whether these are legitmate? Should we try?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;etc.etc.etc&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;Brady&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2022 18:17:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Workflow-Challenge-1-Motif-Extraction-and-Identification/m-p/471291#M71563</guid>
      <dc:creator>brady_brady</dc:creator>
      <dc:date>2022-03-18T18:17:38Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Workflow Challenge 1: Motif Extraction and Identification from Continuous Power Data</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Workflow-Challenge-1-Motif-Extraction-and-Identification/m-p/471312#M71566</link>
      <description>&lt;P&gt;I have done something a bit similar at work where I was counting temperature cycles for thermal shock oven. I think in that case I did it with couple of different formula columns, I'll have to take a look at the code at work and see if it could be modified for this case.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I remember correctly my idea was to detect "start point" of the cycle (0 power in this case and get last value of those), then check that there are enough values which are over some threshold (here it could be 5 values over 350) and after that check where cycle ends (flat part with ~20 values between 80-100). And then have some running variables (motid_id, cycle_ongoing, ...) which I would increase and reset as needed.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2022 18:26:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Workflow-Challenge-1-Motif-Extraction-and-Identification/m-p/471312#M71566</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2022-03-18T18:26:28Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Workflow Challenge 1: Motif Extraction and Identification from Continuous Power Data</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Workflow-Challenge-1-Motif-Extraction-and-Identification/m-p/471317#M71569</link>
      <description>&lt;P&gt;I changed the simple column formula approach to include an AI model, so now the table has one fantastically complex formula along with some simpler ones.&lt;/P&gt;
&lt;P&gt;The attached script add columns and a graph. The model scores the curve segments as signal or noise.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm interested to see how it will score a unique data set.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Byron_JMP_0-1647633910417.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/40957iB21AC87DA8611881/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Byron_JMP_0-1647633910417.png" alt="Byron_JMP_0-1647633910417.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2022 20:09:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Workflow-Challenge-1-Motif-Extraction-and-Identification/m-p/471317#M71569</guid>
      <dc:creator>Byron_JMP</dc:creator>
      <dc:date>2022-03-18T20:09:41Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Workflow Challenge 1: Motif Extraction and Identification from Continuous Power Data</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Workflow-Challenge-1-Motif-Extraction-and-Identification/m-p/471319#M71570</link>
      <description>&lt;P&gt;Hmm. Good questions. Always good to explore assumptions when thinking about a data problem. And also ask the people who own the system that is generating the data!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) Only one cooldown warmup per session. Warmup doesn't really vary that much. Mean is like ~250 +-30 watts unless I've had a few cups of coffee...&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="WarmupDistribution.png" style="width: 199px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/40958i06C070AAC1154F2C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="WarmupDistribution.png" alt="WarmupDistribution.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;2) As you can see I really can only hold my top speed for 6-10 seconds and then the power starts dropping. Maybe in the future they will be longer/wider. We'll have to explore that.&lt;/P&gt;
&lt;P&gt;3) Zeros after the walking period shouldn't be included. They are a reset period. It's largely 0 watts prep from start. Sprint for a period of time. Slow down to a stop. Walk back. Return to zero for the set of the next interval.&lt;/P&gt;
&lt;P&gt;4) Zeros during the motif are bad data and should be interpolated. I've not stopped. It's just that the sensor has dropped out. They should be fixed, marked as missing or interpolated through otherwise I could see it causing some issues with the subsequent analysis.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2022 20:46:42 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Workflow-Challenge-1-Motif-Extraction-and-Identification/m-p/471319#M71570</guid>
      <dc:creator>Daniel_Valente</dc:creator>
      <dc:date>2022-03-18T20:46:42Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Workflow Challenge 1: Motif Extraction and Identification from Continuous Power Data</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Workflow-Challenge-1-Motif-Extraction-and-Identification/m-p/471320#M71571</link>
      <description>&lt;P&gt;Nice! That sounds like a good solution too. Post the JSL if you can dig it up and we'll try it.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2022 20:47:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Workflow-Challenge-1-Motif-Extraction-and-Identification/m-p/471320#M71571</guid>
      <dc:creator>Daniel_Valente</dc:creator>
      <dc:date>2022-03-18T20:47:38Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Workflow Challenge 1: Motif Extraction and Identification from Continuous Power Data</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Workflow-Challenge-1-Motif-Extraction-and-Identification/m-p/471322#M71572</link>
      <description>&lt;P&gt;Nice, Byron -- this looks pretty good. It's picking out those two noise curves. I'll collect some additional data over the weekend and see how it fairs.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ByronExample2.png" style="width: 982px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/40959iBE3EF16538E1F6D5/image-size/large?v=v2&amp;amp;px=999" role="button" title="ByronExample2.png" alt="ByronExample2.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2022 20:49:42 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Workflow-Challenge-1-Motif-Extraction-and-Identification/m-p/471322#M71572</guid>
      <dc:creator>Daniel_Valente</dc:creator>
      <dc:date>2022-03-18T20:49:42Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Workflow Challenge 1: Motif Extraction and Identification from Continuous Power Data</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Workflow-Challenge-1-Motif-Extraction-and-Identification/m-p/471400#M71582</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/260"&gt;@Daniel_Valente&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my attempt at the challenge.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My approach is to identify features at the beginning and end of the motif, identify the entire run region (between the beginning and the end), then assign a motif ID to each.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my code for the column formulas that I used:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);

dt = current data table();

// date from time stamp
dt &amp;lt;&amp;lt; New Column( "Date[timestamp]",
	Numeric,
	Nominal,
	Format( "yyyy-mm-dd", 19 ),
	Input Format( "yyyy-mm-dd" ),
	Formula( :timestamp - Time Of Day( :timestamp ) )
);

// rate of change
dt &amp;lt;&amp;lt; New Column( "rate of change",
	Numeric,
	Continuous,
	Formula(
		Col Moving Average(
			Dif( 
				Col Moving Average(
					:power / Col Maximum( :power, :Name( "Date[timestamp]" ) ),
					0.6,
					5,
					5,
					Empty(),
					:Name( "Date[timestamp]" )
				)
			) 	
			,
			0.95,
			5,
			5,
			Empty(),
			:Name( "Date[timestamp]" )
		)
	)
);

// Start point
dt &amp;lt;&amp;lt; New Column( "Start Point",
	Numeric,
	Continuous,
	Formula( 
		If( Row() == 1,
			0,
			checkZero = 1 * (:power[Row()] &amp;gt; 0 &amp;amp; :power[Row() - 1] == 0);
			foundPeak = 0;
			For( k = Row() + 1, k &amp;lt;= N Rows(), k++,
				If( :power[k] &amp;gt; Col Quantile( :power, 0.93, :Name( "Date[timestamp]" ) ),
					foundPeak = 1;
					Break();
				);
				If( :power[k] == 0, Break() );
			);
			If( checkZero == 1 &amp;amp; foundPeak == 1,
				1,
				0
			);
		)
	)
);

// steady state
dt &amp;lt;&amp;lt; New Column( "Steady State",
	Numeric,
	Continuous,
	Formula(
		ans = 1;
		For( k = 0, k &amp;lt;= 10, k++,
			ans = Minimum(
				ans,
				1 * (:rate of change[Row() - k] &amp;lt; 0.003 &amp;amp;
				:rate of change[Row() - k] &amp;gt; -0.003)
			)
		);
		ans;
	)
);

// Run Region
dt &amp;lt;&amp;lt; New Column( "Run Region",
	Numeric,
	Continuous,
	Format( "Best", 12 ),
	Formula(
		ans = 0;
		For( k = Row(), k &amp;gt;= 1, k--,
			If( :Start Point[k] == 1,
				ans = 1;
				Break();
			);
			If( :Steady State[k] == 0 &amp;amp; :Steady State[k - 1] == 1,
				ans = 0;
				Break();
			);
		);
		ans;
	)
);

// motif ID
dt &amp;lt;&amp;lt; New Column( "Motif ID",
	Numeric,
	Nominal,
	Formula( 
		If( 
			:Run Region == 1,
			Col Cumulative Sum( :Start Point ) 		
		)		
	)
);

// rank timestamp, Motif ID - helps plot each motif
dt &amp;lt;&amp;lt; New Column( "Rank[timestamp]",
	Numeric,
	Continuous,
	Formula( Col Rank( :timestamp, :Motif ID ) )
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 19 Mar 2022 11:18:36 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Workflow-Challenge-1-Motif-Extraction-and-Identification/m-p/471400#M71582</guid>
      <dc:creator>ngambles</dc:creator>
      <dc:date>2022-03-19T11:18:36Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Workflow Challenge 1: Motif Extraction and Identification from Continuous Power Data</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Workflow-Challenge-1-Motif-Extraction-and-Identification/m-p/471401#M71583</link>
      <description>&lt;P&gt;This is a really nice solution. I posted the output on &lt;A href="http://jmp.com/public" target="_self"&gt;JMP Public&lt;/A&gt; with a Local Data Filter to look at the new data set, the three training runs and your feature column of binary steady state:&lt;/P&gt;
&lt;P&gt;&lt;IFRAME src="https://public.jmp.com/packages/MpMc23YyP2hFL6Whr8hfJ/embed" width="1100" height="1100" class="jmp-live-iframe"&gt;&lt;/IFRAME&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 19 Mar 2022 12:51:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Workflow-Challenge-1-Motif-Extraction-and-Identification/m-p/471401#M71583</guid>
      <dc:creator>Daniel_Valente</dc:creator>
      <dc:date>2022-03-19T12:51:53Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Workflow Challenge 1: Motif Extraction and Identification from Continuous Power Data</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Workflow-Challenge-1-Motif-Extraction-and-Identification/m-p/471403#M71585</link>
      <description>&lt;P&gt;Here are all the solutions so far on &lt;A href="http://jmp.com/public" target="_self"&gt;JMP Public:&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE class="jmp-live-card" style="padding-bottom: 0.6em; overflow: hidden;"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;DIV class="j-card-art" style="display: block !important; min-width: 120px; min-height: 75px; border: 1px solid #eeeeee;"&gt;&lt;A class="j-card-art-a" style="background-color: white;" href="https://public.jmp.com/packages/JMP-Workflow-Challenge-1-Motif-Extractio/js-p/s82Hzjd151Z8PMPvdHz26" target="_blank"&gt;&lt;IMG style="margin: 0px auto; line-height: 0; vertical-align: middle; min-height: 75px;" class="j-card-img" src="https://public.jmp.com/packages/djZHm3bFsJKKBnBz4qWMw/thumbnail/1647695000901" border="0" width="120" /&gt;&lt;/A&gt;&lt;/DIV&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;TABLE style="padding-left: 0.8em; font-family: Avenir, Arial, Helvetica, sans-serif; max-width: 400px;"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;H1 class="j-card-title" style="margin-bottom: 3px; margin-top: 0px; font-size: 16px; font-weight: bold; line-height: 20px; font-family: inherit; overflow: hidden;"&gt;&lt;A class="j-card-title-link" style="text-decoration: none; color: #325d81; font-family: inherit; overflow: hidden;" href="https://public.jmp.com/packages/JMP-Workflow-Challenge-1-Motif-Extractio/js-p/s82Hzjd151Z8PMPvdHz26" target="_blank"&gt; JMP Workflow Challenge 1: Motif Extraction and Identification from Continuous Power Data &lt;/A&gt;&lt;/H1&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;A class="j-card-action" style="display: block; font-size: 13px; font-weight: bold; line-height: 20px; color: #1a95b3; text-decoration: none; font-family: inherit;" href="https://public.jmp.com/packages/JMP-Workflow-Challenge-1-Motif-Extractio/js-p/s82Hzjd151Z8PMPvdHz26" target="_blank"&gt; View this at public.jmp.com &lt;/A&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
      <pubDate>Sat, 19 Mar 2022 13:04:39 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Workflow-Challenge-1-Motif-Extraction-and-Identification/m-p/471403#M71585</guid>
      <dc:creator>Daniel_Valente</dc:creator>
      <dc:date>2022-03-19T13:04:39Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Workflow Challenge 1: Motif Extraction and Identification from Continuous Power Data</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Workflow-Challenge-1-Motif-Extraction-and-Identification/m-p/471477#M71598</link>
      <description>&lt;P&gt;Here is another approach with interpolation of the dropouts, using some (relatively simple) formula columns, many of which could be eliminated by using a more complex interpolation formula, at the expense of easy troubleshooting and formula-writing. (See attached table for formulas and graph scripts)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The results seems consistent with what we want, at least in the sample dataset: (red points will be dropped)&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="brady_brady_0-1647789721015.png" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/40979iE98634CA24CE308E/image-size/large?v=v2&amp;amp;px=999" role="button" title="brady_brady_0-1647789721015.png" alt="brady_brady_0-1647789721015.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="brady_brady_5-1647795373082.png" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/40984iDA97618FA5942981/image-size/large?v=v2&amp;amp;px=999" role="button" title="brady_brady_5-1647795373082.png" alt="brady_brady_5-1647795373082.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is how it works so you can judge whether the assumptions made hold for your data:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First, interpolation of the zeros occurring due to "dropouts". Linear interpolation was chosen; splines and quadratics were considered but the results were inferior to my eye.&lt;/P&gt;
&lt;P&gt;Note the "Cum Zeros Behind" through "Interpolated Power" columns in rows 4-6 below.&lt;/P&gt;
&lt;P&gt;"Cum Zeros Behind" is an inclusive lookback for zeros.&lt;/P&gt;
&lt;P&gt;"Cum Zeros Ahead" is an inclusive look-ahead for zeros.&lt;/P&gt;
&lt;P&gt;"Zero Block" is the number of contiguous zeros in the block.&lt;/P&gt;
&lt;P&gt;"Groups for Zeros" starts at 1 and increases whenever a new group of zeros occurs&lt;/P&gt;
&lt;P&gt;Interpolation occurs when there is a short (fewer than 7) block of zeros, not starting on row 1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;****Note: In the sample data, the longest case of interpolation spanned 4 zeros, while the shortest "true" break between intervals was 7 zeros. This is a pretty slim margin for error, and is a possibly significant drawback of this approach. It is important that the shortest "true" break be longer than the longest "dropout".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As mentioned previously, you don't need most of these columns, although the formula for the interpolation will grow much uglier without them, and troubleshooting will be (much) more difficult.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="brady_brady_4-1647795316176.png" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/40983i80BB4B55DEF6ED15/image-size/large?v=v2&amp;amp;px=999" role="button" title="brady_brady_4-1647795316176.png" alt="brady_brady_4-1647795316176.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After interpolation, only blocks of at least 7 consecutive zeros remain in the data (zeros possibly occurring in the first few rows excepted.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The "Interval" column groups the data. It starts at 1 and increments whenever:&lt;/P&gt;
&lt;P&gt;-the timestamp changes by more than 100, or&lt;/P&gt;
&lt;P&gt;-interpolated power moves from 0 to some nonzero value&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The "Post-spike" column is a flag that sets during power's ramp-down from the spike to steady(ish) state.&lt;/P&gt;
&lt;P&gt;It is (re)set to zero:&lt;/P&gt;
&lt;P&gt;- at row 1&lt;/P&gt;
&lt;P&gt;- whenever the interval column changes&lt;/P&gt;
&lt;P&gt;- whenever a new block of zeros occurs&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It sets to 1 whenever interpolated power moves from some value above 90 to some power less than or equal to 90. Based on the data in the sample this seemed reasonable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="brady_brady_3-1647792312132.png" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/40982iD2BB2F3EEF2D6205/image-size/large?v=v2&amp;amp;px=999" role="button" title="brady_brady_3-1647792312132.png" alt="brady_brady_3-1647792312132.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We can now decide which data to ignore--the purpose of the "Ignore" column. We ignore data when any of the following are true:&lt;/P&gt;
&lt;P&gt;- The maximum over the interval is &amp;lt; 400. (This is the "background noise"). Again, based on the provided data.&lt;/P&gt;
&lt;P&gt;- Interpolated power moves above 100, post-spike. (Indicating we've moved into "background noise", rather than ramping down towards 0)&lt;/P&gt;
&lt;P&gt;- Interpolated power is 0&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"Final Power" is the same as "Interpolated Power", but set to missing when "Ignore" == 1.&lt;/P&gt;
&lt;P&gt;"Interval Time" computes time relative to the interval (i.e., starts at 0 and increments from there). Like "Final Power", it is set to missing whenever "Ignore" == 1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I did not disable formula evaluations and subset out the non-ignored data, but this is a likely next step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It will be interesting to see how Dan breaks this next ;)&lt;/img&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;Brady&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 20 Mar 2022 17:14:26 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Workflow-Challenge-1-Motif-Extraction-and-Identification/m-p/471477#M71598</guid>
      <dc:creator>brady_brady</dc:creator>
      <dc:date>2022-03-20T17:14:26Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Workflow Challenge 1: Motif Extraction and Identification from Continuous Power Data</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Workflow-Challenge-1-Motif-Extraction-and-Identification/m-p/471481#M71599</link>
      <description>&lt;P&gt;Nice, Brady.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good point about some of the pretty short times from the start of an interval vs. a drop-out. The drop-outs do seem to be 2-3 seconds, max, however. We will see how this holds with new data being collected this week.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Attached is some additional training data. This is about 1:40 of very steady state running, but at more of a rac -pace (nearly 100% of my critical power). It might help&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/4386"&gt;@Byron_JMP&lt;/a&gt;&amp;nbsp;, though, with his ML model. Maybe add a feature to this training data set to bring it closer to the warm-up/warm-down range?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also who wants to tackle getting the data directly through the Strava API using HTTP Request (); in JMP? I know&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/15921"&gt;@dieterpisot&lt;/a&gt; has done this before. I can tag the workouts with something like sprints so that the data pull can be easily retrieved through the API.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="TrainingData.png" style="width: 924px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/40985iAA30555EB6B808A9/image-size/large?v=v2&amp;amp;px=999" role="button" title="TrainingData.png" alt="TrainingData.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 20 Mar 2022 18:42:21 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Workflow-Challenge-1-Motif-Extraction-and-Identification/m-p/471481#M71599</guid>
      <dc:creator>Daniel_Valente</dc:creator>
      <dc:date>2022-03-20T18:42:21Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Workflow Challenge 1: Motif Extraction and Identification from Continuous Power Data</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Workflow-Challenge-1-Motif-Extraction-and-Identification/m-p/473613#M71826</link>
      <description>&lt;P&gt;I took a shot a getting data straight from the Strava API. I am successfully getting several measurements including distance, velocity, longitude, latitude, altitude, and grade. However I am not getting power. I suspect that this may be due to my Strava account and/or my lack of equipment for measuring power. This solution may or may not be what is needed for someone with power information in their Strava account, but if it's not correct, I can't imagine that I'm too far off.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To get started with the Strava API, this &lt;A href="https://www.youtube.com/watch?v=sgscChKfGyg" target="_self"&gt;youtube&lt;/A&gt; video was very helpful and it clearly demonstrates the steps to get your access token, which is required before this code will get any data from Strava. In the code below, replace your_access_token_here with your actual access token, once you have it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);

accessToken = "your_access_token_here";							// access token from the Strava API
																// helpful link to get started with the API: https://www.youtube.com/watch?v=sgscChKfGyg
//////////////////////////////////////////
//////////////////////////////////////////
// get list of activities from Strava
s = New HTTP Request(
	URL( "https://www.strava.com/api/v3/athlete/activities?access_token=" || accessToken ),
	Method( "GET" ),
	Headers( {"Accept: application/json"} )
) &amp;lt;&amp;lt; Send;
dtx = json to data table(s);
dtx &amp;lt;&amp;lt; set name("Activities List");
// keep only activities marked as sprint
r = dtx &amp;lt;&amp;lt; get rows where(
	!contains(lowercase(:name), "sprint")
);
dtx &amp;lt;&amp;lt; delete rows(r);
if( n rows(dtx) == 0,
	close(dtx, no save);
	throw();
);
// get list of unique activity ids
summarize( activityList = by(dtx:id));
// get and combine the data streams from each activity
dty = new table();
dty &amp;lt;&amp;lt; set name("Strava Data_temp");
for( k = 1, k &amp;lt;= n items(activityList), k++,
	actStream = New HTTP Request(
		URL( "https://www.strava.com/api/v3/activities/" || activityList[k] || "/streams?keys=latlng,watts,distance,velocity,altitude,velocity_smooth,cadence,temp,moving,grade_smooth&amp;amp;access_token=" || accessToken ),
		Method( "GET" ),
		Headers( {"Accept: application/json"} )
	) &amp;lt;&amp;lt; Send;
	dtz = json to data table(actStream);
	dtz &amp;lt;&amp;lt; new column("Activity ID", numeric, nominal, set each value(num(activityList[k])));
	dty &amp;lt;&amp;lt; concatenate(dtz, append to first table);
	close(dtz, no save);
);
// add rank column for x value
dty &amp;lt;&amp;lt; New Column( "x",
	Numeric,
	"Continuous",
	Formula( Col Rank( :Activity ID, :type, :Activity ID ) )
);
// split up latitude and longitude pairs
myCount = 0;
for( k = 1, k &amp;lt;= n rows(dty), k++,
	if( dty:type[k] != "latlng",
		dty:type[k] = dty:type[k]
		,
		myCount ++;
		if( modulo(myCount,2) == 0,
			dty:type[k] = "lat",
			dty:type[k] = "lng"
		)
	);
);
// split tall table to wider table
dt = dty &amp;lt;&amp;lt; Split(
	Split By( :type ),
	Split( :data ),
	Group( :x, :Activity ID ),
	Remaining Columns( Drop All ),
	Sort by Column Property
);
// done with this data table
close(dty, no save);
// update start time from activities table
dt &amp;lt;&amp;lt; Update(
	With( dtx ),
	Match Columns( :Activity ID = :id ),
	Add Columns from Update Table( :start_date, :name ),
	Replace Columns in Main Table( :start_date, :name )
);
// close activity list
close(dtx, no save);
// clean up time stamp
dt &amp;lt;&amp;lt; Begin Data Update;
dt &amp;lt;&amp;lt; Recode Column(
	dt:start_date,
	{Regex( _rcNow, ".*^(.*)Z.*", "\1", GLOBALREPLACE )},
	Target Column( :start_date )
);
dt &amp;lt;&amp;lt; End Data Update;
dt:start_date &amp;lt;&amp;lt; data type(numeric) &amp;lt;&amp;lt; Format( "yyyy-mm-ddThh:mm:ss", 19, 0 ) &amp;lt;&amp;lt; Input Format( "yyyy-mm-ddThh:mm:ss", 0 );
dt &amp;lt;&amp;lt; New Column( "timestamp",
	Numeric,
	"Continuous",
	Format( "yyyy-mm-ddThh:mm:ss", 19, 0 ),
	Input Format( "yyyy-mm-ddThh:mm:ss", 0 ),
	Formula( (:start_date + :x) - 1 )
);
wait(0);
dt:timestamp &amp;lt;&amp;lt; delete formula;
dt &amp;lt;&amp;lt; delete column("start_date");
// arrange columns
dt &amp;lt;&amp;lt; Move Selected Columns( {:timestamp}, To first );
dt &amp;lt;&amp;lt; Move Selected Columns( {:Activity ID, :name}, after(:timestamp) );
// set name
dt &amp;lt;&amp;lt; set name("Strava Data");
// sort chronologically
dt &amp;lt;&amp;lt; Sort( By( :timestamp ), Order( Ascending ), replace table );
dt &amp;lt;&amp;lt; sort( by(:Activity ID), order( ascending ), replace table );&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;only includes data for activities that contain "sprint", not case sensitive, in the name&lt;/LI&gt;&lt;LI&gt;tries to get power (watts), among many other measurements including distance, velocity, position, altitude, etc...&lt;/LI&gt;&lt;LI&gt;arranges the data in a format similar to the original data tables presented with this challenge&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do hope that this code works for a user that has power information in their Strava account.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2022 07:02:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Workflow-Challenge-1-Motif-Extraction-and-Identification/m-p/473613#M71826</guid>
      <dc:creator>ngambles</dc:creator>
      <dc:date>2022-03-28T07:02:03Z</dc:date>
    </item>
    <item>
      <title>Re: JMP Workflow Challenge 1: Motif Extraction and Identification from Continuous Power Data</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-Workflow-Challenge-1-Motif-Extraction-and-Identification/m-p/473635#M71828</link>
      <description>&lt;P&gt;I have taken a shot at getting data straight from the Strava API.&amp;nbsp; I am successfully getting measurements for distance, velocity, position, altitude, &amp;amp; grade. However I am not getting power measurements.&amp;nbsp; I have a suspicion that this is due to my Strava account level and/or due to my lack of power measurement equipment. I have reason to believe that my code might work for users that have power data in their Strava data, but I'm unable to confirm. If this solution isn't correct, I can't imagine that it is too far away from what is needed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I found this &lt;A href="https://www.youtube.com/watch?v=sgscChKfGyg" target="_self"&gt;youtube video&lt;/A&gt; very informative for getting started with the Strava API. It clearly demonstrates how to get your access token from the Strava API, which is required before the JSL code will get any information from Strava. In the code below, replace your_access_token_here with your access token you get from the Strava API prior to running.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;names default to here(1);

accessToken = "your_access_token_here";							// access token from the Strava API
																// helpful link to get started with the API: https://www.youtube.com/watch?v=sgscChKfGyg
//////////////////////////////////////////
//////////////////////////////////////////
// get list of activities from Strava
s = New HTTP Request(
	URL( "https://www.strava.com/api/v3/athlete/activities?access_token=" || accessToken ),
	Method( "GET" ),
	Headers( {"Accept: application/json"} )
) &amp;lt;&amp;lt; Send;
dtx = json to data table(s);
dtx &amp;lt;&amp;lt; set name("Activities List");
// keep only activites marked as sprint
r = dtx &amp;lt;&amp;lt; get rows where(
	!contains(lowercase(:name), "sprint")
);
dtx &amp;lt;&amp;lt; delete rows(r);
if( n rows(dtx) == 0,
	close(dtx, no save);
	throw();
);
// get list of unique activity ids
summarize( activityList = by(dtx:id));
// get and combine the data from each activity
dty = new table();
dty &amp;lt;&amp;lt; set name("Strava Data_temp");
for( k = 1, k &amp;lt;= n items(activityList), k++,
	actStream = New HTTP Request(
		URL( "https://www.strava.com/api/v3/activities/" || activityList[k] || "/streams?keys=latlng,watts,distance,velocity,altitude,velocity_smooth,cadence,temp,moving,grade_smooth&amp;amp;access_token=" || accessToken ),
		Method( "GET" ),
		Headers( {"Accept: application/json"} )
	) &amp;lt;&amp;lt; Send;
	dtz = json to data table(actStream);
	dtz &amp;lt;&amp;lt; new column("Activity ID", numeric, nominal, set each value(num(activityList[k])));
	dty &amp;lt;&amp;lt; concatenate(dtz, append to first table);
	close(dtz, no save);
);
// add rank column for x value
dty &amp;lt;&amp;lt; New Column( "x",
	Numeric,
	"Continuous",
	Formula( Col Rank( :Activity ID, :type, :Activity ID ) )
);
// split up latitude and longitude pairs
myCount = 0;
for( k = 1, k &amp;lt;= n rows(dty), k++,
	if( dty:type[k] != "latlng",
		dty:type[k] = dty:type[k]
		,
		myCount ++;
		if( modulo(myCount,2) == 0,
			dty:type[k] = "lat",
			dty:type[k] = "lng"
		)
	);
);
// split tall table to wider table
dt = dty &amp;lt;&amp;lt; Split(
	Split By( :type ),
	Split( :data ),
	Group( :x, :Activity ID ),
	Remaining Columns( Drop All ),
	Sort by Column Property
);
// done with this data table
close(dty, no save);
// update start time from activities table
dt &amp;lt;&amp;lt; Update(
	With( dtx ),
	Match Columns( :Activity ID = :id ),
	Add Columns from Update Table( :start_date, :name ),
	Replace Columns in Main Table( :start_date, :name )
);
// close activity list
close(dtx, no save);
// clean up time stamp
dt &amp;lt;&amp;lt; Begin Data Update;
dt &amp;lt;&amp;lt; Recode Column(
	dt:start_date,
	{Regex( _rcNow, ".*^(.*)Z.*", "\1", GLOBALREPLACE )},
	Target Column( :start_date )
);
dt &amp;lt;&amp;lt; End Data Update;
dt:start_date &amp;lt;&amp;lt; data type(numeric) &amp;lt;&amp;lt; Format( "yyyy-mm-ddThh:mm:ss", 19, 0 ) &amp;lt;&amp;lt; Input Format( "yyyy-mm-ddThh:mm:ss", 0 );
dt &amp;lt;&amp;lt; New Column( "timestamp",
	Numeric,
	"Continuous",
	Format( "yyyy-mm-ddThh:mm:ss", 19, 0 ),
	Input Format( "yyyy-mm-ddThh:mm:ss", 0 ),
	Formula( (:start_date + :x) - 1 )
);
wait(0);
dt:timestamp &amp;lt;&amp;lt; delete formula;
dt &amp;lt;&amp;lt; delete column("start_date");
// arrange columns
dt &amp;lt;&amp;lt; Move Selected Columns( {:timestamp}, To first );
dt &amp;lt;&amp;lt; Move Selected Columns( {:Activity ID, :name}, after(:timestamp) );
// set name
dt &amp;lt;&amp;lt; set name("Strava Data");
// sort chronologically
dt &amp;lt;&amp;lt; Sort( By( :timestamp ), Order( Ascending ), replace table );
dt &amp;lt;&amp;lt; sort( by(:Activity ID), order( ascending ), replace table );&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The code:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;looks through all Strava activities and selects only those with "sprint" in their names&amp;nbsp; (not case sensitive)&lt;/LI&gt;&lt;LI&gt;tries to get many measurements including power (watts)&lt;/LI&gt;&lt;LI&gt;organizes the information in a data table similar to the original data sets provided in this challenge&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2022 07:38:06 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-Workflow-Challenge-1-Motif-Extraction-and-Identification/m-p/473635#M71828</guid>
      <dc:creator>ngambles</dc:creator>
      <dc:date>2022-03-28T07:38:06Z</dc:date>
    </item>
  </channel>
</rss>

