From 2a413de3ac3f7954f7ee06cd266b4921e04aa577 Mon Sep 17 00:00:00 2001 From: thurinj Date: Fri, 1 Mar 2024 14:04:47 +1100 Subject: [PATCH] Added normalize-cross correlation attribute plotting Added a new plotting function for normalized cross-correlation, working with the default and pygmt backend. --- mtuq/graphics/attrs.py | 55 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/mtuq/graphics/attrs.py b/mtuq/graphics/attrs.py index 30878b2f..179984a0 100644 --- a/mtuq/graphics/attrs.py +++ b/mtuq/graphics/attrs.py @@ -62,6 +62,61 @@ def plot_time_shifts(dirname, attrs, stations, origin, key='total_shift', _plot_attrs(dirname, stations, origin, attrs, key, **kwargs) +def plot_cross_corr(dirname, attrs, stations, origin, key='normalized_cc_max', + **kwargs): + + """ Plots how time shifts vary by location and component + + By default, total time shifts are plotted. To plot just static or + cross-correlation time shifts, use ``key='static_shift'`` or + ``key='time_shift'``, respectively + + .. note :: + + MTUQ distinguishes between the following different types of + time shifts + + - `static_shift` is an initial user-supplied time shift applied during + data processing + + - `time_shift` is a subsequent cross-correlation time shift applied + during misfit evaluation + + - `total_shift` is the total correction, or in other words the sum of + static and cross-correlation time shifts + + + .. rubric :: Required input arguments + + ``dirname`` (`str`): + Directory in which figures will be written + + ``attrs`` (`list` of `AttribDict`): + List returned by misfit function's `collect_attributes` method + + ``stations`` (`list` of `mtuq.Station` objects): + Used to plot station locations + + ``origin`` (`mtuq.Origin` object): + Used to plot origin location + + + .. rubric :: Optional input arguments + + For optional argument descriptions, + `see here `_ + + """ + defaults(kwargs, { + 'label': 'Maximum normalized CC', + 'zero_centered': False, + 'colormap': 'inferno', + 'min_val': 0.0, + 'max_val': 1.0, + }) + + _plot_attrs(dirname, stations, origin, attrs, key, **kwargs) + def plot_amplitude_ratios(dirname, attrs, stations, origin, **kwargs): """ Plots how Aobs/Asyn varies by location and component