prefab 1.4.0__py3-none-any.whl → 1.4.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- prefab/__init__.py +1 -1
- prefab/models/__init__.py +57 -0
- prefab/{models.py → models/base.py} +3 -25
- prefab/models/evaluation.py +29 -0
- prefab/predict.py +7 -2
- {prefab-1.4.0.dist-info → prefab-1.4.2.dist-info}/METADATA +1 -1
- prefab-1.4.2.dist-info/RECORD +17 -0
- {prefab-1.4.0.dist-info → prefab-1.4.2.dist-info}/WHEEL +1 -1
- prefab-1.4.0.dist-info/RECORD +0 -15
- {prefab-1.4.0.dist-info → prefab-1.4.2.dist-info}/entry_points.txt +0 -0
- {prefab-1.4.0.dist-info → prefab-1.4.2.dist-info}/licenses/LICENSE +0 -0
prefab/__init__.py
CHANGED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Fabrication process model definitions and configurations.
|
|
3
|
+
|
|
4
|
+
This module automatically discovers and loads all model definitions from
|
|
5
|
+
Python files in the models/ directory.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import importlib
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
|
|
11
|
+
from .base import Fab, Model
|
|
12
|
+
|
|
13
|
+
models = {}
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def _load_models_from_module(module):
|
|
17
|
+
"""
|
|
18
|
+
Load all Model instances from a module into the models dict.
|
|
19
|
+
|
|
20
|
+
If the module defines a __models__ dict, use that for registration.
|
|
21
|
+
Otherwise, auto-register all Model instances using their variable names.
|
|
22
|
+
|
|
23
|
+
Parameters
|
|
24
|
+
----------
|
|
25
|
+
module : module
|
|
26
|
+
Python module containing Model instances to register.
|
|
27
|
+
"""
|
|
28
|
+
if hasattr(module, "__models__"):
|
|
29
|
+
models_dict = getattr(module, "__models__")
|
|
30
|
+
for name, obj in models_dict.items():
|
|
31
|
+
if isinstance(obj, Model):
|
|
32
|
+
models[name] = obj
|
|
33
|
+
else:
|
|
34
|
+
for name, obj in vars(module).items():
|
|
35
|
+
if isinstance(obj, Model):
|
|
36
|
+
models[name] = obj
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
models_dir = Path(__file__).parent
|
|
40
|
+
|
|
41
|
+
for model_file in models_dir.glob("*.py"):
|
|
42
|
+
if model_file.stem in ("__init__", "base"):
|
|
43
|
+
continue
|
|
44
|
+
|
|
45
|
+
module_name = f".{model_file.stem}"
|
|
46
|
+
try:
|
|
47
|
+
module = importlib.import_module(module_name, package=__package__)
|
|
48
|
+
_load_models_from_module(module)
|
|
49
|
+
except Exception:
|
|
50
|
+
pass
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
__all__ = [
|
|
54
|
+
"Fab",
|
|
55
|
+
"Model",
|
|
56
|
+
"models",
|
|
57
|
+
]
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
"""
|
|
2
|
-
|
|
2
|
+
Base model definitions for fabrication processes.
|
|
3
3
|
|
|
4
|
-
This module defines the data structures for representing nanofabrication
|
|
5
|
-
and their associated
|
|
6
|
-
fabrication specifications (foundry, process) and versioned model configurations
|
|
7
|
-
(dataset, version, release dates). Pre-configured model instances are provided
|
|
8
|
-
for common fabrication processes.
|
|
4
|
+
This module defines the core data structures for representing nanofabrication
|
|
5
|
+
processes and their associated models.
|
|
9
6
|
"""
|
|
10
7
|
|
|
11
8
|
import json
|
|
@@ -64,22 +61,3 @@ class Model(BaseModel):
|
|
|
64
61
|
|
|
65
62
|
def to_json(self):
|
|
66
63
|
return json.dumps(self.model_dump(), default=str)
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
Generic = Fab(
|
|
70
|
-
foundry="Generic",
|
|
71
|
-
process="SOI",
|
|
72
|
-
)
|
|
73
|
-
|
|
74
|
-
Generic_SOI_ANF1_d0 = Model(
|
|
75
|
-
fab=Generic,
|
|
76
|
-
version="ANF1",
|
|
77
|
-
version_date=date(2025, 11, 7),
|
|
78
|
-
dataset="d0",
|
|
79
|
-
dataset_date=date(2025, 11, 7),
|
|
80
|
-
tag="",
|
|
81
|
-
)
|
|
82
|
-
|
|
83
|
-
models = dict(
|
|
84
|
-
Generic_SOI=Generic_SOI_ANF1_d0,
|
|
85
|
-
)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Base evaluation models.
|
|
3
|
+
|
|
4
|
+
Pre-configured model instances for common fabrication processes.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from datetime import date
|
|
8
|
+
|
|
9
|
+
from .base import Fab, Model
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
Generic = Fab(
|
|
13
|
+
foundry="Generic",
|
|
14
|
+
process="SOI",
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
Generic_SOI_ANF1_d0 = Model(
|
|
18
|
+
fab=Generic,
|
|
19
|
+
version="ANF1",
|
|
20
|
+
version_date=date(2025, 11, 7),
|
|
21
|
+
dataset="d0",
|
|
22
|
+
dataset_date=date(2025, 11, 7),
|
|
23
|
+
tag="",
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
# Export models with user-facing names
|
|
27
|
+
__models__ = {
|
|
28
|
+
"Generic_SOI": Generic_SOI_ANF1_d0,
|
|
29
|
+
}
|
prefab/predict.py
CHANGED
|
@@ -517,6 +517,12 @@ def _decode_array(encoded_png: str) -> npt.NDArray[Any]:
|
|
|
517
517
|
|
|
518
518
|
def _prepare_headers() -> dict[str, str]:
|
|
519
519
|
"""Prepare HTTP headers for a server request."""
|
|
520
|
+
# Check for API key first (for headless/server environments)
|
|
521
|
+
api_key = os.environ.get("PREFAB_API_KEY")
|
|
522
|
+
if api_key:
|
|
523
|
+
return {"X-API-Key": api_key}
|
|
524
|
+
|
|
525
|
+
# Fall back to token file (browser OAuth flow)
|
|
520
526
|
token_file_path = os.path.expanduser("~/.prefab.toml")
|
|
521
527
|
try:
|
|
522
528
|
with open(token_file_path) as file:
|
|
@@ -532,7 +538,6 @@ def _prepare_headers() -> dict[str, str]:
|
|
|
532
538
|
except FileNotFoundError:
|
|
533
539
|
raise FileNotFoundError(
|
|
534
540
|
"Could not validate user.\n"
|
|
535
|
-
+ "
|
|
536
|
-
+ "Signup/login and generate a new token.\n"
|
|
541
|
+
+ "Set PREFAB_API_KEY environment variable, or run 'prefab setup'.\n"
|
|
537
542
|
+ "See https://docs.prefabphotonics.com/."
|
|
538
543
|
) from None
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: prefab
|
|
3
|
-
Version: 1.4.
|
|
3
|
+
Version: 1.4.2
|
|
4
4
|
Summary: Artificial nanofabrication of integrated photonic circuits using deep learning
|
|
5
5
|
Project-URL: Homepage, https://prefabphotonics.com
|
|
6
6
|
Project-URL: Repository, https://github.com/PreFab-Photonics/PreFab
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
prefab/__init__.py,sha256=XffqgQ1AexVSwGAgt7Wbfo-4raEefrzmXwE2EEG3WUI,425
|
|
2
|
+
prefab/__main__.py,sha256=M5ulRfgSMdPjeHPoMGQ3P86zFMJDII5I18NGrpFUcsM,3458
|
|
3
|
+
prefab/compare.py,sha256=aX7nr9tznSebYeeztvqIPz57npnJ4-iUeKEedrZdksE,3676
|
|
4
|
+
prefab/device.py,sha256=1O6vTOq4wQRGVYvFWLH0uj1XhhYCfnDnIapDEYnBKHw,47996
|
|
5
|
+
prefab/geometry.py,sha256=-nTaGjdw3KN1SVoyvqdcrE2GJP7OqPF6ivUhrO78rUk,11244
|
|
6
|
+
prefab/predict.py,sha256=LSOf-lo7l8JRzRSXTDWosGfr2baE-D5zZjinkObeJV4,19182
|
|
7
|
+
prefab/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
+
prefab/read.py,sha256=5BmvFemobA72urxs4j2VZRVvanZZGu1mDB1Uh-epyvI,8635
|
|
9
|
+
prefab/shapes.py,sha256=mRGwsPS-A9XsW3jgvUuMCEeNv9BLXsEnJkytlIHUAKE,28802
|
|
10
|
+
prefab/models/__init__.py,sha256=rRrjcOcHPcob98Coksc0tbvYcXbm6SoLEb-Md233Jvo,1391
|
|
11
|
+
prefab/models/base.py,sha256=t4VNMsOztPedj3kN5fZ1-4tk0SRHWrMuqnIVHztsCs4,1514
|
|
12
|
+
prefab/models/evaluation.py,sha256=2_Klui6tY8xPvOSVD8VpZCVAnT1RX15FONqWG-_x-J8,484
|
|
13
|
+
prefab-1.4.2.dist-info/METADATA,sha256=JFb3uFdmPuf8thzsPnOim8F47qqSjVajVG9plmBuonQ,33880
|
|
14
|
+
prefab-1.4.2.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
15
|
+
prefab-1.4.2.dist-info/entry_points.txt,sha256=h1_A9O9F3NAIoKXD1RPb3Eo-WCSiHhMB_AnagBi6XTQ,48
|
|
16
|
+
prefab-1.4.2.dist-info/licenses/LICENSE,sha256=IMF9i4xIpgCADf0U-V1cuf9HBmqWQd3qtI3FSuyW4zE,26526
|
|
17
|
+
prefab-1.4.2.dist-info/RECORD,,
|
prefab-1.4.0.dist-info/RECORD
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
prefab/__init__.py,sha256=z_ADiFh2q1068jMziubytwv4G1_Wh8wYa3hQCm61Mh8,425
|
|
2
|
-
prefab/__main__.py,sha256=M5ulRfgSMdPjeHPoMGQ3P86zFMJDII5I18NGrpFUcsM,3458
|
|
3
|
-
prefab/compare.py,sha256=aX7nr9tznSebYeeztvqIPz57npnJ4-iUeKEedrZdksE,3676
|
|
4
|
-
prefab/device.py,sha256=1O6vTOq4wQRGVYvFWLH0uj1XhhYCfnDnIapDEYnBKHw,47996
|
|
5
|
-
prefab/geometry.py,sha256=-nTaGjdw3KN1SVoyvqdcrE2GJP7OqPF6ivUhrO78rUk,11244
|
|
6
|
-
prefab/models.py,sha256=YORoAPYC0r60yDShmrZdWOEh9jEBcBMizx4aj8ik27U,2047
|
|
7
|
-
prefab/predict.py,sha256=066X_SnSIHPqaPMbk0Yn_yX_KBfUc9yxrsmP_k56FU0,19015
|
|
8
|
-
prefab/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
-
prefab/read.py,sha256=5BmvFemobA72urxs4j2VZRVvanZZGu1mDB1Uh-epyvI,8635
|
|
10
|
-
prefab/shapes.py,sha256=mRGwsPS-A9XsW3jgvUuMCEeNv9BLXsEnJkytlIHUAKE,28802
|
|
11
|
-
prefab-1.4.0.dist-info/METADATA,sha256=1pJWOHiZZ58App0zlSB2rK-3pzV07IO51baZ9ryl-O0,33880
|
|
12
|
-
prefab-1.4.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
13
|
-
prefab-1.4.0.dist-info/entry_points.txt,sha256=h1_A9O9F3NAIoKXD1RPb3Eo-WCSiHhMB_AnagBi6XTQ,48
|
|
14
|
-
prefab-1.4.0.dist-info/licenses/LICENSE,sha256=IMF9i4xIpgCADf0U-V1cuf9HBmqWQd3qtI3FSuyW4zE,26526
|
|
15
|
-
prefab-1.4.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|