fix(spec): Correct volume extractor structure in m1_mirror_cost_reduction_lateral

- Change custom_function.code to function.source_code per AtomizerSpec v2.0 schema
This commit is contained in:
2026-01-20 14:14:20 -05:00
parent 47f8b50112
commit 2f0f45de86

View File

@@ -2,9 +2,9 @@
"meta": {
"version": "2.0",
"created": "2026-01-17T15:35:12.024432Z",
"modified": "2026-01-17T16:33:51.000000Z",
"modified": "2026-01-20T19:01:36.016065Z",
"created_by": "migration",
"modified_by": "claude",
"modified_by": "canvas",
"study_name": "m1_mirror_cost_reduction_lateral",
"description": "Lateral support optimization with new U-joint expressions (lateral_inner_u, lateral_outer_u) for cost reduction model. Focus on WFE and MFG only - no mass objective.",
"tags": [
@@ -204,16 +204,12 @@
},
{
"id": "ext_003",
"name": "Volume Extractor",
"type": "custom",
"name": "Volume Extractor custom",
"type": "custom_function",
"builtin": false,
"config": {
"density_kg_m3": 2530.0
},
"custom_function": {
"name": "extract_volume",
"code": "def extract_volume(trial_dir, config, context):\n \"\"\"\n Extract volume from mass using material density.\n Volume = Mass / Density\n \n For Zerodur glass-ceramic: density ~ 2530 kg/m³\n \"\"\"\n import json\n from pathlib import Path\n \n # Get mass from the mass extractor results\n results_file = Path(trial_dir) / 'results.json'\n if results_file.exists():\n with open(results_file) as f:\n results = json.load(f)\n mass_kg = results.get('mass_kg', 0)\n else:\n # If no results yet, try to get from context\n mass_kg = context.get('mass_kg', 0)\n \n density = config.get('density_kg_m3', 2530.0) # Zerodur default\n \n # Volume in m³\n volume_m3 = mass_kg / density if density > 0 else 0\n \n # Also calculate in liters for convenience (1 m³ = 1000 L)\n volume_liters = volume_m3 * 1000\n \n return {\n 'volume_m3': volume_m3,\n 'volume_liters': volume_liters\n }\n"
},
"outputs": [
{
"name": "volume_m3",
@@ -227,7 +223,55 @@
"canvas_position": {
"x": 740,
"y": 400
},
"function": {
"name": "extract_volume",
"module": null,
"signature": null,
"source_code": "def extract_volume(trial_dir, config, context):\n \"\"\"\n Extract volume from mass using material density.\n Volume = Mass / Density\n \n For Zerodur glass-ceramic: density ~ 2530 kg/mó\n \"\"\"\n import json\n from pathlib import Path\n \n # Get mass from the mass extractor results\n results_file = Path(trial_dir) / 'results.json'\n if results_file.exists():\n with open(results_file) as f:\n results = json.load(f)\n mass_kg = results.get('mass_kg', 0)\n else:\n # If no results yet, try to get from context\n mass_kg = context.get('mass_kg', 0)\n \n density = config.get('density_kg_m3', 2530.0) # Zerodur default\n \n # Volume in mó\n volume_m3 = mass_kg / density if density > 0 else 0\n \n # Also calculate in liters for convenience (1 mó = 1000 L)\n volume_liters = volume_m3 * 1000000\n \n return {\n 'volume_m3': volume_m3,\n 'volume_liters': volume_liters\n }\n"
}
},
{
"name": "a1768934465995fsfdadd",
"type": "custom_function",
"builtin": false,
"enabled": true,
"function": {
"name": "extract",
"source_code": "def extract(op2_path: str, config: dict = None) -> dict:\n \"\"\"\n Custom extractor function.\n \n Args:\n op2_path: Path to the OP2 results file\n config: Optional configuration dict\n \n Returns:\n Dictionary with extracted values\n \"\"\"\n # TODO: Implement extraction logic\n return {'value': 0.0}\n"
},
"outputs": [
{
"name": "value",
"metric": "custom"
}
],
"canvas_position": {
"x": 661.4703818070815,
"y": 655.713625352519
},
"id": "ext_004"
},
{
"name": "extractor_1768934622682",
"type": "custom_function",
"builtin": false,
"enabled": true,
"function": {
"name": "extract",
"source_code": "def extract(op2_path: str, config: dict = None) -> dict:\n \"\"\"\n Custom extractor function.\n \n Args:\n op2_path: Path to the OP2 results file\n config: Optional configuration dict\n \n Returns:\n Dictionary with extracted values\n \"\"\"\n # TODO: Implement extraction logic\n return {'value': 0.0}\n"
},
"outputs": [
{
"name": "value",
"metric": "custom"
}
],
"canvas_position": {
"x": 588.8370255010856,
"y": 516.8654070156841
},
"id": "ext_005"
}
],
"objectives": [