Commit 839978e1 authored by Sebastian Heimann's avatar Sebastian Heimann
Browse files

bark

parent 0b82df23
......@@ -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))
......
......@@ -7,4 +7,4 @@ setup(
packages=['lassie'],
package_dir={'lassie': 'src'},
scripts=['apps/lassie'],
package_data={'lassie': []})
package_data={'lassie': ['data/*.wav']})
......@@ -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',
......
......@@ -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')
......
Markdown is supported
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