def _test_plot_all(plot_all): mpl.rcParams['lines.markersize'] = 200 plot_travel_times(10, phase_list=("SSS", ), min_degrees=150, max_degrees=200, npoints=4, legend=False, plot_all=plot_all)
def test_plot_travel_times_convenience_1(self, model, image_path): """ Travel time plot for many phases at multiple epicentral distances, convenience function """ plot_travel_times(10, phase_list=("P", "S", "SKS", "PP"), min_degrees=40, max_degrees=60, show=False, legend=True, npoints=4) plt.savefig(image_path)
def test_plot_travel_times_convenience(self): """ Travel time plot for many phases at multiple epicentral distances, convenience function """ with ImageComparison( self.image_dir, "traveltimes_many_phases_multiple_degrees.png") as ic: # base line image looks awkward with points at the left/right end # of the plot but that's only due to the "classic" style sheet used # in tests. default mpl2 style makes room around plotted artists # larger point size to ensure plot can fail properly if points # should move mpl.rcParams['lines.markersize'] = 20 plot_travel_times(10, phase_list=("P", "S", "SKS", "PP"), min_degrees=40, max_degrees=60, show=False, legend=True, npoints=4) plt.savefig(ic.name) def _test_plot_all(plot_all): mpl.rcParams['lines.markersize'] = 200 plot_travel_times(10, phase_list=("SSS", ), min_degrees=150, max_degrees=200, npoints=4, legend=False, plot_all=plot_all) # now test option plot_all=False with ImageComparison(self.image_dir, "traveltimes_plot_all_False.png") as ic: _test_plot_all(plot_all=False) plt.savefig(ic.name) # same test should fail if plot_all=True tol = {} # adjust tolerance on Travis minimum dependency build, tolerance is set # so high for that build that image comparison can virtually never # fail.. (also adjust for matplotlib 1.2.0 on centos) if MATPLOTLIB_VERSION <= [1, 2]: tol['reltol'] = 5 tol['adjust_tolerance'] = False with self.assertRaises(ImageComparisonException): with ImageComparison(self.image_dir, "traveltimes_plot_all_False.png", no_uploads=True, **tol) as ic: _test_plot_all(plot_all=True) plt.savefig(ic.name)
def test_plot_travel_times_convenience(self): """ Travel time plot for many phases at multiple epicentral distances, convenience function """ with ImageComparison( self.image_dir, "traveltimes_many_phases_multiple_degrees.png") as ic: # base line image looks awkward with points at the left/right end # of the plot but that's only due to the "classic" style sheet used # in tests. default mpl2 style makes room around plotted artists # larger point size to ensure plot can fail properly if points # should move mpl.rcParams['lines.markersize'] = 20 plot_travel_times(10, phase_list=("P", "S", "SKS", "PP"), min_degrees=40, max_degrees=60, show=False, legend=True, npoints=4) plt.savefig(ic.name) def _test_plot_all(plot_all): mpl.rcParams['lines.markersize'] = 200 plot_travel_times(10, phase_list=("SSS", ), min_degrees=150, max_degrees=200, npoints=4, legend=False, plot_all=plot_all) # now test option plot_all=False with ImageComparison(self.image_dir, "traveltimes_plot_all_False.png") as ic: _test_plot_all(plot_all=False) plt.savefig(ic.name) # Now with option plot_all=True with ImageComparison(self.image_dir, "traveltimes_plot_all_True.png") as ic: _test_plot_all(plot_all=True) plt.savefig(ic.name)
def test_plot_travel_times_convenience(self): """ Travel time plot for many phases at multiple epicentral distances, convenience function """ with ImageComparison( self.image_dir, "traveltimes_many_phases_multiple_degrees.png") as ic: # base line image looks awkward with points at the left/right end # of the plot but that's only due to the "classic" style sheet used # in tests. default mpl2 style makes room around plotted artists # larger point size to ensure plot can fail properly if points # should move mpl.rcParams['lines.markersize'] = 20 plot_travel_times(10, phase_list=("P", "S", "SKS", "PP"), min_degrees=40, max_degrees=60, show=False, legend=True, npoints=4) plt.savefig(ic.name) def _test_plot_all(plot_all): mpl.rcParams['lines.markersize'] = 200 plot_travel_times(10, phase_list=("SSS",), min_degrees=150, max_degrees=200, npoints=4, legend=False, plot_all=plot_all) # now test option plot_all=False with ImageComparison( self.image_dir, "traveltimes_plot_all_False.png") as ic: _test_plot_all(plot_all=False) plt.savefig(ic.name) # same test should fail if plot_all=True tol = {} # adjust tolerance on Travis minimum dependency build, tolerance is set # so high for that build that image comparison can virtually never # fail.. (also adjust for matplotlib 1.2.0 on centos) if MATPLOTLIB_VERSION <= [1, 2]: tol['reltol'] = 5 tol['adjust_tolerance'] = False with self.assertRaises(ImageComparisonException): with ImageComparison( self.image_dir, "traveltimes_plot_all_False.png", no_uploads=True, **tol) as ic: _test_plot_all(plot_all=True) plt.savefig(ic.name)
def test_plot_travel_times_convenience(self): """ Travel time plot for many phases at multiple epicentral distances, convenience function """ with ImageComparison( self.image_dir, "traveltimes_many_phases_multiple_degrees.png") as ic: # base line image looks awkward with points at the left/right end # of the plot but that's only due to the "classic" style sheet used # in tests. default mpl2 style makes room around plotted artists # larger point size to ensure plot can fail properly if points # should move mpl.rcParams['lines.markersize'] = 20 plot_travel_times(10, phase_list=("P", "S", "SKS", "PP"), min_degrees=40, max_degrees=60, show=False, legend=True, npoints=4) plt.savefig(ic.name) def _test_plot_all(plot_all): mpl.rcParams['lines.markersize'] = 200 plot_travel_times(10, phase_list=("SSS",), min_degrees=150, max_degrees=200, npoints=4, legend=False, plot_all=plot_all) # now test option plot_all=False with ImageComparison( self.image_dir, "traveltimes_plot_all_False.png") as ic: _test_plot_all(plot_all=False) plt.savefig(ic.name) # Now with option plot_all=True with ImageComparison( self.image_dir, "traveltimes_plot_all_True.png") as ic: _test_plot_all(plot_all=True) plt.savefig(ic.name)
from obspy.taup import plot_travel_times import matplotlib.pyplot as plt fig, ax = plt.subplots() ax = plot_travel_times(source_depth=10, ax=ax, fig=fig, phase_list=['P', 'PP', 'S'], npoints=200)
from obspy.taup import plot_travel_times import matplotlib.pyplot as plt fig, ax = plt.subplots() ax = plot_travel_times(source_depth=10, ax=ax, fig=fig, phase_list=['P', 'PP', 'S'])
def _test_plot_all(plot_all): mpl.rcParams['lines.markersize'] = 200 plot_travel_times(10, phase_list=("SSS",), min_degrees=150, max_degrees=200, npoints=4, legend=False, plot_all=plot_all)
from obspy.taup import plot_travel_times model = TauPyModel(model="iasp91") #%% Plot ray paths #arrivals = model.get_ray_paths(source_depth_in_km=55, distance_in_degree=150) #arrival = arrivals[0] #arrivals = model.get_ray_paths(source_depth_in_km=55, distance_in_degree=150, # phase_list = ["PKP", "PKIKP", "PKiKP"]) #ax = arrivals.plot_rays() #%% another way to plot travel time curves fig, ax = plt.subplots(figsize=(9, 9)) #ax = plot_travel_times(source_depth=10, phase_list=["PKP", "PKIKP", "PKiKP"], ax = plot_travel_times(source_depth=0, ax=ax, fig=fig, min_degrees=90, max_degrees=130, npoints=200, verbose=True, phase_list=['P', 'PcP', 'PKP', 'PKiKP', 'PKIKP']) #%% Plot travel time curves at one distance #arrivals = model.get_travel_times(source_depth_in_km=55, # distance_in_degree=150, phase_list = ["PKP", "PKIKP", "PKiKP"]) #ax = arrivals.plot_times() #ev_dep = 50. #dist = 50. #dphase = 'P' #arrivals = model.get_travel_times(source_depth_in_km=ev_dep,distance_in_degree=dist,phase_list=[dphase])
plot_all=True, legend=True, label_arrivals=False, verbose=False, fig=None, show=True, ax=None) #toggle between cartsian and spherical #%% fig, ax = plt.subplots() ax = plot_travel_times(source_depth=33, min_degrees=15, max_degrees=40, phase_list=["S", "P"], plot_all=True, npoints=20, ax=ax, fig=fig, verbose=False) ax.grid() #%% st = read("quake.sac_.gz") starttime = UTCDateTime("2014-04-13T12:40:00") st.trim(starttime, starttime + 1500) st.plot() #%%
def _test_plot_all(plot_all): """Helper function for plotting all phases.""" mpl.rcParams['lines.markersize'] = 200 plot_travel_times(10, phase_list=("SSS",), min_degrees=150, max_degrees=200, npoints=4, legend=False, plot_all=plot_all)
from obspy.taup import TauPyModel from obspy.taup import plot_travel_times model = TauPyModel(model="iasp91") #%% Plot ray paths #arrivals = model.get_ray_paths(source_depth_in_km=55, distance_in_degree=150) #arrival = arrivals[0] #arrivals = model.get_ray_paths(source_depth_in_km=55, distance_in_degree=150, # phase_list = ["PKP", "PKIKP", "PKiKP"]) #ax = arrivals.plot_rays() #%% another way to plot travel time curves fig, ax = plt.subplots(figsize=(9, 9)) #ax = plot_travel_times(source_depth=10, phase_list=["PKP", "PKIKP", "PKiKP"], ax = plot_travel_times(source_depth=0, ax=ax, fig=fig, min_degrees=90, max_degrees=130, npoints=200, verbose=True) #%% Plot travel time curves at one distance #arrivals = model.get_travel_times(source_depth_in_km=55, # distance_in_degree=150, phase_list = ["PKP", "PKIKP", "PKiKP"]) #ax = arrivals.plot_times() #ev_dep = 50. #dist = 50. #dphase = 'P' #arrivals = model.get_travel_times(source_depth_in_km=ev_dep,distance_in_degree=dist,phase_list=[dphase])