packing_defect.core.grid
Classes
|
2D grid accumulator for membrane packing defects. |
- class packing_defect.core.grid.DefectGrid(box_xy, dx=1.0, dy=1.0, hz=None)[source]
Bases:
object2D grid accumulator for membrane packing defects.
The grid is defined over the XY plane and tracks two leaflets (“up” and “dw”). Each grid cell stores an integer code identifying the type of defect stamped there and a per-leaflet depth value used to keep only the most exposed atom per cell.
- Parameters:
box_xy (tuple[float, float]) – Box lengths along X and Y in the same units as positions.
dx (float, optional) – Grid spacing along X and Y.
dy (float, optional) – Grid spacing along X and Y.
hz (float, optional) – Mid-plane Z used to separate leaflets; when omitted, callers should ensure consistent leaflet assignment when calling
update.
- Variables:
- get_binary_mask(leaflet: str, threshold: int) ndarray[source]
Return a binary mask where grid values equal
threshold.- Parameters:
leaflet ({"up", "dw"}) – Leaflet to extract.
threshold (int) – Code value considered as a defect in the mask.
- Returns:
Binary array of shape
(nx, ny)where matches are 1 else 0.- Return type:
np.ndarray