コード例 #1
0
     test_seq_file = 'test_sequence/'+frame_type+'.txt'
     gms = open(file_loc+test_seq_file, 'r')
     a = gms.readlines()
     for line in a:
         words = line.split()
         if 'white' in words[1]:
             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):
コード例 #2
0
            UFP_force = np.ravel(UFP_force)
            UFP_force = np.delete(UFP_force, -1)
            channel[pots[j]] = UFP_force
    Earthquake[i] = channel
    
    if ruaumoko == 1:
        ruau = {'Record': 'Rec'}
        for k in rec:
            ruau_rec = cH.callruaudata(frame_type, test_ID, k)
            ruau_rec['Time'] = np.arange(offset_rec[rec.index(k)], len(ruau_rec['floor_displacement_0'])*0.01+offset_rec[rec.index(k)], 0.01)
            ruau[k] = ruau_rec
        Ruau_rec[i] = ruau
        
     # Original Acceleration file
    try:
        earthquake = cH.calleqdata(test_id[test_name.index(i)][0])
        acceleration = earthquake['Data']*earthquake['Scale_Factor']*Magnitude
        DT_a = earthquake['DT']
    except:
        acceleration = np.array([0, 0, 0, 0])
        DT_a = 0.05
    eq_time_a = np.arange(offset_eq, len(acceleration)*DT_a+offset_eq, DT_a)
    orig_earthquake[i] = [acceleration, eq_time_a, DT_a]
        
# design spectra
[T, dSA, dSD, eta]=design_spectra()
#####################################################################################

# Figure stuff
 
fontsize = 8
コード例 #3
0
for motion in range(len(test_sequence)):
    #adjust ruaumoko input file based on ground motion
    ##################################################
        
    if test_sequence[motion][1]=='PUSHOVER':
        timestep = 0.005
        duration = 120
        scale_factor = 1.0
        NPTS = duration/timestep
        gm_file_format = 3
        first_line = 1
        
    else:
        #call earthquake data
        record_name = test_sequence[motion][1]
        Earthquake = cH.calleqdata(record_name)
        Magnitude = float(test_sequence[motion][2])
        ground_motion_file = filelocation+loc+Earthquake['File']
        timestep = Earthquake['DT']
        NPTS = Earthquake['NPTS']
        duration = round(timestep*NPTS,1)
        scale_factor = Earthquake['Scale_Factor']*Magnitude
        gm_file_format = 6
        first_line = 5
        
    print '\n'+str(test_sequence[motion][1])+'\ntimestep:', timestep, 'npts:', NPTS, 'duration:', duration
    #create frame file
    orig_file = open(filelocation+'ruaumoko/'+frame_template, 'r')
    b = orig_file.read()
    orig_file.close()
    b = b.replace('SCALE_FACTOR', str(scale_factor))
コード例 #4
0
scale = 0.5
zeta = 0.05
magnitude = 1.0

# earthquake list
earthquake = []
gms = open(file_location+earthquake_file, 'r')
a = gms.readlines()
for line in a:
    words = line.split()
    earthquake.append(words[0])
gms.close()

Earthquake = {'Name':'data'}
for i in earthquake:
    Earthquake[i]=cH.calleqdata(i)

# print Earthquake['IMPVAL']

[T, dSA, dSD, eta]=design_spectra()
# T = T *np.sqrt(0.5)
tt = np.logspace(0.0001, 3.5, 200, 2)*0.001
# Determine spectra
spectra =[]
disp_spectra = []
for eq in earthquake:
    print eq
    motion = Earthquake[eq]['Data']*Earthquake[eq]['Scale_Factor']*9.81
    DT = Earthquake[eq]['DT']/np.sqrt(0.5)
    spec = CompareRecords(motion, motion, DT, DT)
    [pSA, pSD, pSA2, pSD2, Tt] = spec.ResponseSpectrum(Tt=tt)