g85/g85/main.py

54 lines
1.5 KiB
Python
Raw Normal View History

2021-11-11 23:53:13 -08:00
import datetime
from collections import Counter
from dataclasses import dataclass, field
from itertools import chain
@dataclass
class Device:
BinType: str
2023-07-13 13:16:01 -07:00
NullBin: str | int
ProductId: str | None = None
LotId: str | None = None
WaferSize: float | None = None
CreateDate: datetime.datetime | None = None
DeviceSizeX: float | None = None
DeviceSizeY: float | None = None
SupplierName: str | None = None
OriginLocation: int | None = None
2021-11-11 23:53:13 -08:00
MapType: str = 'Array'
Orientation: float = 0
2023-07-13 13:16:01 -07:00
reference_xy: tuple[int, int] | None = None
2021-11-11 23:53:13 -08:00
2023-07-13 13:16:01 -07:00
bin_pass: dict[int | str, bool] = field(default_factory=dict) # Is this bin passing?
map: list[list[int]] | list[list[str]] = field(default_factory=list) # The actual map
2021-11-11 23:53:13 -08:00
# Map attribs: MapName, MapVersion
# SupplierData attribs: ProductCode, RecipeName
2023-07-13 13:16:01 -07:00
misc: dict[str, str] = field(default_factory=dict) # Any unexpected fields go here
2021-11-11 23:53:13 -08:00
@property
def Rows(self) -> int:
return len(self.map)
@property
def Columns(self) -> int:
if self.Rows == 0:
return 0
return len(self.map[0])
def bin_counts(self) -> Counter:
return Counter(chain(*self.map))
@dataclass
class Map:
xmlns: str = 'http://www.semi.org'
FormatRevision: str = "SEMI G85 0703"
2023-07-13 13:16:01 -07:00
SubstrateType: str | None = None
SubstrateId: str | None = None
2021-11-11 23:53:13 -08:00
2023-07-13 13:16:01 -07:00
devices: list[Device] = field(default_factory=list)
misc: dict[str, str] = field(default_factory=dict) # Any unexpected fields go here
2021-11-11 23:53:13 -08:00