stretch_data#
- static MonostaticRCSPlotter.stretch_data(data, scaling_factor, offset)#
Stretches and scales the input data to a specified range.
This method normalizes the input data between its minimum and maximum values and then applies a linear transformation using the formula:
scaled_data = (data - min) / (max - min) * m + b. The parametersmandbcontrol the scaling and shifting of the normalized data.- Parameters:
- data
numpy.ndarrayorpandas.Series The input data array or series to be stretched.
- scaling_factor
float The scaling factor applied to the normalized data.
- offset
float The offset added to the scaled data after normalization.
- data
- Returns:
numpy.ndarrayorpandas.SeriesTransformed data
- Example:
>>> :obj:`data` = :obj:`np.array`\([1, 2, 3, 4, 5]) ..>>> :obj:`stretched_data` = :obj:`stretch_data`\(:obj:`data`, 2, 1) ..>>> :obj:`print`\(:obj:`stretched_data`) ..- [1. 1.5 2. 2.5 3. ]