faninsar.NSBAS.inversion.NSBASMatrixFactory#

class faninsar.NSBAS.inversion.NSBASMatrixFactory(unw: NDArray[np.floating], pairs: Pairs | Sequence[str], model: TimeSeriesModels | None = None, gamma: float = 0.0001)[source]#

Bases: object

Factory class to generate/format NSBAS matrix.

The NSBAS matrix is usually expressed as: d = Gm, where d is the unwrapped interferograms matrix, G is the NSBAS matrix, and m is the model parameters, which is the combination of the deformation increment and the model parameters. see paper: TODO for more details.

Note

After initialization, the d can still be updated by assigning a new unwrapped interferograms matrix to d. This is useful when the unwrapped interferograms is divided into multiple patches and the NSBAS matrix is calculated for each patch separately.

Examples

>>> import faninsar as fis
>>> import numpy as np
>>> names = ['20170111_20170204',
            '20170111_20170222',
            '20170111_20170318',
            '20170204_20170222',
            '20170204_20170318',
            '20170204_20170330',
            '20170222_20170318',
            '20170222_20170330',
            '20170222_20170411',
            '20170318_20170330']
>>> pairs = fis.Pairs.from_names(names)
>>> unw = np.random.randint(0, 255, (len(pairs), 5))
>>> model = fis.AnnualSinusoidalModel(pairs.dates)
>>> nsbas_matrix = fis.NSBASMatrixFactory(unw, pairs, model)
>>> nsbas_matrix
NSBASMatrixFactory(
    pairs: Pairs(10)
    model: AnnualSinusoidalModel(dates: 6, unit: day)
    gamma: 0.0001
    G shape: (16, 9)
    d shape: (16, 5)
)

reset d by assigning a new unwrapped interferograms matrix with same pairs

>>> nsbas_matrix.d = np.random.randint(0, 255, (len(pairs), 10))
NSBASMatrixFactory(
    pairs: Pairs(10)
    model: AnnualSinusoidalModel(dates: 6, unit: day)
    gamma: 0.0001
    G shape: (16, 9)
    d shape: (16, 10)
)
__init__(unw: NDArray[np.floating], pairs: Pairs | Sequence[str], model: TimeSeriesModels | None = None, gamma: float = 0.0001) None[source]#

Initialize NSBASMatrixFactory.

Parameters:
  • unw (NDArray (n_pairs, n_pixels)) – Unwrapped interferograms matrix

  • pairs (Pairs | Sequence[str]) – Pairs or Sequence of pair names

  • model (Optional[TimeSeriesModels], optional) – Time series model. If None, generate SBAS matrix rather than NSBAS matrix, by default None.

  • gamma (float, optional) – weight for the model component, by default 0.0001. This parameter will be ignored if model is None.

Methods

__init__(unw, pairs[, model, gamma])

Initialize NSBASMatrixFactory.

Attributes

G

Return G matrix for NSBAS d = Gm.

d

Return d matrix for NSBAS d = Gm.

gamma

Return gamma.

model

Return model.

pairs

Return pairs.

property G: NDArray[np.float32]#

Return G matrix for NSBAS d = Gm.

property d: NDArray[np.float32 | np.float64]#

Return d matrix for NSBAS d = Gm.

property gamma: float#

Return gamma.

property model: TimeSeriesModels | None#

Return model.

property pairs: Pairs#

Return pairs.