Modified timeseries_analysis.py with line 638 SCA-related fix