Commit 0c84b7ae authored by Sebastian Heimann's avatar Sebastian Heimann
Browse files

create and print Detection objects (but keep old output format)

parent 8cd80b10
......@@ -9,12 +9,20 @@ import numpy as num
from pyrocko import pile, trace, util, io
from pyrocko.parstack import parstack
from pyrocko.guts import Object, Timestamp, String, Float
from lassie import common, plot, grid as gridmod
logger = logging.getLogger('lassie.core')
class Detection(Object):
id = String.T()
time = Timestamp.T()
location = geo.Point.T()
ifm = Float.T()
def check_data_consistency(p, receivers):
nslc_ids = p.nslc_ids.keys()
nsl_ids = [nslc_id[:3] for nslc_id in nslc_ids]
......@@ -357,9 +365,6 @@ def scan(
tr_stackmax_indx.set_location('i')
for (tpeak, apeak) in zip(tpeaks, apeaks):
logger.info('detection: %s %g' % (
util.time_to_str(tpeak),
apeak))
iframe = int(round(((tpeak-t0) - ioff*deltat_cf) / deltat_cf))
frame = frames[:, iframe]
......@@ -370,6 +375,19 @@ def scan(
idetection += 1
detection = Detection(
id='%06i' % idetection,
time=tpeak,
location=geo.Point(
lat=float(latpeak),
lon=float(lonpeak),
x=float(xpeak),
y=float(ypeak),
z=float(zpeak)),
ifm=float(apeak))
logger.info('detection: %s' % str(detection))
if config.detections_path:
f = open(config.detections_path, 'a')
f.write('%06i %s %g %g %g %g %g %g\n' % (
......
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