Indicator function
timecave.data_generation.time_series_functions.indicator_ts(number_samples, start_index, end_index)
Generate time series array based on a binary indicator function with specified start and end indices.
This function creates a time series array based on a binary indicator function of given length. The specified segment is marked as 1 and the rest as 0.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
number_samples |
int
|
The total number of samples in the time series array. |
required |
start_index |
int
|
The start index of the segment to be marked as 1. |
required |
end_index |
int
|
The end index of the segment to be marked as 1. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
A time series array where the specified segment is marked as 1 and the rest as 0. |
See also
scaled_right_indicator_ts: Scaled right indicator time series. Needs only a start index.
Examples:
>>> import numpy as np
>>> import matplotlib.pyplot as plt
>>> from timecave.data_generation.time_series_functions import indicator_ts
>>> ts = indicator_ts(100, 20, 60);
>>> _ = plt.plot(np.arange(0, ts.shape[0]), ts);
>>> plt.show();
