Files
Atomizer/tools/analysis/audit_v10_fix.py
Anto01 a3f18dc377 chore: Project cleanup and Canvas UX improvements (Phase 7-9)
## Cleanup (v0.5.0)
- Delete 102+ orphaned MCP session temp files
- Remove build artifacts (htmlcov, dist, __pycache__)
- Archive superseded plan docs (RALPH_LOOP V2/V3, CANVAS V3, etc.)
- Move debug/analysis scripts from tests/ to tools/analysis/
- Archive redundant NX journals to archive/nx_journals/
- Archive monolithic PROTOCOL.md to docs/archive/
- Update .gitignore with missing patterns
- Clean old study files (optimization_log_old.txt, run_optimization_old.py)

## Canvas UX (Phases 7-9)
- Phase 7: Resizable panels with localStorage persistence
  - Left sidebar: 200-400px, Right panel: 280-600px
  - New useResizablePanel hook and ResizeHandle component
- Phase 8: Enable all palette items
  - All 8 node types now draggable
  - Singleton logic for model/solver/algorithm/surrogate
- Phase 9: Solver configuration
  - Add SolverEngine type (nxnastran, mscnastran, python, etc.)
  - Add NastranSolutionType (SOL101-SOL200)
  - Engine/solution dropdowns in config panel
  - Python script path support

## Documentation
- Update CHANGELOG.md with recent versions
- Update docs/00_INDEX.md
- Create examples/README.md
- Add docs/plans/CANVAS_UX_IMPROVEMENTS.md
2026-01-24 15:17:34 -05:00

75 lines
3.3 KiB
Python

"""Verify the V10 fix - compare Standard extract_relative vs OPD extract_relative."""
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent.parent))
from optimization_engine.extractors import ZernikeExtractor, ZernikeOPDExtractor
op2 = Path('studies/M1_Mirror/m1_mirror_cost_reduction_V10/2_iterations/iter1/assy_m1_assyfem1_sim1-solution_1.op2')
print("="*70)
print("VERIFICATION: ZernikeOPDExtractor.extract_relative() vs Standard")
print("="*70)
print()
# Standard extractor
extractor_std = ZernikeExtractor(op2, n_modes=50, filter_orders=4)
# OPD extractor (with XY lateral correction)
extractor_opd = ZernikeOPDExtractor(op2, n_modes=50, filter_orders=4)
print("Standard ZernikeExtractor.extract_relative():")
rel_40_std = extractor_std.extract_relative('3', '2')
rel_60_std = extractor_std.extract_relative('4', '2')
rel_90_std = extractor_std.extract_relative('1', '2')
print(f" 40-20: {rel_40_std['relative_filtered_rms_nm']:.2f} nm")
print(f" 60-20: {rel_60_std['relative_filtered_rms_nm']:.2f} nm")
print(f" 90-20 (j1to3): {rel_90_std['relative_rms_filter_j1to3']:.2f} nm")
print()
print("NEW ZernikeOPDExtractor.extract_relative() (with XY lateral correction):")
rel_40_opd = extractor_opd.extract_relative('3', '2')
rel_60_opd = extractor_opd.extract_relative('4', '2')
rel_90_opd = extractor_opd.extract_relative('1', '2')
print(f" 40-20: {rel_40_opd['relative_filtered_rms_nm']:.2f} nm")
print(f" 60-20: {rel_60_opd['relative_filtered_rms_nm']:.2f} nm")
print(f" 90-20 (j1to3): {rel_90_opd['relative_rms_filter_j1to3']:.2f} nm")
print()
print("Lateral displacement diagnostics (OPD method):")
print(f" Max lateral: {rel_40_opd['max_lateral_displacement_um']:.3f} um")
print(f" RMS lateral: {rel_40_opd['rms_lateral_displacement_um']:.3f} um")
print()
print("="*70)
print("COMPARISON")
print("="*70)
print()
print(f"{'Metric':<20} | {'Standard':<12} | {'OPD':<12} | {'Diff %':<10}")
print("-"*60)
def pct_diff(a, b):
return 100.0 * (b - a) / a if a > 0 else 0
print(f"{'40-20 (nm)':<20} | {rel_40_std['relative_filtered_rms_nm']:>12.2f} | {rel_40_opd['relative_filtered_rms_nm']:>12.2f} | {pct_diff(rel_40_std['relative_filtered_rms_nm'], rel_40_opd['relative_filtered_rms_nm']):>+10.1f}%")
print(f"{'60-20 (nm)':<20} | {rel_60_std['relative_filtered_rms_nm']:>12.2f} | {rel_60_opd['relative_filtered_rms_nm']:>12.2f} | {pct_diff(rel_60_std['relative_filtered_rms_nm'], rel_60_opd['relative_filtered_rms_nm']):>+10.1f}%")
print(f"{'90-20 j1to3 (nm)':<20} | {rel_90_std['relative_rms_filter_j1to3']:>12.2f} | {rel_90_opd['relative_rms_filter_j1to3']:>12.2f} | {pct_diff(rel_90_std['relative_rms_filter_j1to3'], rel_90_opd['relative_rms_filter_j1to3']):>+10.1f}%")
print()
print("="*70)
print("WHAT V9 REPORTED (for comparison)")
print("="*70)
print(" 40-20: 6.10 nm (from DB)")
print(" 60-20: 12.76 nm (from DB)")
print()
print("V10 SHOULD NOW REPORT (using OPD extract_relative):")
print(f" 40-20: {rel_40_opd['relative_filtered_rms_nm']:.2f} nm")
print(f" 60-20: {rel_60_opd['relative_filtered_rms_nm']:.2f} nm")
print(f" 90-20: {rel_90_opd['relative_rms_filter_j1to3']:.2f} nm")
print()
print("V10 OLD WRONG VALUES WERE:")
print(" 40-20: 1.99 nm (WRONG - was computing abs(RMS_target - RMS_ref))")
print(" 60-20: 6.82 nm (WRONG)")
print()
print("FIX VERIFIED: OPD extract_relative() correctly computes RMS of (WFE_target - WFE_ref)")