surface_residual — 3D freeform op

• 資料種類:image2d × image2d × image2d × bspline_surface → measurement

• 呼叫: import fullseye as fs; fs.ledger.surface_residual(x, y, z, tck)(要直接呼叫實作,import bspline_surf; bspline_surf.surface_residual(x, y, z, tck);從台帳取用則 ops3d.get("surface_residual"))

• 經台帳呼叫的回傳值: fullseye.ledger.surface_residual(...) 只回傳宣告的 out 型別 measurement 的值(底層函式還會回傳輔助資訊)。需要被捨棄的部分時,請用 fullseye.ledger.surface_residual.raw(...),或直接呼叫 bspline_surf.surface_residual。

• 底層回傳: {"rms","max","pv"} → pv float

用法

回傳散布資料與曲面 tck 的殘差統計(形狀誤差=相對擬合的偏離)。

在各樣本位置求曲面高度,量測與觀測 z 之差的 RMS / 最大絕對值 / PV (peak-to-valley = 最大 - 最小)。在檢測中,這是相對自由曲面的偏差量(凹痕、波紋度、缺料)的定量指標。

Returns

dict

{"rms": float, "max": float, "pv": float}。max 為最大絕對殘差,

pv 為帶符號殘差的最大 - 最小(也能捕捉單側的凸起/凹陷)。

補充:

• 殘差符號為 resid = z - zhat(觀測 − 曲面)。正 = 高於曲面(隆起),負 = 低於曲面(缺料)。max 是絕對值,看不出方向;需要方向時用 eval_bspline_surface 取 zhat 自行求差。

• x, y, z 接受任意 shape,內部經過 eval_bspline_surface(tck, x, y, grid=False)(tck 類型檢查也在那裡進行,曲線 tck 或多項式 dict 為 ValueError)。z 與 x 元素數不同時會出現 numpy 的形狀錯誤(沒有專門檢查,z 只有 1 個元素時會靜默 broadcast)。

• 單位與 z 相同。rms 是全部點的均方根,因此局部凹痕會被平均沖淡。局部瑕疵用 max 或 pv 查看。

• 典型:fit_bspline_surface → 本 op。在擬合所用的點上求值時,smooth 越小殘差越接近 0(也可作為過擬合的指標)。

參考(範例資料、文獻)

• 範例資料目錄(下載 URL / 授權) —— 2-D 用 skimage.data(BSD/公有領域)加合成圖,3-D 給出真實資料源(Stanford/PDS 等)的下載 URL。

• 運算子來歷與參考文獻 —— 該運算子族所依據的研究/方法出處。

可執行的範例(實際呼叫該運算子並已驗證的樣例)

• bspline_freeform — py -3.11 examples_3d/bspline_freeform.py

型別可銜接的下一個運算子(可接受 measurement 作為輸入)

vol_gaussian_psf · fuse_to_voxel · fresnel_reflectance · snell_angle

同類別(freeform)

fit_bspline_surface · eval_bspline_surface · fit_bspline_curve · eval_bspline_curve


*Provenance: bspline_surf.py — 3D 運算子登記表。本條目由 tools/opdocs.py md 自動產生(請勿手動編輯)。*

© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.