{"repo": "alchosyn/metasurface-design-agent", "files": {"agent/config.py": {"03e31a4f27f85b2bf1574082be3d28b4c042736c": {"t": 1785746868.3186674, "n": 2736, "h": "f069283b8554165b", "c": "\"\"\"\nConfiguration constants for the Optical Design Optimization Agent.\n\"\"\"\n\nfrom __future__ import annotations\n\nimport os\nfrom pathlib import Path\nfrom dotenv import load_dotenv\n\n# ── Project paths ──────────────────────────────────────────────────\nPROJECT_ROOT = Path(__file__).resolve().parent.parent\nload_dotenv(PROJECT_ROOT / \".env\")\nML_DIR = PROJECT_ROOT / \"ml\"\nDATA_DIR = PROJECT_ROOT / \"data\"\nMATLAB_DIR = PROJECT_ROOT / \"matlab\" / \"Double Helix\"\nPHASEORI_MAT = MATLAB_DIR / \"3 DHPSF Propagation\" / \"phaseori.mat\"\nROTATION_ANGLES_CSV = (\n MATLAB_DIR / \"3 DHPSF Propagation\" / \"Pillar_Rotation_Angles_Deg.csv\"\n)\n\n# Agent output directory (created per run)\nAGENT_OUTPUT_DIR = DATA_DIR / \"agent_runs\"\n\n# ── Physical constants ─────────────────────────────────────────────\nWAVELENGTH_UM = 0.632 # He-Ne laser, μm\nWAVELENGTH_NM = 632.0 # nm\nNA = 0.1 # numerical aperture\nAPERTURE_UM = 400.0 # aperture diameter D, μm\nPERIOD_NM = 400.0 # unit cell period, nm\nARRAY_SIZE = 1000 # 1000 × 1000 pillar array\n\n# Pillar geometry bounds (nm)\nL_MIN, L_MAX = 60.0, 340.0\nW_MIN, W_MAX = 60.0, 340.0\nH_MIN, H_MAX = 600.0, 860.0\n\n# Design target\nPHASE_TARGET_DEG = 180.0 # half-wave plate |Δφ| = 180°\n\n# ── Surrogate model defaults ──────────────────────────────────────\nSURROGATE_HIDDEN = 64 # smaller than original 128 (less data)\nSURROGATE_N_LAYERS = 3\nSURROGATE_DROPOUT = 0.1 # enable dropout for MC uncertainty\nSURROGATE_TRAIN_EPOCHS = 1000\nSURROGATE_TRAIN_LR = 1e-3\nSURROGATE_TRAIN_BATCH = 32\nSURROGATE_MIN_POINTS = 20\nMC_DROPOUT_SAMPLES = 50 # forward passes for uncertainty\n\n# ── FOM weights ───────────────────────────────────────────────────\nFOM_PHASE_WEIGHT = 10.0 # penalty per degree of phase error\nFOM_TRANS_WEIGHT = 1.0 # reward for transmittance\n\n# ── Agent defaults ────────────────────────────────────────────────\nMAX_CST_CALLS = 200\nMAX_ITERATIONS = 50\nGRAPH_RECURSION_LIMIT = 500 # nodes per run (each tool cycle ≈ 3-4 nodes)\n\n# ── Fresnel propagation ──────────────────────────────────────────\nFRESNEL_Z_POSITIONS_UM = [\n 1750, 1780, 1810, 1840, 1870, 1900, 1930, 1960,\n 1990, 2020, 2050, 2080, 2110, 2140, 2170, 2200,\n 2230, 2260,\n]\nPSF_CROP_SIZE = 128\n\n# ── LLM configuration ────────────────────────────────────────────\nLLM_MODEL = \"deepseek-chat\"\nLLM_BASE_URL = \"https://api.deepseek.com\"\nLLM_TEMPERATURE = 0.3\nLLM_MAX_TOKENS = 4000\n\n\ndef get_deepseek_api_key() -> str:\n key = os.environ.get(\"DEEPSEEK_API_KEY\", \"\")\n if not key:\n raise EnvironmentError(\n \"DEEPSEEK_API_KEY not set. \"\n \"Export it: set DEEPSEEK_API_KEY=sk-...\"\n )\n return key\n"}, "0717d48e61843cb61c69fd6014b83947a73deda9": {"t": 1785768285.8712687, "n": 2736, "h": "f069283b8554165b", "c": "\"\"\"\nConfiguration constants for the Optical Design Optimization Agent.\n\"\"\"\n\nfrom __future__ import annotations\n\nimport os\nfrom pathlib import Path\nfrom dotenv import load_dotenv\n\n# ── Project paths ──────────────────────────────────────────────────\nPROJECT_ROOT = Path(__file__).resolve().parent.parent\nload_dotenv(PROJECT_ROOT / \".env\")\nML_DIR = PROJECT_ROOT / \"ml\"\nDATA_DIR = PROJECT_ROOT / \"data\"\nMATLAB_DIR = PROJECT_ROOT / \"matlab\" / \"Double Helix\"\nPHASEORI_MAT = MATLAB_DIR / \"3 DHPSF Propagation\" / \"phaseori.mat\"\nROTATION_ANGLES_CSV = (\n MATLAB_DIR / \"3 DHPSF Propagation\" / \"Pillar_Rotation_Angles_Deg.csv\"\n)\n\n# Agent output directory (created per run)\nAGENT_OUTPUT_DIR = DATA_DIR / \"agent_runs\"\n\n# ── Physical constants ─────────────────────────────────────────────\nWAVELENGTH_UM = 0.632 # He-Ne laser, μm\nWAVELENGTH_NM = 632.0 # nm\nNA = 0.1 # numerical aperture\nAPERTURE_UM = 400.0 # aperture diameter D, μm\nPERIOD_NM = 400.0 # unit cell period, nm\nARRAY_SIZE = 1000 # 1000 × 1000 pillar array\n\n# Pillar geometry bounds (nm)\nL_MIN, L_MAX = 60.0, 340.0\nW_MIN, W_MAX = 60.0, 340.0\nH_MIN, H_MAX = 600.0, 860.0\n\n# Design target\nPHASE_TARGET_DEG = 180.0 # half-wave plate |Δφ| = 180°\n\n# ── Surrogate model defaults ──────────────────────────────────────\nSURROGATE_HIDDEN = 64 # smaller than original 128 (less data)\nSURROGATE_N_LAYERS = 3\nSURROGATE_DROPOUT = 0.1 # enable dropout for MC uncertainty\nSURROGATE_TRAIN_EPOCHS = 1000\nSURROGATE_TRAIN_LR = 1e-3\nSURROGATE_TRAIN_BATCH = 32\nSURROGATE_MIN_POINTS = 20\nMC_DROPOUT_SAMPLES = 50 # forward passes for uncertainty\n\n# ── FOM weights ───────────────────────────────────────────────────\nFOM_PHASE_WEIGHT = 10.0 # penalty per degree of phase error\nFOM_TRANS_WEIGHT = 1.0 # reward for transmittance\n\n# ── Agent defaults ────────────────────────────────────────────────\nMAX_CST_CALLS = 200\nMAX_ITERATIONS = 50\nGRAPH_RECURSION_LIMIT = 500 # nodes per run (each tool cycle ≈ 3-4 nodes)\n\n# ── Fresnel propagation ──────────────────────────────────────────\nFRESNEL_Z_POSITIONS_UM = [\n 1750, 1780, 1810, 1840, 1870, 1900, 1930, 1960,\n 1990, 2020, 2050, 2080, 2110, 2140, 2170, 2200,\n 2230, 2260,\n]\nPSF_CROP_SIZE = 128\n\n# ── LLM configuration ────────────────────────────────────────────\nLLM_MODEL = \"deepseek-chat\"\nLLM_BASE_URL = \"https://api.deepseek.com\"\nLLM_TEMPERATURE = 0.3\nLLM_MAX_TOKENS = 4000\n\n\ndef get_deepseek_api_key() -> str:\n key = os.environ.get(\"DEEPSEEK_API_KEY\", \"\")\n if not key:\n raise EnvironmentError(\n \"DEEPSEEK_API_KEY not set. \"\n \"Export it: set DEEPSEEK_API_KEY=sk-...\"\n )\n return key\n"}, "b0755127a5cae655e379f17b8354c05fa7bf0789": {"t": 1785768287.215014, "n": 2670, "h": "aa16dc31c7b71eda", "c": "\"\"\"\nConfiguration constants for the Optical Design Optimization Agent.\n\"\"\"\n\nfrom __future__ import annotations\n\nimport os\nfrom pathlib import Path\n\n# ── Project paths ──────────────────────────────────────────────────\nPROJECT_ROOT = Path(__file__).resolve().parent.parent\nML_DIR = PROJECT_ROOT / \"ml\"\nDATA_DIR = PROJECT_ROOT / \"data\"\nMATLAB_DIR = PROJECT_ROOT / \"matlab\" / \"Double Helix\"\nPHASEORI_MAT = MATLAB_DIR / \"3 DHPSF Propagation\" / \"phaseori.mat\"\nROTATION_ANGLES_CSV = (\n MATLAB_DIR / \"3 DHPSF Propagation\" / \"Pillar_Rotation_Angles_Deg.csv\"\n)\n\n# Agent output directory (created per run)\nAGENT_OUTPUT_DIR = DATA_DIR / \"agent_runs\"\n\n# ── Physical constants ─────────────────────────────────────────────\nWAVELENGTH_UM = 0.632 # He-Ne laser, μm\nWAVELENGTH_NM = 632.0 # nm\nNA = 0.1 # numerical aperture\nAPERTURE_UM = 400.0 # aperture diameter D, μm\nPERIOD_NM = 400.0 # unit cell period, nm\nARRAY_SIZE = 1000 # 1000 × 1000 pillar array\n\n# Pillar geometry bounds (nm)\nL_MIN, L_MAX = 60.0, 340.0\nW_MIN, W_MAX = 60.0, 340.0\nH_MIN, H_MAX = 600.0, 860.0\n\n# Design target\nPHASE_TARGET_DEG = 180.0 # half-wave plate |Δφ| = 180°\n\n# ── Surrogate model defaults ──────────────────────────────────────\nSURROGATE_HIDDEN = 64 # smaller than original 128 (less data)\nSURROGATE_N_LAYERS = 3\nSURROGATE_DROPOUT = 0.1 # enable dropout for MC uncertainty\nSURROGATE_TRAIN_EPOCHS = 1000\nSURROGATE_TRAIN_LR = 1e-3\nSURROGATE_TRAIN_BATCH = 32\nSURROGATE_MIN_POINTS = 20\nMC_DROPOUT_SAMPLES = 50 # forward passes for uncertainty\n\n# ── FOM weights ───────────────────────────────────────────────────\nFOM_PHASE_WEIGHT = 10.0 # penalty per degree of phase error\nFOM_TRANS_WEIGHT = 1.0 # reward for transmittance\n\n# ── Agent defaults ────────────────────────────────────────────────\nMAX_CST_CALLS = 200\nMAX_ITERATIONS = 50\nGRAPH_RECURSION_LIMIT = 500 # nodes per run (each tool cycle ≈ 3-4 nodes)\n\n# ── Fresnel propagation ──────────────────────────────────────────\nFRESNEL_Z_POSITIONS_UM = [\n 1750, 1780, 1810, 1840, 1870, 1900, 1930, 1960,\n 1990, 2020, 2050, 2080, 2110, 2140, 2170, 2200,\n 2230, 2260,\n]\nPSF_CROP_SIZE = 128\n\n# ── LLM configuration ────────────────────────────────────────────\nLLM_MODEL = \"deepseek-chat\"\nLLM_BASE_URL = \"https://api.deepseek.com\"\nLLM_TEMPERATURE = 0.3\nLLM_MAX_TOKENS = 4000\n\n\ndef get_deepseek_api_key() -> str:\n key = os.environ.get(\"DEEPSEEK_API_KEY\", \"\")\n if not key:\n raise EnvironmentError(\n \"DEEPSEEK_API_KEY not set. \"\n \"Export it: set DEEPSEEK_API_KEY=sk-...\"\n )\n return key\n"}, "d2b9d13ca365053a37aa0e2d9cbe838ca22ac196": {"t": 1785768288.7371628, "n": 2593, "h": "d18d9b0c9b65cb67", "c": "\"\"\"\nConfiguration constants for the Optical Design Optimization Agent.\n\"\"\"\n\nfrom __future__ import annotations\n\nimport os\nfrom pathlib import Path\n\n# ── Project paths ──────────────────────────────────────────────────\nPROJECT_ROOT = Path(__file__).resolve().parent.parent\nML_DIR = PROJECT_ROOT / \"ml\"\nDATA_DIR = PROJECT_ROOT / \"data\"\nMATLAB_DIR = PROJECT_ROOT / \"matlab\" / \"Double Helix\"\nPHASEORI_MAT = MATLAB_DIR / \"3 DHPSF Propagation\" / \"phaseori.mat\"\nROTATION_ANGLES_CSV = (\n MATLAB_DIR / \"3 DHPSF Propagation\" / \"Pillar_Rotation_Angles_Deg.csv\"\n)\n\n# Agent output directory (created per run)\nAGENT_OUTPUT_DIR = DATA_DIR / \"agent_runs\"\n\n# ── Physical constants ─────────────────────────────────────────────\nWAVELENGTH_UM = 0.632 # He-Ne laser, μm\nWAVELENGTH_NM = 632.0 # nm\nNA = 0.1 # numerical aperture\nAPERTURE_UM = 400.0 # aperture diameter D, μm\nPERIOD_NM = 400.0 # unit cell period, nm\nARRAY_SIZE = 1000 # 1000 × 1000 pillar array\n\n# Pillar geometry bounds (nm)\nL_MIN, L_MAX = 60.0, 340.0\nW_MIN, W_MAX = 60.0, 340.0\nH_MIN, H_MAX = 600.0, 860.0\n\n# Design target\nPHASE_TARGET_DEG = 180.0 # half-wave plate |Δφ| = 180°\n\n# ── Surrogate model defaults ──────────────────────────────────────\nSURROGATE_HIDDEN = 64 # smaller than original 128 (less data)\nSURROGATE_N_LAYERS = 3\nSURROGATE_DROPOUT = 0.1 # enable dropout for MC uncertainty\nSURROGATE_TRAIN_EPOCHS = 1000\nSURROGATE_TRAIN_LR = 1e-3\nSURROGATE_TRAIN_BATCH = 32\nSURROGATE_MIN_POINTS = 20\nMC_DROPOUT_SAMPLES = 50 # forward passes for uncertainty\n\n# ── FOM weights ───────────────────────────────────────────────────\nFOM_PHASE_WEIGHT = 10.0 # penalty per degree of phase error\nFOM_TRANS_WEIGHT = 1.0 # reward for transmittance\n\n# ── Agent defaults ────────────────────────────────────────────────\nMAX_CST_CALLS = 200\nMAX_ITERATIONS = 50\n\n# ── Fresnel propagation ──────────────────────────────────────────\nFRESNEL_Z_POSITIONS_UM = [\n 1750, 1780, 1810, 1840, 1870, 1900, 1930, 1960,\n 1990, 2020, 2050, 2080, 2110, 2140, 2170, 2200,\n 2230, 2260,\n]\nPSF_CROP_SIZE = 128\n\n# ── LLM configuration ────────────────────────────────────────────\nLLM_MODEL = \"deepseek-chat\"\nLLM_BASE_URL = \"https://api.deepseek.com\"\nLLM_TEMPERATURE = 0.3\nLLM_MAX_TOKENS = 4000\n\n\ndef get_deepseek_api_key() -> str:\n key = os.environ.get(\"DEEPSEEK_API_KEY\", \"\")\n if not key:\n raise EnvironmentError(\n \"DEEPSEEK_API_KEY not set. \"\n \"Export it: set DEEPSEEK_API_KEY=sk-...\"\n )\n return key\n"}}}}