Skip to content

Commit

Permalink
Do not invert if only one station selected in svd mag calc
Browse files Browse the repository at this point in the history
  • Loading branch information
calum-chamberlain committed Aug 31, 2016
1 parent b615e0a commit 5680a6c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions eqcorrscan/utils/mag_calc.py
Original file line number Diff line number Diff line change
Expand Up @@ -962,9 +962,13 @@ def SVD_moments(U, s, V, stachans, event_list, n_SVs=4):
# Sometimes the randomisation generates a singular matrix - rather than
# attempting to regulerize this matrix I propose undertaking the
# randomisation step a further time
if len(stachans) == 1:
print('Only provided data from one station-channel - '
'will not try to invert')
return U[0][:, 0], event_list[0]
for i, stachan in enumerate(stachans):
k = [] # Small kernel matrix for one station - channel
# Copy the relevant vectors so as not to detroy them
# Copy the relevant vectors so as not to destroy them
U_working = copy.deepcopy(U[i])
V_working = copy.deepcopy(V[i])
s_working = copy.deepcopy(s[i])
Expand Down Expand Up @@ -1026,7 +1030,6 @@ def SVD_moments(U, s, V, stachans, event_list, n_SVs=4):
else:
result = 0
row.append(result)
print(row)
# Add each row to the K matrix
k.append(row)
# k is now a square matrix, we need to flesh it out to be K_width
Expand Down

0 comments on commit 5680a6c

Please sign in to comment.