faninsar.NSBAS.inversion.calculate_u#

faninsar.NSBAS.inversion.calculate_u(loops: Loops, unw_phases: np.ndarray, device: str | torch.device | None = None, dtype: torch.dtype = torch.float64) NDArray[np.floating][source]#

Calculate correction matrix u by loop closure phase using least square.

More details see paper:

Tip

The pairs in the loops may be fewer than the input pairs. To make sure the pairs in the loops are the same as the pairs in the unw_phases, you can use the Pairs.where() method to get the index/mask of the pairs in the loops from the input pairs.

Parameters:
  • loops (Loops) – Loops object. Loops are used to calculate the design matrix, which describes the relationship between the loops and pairs.

  • unw_phases (ndarray) – unwrapped interferograms phases with shape of (n_pair, n_pixel).

  • device (Optional[str | torch.device], optional) – device of torch.tensor used for computation. If None, use GPU if available, otherwise use CPU.

  • dtype (torch.dtype, optional) – dtype of torch.tensor used for computation.

Examples

get the loops from the pairs:

>>> loops = pairs.to_loops()
>>> idx = pairs.where(
...     loops.pairs
... )  # get the index of the pairs in the loops from the input pairs
>>> unw_used = unw[idx]

calculate u by loops and unwrapped interferometric phases:

>>> u = np.zeros_like(unw, dtype=np.float32)
>>> u[idx] = np.round(NSBAS.calculate_u(loops, unw_used))

calculate the corrected interferometric phases

>>> unw_c = unw - 2 * np.pi * u