Commit b1ccc7de authored by Marius Isken's avatar Marius Isken
Browse files

super_group -> normalisation_family; group -> path

parent 28946af0
......@@ -96,9 +96,9 @@ class Config(HasPaths):
ds = self.get_dataset(event.name)
targets = []
for igroup, target_config in enumerate(self.target_groups):
targets.extend(target_config.get_targets(
ds, event, 'group_%i' % igroup))
for igroup, target_group in enumerate(self.target_groups):
targets.extend(target_group.get_targets(
ds, event, 'target.%i' % igroup))
return targets
......
......@@ -1151,17 +1151,21 @@ def draw_fits_figures(ds, model, plt):
target_to_result[target] = result
dtrace.meta = dict(super_group=target.super_group, group=target.group)
dtrace.meta = dict(
normalisation_family=target.normalisation_family,
path=target.path)
dtraces.append(dtrace)
result.processed_syn.meta = dict(
super_group=target.super_group, group=target.group)
normalisation_family=target.normalisation_family,
path=target.path)
all_syn_trs.append(result.processed_syn)
if result.spectrum_syn:
result.spectrum_syn.meta = dict(
super_group=target.super_group, group=target.group)
normalisation_family=target.normalisation_family,
path=target.path)
all_syn_specs.append(result.spectrum_syn)
......@@ -1170,7 +1174,7 @@ def draw_fits_figures(ds, model, plt):
return []
def skey(tr):
return tr.meta['super_group'], tr.meta['group']
return tr.meta['normalisation_family'], tr.meta['path']
trace_minmaxs = trace.minmax(all_syn_trs, skey)
......@@ -1185,7 +1189,7 @@ def draw_fits_figures(ds, model, plt):
cg_to_targets = gather(
problem.waveform_targets,
lambda t: (t.super_group, t.group, t.codes[3]),
lambda t: (t.normalisation_family, t.path, t.codes[3]),
filter=lambda t: t in target_to_result)
cgs = sorted(cg_to_targets.keys())
......@@ -1283,7 +1287,8 @@ def draw_fits_figures(ds, model, plt):
target = frame_to_target[iy, ix]
amin, amax = trace_minmaxs[target.super_group, target.group]
amin, amax = trace_minmaxs[
target.normalisation_family, target.path]
absmax = max(abs(amin), abs(amax))
ny_this = nymax # min(ny, nymax)
......@@ -1343,7 +1348,8 @@ def draw_fits_figures(ds, model, plt):
elif target.misfit_config.domain == 'frequency_domain':
asmax = amp_spec_maxs[target.super_group, target.group]
asmax = amp_spec_maxs[
target.normalisation_family, target.path]
fmin, fmax = \
target.misfit_config.get_full_frequency_range()
......@@ -1848,7 +1854,8 @@ class SolverPlot(object):
self.bcolors = colors.hsv_to_rgb(hsv[num.newaxis, :, :])[0, :, :]
bounds = self.problem.get_parameter_bounds() + self.problem.get_dependant_bounds()
bounds = self.problem.get_parameter_bounds()\
+ self.problem.get_dependant_bounds()
self.xlim = fixlim(*xpar.scaled(bounds[ixpar]))
self.ylim = fixlim(*ypar.scaled(bounds[iypar]))
......
......@@ -337,17 +337,14 @@ class Problem(Object):
return gcms
def make_group_mask(self):
super_group_names = set()
groups = num.zeros(len(self.targets), dtype=num.int)
ngroups = 0
for itarget, target in enumerate(self.targets):
if target.super_group not in super_group_names:
super_group_names.add(target.super_group)
ngroups += 1
family_names = set()
families = num.zeros(len(self.targets), dtype=num.int)
groups[itarget] = ngroups - 1
for itarget, target in enumerate(self.targets):
family_names.add(target.normalisation_family)
families[itarget] = len(family_names) - 1
return groups, ngroups
return families, len(family_names)
def get_group_mask(self):
if self._group_mask is None:
......
import numpy as num
import math
import logging
from pyrocko import gf, util, moment_tensor as mtm
from pyrocko.guts import String, Float, Dict, Int, StringChoice
from .base import Problem, ProblemConfig, logger
from .base import Problem, ProblemConfig
from ..meta import Forbidden, expand_template, Parameter
guts_prefix = 'grond'
logger = logger.getChild('cmt')
logger = logging.getLogger('grond.problems').getChild('cmt')
km = 1e3
as_km = dict(scale_factor=km, scale_unit='km')
......
import numpy as num
import logging
from pyrocko import gf, util
from pyrocko.guts import String, Float, Dict, Int
from .base import Problem, ProblemConfig, logger
from .base import Problem, ProblemConfig
from ..meta import Forbidden, expand_template, Parameter
guts_prefix = 'grond'
logger = logger.getChild('grond.doubleDC')
logger = logging.getLogger('grond.problems').getChild('double_dc')
km = 1e3
as_km = dict(scale_factor=km, scale_unit='km')
......
import numpy as num
import logging
from pyrocko import gf
from pyrocko.guts import String, Bool, Float, Dict, Int
from .base import Problem, ProblemConfig, logger
from .base import Problem, ProblemConfig
from ..meta import expand_template, Parameter
guts_prefix = 'grond'
logger = logger.getChild('rectangular')
logger = logging.getLogger('grond.problems').getChild('rectangular')
km = 1e3
as_km = dict(scale_factor=km, scale_unit='km')
......
......@@ -9,8 +9,8 @@ class MisfitConfig(Object):
class TargetGroup(Object):
super_group = gf.StringID.T(default='', optional=True)
group = gf.StringID.T(optional=True)
normalisation_family = gf.StringID.T(default='', optional=True)
path = gf.StringID.T(optional=True)
weight = Float.T(default=1.0)
misfit_config = MisfitConfig.T(optional=True)
......@@ -18,7 +18,7 @@ class TargetGroup(Object):
interpolation = gf.InterpolationMethod.T()
store_id = gf.StringID.T(optional=True)
def get_targets(self, ds, event, default_group):
def get_targets(self, ds, event, default_path):
raise NotImplementedError()
......@@ -58,7 +58,7 @@ class MisfitTarget(object):
self._result_mode = result_mode
def string_id(self):
return '.'.join([self.super_group, self.group, self.id])
return '.'.join([self.normalisation_family, self.path, self.id])
def post_process(self, engine, source, statics):
raise NotImplementedError()
......
......@@ -14,7 +14,7 @@ logger = logging.getLogger('grond.target').getChild('satellite')
class SatelliteTargetGroup(TargetGroup):
kite_scenes = List.T(optional=True)
def get_targets(self, ds, event, default_group):
def get_targets(self, ds, event, default_path):
logger.debug('Selecting satellite targets...')
targets = []
......@@ -50,8 +50,8 @@ class SatelliteTargetGroup(TargetGroup):
tsnapshot=None,
interpolation=self.interpolation,
store_id=self.store_id,
super_group=self.super_group,
group=self.group or default_group,
normalisation_family=self.normalisation_family,
path=self.path or default_path,
misfit_config=self.misfit_config)
sat_target.set_dataset(ds)
......@@ -76,12 +76,12 @@ class SatelliteMisfitConfig(MisfitConfig):
class SatelliteMisfitTarget(gf.SatelliteTarget, MisfitTarget):
scene_id = String.T()
super_group = gf.StringID.T()
normalisation_family = gf.StringID.T()
misfit_config = SatelliteMisfitConfig.T()
manual_weight = Float.T(
default=1.0,
help='Relative weight of this target')
group = gf.StringID.T(
path = gf.StringID.T(
help='Group')
parameters = [
......
......@@ -26,7 +26,7 @@ class WaveformTargetGroup(TargetGroup):
limit = Int.T(optional=True)
channels = List.T(String.T(), optional=True)
def get_targets(self, ds, event, default_group):
def get_targets(self, ds, event, default_path):
logger.debug('Selecting waveform targets...')
origin = event
targets = []
......@@ -51,8 +51,8 @@ class WaveformTargetGroup(TargetGroup):
store_id=self.store_id,
misfit_config=self.misfit_config,
manual_weight=self.weight,
super_group=self.super_group,
group=self.group or default_group)
normalisation_family=self.normalisation_family,
path=self.path or default_path)
if self.distance_min is not None and \
target.distance_to(origin) < self.distance_min:
......@@ -212,8 +212,8 @@ class WaveformMisfitTarget(gf.Target, MisfitTarget):
misfit_config = WaveformMisfitConfig.T()
flip_norm = Bool.T(default=False)
manual_weight = Float.T(default=1.0)
super_group = gf.StringID.T()
group = gf.StringID.T()
normalisation_family = gf.StringID.T()
path = gf.StringID.T()
analysis_result = TargetAnalysisResult.T(optional=True)
parameters = []
......@@ -227,8 +227,7 @@ class WaveformMisfitTarget(gf.Target, MisfitTarget):
self._target_ranges = None
def string_id(self):
return '.'.join(x for x in (
self.super_group, self.group) + self.codes if x)
return '.'.join(x for x in (self.path) + self.codes if x)
@property
def id(self):
......
Supports Markdown
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