relmt.plot module#
Plotting utilities for relMT
- relmt.plot.alignment(arr, hdr, dt_mccc=None, dt_rms=None, dt_pca=None, ccij=None, event_list=None, event_dict={}, station_dict={}, sort='pci', highlight_events=[])[source]#
Plot waveform array with alignment diagnostics
- Parameters:
arr (
ndarray) –(events, components, samples)Waveform arrayhdr (
Header) – Header of the waveform arraydt_rms (
ndarray|None) – RMS of time shifts from MCCC alignmentccij (
ndarray|None) – 2D Cross-correlation matrix between all event pairssort (
str) – Sort by “magnitude”, “pci” (principal component index), or “none” (input order)refevs – Highlight these reference events in red
- Returns:
fig – The
matplotlib.figure.Figurecontaining the plotaxs – Dictionary of
matplotlib.axes.Axesin the plot with keys: - “dt”: Time shifts - “snr”: Signal to noise ratios - “pv”: Principal seismograms - “wv”: Waveform section - “cci”: Average correlation of each event - “ccij”: Cross-correlation matrix - “ec”: Expansion coefficients
- relmt.plot.amplitude_connections(amplitudes, s_amplitudes=None, reference_mts=None, ax=None, node_size=250.0, node_linewidth=1.0)[source]#
Plot a graph representation of event connections.
Events are connected as pairs or triplets through relative amplitude measurements. Represent these connections as a graph and colour by number of connections
- ..note:
Requires networkx to be installed.
- Parameters:
amplitudes (
list[P_Amplitude_Ratio] |list[S_Amplitude_Ratios]) – Event pair- or tripletwise P- or S-amplitude mesuremetns.s_samplitudes – Second set of S-amplitude measurements. Observations will be combined
referenc_mts – Highlight these reference moment tensors with a larger node and thicker outline
node_size (
float) – Size of a node. Increase if you have big numbersnode_linewidth (
float) – Width of the node edges_amplitudes (
list[S_Amplitude_Ratios] |None)
- Returns:
Axes– The axis of the plot
- relmt.plot.bootstrap_matrix(moment_tensors, plot_beachball=False, best_mt=None, takeoff=None, subplot_kwargs={'figsize': (8, 9)})[source]#
Plot bootstrapped moment tensor components
- Parameters:
plot_beachball (
bool) – Plot bootstrap results as beacball plot. Requires pyrockobest_mt (
MT|None) – Also show the best moment tensor, when plot_beachball=True Requires pyrocko.takeoff (
ndarray|None) – (2, N) array of takeoff azimuth and plunge angles (degree).subplot_kwargs (
dict) – Keyword arguments passed on tomatplotlib.pyplot.subplots()
- Returns:
fig – The
class matplotlib..figure.Figurethat holds the plotaxs –
(6, 6)array ofclass matplotlib.axes.Axes
- relmt.plot.mt_matrix(mtd, highlight=[], names={}, values={}, valuename='Value', cmap=<matplotlib.colors.ListedColormap object>, overlay_dc_at=1.0, ax=None)[source]#
Plot moment tensors into a square matrix
- relmt.plot.p_reconstruction(wvfA, wvfB, Aab, sampling_rate=None, events_ab=None, axs=None)[source]#
Plot reconstruction of P wave train of event B from event A
Top panel shows reconstucted data over waveform A. Bottom two panels show waveform A and B, respectively.
- Parameters:
wvfA (
ndarray) –(samles,)waveforms of event A and BwvfB (
ndarray) –(samles,)waveforms of event A and BAab (
float) – Relative amplitude between A and Bevents_ab (
tuple[int,int] |None) – Show event numbers in axis titlesaxs (
tuple[Axes,Axes,Axes] |None) – A tuple of axes to plot into. If None, create new axes.
- Returns:
- relmt.plot.s_reconstruction(wvfA, wvfB, wvfC, Babc, Bacb, sampling_rate=None, events_abc=None, axs=None)[source]#
Plot reconstruction of S wave train of event A from events B and C
Top panel shows reconstucted data over waveform A. Bottom two panels show waveform A, B, and C, respectively.
- Parameters:
wvfA (
ndarray) – Waveform of events A, B, and CwvfB (
ndarray) – Waveform of events A, B, and CwvfC (
ndarray) – Waveform of events A, B, and CBabc (
float) – Relative contribution of B to ABacb (
float) – Relative contribution of C to Asamling_rate – Supply to show a time axis
events_abc (
tuple[int,int,int] |None) – Show event numbers in axis titles.axs (
tuple[Axes,Axes,Axes,Axes] |None) – Tuple of axes to plot into. If None, create new axes.
- Returns:
tuple[Axes,Axes,Axes,Axes] – Axes of the resulting subplots
- relmt.plot.section_2d(mat, scaling=None, time_shift=0.0, sampling_rate=1.0, components=None, ax=None, wiggle=True, image=False, plot_kwargs={}, image_kwargs={})[source]#
Plot a section of seismograms in 2D array.
- Parameters:
mat (
ndarray) –(events, samples)Waveform matrixscaling (
float|None) – If None, scale each trace to its absolute maximum value. If 0, scale by absolute value of the section. If non-zero float, scale each trace by this factor.time_shift (
float) – Add time shift to tick labels (seconds)sampling_rate (
float) – Sampling rate of the seismograms (Hertz)ax (
Axes|None) – Place plot in existing axis. If None, create an axiswiggle (
bool) – Produce a wiggle plotimage (
bool) – Produce a colored image plotplot_kwargs (
dict) – Additional keyword arguments passed tomatplotlib.pyplot.plot()(wiggle plot)image_kwargs (
dict) – Additional keyword arguments passed tomatplotlib.pyplot.imshow()(image plot)
- Returns:
Axes– Axis containing the plot
- relmt.plot.section_3d(arr, scale=-1.0, ax=None, sampling_rate=None, components=None, station=None, events_=None, phase=None, plot_kwargs={})[source]#
Plot seismograms in waveform matrix containing N events, C components and S samples
- Parameters:
arr (
ndarray) –(events, components, samples)Waveform matrixscale (
float) –< 0each trace is scaled to its maximum amplitude (default)= 0each trace is scaled to the maximum amplitude of the section> 0then each trace is scaled to that amplitude
ax (
Axes|None) – When supplied, plot into this axis instead of creating a new figuresampling_rate (
float|None) – Sampling rate of the seismic waveform (Hertz)events – Event names corresponding to the first dimension of the waveform array.
phase (
str|None) – Seismic phase type to consider (‘P’ or ‘S’)plot_kwargs (
dict) – Additional keyword arguments passed tomatplotlib.pyplot.plot()
- Returns:
Axes– Axis containing the plot
- relmt.plot.spectra(arr, hdr, bandpassd={}, highlight=[], integrate=False, ax=None)[source]#
Plot spectra of waveform array
- Parameters:
arr (
ndarray) –(events, components, samples)Waveform arrayhdr (
Header) – Header of the waveform arrayevd – Event dictionary
bandpasd – Dictionary of wavelet bandpasses per waveform id and event id
highlight (
list[int]) – Highlight these event IDs with discrete colorsax – Plot into this axis. If None, create one.
integrate (
bool)
- Return type: