Another interesting question through the support portal this morning. The user has a signal where each discrete point represents the run length recorded at the end of the run. They would like to translate this signal into a condition so it can be used for further analysis.
The original signal looks a bit like this
To create the matching condition we need to use a transform and the ToCapsules() function
$Signal.toCapsules( //for each sample in the signal create a capsule
$sample -> //create a variable name of your choice to reference each indivudal sample in your signal
capsule( //open the capsule
$sample.key()-$sample.value(), //Capsule Start definition (Key = timestamp of the sample - value of the sample)
$sample.key() //Capsule End definition (timestamp of the sample)
),5d) //Maximum length of any given capsule in the condition