You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 21, 2025. It is now read-only.
I use a pseudo-inversing algo from numpy in order to obtain original values from a moving average series. When i use this script on movig average from randomly generated number, everyting is ok, i can obtain original values with a small error but when I use the same script on STA values from last 7 days, the result not as expected, many negative values, high volatility which makes me think that STA in not a real moving (rolling) average, but something else. Can you provide the algorithm used for obtaining STA values or can you provide the raw, instant radon values over the last hour ?
Here is the python script I use:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy.ndimage import shift
import random
def reconstruct_orig(sm_x:np.ndarray, win_size:int=7):
arr_size = sm_x.shape[0]+win_size
# get A and its inverse
A = (np.tril(np.ones((arr_size,arr_size)),-1) - np.tril(np.ones((arr_size,arr_size)),-(win_size+1)))/win_size
A = A[win_size:,:]
pA = np.linalg.pinv(A) #pseudo inverse
return np.dot(pA, sm_x)
if __name__=="__main__":
data = np.loadtxt("sta.csv", delimiter=",",dtype='float')
orig = pd.DataFrame(data)
re_x = reconstruct_orig(orig, win_size=24)
data = np.concatenate([np.zeros((23)), data]) # right shift 24 values
plt.plot(data,label='original x')
plt.plot(re_x, label='reconstructed x')
plt.legend()
plt.show()