Coverage for /usr/local/lib/python3.11/dist-packages/pyrocko/__init__.py: 49%
39 statements
« prev ^ index » next coverage.py v6.5.0, created at 2024-03-07 11:54 +0000
« prev ^ index » next coverage.py v6.5.0, created at 2024-03-07 11:54 +0000
1# https://pyrocko.org - GPLv3
2#
3# The Pyrocko Developers, 21st Century
4# ---|P------/S----------~Lg----------
6'''
7A toolbox and library for seismology.
8'''
10import sys
12try:
13 from .info import * # noqa
14 __version__ = version # noqa
15except ImportError:
16 pass # not available in dev mode
18grumpy = 0 # noqa
21def get_logger():
22 from .util import logging
23 return logging.getLogger('pyrocko')
26class ExternalProgramMissing(Exception):
27 pass
30def app_init(log_level='info', progress_viewer='terminal', program_name=None):
31 '''
32 Setup logging and progress indicators for Pyrocko scripts.
34 This is a shortcut for calling :py:func:`pyrocko.util.setup_logging` and
35 :py:func:`pyrocko.progress.set_default_viewer`.
37 :param program_name:
38 ``programname`` argument for :py:func:`pyrocko.util.setup_logging`
39 :type program_name:
40 str
42 :param log_level:
43 ``levelname`` argument for :py:func:`pyrocko.util.setup_logging`
44 :type log_level:
45 str
47 :param progress_viewer:
48 ``viewer`` argument for
49 :py:func:`pyrocko.progress.set_default_viewer`
50 '''
51 from pyrocko import util, progress
52 if program_name is None:
53 program_name = sys.argv[0]
55 util.setup_logging(sys.argv[0], log_level)
56 progress.set_default_viewer(progress_viewer)
59def make_squirrel(*args, **kwargs):
60 from pyrocko.squirrel import Squirrel
61 return Squirrel(*args, **kwargs)
64def snuffle(*args, **kwargs):
65 '''
66 Start Snuffler.
68 Calls :py:func:`pyrocko.gui.snuffler.snuffler.snuffle`
69 '''
71 from pyrocko import deps
73 deps.require('PyQt5.Qt')
75 from pyrocko.gui.snuffler import snuffler
76 return snuffler.snuffle(*args, **kwargs)
79def sparrow(*args, **kwargs):
80 '''
81 Start Sparrow.
83 Calls :py:func:`pyrocko.gui.sparrow.main`.
84 '''
86 from pyrocko import deps
88 deps.require('vtk')
89 deps.require('PyQt5.Qt')
90 # deps.import_optional('kite', 'InSAR visualization')
92 from pyrocko.gui.sparrow.main import main
93 return main(*args, **kwargs)
96def drum(*args, **kwargs):
97 '''
98 Start Drum Plot.
100 Calls :py:func:`pyrocko.gui.drum.main`.
101 '''
103 from pyrocko import deps
105 deps.require('PyQt5.Qt')
106 deps.require('serial')
108 from pyrocko.gui.drum.main import main
109 return main(*args, **kwargs)