links
GridSearchLinearModel
dataclass
Bases: Parameters, LinkModelInterface
Search parameter grid space for the maxima.
Implements grid search for best fitting parameters. We don't solve a bunch of MCF problems like Pepe and Lanari (2006) but instead solve this link-by-link.
Max: |exp(j * (A * x - b))|^2 s.t: ranges[i][0] <= x_i <= ranges[i][1]
Source code in src/spurt/links/_grid_search.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | |
estimate_model(wrapdata, weights=None)
Fit model parameters via grid search followed by Nelder-Mead optimization.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wrapdata
|
ndarray
|
Real-valued array of wrapped phase gradient |
required |
weights
|
ndarray | float | None
|
Real-valued weights - assumed to be normalized to 1. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
params |
ndarray
|
1D array of length ndim |
coh |
float
|
Temporal coherence |
Source code in src/spurt/links/_grid_search.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | |
estimate_model_many(wrapdata, weights=None, worker_count=None)
Grid search followed by fmin in parallel.
Source code in src/spurt/links/_grid_search.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | |
LinkModelInterface
Bases: Protocol
Interface to correcting link gradients.
Such objects should provide access to estimated model parameters and reconstructed model.
Attributes:
| Name | Type | Description |
|---|---|---|
nobs |
int
|
Number of observations. Can be epochs or interferograms based on context. |
ndim |
int
|
Number of model parameters. |
Source code in src/spurt/links/_interface.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | |
ndim
property
Return number of model parameters.
nobs
property
Return number of observations in model.
estimate_model(wrapdata, weights=None)
Return estimated model parameters and quality metric.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wrapdata
|
ndarray
|
1D complex array or real valued array in radians. |
required |
weights
|
ndarray | float | None
|
1D array of same length as wrapdata with weights. If scalar, all observations are equally weighted. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
params |
ndarray
|
1D array of length ndim with the estimated model parameters. |
quality |
float
|
Temporal coherence or a similar quality metric indicating model fit. |
Source code in src/spurt/links/_interface.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | |
estimate_model_many(wrapdata, weights=None, worker_count=0)
Estimate model for many inputs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wrapdata
|
ndarray
|
2D complex array or real valued array in radians. |
required |
weights
|
ndarray | float | None
|
1D / 2D array of same length as wrapdata with weights. If 1D array, same weights are reused for all inputs. worker_count: int Number of workers to use if inputs can be handled in parallel. The implementation determines default in case a number <=0 is provided. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
params |
ndarray
|
2D array of shape (ninputs, ndim) with the estimated model parameters. |
quality |
ndarray
|
1D array of length ninputs representing temporal coherence or a similar quality metric indicating model fit. |
Source code in src/spurt/links/_interface.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | |
fwd_model(x)
Return model evaluated at x.
Source code in src/spurt/links/_interface.py
43 44 | |