('R', 'C', 0, f()), ('R', 'C', 1, f()), ('L', 'U', 0, f()), ('L', 'U', 1, f()), ('L', 'C', 0, f()), ('L', 'C', 1, f())] # reorganize inputs for dispersion_1 Waves, Types, Modes, Freqs = zip(*curves) # compute dispersion curves with Timer('dispersion'): out = list(dispersion_1(ztop, vp, vs, rh, Waves, Types, Modes, Freqs)) # display results ax = plt.gca() for w, t, m, fs, us in out: ax.loglog(1. / fs, us, '+-', label="%s%s%d" % (w, t, m)) ax.set_xlabel('period (s)') ax.set_ylabel('velocity (km/s)') ax.grid(True, which="major") ax.grid(True, which="minor") logtick(ax, "xy") plt.legend() plt.show()
pmin, pmax = np.inf, -np.inf for f in argv['show']: s = surf96reader(f) print f for law in s.get_all(): print " %s" % str(law) law.show(gca(), period=not "freq" in argv.keys(), label="%s%s%d" % (law.wave, law.type, law.mode) ) #alpha = 0.5, color = "r" if law.mode else "k") pmin = min([pmin, 1. / law.freq.max()]) pmax = max([pmax, 1. / law.freq.min()]) gca().set_xscale('log') gca().set_yscale('log') logtick(gca(), "xy") if not "freq" in argv.keys(): gca().set_xlim(pmin, pmax) else: gca().set_xlim(1. / pmax, 1. / pmin) gca().grid(True) gca().set_xlabel("period (s)") gca().set_ylabel("velocity (km/s)") # plt.legend() showme() sys.exit() # ----------------------------------- elif "resamp" in argv.keys(): def tostr(law, newf): fmt = "SURF96 {wave} {type} {flag} {mode} {period} {value} {dvalue}" stdlaw = Claw(freq=law.freq, value=law.dvalue, extrapolationmode=0)
def tick(self): for _, ax in self.axdisp.items(): logtick(ax, "xy") for _, ax in self.axdepth.items(): if ax is not None: Ntick(ax, 4, "x")
assert s96out.endswith('.surf96') or s96out.endswith('.s96') with open(s96out, 'w') as fid: for curve in curves: fid.write(str(curve)) else: axvp = gcf().add_subplot(1, 5, 1) axvs = gcf().add_subplot(1, 5, 2, sharey=axvp) axpr = gcf().add_subplot(1, 5, 3, sharey=axvp) axrh = gcf().add_subplot(1, 5, 4, sharey=axvp) axdsp = gcf().add_subplot(2, 5, 5) dm.vp.show(axvp) dm.vs.show(axvs) dm.pr().show(axpr) dm.rh.show(axrh) for curve in curves: #for w, t, m, F, V in dispersion_1(ztop, vp, vs, rh, Waves, Types, Modes, Freqs): axdsp.loglog(1. / curve.freqs, curve.values, label="%s%s%d" % (curve.wave, curve.type, curve.mode)) if "save" not in argv.keys(): logtick(axdsp, "xy") # plt.legend() showme() sys.exit()
def tick(self): for ax in self.axdisp: logtick(ax, "xy") for ax in self.axdepth: Ntick(ax, 4, "x")
# ##compute dispersion curves fig1 = plt.figure(figsize=(8, 8)) fig1.subplots_adjust(wspace=0.3) with Timer('dispersion'): out = list(dispersion_1(ztop, vp, vs, rh, Waves, Types, Modes, Freqs)) ax1 = fig1.add_subplot(223) dm.show(ax1) ax1.grid(True, linestyle=":", color="k") plt.legend() ax2 = fig1.add_subplot(222) for w, t, m, fs, us in out: ax2.loglog(1. / fs, us, '+-', label="%s%s%d" % (w, t, m)) ax2.set_ylabel('velocity (km/s)') ax2.grid(True, which="major") ax2.grid(True, which="minor") logtick(ax2, "xy") plt.legend() # ## sensitivity kernels norm = "norm" in argv.keys() if "png" not in argv.keys(): fig1.show() for w, t, m, F, DLOGVADZ, DLOGVADLOGVS, DLOGVADLOGPR, DLOGVADLOGRH in \ sker17_1(ztop, vp, vs, rh, Waves, Types, Modes, Freqs, dz=0.001, dlogvs=.01, dlogpr=.01, dlogrh=.01, norm=norm, h=0.005, dcl=0.005, dcr=0.005): # ------ _depth_ = np.concatenate((ztop, [1.1 * ztop[-1]]))