Browse Source

bark

template_parallel
Sebastian Heimann 4 years ago
parent
commit
839978e145
5 changed files with 20 additions and 3 deletions
  1. +6
    -1
      apps/lassie
  2. +1
    -1
      setup.py
  3. +8
    -0
      src/common.py
  4. +5
    -1
      src/core.py
  5. BIN
      src/data/bark.wav

+ 6
- 1
apps/lassie View File

@ -320,6 +320,10 @@ def command_search(args):
'--nworkers', dest='nworkers', metavar="N",
help='use N cpus in parallel')
parser.add_option(
'--speak', dest='bark', action='store_true',
help='alert on detection of events')
parser, options, args = cl_parse('search', args, setup=setup)
if len(args) != 1:
help_and_die(parser, 'missing argument')
@ -349,7 +353,8 @@ def command_search(args):
show_movie=options.show_movie,
show_window_traces=options.show_window_traces,
stop_after_first=options.stop_after_first,
nparallel=nparallel)
nparallel=nparallel,
bark=options.bark)
except lassie.LassieError, e:
die(str(e))


+ 1
- 1
setup.py View File

@ -7,4 +7,4 @@ setup(
packages=['lassie'],
package_dir={'lassie': 'src'},
scripts=['apps/lassie'],
package_data={'lassie': []})
package_data={'lassie': ['data/*.wav']})

+ 8
- 0
src/common.py View File

@ -8,6 +8,10 @@ from pyrocko.gf import Earthmodel1D
guts_prefix = 'lassie'
def data_file(fn):
return op.join(op.split(__file__)[0], 'data', fn)
class LassieError(Exception):
pass
@ -115,6 +119,10 @@ def expand_template(template, d):
raise LassieError(
'malformed placeholder in template: "%s"' % template)
def bark():
import subprocess
subprocess.call(['aplay', data_file('bark.wav')])
__all__ = [
'LassieError',


+ 5
- 1
src/core.py View File

@ -123,7 +123,8 @@ def search(
show_window_traces=False,
force=False,
stop_after_first=False,
nparallel=None):
nparallel=None,
bark=False):
fp = config.expand_path
@ -444,6 +445,9 @@ def search(
z=float(zpeak)),
ifm=float(apeak))
if bark:
common.bark()
logger.info('detection: %s' % str(detection))
f = open(detections_path, 'a')


BIN
src/data/bark.wav View File


Loading…
Cancel
Save