コード例 #1
0
    # sampled_data_FC1=sp.sampling(x1,gau_fil_data_FC1)
    # sampled_data_FC2=sp.sampling(x2,gau_fil_data_FC2)
    # print '\n Sample the data successfully!'

    ##interpolate the filtered data with nearest value
    sampled_data_FC1=int_nea.interpolate_nearest(x1,gau_fil_data_FC1)
    sampled_data_FC2=int_nea.interpolate_nearest(x2,gau_fil_data_FC2)
    print '\n interpolate the data successfully!'

    ##save the sampled data
    wsd.wri_sam_data(sampled_data_FC1,FC='FC1')
    wsd.wri_sam_data(sampled_data_FC2,FC='FC2')
    print ('\n save the sampled data successfully!')
elif switch_r_nr==1:
    ##read the sampled data, TO SAVE TIME
    sampled_data_FC1=rsd.re_sam_data(FC='FC1')
    sampled_data_FC2=rsd.re_sam_data(FC='FC2')

    print ('\n read the sampled data successfully!')
else:
    # ERR INIT switch_r_nr
    print ('\n ERR INIT switch_r_nr \nswitch_r_nr must be 1 or 0 !!!')
# </editor-fold>    


# test
plt.plot(sampled_data_FC1[:,1])
plt.plot(sampled_data_FC2[:,1])
plt.show()

## use the svr fit the FC1-FC2 and get the FC2 predict value
コード例 #2
0
ファイル: arma_FC_1.py プロジェクト: Newsteinwell/write-code
import numpy as np
import pandas as pd
import test_stationarity as test_sta
import matplotlib.pylab as plt
from matplotlib.pylab import rcParams
import read_sam_data as rsd
import pdb
import rloess 


rcParams['figure.figsize']=15,6

dateparse=lambda dates:pd.datetime.strptime(dates,'%Y-%m')
date=pd.read_csv('/home/ycc/Documents/data/AirPassengers.csv',parse_dates="Month",index_col="Month",date_parser=dateparse)

sampled_FC1=rsd.re_sam_data('FC1')
sampled_FC2=rsd.re_sam_data('FC2')

# divide the data into time and value
sampled_FC1_value=sampled_FC1[:,1]
sampled_FC2_value=sampled_FC2[:,1]
sampled_FC1_time=sampled_FC1[:,0]
sampled_FC2_time=sampled_FC2[:,0]

# implement the rloess filter
FC2_value_filtered=rloess.lowess(sampled_FC2_time,sampled_FC2_value,f=0.9,iter=3)

#plt.plot(sampled_FC2_value)
#plt.plot(FC2_value_filtered)
#plt.show()
コード例 #3
0
ファイル: RUL_err.py プロジェクト: Newsteinwell/write-code
#!/usr/bin/env python
# coding=utf-8
import read_sam_data as rsd
import numpy as np

sampled_data_FC=rsd.re_sam_data(FC='FC2')
FT1_FC=sampled_data_FC[0,1]*(1-0.035)
FT2_FC=sampled_data_FC[0,1]*(1-0.040)
FT3_FC=sampled_data_FC[0,1]*(1-0.045)
FT4_FC=sampled_data_FC[0,1]*(1-0.050)
FT5_FC=sampled_data_FC[0,1]*(1-0.055)

FT1_flag=0  # flag bit, 0 means haven't searched the FT1, 1 means already searched the FT1
FT2_flag=0  # flag bit, 0 means haven't searched the FT1, 1 means already searched the FT1
FT3_flag=0  # flag bit, 0 means haven't searched the FT1, 1 means already searched the FT1
FT4_flag=0  # flag bit, 0 means haven't searched the FT1, 1 means already searched the FT1
FT5_flag=0  # flag bit, 0 means haven't searched the FT1, 1 means already searched the FT1


sampled_data_FC=sampled_data_FC[1100:,]

x_old=np.array([[0],[0]])
for x in sampled_data_FC:
    if x[1] < FT1_FC and x_old[1] > FT1_FC and FT1_flag==0:
        FT1_value=x
        FT1_flag=1
    if x[1] < FT2_FC and x_old[1] > FT2_FC and FT2_flag==0:
        FT2_value=x
        FT2_flag=1
    if x[1] < FT3_FC and x_old[1] > FT3_FC and FT3_flag==0:
        FT3_value=x