green = '\x1b[32m' red = '\x1b[31m' blue = '\x1b[34m' dim = '\x1b[2m' reset = '\x1b[0m'
for line in diff: if line.startswith('+'): yield green + line + reset elif line.startswith('-'): yield red + line + reset elif line.startswith('^'): yield blue + line + reset elif line.startswith('@'): yield dim + line + reset else: yield line
default=True, help='Load the GF stores from ~/.pyrocko/config') Path.T(), help='List of path hosting collection of Green\'s function stores.') Path.T(), help='List of Green\'s function stores')
use_config=self.gf_stores_from_pyrocko_config, store_superdirs=fp(self.gf_store_superdirs), store_dirs=fp(self.gf_store_dirs))
help='Rundir for the optimisation, supports templating' ' (eg. ${event_name})') help='Dataset configuration object') TargetGroup.T(), help='List of ``TargetGroup``s') help='Problem config') AnalyserConfig.T(), default=[TargetBalancingAnalyserConfig.D()], help='List of problem analysers') help='The optimisers configuration') default=EngineConfig.D(), help=':class:`pyrocko.gf.LocalEngine` configuration') gf.StringID.T(), help='Restrict application to given event names. If empty, all events ' 'found through the dataset configuration are considered.') gf.StringID.T(), help='Event names to be excluded')
names = self.event_names else:
def nevents(self): return len(self.dataset_config.get_events())
ds, event, 'target.%i' % igroup))
synt.set_problem(problem) problem.base_source = problem.get_source(synt.get_x())
event, self.target_groups, targets)
except OSError: raise GrondError( 'Cannot read Grond configuration file: %s' % path)
raise GrondError('Invalid Grond configuration in file "%s".' % path)
config, filename=path, header='Grond configuration file, version %s' % __version__)
except OSError: raise GrondError( 'Cannot write Grond configuration file: %s' % path)
s1.splitlines(1), s2.splitlines(1), 'left', 'right'))
sys.stdout.writelines(color_diff(result)) else:
ident = r'[a-zA-Z][a-zA-Z0-9_]*' rint = r'-?[0-9]+' m = re.match( r'^(%s)(\[((%s)?(:)(%s)?|(%s))\])?$' % (ident, rint, rint, rint), yname)
if not m: raise YPathError('Syntax error in component: "%s"' % yname)
d = dict( name=m.group(1))
if m.group(2): if m.group(5): istart = iend = None if m.group(4): istart = int(m.group(4)) if m.group(6): iend = int(m.group(6))
d['slice'] = (istart, iend) else: d['index'] = int(m.group(7))
return d
if ynames: for sobj in iter_get_obj(obj, ynames): yield sobj else: yield obj
yname = ynames.pop(0) d = parse_yname(yname) if d['name'] not in obj.T.propnames: raise AttributeError(d['name'])
obj = getattr(obj, d['name'])
if 'index' in d: sobj = obj[d['index']] for ssobj in _decend(sobj, ynames): yield ssobj
elif 'slice' in d: for i in range(*slice(*d['slice']).indices(len(obj))): sobj = obj[i] for ssobj in _decend(sobj, ynames): yield ssobj else: for sobj in _decend(obj, ynames): yield sobj
EngineConfig Config read_config write_config diff_configs '''.split() |