Skip to content

Instantly share code, notes, and snippets.

@PierreZ
Created October 9, 2016 16:27
Show Gist options
  • Save PierreZ/a5d53ecd853513a0e47c672bfd06a2d3 to your computer and use it in GitHub Desktop.
Save PierreZ/a5d53ecd853513a0e47c672bfd06a2d3 to your computer and use it in GitHub Desktop.
Example of PATTERNS with Warp10
[ 'data' ] EXPORT
NEWGTS 'cos' RENAME
1 1080
<% DUP 'i' STORE DUP 2 * PI * 360 / COS $i * NaN NaN NaN 4 ROLL ADDVALUE %> FOR
[ SWAP bucketizer.last 1080 1 0 ] BUCKETIZE 'cos' STORE
NEWGTS 'pattern.to.detect' RENAME
200 370
<% DUP 'i' STORE DUP 2 * PI * 360 / COS $i * NaN NaN NaN 4 ROLL ADDVALUE %> FOR
[ SWAP bucketizer.last 2160 1 0 ] BUCKETIZE 'pattern.to.detect' STORE
// Create Pattern
32 'windowSize' STORE
8 'patternLength' STORE
16 'quantizationScale' STORE
$pattern.to.detect 0 GET $windowSize $patternLength $quantizationScale PATTERNS VALUES 'patterns' STORE
$cos $patterns $windowSize $patternLength $quantizationScale PATTERNDETECTION 'cos.detection' RENAME 'cos.detection' STORE
$cos.detection
// Let's create a gts for each trip
10 // Quiet period
5 // Min number of values
'subPattern' // Label
TIMESPLIT 'cos.detection.splitted' STORE
[
{
'key' 'cosinus'
}
{
'key' 'detection of cosinus'
}
] 'params' STORE
{ 'interpolate' 'linear' 'timestamps' true 'yLabel' 'cosinus' 'xLabel' 'Timestamps' } 'globalParams' STORE
[ {
'gts' [ $cos 0 GET $cos.detection.splitted 0 GET APPEND ]
'params' $params
'globalParams' $globalParams
} ] 'data' STORE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment