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
They are represented by the
pyrocko.marker.Marker class and the
pyrocko.marker.PhaseMarker subclasses. The functions
pyrocko.marker.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 get_example_data('my_markers.pf') markers = pm.load_markers('my_markers.pf') pm.associate_phases_to_events(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