Skip to content

Commit

Permalink
align_to_common_reference_date: Add full column rank assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
scottstanie committed Jan 17, 2025
1 parent 8a8aeeb commit efe5054
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions scripts/align_to_common_reference_date.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ def rereference(

# Build incidence matrix A and its pseudo-inverse
A = get_incidence_matrix(ifg_date_pairs, all_dates)
assert _is_full_column_rank(A)
A_pinv = np.linalg.pinv(A)
# Normally we have M interferograms, N = (len(all_dates) - 1) unknowns
# Here the "inversion" is actually a trivial inversion, essentially a running sum,
Expand Down Expand Up @@ -180,6 +181,10 @@ def rereference(
print(f"Saved displacement stack to {output_dir}")


def _is_full_column_rank(A):
return np.linalg.matrix_rank(A) == A.shape[1]


QUALITY_LAYERS = [p.name for p in DISPLACEMENT_PRODUCTS]
# Remove the two that need to be inverted
QUALITY_LAYERS.pop(QUALITY_LAYERS.index("displacement"))
Expand Down

0 comments on commit efe5054

Please sign in to comment.