Skip to content

Multi-surfaces-based flattening#13

Closed
huangziwei wants to merge 5 commits into
mainfrom
multisurface
Closed

Multi-surfaces-based flattening#13
huangziwei wants to merge 5 commits into
mainfrom
multisurface

Conversation

@huangziwei

@huangziwei huangziwei commented Mar 3, 2026

Copy link
Copy Markdown
Collaborator

What

This PR expands the two-SAC-surfaces-based flattening to multi-surfaces support.

Why

Cells far from the SAC bands (e.g., in the OPL) are not warped/unwarped accurately when using only ON/OFF SAC as reference surfaces. We discovered this when implementing the unwarper that OPL cells showed poorer roundtrip accuracy, which hinted at inaccurate forward warping in the first place.

How

Core change: build_mapping now accepts a dict of N tagged surfaces (e.g., {"on_sac": ..., "off_sac": ..., "xbc": ...}) instead of exactly two. Surfaces are auto-sorted by median depth throughout the pipeline.

Flattening surface selection: For each cell, warp_nodes and unwarp_nodes automatically select the two surfaces that bracket the cell's median z-depth for local LS registration.

Normalization anchors: ON SAC (z=0) and OFF SAC (z=12) remain the universal normalization anchors. Other surfaces get their normalized z positions from the same linear transform.

TL;DR

In short, we still assume the SAC bands as canonical reference surfaces, and set as default (which also backward compatible with the old data), but the code now is flexible enough to handle any n>=2 surfaces, and they don't have to be SAC bands if you know the what params to use beforehand.

Pending

I actually want to have some real data from EW2 to test it properly before merging. AFAIK, we don't have a complete layer of proofread cells beyond OFF SAC yet.

@huangziwei huangziwei changed the title [WIP] Multi-surface warping Multi-surfaces-based flattening Mar 3, 2026
@huangziwei

Copy link
Copy Markdown
Collaborator Author

Not needed yet. Will reopen once we reach the point where we have such data.

@huangziwei huangziwei closed this Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant