Skip to content

Commit

Permalink
avoids zero division for zero traces in corrcoef
Browse files Browse the repository at this point in the history
  • Loading branch information
danielpeter committed Jun 30, 2021
1 parent 173edf9 commit 2d24a24
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions utils/compare_seismogram_correlations.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,11 +247,11 @@ def plot_correlations(out_dir,ref_dir):
err = norm(ref-syn)

#debug
#print('norm syn = %e norm ref = %e' % (norm(syn),fac_norm))
#print('syn_file: %s\nref_file: %s\nnorm syn = %e\nnorm ref = %e' % (syn_file,ref_file,norm(syn),norm(ref)))

# correlation test
# total length
if fac_norm > 0.0:
if norm(ref) > 0.0 and norm(syn) > 0.0:
corr_mat = np.corrcoef(ref, syn)
else:
if norm(ref-syn) > 0.0:
Expand Down

0 comments on commit 2d24a24

Please sign in to comment.