Import pygmm module

In [1]:
import pygmm

Import SciPy, NumPy, matplotlib module

In [2]:
import numpy as np
import scipy as sp
import matplotlib as mpl

print("# numpy version = ",np.__version__)
print("# scipy version = ",sp.__version__)
print("# matplotlib version = ",mpl.__version__)

import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import matplotlib.dates as mdates 


from scipy import signal
from scipy import ndimage

from scipy.fftpack import fft, ifft
from scipy.linalg import norm

from scipy.stats import pearsonr
from scipy.stats import spearmanr
from scipy.stats import kendalltau

import sys
import os
# numpy version =  1.19.1
# scipy version =  1.5.2
# matplotlib version =  3.3.1

Font size

In [3]:
# font size
SMALL_SIZE = 16
MEDIUM_SIZE = 18
BIGGER_SIZE = 20

#SMALL_SIZE = 32
#MEDIUM_SIZE = 32
#BIGGER_SIZE = 36

plt.rc('font', size=SMALL_SIZE)          # controls default text sizes
plt.rc('axes', titlesize=SMALL_SIZE)     # fontsize of the axes title
plt.rc('axes', labelsize=MEDIUM_SIZE)    # fontsize of the x and y labels
plt.rc('xtick', labelsize=SMALL_SIZE)    # fontsize of the tick labels
plt.rc('ytick', labelsize=SMALL_SIZE)    # fontsize of the tick labels
plt.rc('legend', fontsize=SMALL_SIZE)    # legend fontsize
plt.rc('figure', titlesize=BIGGER_SIZE)  # fontsize of the figure title
In [4]:
fig, ax = plt.subplots(figsize=(20, 10))
#ax = plt.figure(figsize=(20, 16))

for dist_jb in [10, 50]:
    #for v_s30 in [300, 600, 900]:
    for v_s30 in [500]:
        for mag in [3, 4, 5, 6]:

            #m = pygmm.ChiouYoungs2014(mag=7, dist_jb=20, dist_x=20, dist_rup=25, dip=90, v_s30=v_s30)
            #m = pygmm.ChiouYoungs2014(mag=7, dist_jb=20, dist_x=20, dist_rup=25, dip=90, v_s30=v_s30, mechanism="RS")
            #m = pygmm.BooreStewartSeyhanAtkinson2014(mag=4.0, v_s30=v_s30, mechanism="RS",dist_jb=20)
            #scenario = pygmm.Scenario(mag=3.5, dist_jb=20, dist_x=20, dist_rup=25, dip=90, v_s30=v_s30)
            #scenario = pygmm.Scenario(mag=5.5, dist_jb=20, v_s30=v_s30)
            scenario = pygmm.Scenario(mag=mag, dist_jb=dist_jb, v_s30=v_s30)
            #m = pygmm.BooreStewartSeyhanAtkinson2014(mag=4.0, v_s30=v_s30, mechanism="RS",dist_jb=20)

            #m = pygmm.ChiouYoungs2014(scenario)
            m = pygmm.BooreStewartSeyhanAtkinson2014(scenario)
            #print(m)
            #print(m.pga)
            if dist_jb == 10:
                linestlye = "solid"
            else:
                linestlye = "dashed"
                
            ax.plot(m.periods, m.spec_accels, linestyle=linestlye,linewidth = 3.5, label="mag = "+str(mag)+" dist_jb = "+str(dist_jb)+"km vs30 = "+str(v_s30)+"m/s")

ax.set_xlabel('Period (s)')
ax.set_xscale('log')

ax.set_ylabel('5%-Damped Spectral Accel. (g)')
ax.set_yscale('log')

ax.grid()

#ax.legend(title='$V_{s30}$ (m/s)')
ax.legend()
Out[4]:
<matplotlib.legend.Legend at 0x7f9ef928e610>