Offline Chart Analysis¶
These functions operate on a completed survey result. The elevation map is read
from the measured log-likelihood; z_fidelity_map flags projection aliasing.
elevation_map
¶
elevation_map(surface, n_grid: int = DEFAULT_MOVIE_N_GRID, quantile: float = DEFAULT_ELEVATION_QUANTILE, datum=None, threshold=None, extent=None) -> np.ma.MaskedArray
Render map elevation from the measured per-sample log-likelihood.
The elevation of a cell is a high quantile of the log-likelihood over the samples in that cell. The value comes from the alignment likelihood, not from the bias, so it does not depend on delta_T.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
surface
|
chart result
|
A completed survey result (duck-typed). The function reads only |
required |
n_grid
|
int
|
Grid resolution along each axis. |
DEFAULT_MOVIE_N_GRID
|
quantile
|
float
|
Per-cell log-likelihood quantile in (0, 1]. A value of 1.0 gives the strict per-cell maximum. |
DEFAULT_ELEVATION_QUANTILE
|
datum
|
float or None
|
An offset. The function subtracts it from every elevation. Pass
|
None
|
threshold
|
float or None
|
The function masks a cell whose elevation is below this value. |
None
|
extent
|
tuple or None
|
The bounds |
None
|
Returns:
| Type | Description |
|---|---|
(MaskedArray, shape(n_grid, n_grid), float64)
|
Elevation at each cell. Element |
Source code in src/hifuku/analysis2d.py
z_fidelity_map
¶
z_fidelity_map(surface, n_grid: int = DEFAULT_MOVIE_N_GRID, extent=None, min_samples: int = 2) -> np.ma.MaskedArray
Per-cell aliasing indicator from the variance of the residual z.
The chart projection is many-to-one, so distinct trees can share a chart point. Within a cell, this function splits the variance of z into a within-walker part and a between-walker part. The within-walker part is genuine out-of-plane roughness. The between-walker part is aliasing: several smooth sheets stacked at one chart point. The two parts sum to the total variance (law of total variance).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
surface
|
chart result
|
A completed survey result (duck-typed). The function reads only |
required |
n_grid
|
int
|
Grid resolution along each axis. |
DEFAULT_MOVIE_N_GRID
|
extent
|
tuple or None
|
The bounds |
None
|
min_samples
|
int
|
The function masks a cell with fewer than this many samples. |
2
|
Returns:
| Type | Description |
|---|---|
(MaskedArray, shape(n_grid, n_grid), float64)
|
The aliasing indicator |
Notes
This is a measure-only diagnostic. z is a scalar residual, a cheap and partial probe of a high-dimensional orthogonal complement.
Source code in src/hifuku/analysis2d.py
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 | |
grid_extent
¶
Return (lam1_min, lam1_max, lam2_min, lam2_max) for a completed surface.
Bounds are computed from all particle positions across all stored snapshots
plus all MCMC sample positions, with a margin of surface.h on each side.
Use the returned tuple as the extent argument to imshow and to set
axis limits:
ext = grid_extent(surf)
ax.imshow(data, extent=[ext[0], ext[1], ext[2], ext[3]], ...)