TimePeriods (FPScript)
Searches a data set with calendar time values for periodic time segments.
Syntax
TimePeriods(DataSet, Criterion, LowerBound, UpperBound [ , Operation = EVENT_DEFAULT ])
The syntax of the TimePeriods function consists of the following parts:
Part |
Description |
||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
DataSet |
The data set with calendar time values in which to search for periods. Permitted data structures are data series, data matrix, signal, signal series und signal series with two-dimensional X-component. All real data types are permitted. If the argument is a list, then the function is executed for each element of the list and the result is also a list. |
||||||||||||||||||
Criterion |
Specifies which date element the search is to be based on. The argument Criterion can have the following values:
If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated. |
||||||||||||||||||
LowerBound |
Specifies the lower limit of the time segment. If you specify a value with a unit, this unit must match the selected date element. Permitted data structures are scalar value. All real data types are permitted. If the argument is a list, then the function is executed for each element of the list and the result is also a list. |
||||||||||||||||||
UpperBound |
Specifies the upper limit of the time segment. If you specify a value with a unit, this unit must match the selected date element. Permitted data structures are scalar value. All real data types are permitted. If the argument is a list, then the function is executed for each element of the list and the result is also a list. |
||||||||||||||||||
Operation |
Specifies the mode of operation of the function. The argument Operation can have the following values:
If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated. If this argument is omitted, it will be set to the default value EVENT_DEFAULT. |
Remarks
The result always has the data type calendar time.
In the case of signals and signal series, the X component is searched.
In the event that LowerBound is less than or equal to UpperBound, a value is in the interval if it is greater than or equal to LowerBoundand is less than or equal to UpperBound. If LowerBound is specified as greater than UpperBound, then a value is in the interval if it is greater than or equal to LowerBoundor less than or equal to UpperBound. This is approximately equivalent to a complementation.
For the date elements SECOND, MINUTE and HOUR you can specify the interval limits as floating point values.
Available in
FlexPro Basic, Professional, Developer Suite
Examples
TimePeriods(TimeSignal, SECOND, 3.5, 12.3) |
Returns the indices of the values of the signal 'TimeSignal', which are in the interval [3.5, 12.3] seconds in each minute. |
TimePeriods(TimeSignal, SECOND, 200 ms, 600 ms) |
Returns the indices of the values of the signal 'TimeSignal', which are in the interval [0.2, 0.6] seconds in each minute. |
TimePeriods(SignalSeries, WEEKDAY, MONDAY, FRIDAY, EVENT_SETVOID) |
Returns the signal series where all Y values occurring on a weekend have been set to void. |
IndexAnd(TimePeriods(TimeSignal, WEEKDAY, MONDAY, FRIDAY), TimePeriods(TimeSignal, HOUR, 9.0, 17.5)) |
Returns the indices of the 'TimeSignal' signal values that fall on a weekday and are between the hours of 9:00 and 17:30. |