Commit c3ae3c00 authored by Marius Kriegerowski's avatar Marius Kriegerowski

option: use absolute

parent 3c92f0cd
......@@ -3,7 +3,7 @@
import tensorflow as tf
from pyrocko.io import save, load
from pyrocko.model import load_stations
from pyrocko.guts import Object, String, Int, Float, Tuple
from pyrocko.guts import Object, String, Int, Float, Tuple, Bool
from pyrocko.gui import marker
from pyrocko.gf.seismosizer import Engine, Target
from pyrocko import orthodrome
......@@ -47,6 +47,7 @@ class DataGenerator(Object):
_shape = None
fn_stations = String.T()
need_same_dimensions = True # bin mir nicht sicher, ob das sein muss...
absolute = Bool.T(help='Use absolute amplitudes', default=False)
effective_deltat = Float.T(optional=True)
sample_length = Float.T(help='length [s] of data window')
reference_target = Target.T(
......@@ -97,6 +98,10 @@ class DataGenerator(Object):
def fit_data_into_chunk(self, traces, chunk, indices=None, tref=0):
indices = indices or range(len(traces))
for i, tr in zip(indices, traces):
if self.absolute:
tr.data = num.abs(tr.data)
data_len = len(tr.data)
istart_trace = int((tr.tmin - tref) / tr.deltat)
istart_array = max(istart_trace, 0)
......@@ -203,7 +208,7 @@ class PileData(DataGenerator):
_trs.append(tr)
trs = _trs
if not len(trs):
logging.debug('no data at tmin=%s' % m.tmin)
logging.debug('No data at tmin=%s' % m.tmin)
continue
chunk = self.get_raw_data_chunk()
indices = [nslc_to_index[tr.nslc_id] for tr in trs]
......
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