Browse Source

docs target

whitelist
miili 3 years ago
parent
commit
a0a04ee0ed
  1. 7
      src/targets/base.py
  2. 2
      src/targets/gnss_campaign/target.py
  3. 30
      src/targets/waveform/target.py

7
src/targets/base.py

@ -22,6 +22,13 @@ class TargetGroup(Object):
weight = Float.T(
default=1.0,
help='Additional manual weight of the target group')
interpolation = gf.InterpolationMethod.T(
default='nearest_neighbor',
help='Interpolation from pre-calculated GF store.')
store_id = gf.StringID.T(
optional=True,
help='ID of the Green\'s function store for this TargetGroup.')
def get_targets(self, ds, event, default_path):
raise NotImplementedError()

2
src/targets/gnss_campaign/target.py

@ -36,8 +36,6 @@ class GNSSCampaignTargetGroup(TargetGroup):
help='List of individual campaign names'
' (`name` in `gnss.yaml` files).')
misfit_config = GNSSCampaignMisfitConfig.T()
interpolation = gf.InterpolationMethod.T()
store_id = gf.StringID.T(optional=True)
def get_targets(self, ds, event, default_path):
logger.debug('Selecting GNSS targets...')

30
src/targets/waveform/target.py

@ -8,7 +8,6 @@ from pyrocko.guts import (Object, String, Float, Bool, Int, StringChoice,
from pyrocko.guts_array import Array
from grond.dataset import NotFound
from grond.analysers.base import AnalyserResult
from ..base import (MisfitConfig, MisfitTarget, MisfitResult, TargetGroup)
@ -255,6 +254,8 @@ class WaveformMisfitTarget(gf.Target, MisfitTarget):
flip_norm = Bool.T(default=False)
misfit_config = WaveformMisfitConfig.T()
can_bootstrap_weights = True
def __init__(self, **kwargs):
gf.Target.__init__(self, **kwargs)
MisfitTarget.__init__(self, **kwargs)
@ -271,26 +272,13 @@ class WaveformMisfitTarget(gf.Target, MisfitTarget):
return plots
def get_combined_weight(self):
w = self.manual_weight
if 'target_balancing' in self.analyser_results:
w *= self.get_balancing_weight()
if 'noise' in self.analyser_results:
w *= self.get_station_noise_weight()
return num.array([w], dtype=num.float)
def get_balancing_weight(self):
if 'target_balancing' not in self.analyser_results:
raise AnalyserResult.NoResults(
'no balancing weights available')
return self.analyser_results['target_balancing'].weight
def get_station_noise_weight(self):
if 'noise' not in self.analyser_results:
raise AnalyserResult.NoResults(
'no station noise weights available')
return self.analyser_results['target_balancing'].weight
if self._combined_weight is None:
w = self.manual_weight
for analyser in self.analyser_results.values():
w *= analyser.weight
self._combined_weight = num.array([w], dtype=num.float)
return self._combined_weight
def get_taper_params(self, engine, source):
store = engine.get_store(self.store_id)

Loading…
Cancel
Save