def spectral_analysis_noisy(df, column, bins = False):
    
    if bins == 'Default':
        
        bins = len(df)
        timestep = df.index[1]
    else:
        timestep = df.index[1]
    sampling_freq = 1/timestep
    spec = stats_lib.fft(df[column].to_numpy(), int(sampling_freq), int(bins))
    frequency = np.fft.fftfreq(int(bins), d=timestep)

    return spec, frequency
def spectral_analysis(df, column, bins = False):

    if bins == 'Default':

        bins = len(df)
        timestep = df.index[1]
    else:
        timestep = df.index[1]

    sampling_freq = 1/timestep
    spec = stats_lib.fft(df[column].to_numpy(), int(sampling_freq), int(bins))
    frequency = np.fft.fftfreq(int(bins), d=timestep)

    #call on the smoothing function. pass on the spectral analysis values
    s1 = (5) #define the first moving average window. these are hard coded into the program. future versions of the dashboard, we can adjust this.
    s2 = (69) #define the second moving average window.
    Fxdata, Fydata, Spans = logmovav(s1, s2, frequency, spec)

    #return spec, frequency
    return Fydata, Fxdata
示例#3
0
df['time'] = t
#rename index to time values
df = df.set_index('time')

# %% Spectral Analysis
rotor_freq = mean_val[0]/60
path_fft = 'Results/fft/'
os.makedirs(path_fft)
bins = (run_time*sampling_freq)
timestep = df.index[1]

for column in df:  
    if column == 'RPM':
        pass
    else:
        spec = stats_lib.fft(df[column].to_numpy(), sampling_freq, bins)
        frequency = np.fft.fftfreq(bins, d=timestep)
        stats_lib.fft_plot(spec, column, frequency, rotor_freq, units, path_fft)
      #  plt.loglog(frequency[0:int(bins/2)], spec)
        

    
                    
# %% Rolling Averages
#create new data frame that holds the rolling mean for each property

import stats_lib

'''
Mean
'''