mtuq icon indicating copy to clipboard operation
mtuq copied to clipboard

example for direct evaluation of an input moment tensor

Open carltape opened this issue 6 months ago • 5 comments

It is often very helpful to be able to specify a fixed set of coordinates for a moment tensor (say: Mw, lune longitude, lune latitude, strike, dip, rake) and then evaluate the misfit with observed waveforms, and also generate the various plots (including waveform fits). Could we please add such an example in the documentation? Basically this would be a degenerate grid search using a grid with no volume. I think that for new users this would reinforce the underlying forward-solving that is happening thousands of times, whether within a grid search or sampling-based approach. Thanks.

carltape avatar Jun 19 '25 18:06 carltape

To plot observed and synthetic waveforms, we could do something like

from mtuq import MomentTensor
from mtuq.graphics import plot_waveforms1

mt = MomentTensor([mrr,mtt,mpp,mrt,mrp,mtp])
plot_waveforms1(filename,data, greens.get_synthetics(mt), stations, origin, header=None)

Agreed, it could be helpful to work this into the documentation.

rmodrak avatar Jul 17 '25 19:07 rmodrak

Here is how one could modify any of the examples/ scripts:


    mt_dict = {
        "Mrr": -5800435174432632.0,
        "Mtt": 789342714264084.5,
        "Mpp": 5011092460168549.0,
        "Mrt": 3034156721905327.0,
        "Mrp": 2110077787951300.2,
        "Mtp": 2602039428905879.0,
        }

    mt_array = list(mt_dict.values())
    mt = MomentTensor(mt_array)


    plot_data_greens2(event_id+'DC_waveforms.png',
        data_bw, data_sw, greens_bw, greens_sw, process_bw, process_sw, 
        misfit_bw, misfit_sw, stations, origin, mt, lune_dict)

rmodrak avatar Oct 17 '25 05:10 rmodrak

Alternatively, one could generate the synthetics first and pass them directly

    from mtuq.graphics import plot_waveforms2

    synthetics_bw = greens_bw.get_synthetics(mt)
    synthetics_sw = greens_sw.get_synthetics(mt)


    plot_waveforms2(event_id+'DC_waveforms.png',
        data_bw, data_sw, synthetics_bw, synthetics_sw, stations, origin)

rmodrak avatar Oct 17 '25 05:10 rmodrak

Attached is a complete script illustrating the above

direct_evaluation.py

rmodrak avatar Oct 17 '25 05:10 rmodrak

a "misfit function evaluation" page could be added here?

https://mtuqorg.github.io/mtuq/user_guide/06.html

rmodrak avatar Oct 17 '25 17:10 rmodrak