Commit b69de43d authored by Sebastian Heimann's avatar Sebastian Heimann
Browse files

fix error in plotting of cf traces

parent afa541a6
...@@ -531,6 +531,7 @@ class ManualPickIFC(IFC): ...@@ -531,6 +531,7 @@ class ManualPickIFC(IFC):
nsl = tr.nslc_id[:3] nsl = tr.nslc_id[:3]
try: try:
index = nsl_to_index[nsl] index = nsl_to_index[nsl]
print nsl
ts = picked_times[picked_index == index] ts = picked_times[picked_index == index]
its = (num.round((ts - tr.tmin) / tr.deltat)).astype(num.int64) its = (num.round((ts - tr.tmin) / tr.deltat)).astype(num.int64)
its = its[num.logical_and(0 <= its, its < tr.data_len())] its = its[num.logical_and(0 <= its, its < tr.data_len())]
......
...@@ -198,12 +198,13 @@ def plot_detection( ...@@ -198,12 +198,13 @@ def plot_detection(
station_index = dict( station_index = dict(
(rec.codes, i) for (i, rec) in enumerate(receivers)) (rec.codes, i) for (i, rec) in enumerate(receivers))
dists = [] dists_all = []
amps = [] amps = []
shifts = [] shifts = []
pdata2 = [] pdata2 = []
for trs, shift_table, shifter in pdata: for trs, shift_table, shifter in pdata:
trs = [tr.copy() for tr in trs] trs = [tr.copy() for tr in trs]
dists = []
for tr in trs: for tr in trs:
istation = station_index[tr.nslc_id[:3]] istation = station_index[tr.nslc_id[:3]]
shift = shift_table[imax, istation] shift = shift_table[imax, istation]
...@@ -217,10 +218,11 @@ def plot_detection( ...@@ -217,10 +218,11 @@ def plot_detection(
amps.append(num.max(num.abs(amp))) amps.append(num.max(num.abs(amp)))
shifts.append(shift) shifts.append(shift)
pdata2.append((trs, shift_table, shifter)) pdata2.append((trs, dists, shift_table, shifter))
dists_all.extend(dists)
dist_min = min(dists) dist_min = min(dists_all)
dist_max = max(dists) dist_max = max(dists_all)
shift_min = min(shifts) shift_min = min(shifts)
shift_max = max(shifts) shift_max = max(shifts)
...@@ -245,7 +247,7 @@ def plot_detection( ...@@ -245,7 +247,7 @@ def plot_detection(
lw=2.) lw=2.)
nsl_have = set() nsl_have = set()
for ishifter, (trs, shift_table, shifter) in enumerate(pdata2): for ishifter, (trs, dists, shift_table, shifter) in enumerate(pdata2):
color = plot.mpl_graph_color(ishifter) color = plot.mpl_graph_color(ishifter)
for tr, dist in zip(trs, dists): for tr, dist in zip(trs, dists):
......
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