Commit dd08690b authored by Sebastian Heimann's avatar Sebastian Heimann
Browse files

Merge branch 'master' of gitext:heimann/lassie

Conflicts:
	src/config.py
	src/core.py
	src/plot.py
parents 805cf696 f7849e5b
......@@ -8,7 +8,8 @@ from collections import defaultdict
import numpy as num
from pyrocko import pile, trace, util, io, model
from pyrocko.parstack import parstack
from pyrocko.parstack import parstack, argmax as pargmax
from pyrocko.guts import Object, Timestamp, String, Float
from lassie import common, plot, grid as gridmod, geo
......@@ -416,9 +417,7 @@ def search(
tr_stackmax_indx = tr_stackmax.copy(data=False)
imaxs = num.zeros(frames.shape[1], dtype=num.int32)
for iframe, frame in enumerate(frames.T):
imaxs[iframe] = num.argmax(frame)
imaxs = pargmax(frames)
tr_stackmax_indx.set_ydata(imaxs.astype(num.int32))
tr_stackmax_indx.set_location('i')
......
......@@ -25,12 +25,23 @@ def downsample(tr, deltat):
class TraceSelector(Object):
'''
Filter traces used in an IFC using NSLC-id lists and/or lists of regular
Filter traces used in an IFC by NSLC-id lists and/or lists of regular
expressions.
'''
white_list = List.T(optional=True, default=[])
white_list_regex = List.T(String.T(default=[]))
white_list = List.T(
optional=True,
default=[],
help='list of NSLC ids'
)
white_list_regex = List.T(
String.T(
default=[],
optional=True,
),
help='list of regular expressions'
)
def __call__(self, trs):
matched = []
......@@ -54,11 +65,13 @@ class IFC(common.HasPaths):
'''Image function contribution.'''
name = String.T()
weight = Float.T(default=1.0)
weight = Float.T(
default=1.0,
help='global weight for this IFC')
weights = Dict.T(
String.T(),
Float.T(),
String.T(help='NSL regular expression identifying stations'),
Float.T(help='weighting factor'),
optional=True,
help='weight selected traces')
......@@ -66,6 +79,9 @@ class IFC(common.HasPaths):
fmax = Float.T()
shifter = shifter.Shifter.T(optional=True)
trace_selector = TraceSelector.T(
optional=True, help='select traces to be treated by this IFC')
def __init__(self, *args, **kwargs):
Object.__init__(self, *args, **kwargs)
self.shifter.t_tolerance = 1./(self.fmax * 2.)
......@@ -77,12 +93,6 @@ class IFC(common.HasPaths):
def get_table(self, grid, receivers):
return self.shifter.get_table(grid, receivers)
weights = Dict.T(
String.T(),
Float.T(),
optional=True,
help='give weight (default is 1) to selected stations.')
def get_tpad(self):
return 4. / self.fmin
......@@ -127,7 +137,6 @@ class WavePacketIFC(IFC):
fsmooth = Float.T(optional=True)
fsmooth_factor = Float.T(default=0.1)
trace_selector = TraceSelector.T(optional=True)
def get_tpad(self):
return 4. / self.get_fsmooth()
......@@ -237,6 +246,9 @@ class OnsetIFC(IFC):
fsmooth = self.get_fsmooth()
fnormalize = self.get_fnormalize()
if self.trace_selector:
trs = self.trace_selector(trs)
if not trs:
return []
......
import os
import numpy as num
from pyrocko import automap, plot
......
import copy
import os
import numpy as num
from pyrocko import util, gui_util, model, orthodrome, pile, snuffler
from pyrocko import util, gui_util, model, orthodrome, pile, snuffler, \
marker as pmarker
from pyrocko.snuffling import Snuffling, Param, Choice, Switch
from lassie import geo
from lassie import geo, ifc
kind_default = '1 (green)'
......@@ -267,6 +268,11 @@ def snuffle(config):
s.detections = detections_to_event_markers(detections_path)
s.add_markers(s.detections)
for _ifc in s.config.image_function_contributions:
if isinstance(_ifc, ifc.ManualPickIFC):
s.add_markers(
pmarker.load_markers(_ifc.picks_path))
receivers = config.get_receivers()
stations = set()
lats, lons = geo.points_coords(receivers, system='latlon')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment