Tuesday, 19 April 2022

How to decompose multiple periodicities present in the data without specifying the period?

I am trying to decompose the periodicities present in a signal into its individual components, to calculate their time-periods.

Say the following is my sample signal:

enter image description here

You can reproduce the signal using the following code:

t_week = np.linspace(1,480, 480)
t_weekend=np.linspace(1,192,192)
T=96 #Time Period
x_weekday = 10*np.sin(2*np.pi*t_week/T)+10
x_weekend = 2*np.sin(2*np.pi*t_weekend/T)+10
x_daily_weekly_sinu = np.concatenate((x_weekday, x_weekend)) 

#Creating the Signal
x_daily_weekly_long_sinu = np.concatenate((x_daily_weekly_sinu,x_daily_weekly_sinu,x_daily_weekly_sinu,x_daily_weekly_sinu,x_daily_weekly_sinu,x_daily_weekly_sinu,x_daily_weekly_sinu,x_daily_weekly_sinu,x_daily_weekly_sinu,x_daily_weekly_sinu))

#Visualization
plt.plot(x_daily_weekly_long_sinu)
plt.show()

My objective is to split this signal into 3 separate isolated component signals consisting of:

  1. Days as period
  2. Weekdays as period
  3. Weekends as period

Periods as shown below:

enter image description here

I tried using the STL decomposition method from statsmodel:

sm.tsa.seasonal_decompose()

But this is suitable only if you know the period beforehand. And is only applicable for decomposing a single period at a time. While, I need to decompose any signal having multiple periodicities and whose periods are not known beforehand.

Can anyone please help how to achieve this?



from How to decompose multiple periodicities present in the data without specifying the period?

No comments:

Post a Comment