forked from LuisMontejo/DirectionalitySpectra
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExampleDirectionalitySpectra.py
More file actions
61 lines (40 loc) · 1.79 KB
/
ExampleDirectionalitySpectra.py
File metadata and controls
61 lines (40 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
'''
Example: load the two horizontal components of a record and computes the
directionality factor, RotD100/RotD50 response spectra and ratios, and the
directionality reponse spectrum.
luis.montejo@upr.edu
alan.rivera@upr.edu
Rivera-Figueroa, A., & Montejo, L.A. (2021). Spectral Matching RotD100 Target
Spectra: Effect on records characteristics and seismic response.
Earthquake Spectra. https://doi.org/10.1177/87552930211049259
'''
import numpy as np
import matplotlib.pyplot as plt
from DirectionalitySpectra import dfactor,DFSpectra, load_PEERNGA_record
plt.close('all')
'''
use "load_PEERNGA_record" to load the 2 horizontal components:
s: acceleration series, dt: time step, n: number of data points, name: name of record
'''
comp1 = 'RSN730_SPITAK_GUK000.at2' # horizontal comp1 [g]
comp2 = 'RSN730_SPITAK_GUK090.at2' # horizontal comp2 [g]
s1,dt,n,name1 = load_PEERNGA_record(comp1)
s2,dt,n,name2 = load_PEERNGA_record(comp2)
'''
use "dfactor" to calculate the directionality factor for the acceleration series
hr, htheta : polar coordinates of the envelope (convex hull)
rmax : max response (radius)
thetamax : angle for rmax (deg)
df : directionality factor
'''
hr, htheta, rmax, thetamax, df = dfactor(s1,s2, plot=1)
'''
use "DFSpectra" to calculate
RotD100, RotD50, ratios RotD100/RotD50 and
Directionality spectrum of accelerarion (DSA)
'''
dampratio = 0.05 # damping ratio for spectra
theta = np.arange(0,180,1) # vector with angles to evaluate rotated spectra
freqs = np.geomspace(0.1,1/(2*dt),100) # frequencies vector
T = 1/freqs # periods vector
RotD100, RotD50, ratios, DSA = DFSpectra(T,s1,s2,dampratio,dt,theta, plot=1)