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

Started new listeners

parent 0ead9fe5
#!/usr/bin/env python #!/usr/bin/env python
import os import os
from distutils.core import setup from setuptools import setup
def grond_completion(): def grond_completion():
...@@ -12,13 +12,31 @@ def grond_completion(): ...@@ -12,13 +12,31 @@ def grond_completion():
setup( setup(
name='grond', name='grond',
description='What do you want to bust today?!', description='What do you want to bust today?!',
version='0.1', version='0.2',
author='Sebastian Heimann', author='Sebastian Heimann',
author_email='sebastian.heimann@gfz-potsdam.de', author_email='sebastian.heimann@gfz-potsdam.de',
packages=['grond', 'grond.baraddur', 'grond.problems', 'grond.optimizers', packages=[
'grond.analysers', 'grond.listeners', 'grond.targets'], 'grond',
'grond.apps',
'grond.baraddur',
'grond.targets',
'grond.targets.waveform',
'grond.targets.satellite',
'grond.problems',
'grond.problems.cmt',
'grond.problems.double_dc',
'grond.problems.rectangular',
'grond.optimizers',
'grond.optimizers.highscore',
'grond.analysers',
'grond.listeners',
],
python_requires='>=3.5', python_requires='>=3.5',
scripts=['apps/grond'], entry_points={
'console_scripts': [
'grond = grond.apps.__main__:main',
]
},
package_dir={'grond': 'src'}, package_dir={'grond': 'src'},
package_data={'grond': ['baraddur/templates/*.html', package_data={'grond': ['baraddur/templates/*.html',
'baraddur/res/*']}, 'baraddur/res/*']},
......
...@@ -4,7 +4,6 @@ from .problems import * # noqa ...@@ -4,7 +4,6 @@ from .problems import * # noqa
from .targets import * # noqa from .targets import * # noqa
from .meta import * # noqa from .meta import * # noqa
from .synthetic_tests import * # noqa from .synthetic_tests import * # noqa
from .solvers import * # noqa
from .optimizers import * # noqa from .optimizers import * # noqa
__version__ = '0.2' __version__ = '0.2'
...@@ -81,6 +81,32 @@ To get further help and a list of available options for any subcommand run: ...@@ -81,6 +81,32 @@ To get further help and a list of available options for any subcommand run:
''' % usage_tdata ''' % usage_tdata
def main(args=None):
if not args:
args = sys.argv
args = list(sys.argv)
if len(args) < 2:
sys.exit('Usage: %s' % usage)
args.pop(0)
command = args.pop(0)
if command in subcommands:
globals()['command_' + d2u(command)](args)
elif command in ('--help', '-h', 'help'):
if command == 'help' and args:
acommand = args[0]
if acommand in subcommands:
globals()['command_' + acommand](['--help'])
sys.exit('Usage: %s' % usage)
else:
die('no such subcommand: %s' % command)
def add_common_options(parser): def add_common_options(parser):
parser.add_option( parser.add_option(
'--loglevel', '--loglevel',
...@@ -206,7 +232,8 @@ def command_init(args): ...@@ -206,7 +232,8 @@ def command_init(args):
elif options.static: elif options.static:
config_type = 'static' config_type = 'static'
sub_dirs += ['scenes'] sub_dirs += ['scenes', 'gnss']
dataset_config = grond.DatasetConfig( dataset_config = grond.DatasetConfig(
events_path='events.txt', events_path='events.txt',
kite_scene_paths=['scenes'], kite_scene_paths=['scenes'],
...@@ -245,14 +272,14 @@ def command_init(args): ...@@ -245,14 +272,14 @@ def command_init(args):
engine_config = grond.EngineConfig( engine_config = grond.EngineConfig(
gf_store_superdirs=['.']) gf_store_superdirs=['.'])
solver_config = grond.HighScoreSolverConfig() optimizer_config = grond.HighScoreOptimizerConfig()
config = grond.Config( config = grond.Config(
rundir_template=op.join('rundir', '${problem_name}.grun'), rundir_template=op.join('rundir', '${problem_name}.grun'),
dataset_config=dataset_config, dataset_config=dataset_config,
target_groups=target_groups, target_groups=target_groups,
problem_config=problem_config, problem_config=problem_config,
solver_config=solver_config, optimizer_config=optimizer_config,
engine_config=engine_config) engine_config=engine_config)
events = '''name = 2011-myanmar events = '''name = 2011-myanmar
...@@ -706,24 +733,4 @@ def command_qc_polarization(args): ...@@ -706,24 +733,4 @@ def command_qc_polarization(args):
if __name__ == '__main__': if __name__ == '__main__':
main()
if len(sys.argv) < 2:
sys.exit('Usage: %s' % usage)
args = list(sys.argv)
args.pop(0)
command = args.pop(0)
if command in subcommands:
globals()['command_' + d2u(command)](args)
elif command in ('--help', '-h', 'help'):
if command == 'help' and args:
acommand = args[0]
if acommand in subcommands:
globals()['command_' + acommand](['--help'])
sys.exit('Usage: %s' % usage)
else:
die('no such subcommand: %s' % command)
from __future__ import print_function
import glob import glob
import copy import copy
import logging import logging
......
from .base import * # noqa from .base import * # noqa
from .highscore import * # noqa from .highscore.optimizer import * # noqa
...@@ -9,9 +9,11 @@ import numpy as num ...@@ -9,9 +9,11 @@ import numpy as num
from pyrocko.guts import StringChoice, Int, Float, Object, List from pyrocko.guts import StringChoice, Int, Float, Object, List
from pyrocko.guts_array import Array from pyrocko.guts_array import Array
from ..meta import GrondError, Forbidden from grond.meta import GrondError, Forbidden
from .base import Optimizer, OptimizerConfig, BadProblem
from ..problems.base import ModelHistory from ..base import Optimizer, OptimizerConfig, BadProblem
from grond.problems.base import ModelHistory
guts_prefix = 'grond' guts_prefix = 'grond'
...@@ -374,7 +376,10 @@ class HighScoreOptimizer(Optimizer): ...@@ -374,7 +376,10 @@ class HighScoreOptimizer(Optimizer):
class HighScoreOptimizerConfig(OptimizerConfig): class HighScoreOptimizerConfig(OptimizerConfig):
sampler_phases = List.T(SamplerPhase.T()) sampler_phases = List.T(
SamplerPhase.T(),
default=[UniformSamplerPhase(niterations=1000),
DirectedSamplerPhase(niterations=5000)])
chain_length_factor = Float.T(default=8.) chain_length_factor = Float.T(default=8.)
nbootstrap = Int.T(default=10) nbootstrap = Int.T(default=10)
......
from .base import * # noqa from .base import * # noqa
from .cmt import * # noqa from .cmt.problem import * # noqa
from .rectangular import * # noqa from .rectangular.problem import * # noqa
from .double_dc import * # noqa from .double_dc.problem import * # noqa
...@@ -5,8 +5,9 @@ import logging ...@@ -5,8 +5,9 @@ import logging
from pyrocko import gf, util, moment_tensor as mtm from pyrocko import gf, util, moment_tensor as mtm
from pyrocko.guts import String, Float, Dict, StringChoice from pyrocko.guts import String, Float, Dict, StringChoice
from .base import Problem, ProblemConfig from grond.meta import Forbidden, expand_template, Parameter
from ..meta import Forbidden, expand_template, Parameter
from ..base import Problem, ProblemConfig
guts_prefix = 'grond' guts_prefix = 'grond'
logger = logging.getLogger('grond.problems').getChild('cmt') logger = logging.getLogger('grond.problems').getChild('cmt')
......
...@@ -4,8 +4,9 @@ import logging ...@@ -4,8 +4,9 @@ import logging
from pyrocko import gf, util from pyrocko import gf, util
from pyrocko.guts import String, Float, Dict from pyrocko.guts import String, Float, Dict
from .base import Problem, ProblemConfig from grond.meta import Forbidden, expand_template, Parameter
from ..meta import Forbidden, expand_template, Parameter
from ..base import Problem, ProblemConfig
guts_prefix = 'grond' guts_prefix = 'grond'
......
...@@ -4,8 +4,9 @@ import logging ...@@ -4,8 +4,9 @@ import logging
from pyrocko import gf from pyrocko import gf
from pyrocko.guts import String, Bool, Float, Dict, Int from pyrocko.guts import String, Bool, Float, Dict, Int
from .base import Problem, ProblemConfig from grond.meta import expand_template, Parameter
from ..meta import expand_template, Parameter
from ..base import Problem, ProblemConfig
guts_prefix = 'grond' guts_prefix = 'grond'
logger = logging.getLogger('grond.problems').getChild('rectangular') logger = logging.getLogger('grond.problems').getChild('rectangular')
......
from .waveform import * # noqa from .waveform.target import * # noqa
from .satellite import * # noqa from .satellite.target import * # noqa
from .base import * # noqa from .base import * # noqa
...@@ -2,7 +2,7 @@ import logging ...@@ -2,7 +2,7 @@ import logging
from pyrocko import gf from pyrocko import gf
from .base import MisfitTarget, MisfitConfig, MisfitResult, TargetGroup from ..base import MisfitTarget, MisfitConfig, MisfitResult, TargetGroup
guts_prefix = 'grond' guts_prefix = 'grond'
logger = logging.getLogger('grond.target').getChild('gnss') logger = logging.getLogger('grond.target').getChild('gnss')
......
...@@ -4,8 +4,9 @@ import numpy as num ...@@ -4,8 +4,9 @@ import numpy as num
from pyrocko import gf from pyrocko import gf
from pyrocko.guts import String, Bool, Dict, List from pyrocko.guts import String, Bool, Dict, List
from .base import MisfitTarget, MisfitConfig, MisfitResult, TargetGroup from grond.meta import Parameter
from ..meta import Parameter
from ..base import MisfitTarget, MisfitConfig, MisfitResult, TargetGroup
guts_prefix = 'grond' guts_prefix = 'grond'
logger = logging.getLogger('grond.target').getChild('satellite') logger = logging.getLogger('grond.target').getChild('satellite')
...@@ -138,10 +139,10 @@ class SatelliteMisfitTarget(MisfitTarget, gf.SatelliteTarget): ...@@ -138,10 +139,10 @@ class SatelliteMisfitTarget(MisfitTarget, gf.SatelliteTarget):
def get_combined_weight(self, apply_balancing_weights=False): def get_combined_weight(self, apply_balancing_weights=False):
return self.manual_weight return self.manual_weight
__all__ = ''' __all__ = '''
SatelliteTargetGroup SatelliteTargetGroup
SatelliteMisfitConfig SatelliteMisfitConfig
SatelliteMisfitTarget SatelliteMisfitTarget
SatelliteMisfitResult SatelliteMisfitResult
'''.split() '''.split()
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