示例#1
0
             pass
         else:
             test_id.append([words[1], float(words[2]), words[0]])
     gms.close()
 #adjust ruaumoko input file based on ground motion
 ##################################################
 for i in range(len(test_id)):
     test_ID = test_id[i][0]+'_'+str(int(test_id[i][1]*100))
     if ground_motions == 'orig': # run original EQ file
         earthquake = cH.calleqdata(test_id[i][0])
         acceleration = earthquake['Data']*earthquake['Scale_Factor']*test_id[i][1] # g
         NPTS = earthquake['NPTS']
         DT = earthquake['DT']
     elif ground_motions == 'recD':
         DT = 0.005
         channel = cH.calltestdata(frame_type, test_ID)
         disp = CompareRecords(channel['Table_displacement']/1000, channel['Table_displacement']/1000, DT, DT)
         disp.Remove_average()
         disp.Butter_pass([0.1, 20])
         displacement = disp.motions[0]
         int_vel = np.zeros(len(displacement))
         int_vel[0] = 0.0
         int_accel = np.zeros(len(displacement))
         int_accel[0] = 0.0
         for k in range(len(displacement)-1):
             int_vel[k+1] = (displacement[k+1]-displacement[k])/DT
             int_accel[k+1] = (int_vel[k+1]-int_vel[k])/DT/9.81
         acceleration = int_accel            
         NPTS = len(acceleration)
     elif ground_motions == 'pushover':
         acceleration = np.array([0.0, 0.1, 0.1])
示例#2
0
spectra = {'EQ':"Spectra"}
EQlist = []
# save_data = open(filelocation+'/floor_analysis/'+frame_type+'.txt', 'w')
for mag in range(len(test_sequence)):
    print test_sequence[mag][0], float(test_sequence[mag][2])
    if 'white' in test_sequence[mag][0]:
        pass
    elif 'sine' in test_sequence[mag][0]:
        pass 
    elif 'fv' in test_sequence[mag][0]:
        pass 
    else:
           
        record = test_sequence[mag][1]+'_'+str(int(float(test_sequence[mag][2])*100))
        EQlist.append([test_sequence[mag][1], float(test_sequence[mag][2])])
        channel = cH.calltestdata(frame_type, record)
             
        # peak floor acceleration
#         accF = CompareRecords(channel['Accel_Bottom_floor_pair']*9.81, channel['Accel_Top_floor_pair']*9.81, DT, DT)   
#         accF.Remove_average()
#         accF.Butter_pass(BP)
#         A1 = max(abs(accF.motions[0]))/9.81
#         A2 = max(abs(accF.motions[1]))/9.81       
        
        #beam acceleration spectra
        accb = CompareRecords(channel['Accel_Bottom_beam_pair']*9.81, channel['Accel_Top_beam_pair']*9.81, DT, DT)   
        accb.Remove_average()
        accb.Butter_pass(BP)
        [pSA, pSD, pSA2, pSD2, Tt] = accb.ResponseSpectrum()
        spectra[record] = [pSA, pSA2, test_sequence[mag][1]]
        
示例#3
0
import matplotlib.pyplot as plt
import numpy as np
import call_HDF as cH
import scipy.signal as sp
Channel = cH.calltestdata('Hyb_UFP', 'white_noise_25')
acc = Channel['Accel_Top_beam_pair']*9.81
 
win = np.arange(0,30, 0.05)
  
[f, Pxx] = sp.welch(acc, fs=200, window=win)

for i in Pxx:
    print i

Pmax = max(Pxx) 
middle = Pxx.argmax()
a = max(Pxx)/np.sqrt(2)
  
f1 = f[0:middle+1] 
Pxx1 = Pxx[0:middle+1] 
f2 = f[middle:-1]
Pxx2 =  Pxx[middle:-1]
  
b1 = np.interp(a, Pxx1, f1)
b2 = np.interp(-a, -Pxx2, f2)
  
 
# print f[middle] 
# print a, b1, b2
zi = np.round((b2-b1)/(2*f[middle])*100,2)
print 'zi = ',zi, ' %'
示例#4
0
    Magnitude = float(words[2])
    test_id.append([record_name, Magnitude])
    gms.close() 

###################################################################################
# call test data
Earthquake = {'Earthquake':'Channel'}

for i in frame_type:
    test_ID =  test_id[frame_type.index(i)][0]+'_'+str(int(test_id[frame_type.index(i)][1]*100))
    Magnitude = test_id[frame_type.index(i)][1]
    try:    
        table_acceleration = np.loadtxt(filelocation+'table_acceleration/'+i+'/'+test_name+'.txt')*-1
    except:
        table_acceleration = np.array([0, 0, 0])
    channel = cH.calltestdata(i, test_ID)
    channel['Time'] = np.arange(0, len(channel['Load_Cell_Lower_S'])*DT, DT)
    channel['Time_ta'] = np.arange(2.035, len(table_acceleration)*DT_ta+2.035, DT_ta)
    channel['Table_acceleration'] = np.interp(channel['Time'], channel['Time_ta'], table_acceleration) 
    Earthquake[i] = channel

# design spectra
[T, dSA, dSD, eta]=design_spectra()
#####################################################################################

# Figure stuff
 
fontsize = 8
rcParams['axes.labelsize'] = fontsize
rcParams['xtick.labelsize'] = fontsize
rcParams['ytick.labelsize'] = fontsize