我正在尝试安排一个大小为 (1425 x 15) 的特征矩阵,其中每一列代表每个传感器的自然频率,每一行代表一个数据文件。但是,我继续在每一列中获取相同的值,并将下一个值打印到下一行。我将如何重新排列特征矩阵?
我试图形成一个可以在下面找到的代码,但是,我不知道我在代码中的错误是什么。我形成了不同的代码,但结果仍然相同。请在下面找到形成的代码:
代码 1:
# Matrix array:
DataSizerow=0
DataSizecolumn=0
Data = np.zeros((1425,15))
# Forming a feature matrix from frequency, PSD and AutoCorrelation values:
# Dataset.shape[1] represesnt the acceleration dataset column
# List_Of_DataFrame_Feature = []
# List_Of_DataFrame_Label = []
Length_PSD_mean = len(x_axis_list_psd_filtered)
print('Length of PSD values: ', Length_PSD_mean)
if Length_PSD_mean > 1:
for PSD_Mean in range(Length_PSD_mean):
X_axis_values_psd_mean = mean(x_axis_list_psd_filtered)
else:
X_axis_values_psd_mean = x_axis_list_psd_filtered
DataFrame_Feature = np.array(X_axis_values_psd_mean)
DataFrame_Feature1 = np.array(x_axis_list_filtered)
DataSizecolumn = DataSizecolumn + 1
print('Data Size column: ',DataSizecolumn)
Data[DataSizecolumn - 1] = DataFrame_Feature
if DataSizecolumn in range(1, dataset.shape[1]):
DataSizerow = DataSizerow + 1
print('Data Size row: ', DataSizerow)
Data[DataSizerow - 1] = DataFrame_Feature
print('Sensor {0}'.format(k))
print('Data Frame: ', Data)
代码 2:
# Dataset.shape[0] represesnt the acceleration dataset row
# Dataset.shape[1] represesnt the acceleration dataset column
DataSizecolumn1 = 0
DataSizerow1 = 0
DataFrame1 = np.zeros((1426, 16))
for DataSizecolumn1 in range(1, dataset.shape[1]):
print('Data Size column: ', DataSizecolumn1)
for DataSizerow1 in range(1, dataset.shape[0]):
print('Data Size row: ', DataSizerow1)
DataFrame1[DataSizerow1][DataSizecolumn1] = DataFrame_Feature
print('Sensor {0}'.format(k))
print('DataFrame: ', DataFrame1)
代码 3:
# Dataset.shape[0] represesnt the acceleration dataset row
# Dataset.shape[1] represesnt the acceleration dataset column
DataSizecolumn2 = 0
DataSizerow2 = 0
DataFrame2 = np.zeros((1426, 16))
for DataSizecolumn2 in range(1, dataset.shape[1]):
print('Data Size column: ', DataSizecolumn2)
DataFrame2[DataSizecolumn2] = DataFrame_Feature
if DataSizecolumn2 == dataset.shape[1]:
DataSizerow2 = DataSizerow2 + 1
print('Data Size row: ', DataSizerow2)
DataFrame2[DataSizerow2] = DataFrame_Feature
if DataSizerow2 == dataset.shape[0]:
break
print('Sensor {0}'.format(k))
print('DataFrame: ', DataFrame2)
预期的结果应该像下面的单行矩阵:
Sensor 1 | Sensor 2 | Sensor 3 | Sensor 4 | Sensor 5 | Sensor 6 |
Data file 13 | 51.5 | 13 | 13 | 13 | 13 |
Sensor 7 | Sensor 8 | Sensor 9 | Sensor 10 | Sensor 11 | Sensor 12 |
Data file 8.5 | 14 | 20 | 18.6 | 9.5 | 39 |
Sensor 13 | Sensor 14 | Sensor 15 |
Data file 8.5 | 8.5 | 8.5 |
但实际结果如下:
Sensor 1 | Sensor 2 | Sensor 3 | Sensor 4 | Sensor 5 | Sensor 6 |
Data file 13 | 13 | 13 | 13 | 13 | 13 |
Sensor 7 | Sensor 8 | Sensor 9 | Sensor 10 | Sensor 11 | Sensor 12 |
Data file 13 | 13 | 13 | 13 | 13 | 13 |
Sensor 13 | Sensor 14 | Sensor 15 |
Data file 13 | 13 | 13 |
请在下面找到整个代码:
import matplotlib.pyplot as plt
import numpy as np
from scipy.fftpack import fft
from scipy.signal import welch
import glob
import sys
from numpy import NaN, Inf, arange, isscalar, asarray, array
from statistics import mean
np.set_printoptions(threshold=sys.maxsize)
def peakdet(v, delta, x=None):
"""
Converted from MATLAB script at http://billauer.co.il/peakdet.html
Returns two arrays
function [maxtab, mintab]=peakdet(v, delta, x)
%PEAKDET Detect peaks in a vector
% [MAXTAB, MINTAB] = PEAKDET(V, DELTA) finds the local
% maxima and minima ("peaks") in the vector V.
% MAXTAB and MINTAB consists of two columns. Column 1
% contains indices in V, and column 2 the found values.
%
% With [MAXTAB, MINTAB] = PEAKDET(V, DELTA, X) the indices
% in MAXTAB and MINTAB are replaced with the corresponding
% X-values.
%
% A point is considered a maximum peak if it has the maximal
% value, and was preceded (to the left) by a value lower by
% DELTA.
% Eli Billauer, 3.4.05 (Explicitly not copyrighted).
% This function is released to the public domain; Any use is allowed.
"""
maxtab = []
mintab = []
if x is None:
x = arange(len(v))
v = asarray(v)
if len(v) != len(x):
sys.exit('Input vectors v and x must have same length')
if not isscalar(delta):
sys.exit('Input argument delta must be a scalar')
if delta <= 0:
sys.exit('Input argument delta must be positive')
mn, mx = Inf, -Inf
mnpos, mxpos = NaN, NaN
lookformax = True
for i in arange(len(v)):
this = v[i]
if this > mx:
mx = this
mxpos = x[i]
if this < mn:
mn = this
mnpos = x[i]
if lookformax:
if this < mx - delta:
maxtab.append((mxpos, mx))
mn = this
mnpos = x[i]
lookformax = False
else:
if this > mn + delta:
mintab.append((mnpos, mn))
mx = this
mxpos = x[i]
lookformax = True
return array(maxtab), array(mintab)
# Definition to get values needed for the FFT plot:
def get_fft_values(y_values, T, N, f_s):
f_values = np.linspace(0.0, 1.0/(2.0*T), N//2)
fft_values_ = fft(y_values)
fft_values = 2.0/N * np.abs(fft_values_[0:N//2])
return f_values, fft_values
# Definition to find the values of axis:
def findyaxis(y_axis_input, x, y):
x = np.array(x)
order = y.argsort()
y = y[order]
x = x[order]
input = np.array(y_axis_input)
return x[y.searchsorted(input, 'left')]
def merge(list1, list2):
merged_list = [(list1[i], list2[i]) for i in range(0, len(list1))]
return merged_list
def autocorr(x):
result = np.correlate(x, x, mode='full')
return result[len(result) // 2:]
def get_autocorr_values(y_values, T, N, f_s):
autocorr_values = autocorr(y_values)
x_values = np.array([T * jj for jj in range(0, N)])
return x_values, autocorr_values
def signaltonoise(a, axis=0, ddof=0):
"""
The signal - to - noise ratio of the input data. Returns the signal - to - noise ratio of `a`, here defined as the
mean divided by the standard deviation.
Parameters
----------
a: array_like An array_like object containing the sample data.
axis: int or None, optional.
If axis is equal to None, the array is first ravel 'd. If axis is an
integer, this is the axis over which to operate.Default is 0.
ddof: int, optional.
Degrees of freedom correction for standard deviation.Default is 0.
Returns
-------
s2n: ndarray.
The mean to standard deviation ratio(s) along `axis`, or 0 where the standard deviation is 0.
"""
a = np.asanyarray(a)
m = a.mean(axis)
sd = a.std(axis=axis, ddof=ddof)
return np.where(sd == 0, 0, m/sd)
def get_psd_values(y_values, T, N, f_s):
f_values, psd_values = welch(y_values, fs=f_s)
return f_values, psd_values
def smooth(y, box_pts):
box = np.ones(box_pts)/box_pts
y_smooth = np.convolve(y, box, mode='same')
return y_smooth
# Assign folder to `folder`:
DataPathList = sorted(glob.glob('DataPath*.txt'), key = lambda z: (len(z)))
# DataSizerow = 0
# DataSizecolumn = 0
MaxDataSizerow = 1425
MaxDataSizecolumn = 15
Data = np.zeros((1426,15))
for fp in DataPathList:
# Load spreadsheet:
print('Opened file number: {}'.format(fp))
dataset = np.loadtxt(fname=fp)
print('The size matrix of Sensors Undamaged Scenario:', dataset.shape)
print('The column size matrix of Sensors Undamaged Scenario:',dataset.shape[1])
for k in range(1, dataset.shape[1]):
# Create some time data to use for the plot:
dt = 1
# Getting the time period and frequency:
t_n = 2
N = 2192
T_s = 0.00390625
f_s = 256
# Obtaining data in order to plot the graph:
y = dataset[:,k]
x = np.arange(0, len(y), dt)
x1 = np.linspace(0, t_n, N)
SNR = signaltonoise(y)
print('Signal-to-Noise Ratio (SNR): ', SNR, 'dB')
SR = 1/t_n
SR1 = 1/T_s
Nf = (SR)/2
Nf1 = (SR1)/2
# Plotting the acceleration-time graph:
# plt.plot(x1, y)
# plt.xlabel('Time (s)')
# plt.ylabel('Acceleration (ms^-2)')
# plt.title('Plot of Sensor {0}'.format(k))
# # plt.show()
# plt.show(block = False)
# print('Plot of Sensor {0}'.format(k))
# plt.pause(5) # Pauses the program for 10 seconds
# plt.close('all')
## Fast Fourier Transform (FFT)
# Obtaining the Sampling frequency and time period:
print('Period:', T_s, 's')
print('Sampling Frequency: ', f_s, 'Hz')
f_values, fft_values = get_fft_values(y, T_s, N, f_s)
# Setting plot limits:
ax = plt.gca()
ax.set_ylim([min(fft_values), max(fft_values)])
ax.set_xlim([min(f_values), max(f_values)])
amp_index = np.array(fft_values)
amp_index_max = max(amp_index)
amp_index_min = min(amp_index)
delta = (amp_index_max + amp_index_min)/2
# Obtaining the amplitude values:
maxtab, mintab = np.array(peakdet(amp_index, delta))
amplitudes3 = maxtab
y_axis_list = []
for e in range(len(amplitudes3)):
amplitude3 = amplitudes3[e]
amplitude3final = amplitudes3[e][1]
y_values = amplitude3final
y_axis_list.append(y_values)
x_axis = np.abs(f_values)
x_axis_list = []
for o in range(len(y_axis_list)):
x_axis_values = findyaxis(y_axis_list[o], x_axis, fft_values)
x_axis_list.append(x_axis_values)
peaks = merge(x_axis_list, y_axis_list)
print('Number of Peaks Coordinates: ', len(peaks))
print('Peaks Coordinates: ', peaks)
# Plotting the amplitude-frequency graph:
# plt.plot(f_values, fft_values, linestyle='-', color='blue')
# plt.scatter(x_axis_list, y_axis_list, marker='*', color='red', label='Peaks: {0}'.format(len(peaks)))
# plt.xlabel('Frequency [Hz]', fontsize=16)
# plt.ylabel('Amplitude', fontsize=16)
# plt.title("Frequency domain of the signal {0}".format(k), fontsize=16)
# plt.legend()
# # plt.show()
# plt.show(block = False)
# print('Frequency domain with peaks of the signal {0}'.format(k))
# plt.pause(5) # Pauses the program for 10 seconds
# plt.close('all')
# Obtaining the PSD values:
f_values, psd_values = get_psd_values(y, T_s, N, f_s)
amp_psd_index = np.array(psd_values)
amp_psd_index_max = max(amp_psd_index)
amp_psd_index_min = min(amp_psd_index)
psd_delta = (amp_psd_index_max + amp_psd_index_min) / 2
maxtab, mintab = np.array(peakdet(amp_psd_index, psd_delta))
amplitudes_psd = maxtab
y_axis_list_psd = []
for e in range(len(amplitudes_psd)):
amplitude_psd = amplitudes_psd[e]
amplitude_psd_final = amplitudes_psd[e][1]
y_values_psd = amplitude_psd_final
y_axis_list_psd.append(y_values_psd)
x_axis_psd = np.abs(f_values)
x_axis_list_psd = []
for o in range(len(y_axis_list_psd)):
x_axis_values_psd = findyaxis(y_axis_list_psd[o], x_axis_psd, psd_values)
x_axis_list_psd.append(x_axis_values_psd)
psd_peaks = merge(x_axis_list_psd, y_axis_list_psd)
print('Number of PSD Peaks Coordinates: ', len(psd_peaks))
print('PSD Peaks Coordinates: ', psd_peaks)
# Plotting PSD-Frequency graph:
# plt.plot(f_values, psd_values, linestyle='-', color='blue')
# plt.scatter(x_axis_list_psd, y_axis_list_psd, marker='*', color='red', label='Peaks: {0}'.format(len(psd_peaks)))
# plt.xlabel('Frequency [Hz]')
# plt.ylabel('PSD [V**2 / Hz]')
# plt.title("PSD of the signal {0}".format(k), fontsize=16)
# plt.legend()
# # plt.show()
# plt.show(block = False)
# print('PSD with peaks of the signal {0}'.format(k))
# plt.pause(5) # Pauses the program for 10 seconds
# plt.close('all')
# Obtaining AutoCorrelation values:
t_values, autocorr_values = get_autocorr_values(y, T_s, N, f_s)
amp_auto_corr_index = np.array(autocorr_values)
amp_auto_corr_index_max = max(amp_auto_corr_index)
amp_auto_corr_index_min = min(amp_auto_corr_index)
auto_corr_delta = (amp_auto_corr_index_max + amp_auto_corr_index_min) / 2
maxtab, mintab = np.array(peakdet(amp_auto_corr_index, auto_corr_delta))
amplitudes_auto_corr = maxtab
y_axis_list_auto_corr = []
for e in range(len(amplitudes_auto_corr)):
amplitude_auto_corr = amplitudes_auto_corr[e]
amplitude_auto_corr_final = amplitudes_auto_corr[e][1]
y_values_auto_corr = amplitude_auto_corr_final
y_axis_list_auto_corr.append(y_values_auto_corr)
x_axis_auto_corr = np.abs(t_values)
x_axis_list_auto_corr = []
for o in range(len(y_axis_list_auto_corr)):
x_axis_values_auto_corr = findyaxis(y_axis_list_auto_corr[o], x_axis_auto_corr, autocorr_values)
x_axis_list_auto_corr.append(x_axis_values_auto_corr)
auto_corr_peaks = merge(x_axis_list_auto_corr, y_axis_list_auto_corr)
print('Number of AutoCorrelation Peaks Coordinates: ', len(auto_corr_peaks))
print('AutoCorrelation Peaks Coordinates: ', auto_corr_peaks)
# Plotting Autocorrelation-Time delay graph
# plt.plot(t_values, autocorr_values, linestyle='-', color='blue')
# plt.scatter(x_axis_list_auto_corr, y_axis_list_auto_corr, marker='*', color='red', label='Peaks: {0}'.format(len(auto_corr_peaks)))
# plt.xlabel('time delay [s]')
# plt.ylabel('Autocorrelation amplitude')
# plt.title("AutoCorrelation of the signal {0}".format(k), fontsize=16)
# plt.legend()
# # plt.show()
# plt.show(block = False)
# print('AutoCorrelation with peaks of the signal {0}'.format(k))
# plt.pause(5) # Pauses the program for 10 seconds
# plt.close('all')
print('Completed file {}'.format(fp), ', Now going into filtering the signal')
########################################################################################################################
############################################## Filtered Section ########################################################
########################################################################################################################
# Plotting the smoothed filtered signal acceleration-time graph:
y_filter = smooth(y, 10)
# plt.plot(x1, y_filter)
# plt.xlabel('Time (s)')
# plt.ylabel('Acceleration (ms^-2)')
# plt.title('Plot of Smoothed Sensor {0}'.format(k))
# # plt.show()
# plt.show(block = False)
# print('Plot of Smoothed Sensor {0}'.format(k))
# plt.pause(5) # Pauses the program for 10 seconds
# plt.close('all')
## Filtered Fast Fourier Transform (FFT)
# Obtaining the Sampling frequency and time period:
print('Period:', T_s, 's')
print('Sampling Frequency: ', f_s, 'Hz')
f_values_filtered, fft_values_filtered = get_fft_values(y_filter, T_s, N, f_s)
# Setting plot limits:
ax = plt.gca()
ax.set_ylim([min(fft_values_filtered), max(fft_values_filtered)])
ax.set_xlim([min(f_values_filtered), max(f_values_filtered)])
amp_index_filtered = np.array(fft_values_filtered)
amp_index_filtered_max = max(amp_index_filtered)
amp_index_filtered_min = min(amp_index_filtered)
amp_index_filtered_delta = (amp_index_filtered_max + abs(amp_index_filtered_min)) / 2
# Obtaining the amplitude values:
maxtab, mintab = np.array(peakdet(amp_index_filtered, amp_index_filtered_delta))
amplitudes3 = maxtab
y_axis_list_filtered = []
for e in range(len(amplitudes3)):
amplitude3 = amplitudes3[e]
amplitude3final = amplitudes3[e][1]
y_values_filtered = amplitude3final
y_axis_list_filtered.append(y_values_filtered)
x_axis_filtered = np.abs(f_values_filtered)
x_axis_list_filtered = []
for o in range(len(y_axis_list_filtered)):
x_axis_values_filtered = findyaxis(y_axis_list_filtered[o], x_axis_filtered, fft_values_filtered)
x_axis_list_filtered.append(x_axis_values_filtered)
peaks_filtered = merge(x_axis_list_filtered, y_axis_list_filtered)
print('Number of Filtered Peaks Coordinates: ', len(peaks_filtered))
print('Filtered Peaks Coordinates: ', peaks_filtered)
# Plotting the amplitude-frequency graph:
# plt.plot(f_values_filtered, fft_values_filtered, linestyle='-', color='blue')
# plt.scatter(x_axis_list_filtered, y_axis_list_filtered, marker='*', color='red', label='Peaks: {0}'.format(len(peaks_filtered)))
# plt.xlabel('Frequency [Hz]', fontsize=16)
# plt.ylabel('Amplitude', fontsize=16)
# plt.title("Filtered Frequency domain of the signal {0}".format(k), fontsize=16)
# plt.legend()
# # plt.show()
# plt.show(block = False)
# print('Filtered Frequency domain with peaks of the signal {0}'.format(k))
# plt.pause(5) # Pauses the program for 10 seconds
# plt.close('all')
# Obtaining PSD Filtered values:
f_values_filtered, psd_values_filtered = get_psd_values(y_filter, T_s, N, f_s)
amp_psd_index_filtered = np.array(psd_values_filtered)
amp_psd_index_filtered_max = max(amp_psd_index_filtered)
amp_psd_index_filtered_min = min(amp_psd_index_filtered)
amp_psd_index_filtered_delta = (amp_psd_index_filtered_max + abs(amp_psd_index_filtered_min)) / 2
maxtab, mintab = np.array(peakdet(amp_psd_index_filtered, amp_psd_index_filtered_delta))
amplitudes_psd_filtered = maxtab
y_axis_list_psd_filtered = []
for e in range(len(amplitudes_psd_filtered)):
amplitude_psd_filtered = amplitudes_psd_filtered[e]
amplitude_psd_final_filtered = amplitudes_psd_filtered[e][1]
y_values_psd_filtered = amplitude_psd_final_filtered
y_axis_list_psd_filtered.append(y_values_psd_filtered)
x_axis_psd_filtered = np.abs(f_values_filtered)
x_axis_list_psd_filtered = []
for o in range(len(y_axis_list_psd_filtered)):
x_axis_values_psd_filtered = findyaxis(y_axis_list_psd_filtered[o], x_axis_psd_filtered, psd_values_filtered)
x_axis_list_psd_filtered.append(x_axis_values_psd_filtered)
psd_peaks_filtered = merge(x_axis_list_psd_filtered, y_axis_list_psd_filtered)
print('Number of Filtered PSD Peaks Coordinates: ', len(psd_peaks_filtered))
print('Filtered PSD Peaks Coordinates: ', psd_peaks_filtered)
print('X-Axis Filtered PSD Amplitudes: ', amplitudes_psd_filtered[:, [0]])
length_amplitudes_psd_filtered = len(amplitudes_psd_filtered[:, [0]])
print('Amplitudes PSD filtered length: ', length_amplitudes_psd_filtered)
if length_amplitudes_psd_filtered > 1:
# for PSD_Mean in range(length_amplitudes_psd_filtered):
X_axis_values_psd_mean = mean(x_axis_list_psd_filtered)
print('Mean Amplitudes PSD filtered: ', X_axis_values_psd_mean)
else:
X_axis_values_psd_mean = x_axis_list_psd_filtered
# Plotting PSD-Frequency filtered graph:
# plt.plot(f_values_filtered, psd_values_filtered, linestyle='-', color='blue')
# plt.scatter(x_axis_list_psd_filtered, y_axis_list_psd_filtered, marker='*', color='red', label='Peaks: {0}'.format(len(psd_peaks_filtered)))
# plt.xlabel('Frequency [Hz]')
# plt.ylabel('PSD [V**2 / Hz]')
# plt.title("Filtered PSD of the signal {0}".format(k), fontsize=16)
# plt.legend()
# # plt.show()
# plt.show(block = False)
# print('Filtered PSD with peaks of the signal {0}'.format(k))
# plt.pause(5) # Pauses the program for 10 seconds
# plt.close('all')
# Obtaining Filtered AutoCorrelation values:
t_values_filtered, autocorr_values_filtered = get_autocorr_values(y_filter, T_s, N, f_s)
amp_auto_corr_index_filtered = np.array(autocorr_values_filtered)
amp_auto_corr_index_filtered_max = max(amp_auto_corr_index_filtered)
amp_auto_corr_index_filtered_min = min(amp_auto_corr_index_filtered)
amp_auto_corr_index_filtered_delta = (amp_auto_corr_index_filtered_max + abs(amp_auto_corr_index_filtered_min)) / 2
maxtab, mintab = np.array(peakdet(amp_auto_corr_index_filtered, amp_auto_corr_index_filtered_delta))
amplitudes_auto_corr_filtered = maxtab
y_axis_list_auto_corr_filtered = []
for e in range(len(amplitudes_auto_corr_filtered)):
amplitude_auto_corr_filtered = amplitudes_auto_corr_filtered[e]
amplitude_auto_corr_final_filtered = amplitudes_auto_corr_filtered[e][1]
y_values_auto_corr_filtered = amplitude_auto_corr_final_filtered
y_axis_list_auto_corr_filtered.append(y_values_auto_corr_filtered)
x_axis_auto_corr_filtered = np.abs(t_values_filtered)
x_axis_list_auto_corr_filtered = []
for o in range(len(y_axis_list_auto_corr_filtered)):
x_axis_values_auto_corr_filtered = findyaxis(y_axis_list_auto_corr_filtered[o], x_axis_auto_corr_filtered, autocorr_values_filtered)
x_axis_list_auto_corr_filtered.append(x_axis_values_auto_corr_filtered)
auto_corr_peaks_filtered = merge(x_axis_list_auto_corr_filtered, y_axis_list_auto_corr_filtered)
print('Number of Filtered AutoCorrelation Peaks Coordinates: ', len(auto_corr_peaks_filtered))
print('Filtered AutoCorrelation Peaks Coordinates: ', auto_corr_peaks_filtered)
# Plotting AutoCorrelation-Time delay filtered graph:
# plt.plot(t_values_filtered, autocorr_values_filtered, linestyle='-', color='blue')
# plt.scatter(x_axis_list_auto_corr_filtered, y_axis_list_auto_corr_filtered, marker='*', color='red', label='Peaks: {0}'.format(len(auto_corr_peaks_filtered)))
# plt.xlabel('time delay [s]')
# plt.ylabel('Autocorrelation amplitude')
# plt.title("Filtered AutoCorrelation of the signal {0}".format(k), fontsize=16)
# plt.legend()
# # plt.show()
# plt.show(block = False)
# print('Filtered AutoCorrelation with peaks of the signal {0}'.format(k))
# plt.pause(5) # Pauses the program for 10 seconds
# plt.close('all')
########################################################################################################################
############################################## Feature Matrix ##########################################################
########################################################################################################################
# Forming a feature matrix from frequency, PSD and AutoCorrelation values:
for DataSizeRow in range(MaxDataSizerow):
for DataSizeColumn in range(MaxDataSizecolumn):
DataFrame_Feature = np.array(X_axis_values_psd_mean)
Data[DataSizeColumn - 1] = DataFrame_Feature
Data[DataSizeColumn + 1]
break
print('Data Frame: ', Data)
# np.savetxt('DataFrameTestfinal1.txt', Data, delimiter = ' , ')
# # np.savetxt('DataFrame3.txt', DataFrame, delimiter=' , ')
# np.savetxt('DataFrameTestfinal2.txt', DataFrame1, delimiter=' , ')
# np.savetxt('DataFrameTestfinal3.txt', DataFrame2, delimiter=' , ')
print('Completed both original and filtered signals of file {}'.format(fp))
数据集来自网站链接。链接: http ://users.metropolia.fi/~kullj/JrkwXyZGkhF/wooden_bridge_time_histories/
谢谢您的帮助。