Segment and Pick - s-schneider/frospy GitHub Wiki
Pick
Auxiliary input data for splitting function measurements can be added using the
Segment
and Pick
classes.
Segments are list-like objects which contain multiple Pick
objects, i.e. frequency and time windows with additional information such as the weight, modes within the frequency window and event or source name.
The following example demonstrates how to create Pick
object of a frequency window for a given Spectrum object. An example file is provided in the repository. In this example replace the 'PATH/TO/REPO' with the actual path to where you cloned/downloaded the repository.
>>> from obspy import read
>>> st = read('/PATH/TO/REPO/frospy/data/examples/031111B.ahx')
>>> print(st)
1 Trace(s) in Stream:
.ADO..VHZ | 2011-03-11T05:47:40.000000Z - 2011-03-18T05:47:30.000000Z | 0.1 Hz, 60480 samples
>>> from frospy import Spectrum
>>> from frospy.spectrum.controllers import get_pick
>>> spec = Spectrum(st[0], 5, 50)
>>> print(spec)
ADO | VHZ | 5.0-50.0 hrs
Spectrum for: Data
>>> pick = get_pick(spec, [1.025, 1.05], event='031111B', weighting='sum')
>>> print(pick)
ADO | fw1: 1.025 fw2: 1.050 | tw1: 5.000 tw2: 50.000 | weight: 9.10e-05
The metadata of the Pick can be accessed vie the stats
keyword:
>>> print(pick.stats)
modes: 1 Mode(s) in Modes:
0S6 | freq: 1.038 | Q: 347.343
station: ADO
event: 031111B
channel: VHZ
snr: 4.358330248162506
author: User
data_origin:
misfit: None
Segment
Multiple
Pick
objects can be grouped in a Segment
object, which is demonstrated in the following example:
>>> from frospy import Segment
>>> Seg = Segment()
>>> Seg += pick
>>> print(Seg)
1 Picks(s) in Segment:
ADO | fw1: 1.025 fw2: 1.050 | tw1: 5.000 tw2: 50.000 | weight: 9.10e-05