Msamp = 0.25 Mws = np.arange(minM, maxM + Msamp, Msamp) Ns = gr_obj.get_N(Mws) setmin = True if (args.minMw is not None): min_Mw = args.minMw else: # If no min_Mw argument is given setmin = False min_Mw = -999.0 else: # Basic characteristics of seismicity catalog m0total = 1.0e17 max_m0 = math.pow(10.0, 19.5) minM = -1.0 min_m0 = gr.calc_m0(minM) slope = 1.0 root = 'random' # Define the Gutenberg-Richter relationship values gr_obj = gr.GutenbergRichter(b=slope, m0total=m0total, max_m0=max_m0, min_m0=min_m0) gr_obj.calc_a() # Make a plot of the chosen G-R relationship maxM = gr.calc_Mw(max_m0) Msamp = 0.25 Mws = np.arange(minM, maxM + Msamp, Msamp)
f2 = 1.0 psdperiodmin = 1.0/f2 # The period range chosen to extract psd values psdperiodmax = 1.0/f1 psdperiodstep = 1.0 psdperiodrange = np.arange(psdperiodmin, psdperiodmax, psdperiodstep) makeplots = False # Define a matrix of assumed Gutenberg-Richter parameters max_m0 = math.pow(10.0, 19.5) # Assuming a fixed corner, will calculate m0total bvals = np.array([0.9, 0.95, 1.0, 1.05, 1.1]) avals = np.arange(2.5, 7.5, 0.25) magmin = 1.0 magmax = 8.0 magstep = 0.5 magarray = np.arange(magmin, magmax, magstep) m0array = gr.calc_m0(magarray) nevents = np.zeros((len(avals), len(bvals), len(magarray))) m0total = np.zeros((len(avals), len(bvals))) # Fill in matrix of nevents and m0total for i, a in enumerate(avals): for j, b in enumerate(bvals): gro = gr.GutenbergRichter(a=a, b=b, max_m0=max_m0) gro.calc_m0total() m0total[i, j] = gro.m0total nevents[i, j, :] = gro.get_N(magarray) # subtract events from next bin up to avoid double counting for k in range(len(magarray)): if (k + 1 < len(magarray)): nevents[i, j, k] = nevents[i, j, k] - nevents[i, j, k + 1]
import pylab as P from tqdm import tqdm import cPickle as pickle import sys # Determine if the output filename is specified on command line if len(sys.argv) > 1: fileout = sys.argv[1] else: fileout = 'catalog.pkl' # Basic characteristics of seismicity catalog m0total = 1.0e16 max_m0 = math.pow(10.0, 18.0) minM = -1.0 min_m0 = gr.calc_m0(minM) slope = 1.0 # Define the Gutenberg-Richter relationship values gr_obj = gr.GutenbergRichter(b=slope, m0total=m0total, max_m0=max_m0, min_m0=min_m0) gr_obj.calc_a() # Make a plot of the chosen G-R relationship maxM = gr.calc_Mw(max_m0) Msamp = 0.25 Mws = np.arange(minM, maxM + Msamp, Msamp) Ns = gr_obj.get_N(Mws) max_dep = 2.0 #max depth in km, events will be uniform between 0 and max_dep