Snuffler markers

Snuffler’s markers are a simple way to transfer interactive selections and picks to a user script or, vice versa, to visualize processing results from a user script in the interactive waveform browser.

Markers are handled in Pyrocko through the pyrocko.gui.snuffler.marker module. They are represented by the Marker class and the EventMarker and PhaseMarker subclasses. The functions load_markers() and save_markers() can be used to read and write markers in the file format used by Snuffler.

Read markers from file exported by Snuffler

The following example shows how to read a Pyrocko marker file, how to reassociate any contained phases and events, and how to access the attached event information, which may be shared between different markers.


from pyrocko import util
from pyrocko.gui import marker as pm
from pyrocko.example import get_example_data

# Download example markers

markers = pm.load_markers('')

for marker in markers:
    print(util.time_to_str(marker.tmin), util.time_to_str(marker.tmax))

    # only event and phase markers have an event attached
    if isinstance(marker, (pm.EventMarker, pm.PhaseMarker)):
        ev = marker.get_event()
        print(ev)  # may be shared between markers