2025-11-28 16:30:15 -05:00
|
|
|
"""Core extractor library for Atomizer.
|
|
|
|
|
|
|
|
|
|
Available extractors:
|
|
|
|
|
- Displacement: extract_displacement
|
2025-12-06 13:40:14 -05:00
|
|
|
- Stress: extract_solid_stress (von Mises), extract_principal_stress
|
2025-11-28 16:30:15 -05:00
|
|
|
- Frequency: extract_frequency
|
2025-12-06 13:40:14 -05:00
|
|
|
- Mass (BDF): extract_mass_from_bdf
|
|
|
|
|
- Mass (Expression): extract_mass_from_expression
|
|
|
|
|
- Mass (Part): extract_part_mass_material, extract_part_mass, PartMassExtractor
|
|
|
|
|
- Strain Energy: extract_strain_energy, extract_total_strain_energy
|
|
|
|
|
- SPC Forces: extract_spc_forces, extract_total_reaction_force
|
2025-11-28 16:30:15 -05:00
|
|
|
- Zernike: extract_zernike_from_op2, ZernikeExtractor (telescope mirrors)
|
2025-12-20 13:47:21 -05:00
|
|
|
- Part Introspection: introspect_part (comprehensive NX .prt analysis)
|
2026-01-20 13:11:42 -05:00
|
|
|
- Custom: CustomExtractorLoader for user-defined Python extractors
|
2025-12-06 13:40:14 -05:00
|
|
|
|
|
|
|
|
Phase 2 Extractors (2025-12-06):
|
|
|
|
|
- Principal stress extraction (sigma1, sigma2, sigma3)
|
|
|
|
|
- Strain energy extraction (element strain energy)
|
|
|
|
|
- SPC forces extraction (reaction forces at boundary conditions)
|
|
|
|
|
|
|
|
|
|
Phase 3 Extractors (2025-12-06):
|
|
|
|
|
- Temperature extraction (thermal analysis: SOL 153/159)
|
|
|
|
|
- Thermal gradient extraction
|
|
|
|
|
- Heat flux extraction
|
|
|
|
|
- Modal mass extraction (modal effective mass from F06)
|
2025-12-20 13:47:21 -05:00
|
|
|
|
|
|
|
|
Phase 4 Extractors (2025-12-19):
|
|
|
|
|
- Part Introspection (E12): Comprehensive .prt analysis (expressions, mass, materials, attributes, groups, features)
|
2026-01-20 13:11:42 -05:00
|
|
|
|
|
|
|
|
Phase 5 Extractors (2026-01-17):
|
|
|
|
|
- Custom Extractor Loader: Dynamic loading and execution of user-defined Python extractors
|
|
|
|
|
from AtomizerSpec v2.0 (sandboxed execution with security validation)
|
2025-11-28 16:30:15 -05:00
|
|
|
"""
|
|
|
|
|
|
2025-12-22 21:03:19 -05:00
|
|
|
# Zernike extractor for telescope mirror optimization (standard Z-only method)
|
2025-11-28 16:30:15 -05:00
|
|
|
from optimization_engine.extractors.extract_zernike import (
|
|
|
|
|
ZernikeExtractor,
|
|
|
|
|
extract_zernike_from_op2,
|
|
|
|
|
extract_zernike_filtered_rms,
|
|
|
|
|
extract_zernike_relative_rms,
|
|
|
|
|
)
|
|
|
|
|
|
2025-12-22 21:03:19 -05:00
|
|
|
# Analytic (parabola-based) Zernike extractor (accounts for lateral X/Y displacement)
|
|
|
|
|
# Uses parabola formula - requires knowing focal length
|
|
|
|
|
from optimization_engine.extractors.extract_zernike_opd import (
|
|
|
|
|
ZernikeAnalyticExtractor,
|
|
|
|
|
extract_zernike_analytic,
|
|
|
|
|
extract_zernike_analytic_filtered_rms,
|
|
|
|
|
compare_zernike_methods,
|
|
|
|
|
# Backwards compatibility (deprecated)
|
|
|
|
|
ZernikeOPDExtractor as _ZernikeOPDExtractor_deprecated,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# OPD-based Zernike extractor (uses actual mesh geometry, no shape assumption)
|
|
|
|
|
# MOST RIGOROUS method - RECOMMENDED for telescope mirror optimization
|
2026-01-13 15:53:55 -05:00
|
|
|
# Supports ANNULAR APERTURES (mirrors with central holes) via inner_radius parameter
|
2025-12-22 21:03:19 -05:00
|
|
|
from optimization_engine.extractors.extract_zernike_figure import (
|
|
|
|
|
ZernikeOPDExtractor,
|
|
|
|
|
extract_zernike_opd,
|
|
|
|
|
extract_zernike_opd_filtered_rms,
|
2026-01-13 15:53:55 -05:00
|
|
|
compute_zernike_coefficients_annular,
|
2025-12-22 21:03:19 -05:00
|
|
|
# Backwards compatibility (deprecated)
|
|
|
|
|
ZernikeFigureExtractor,
|
|
|
|
|
extract_zernike_figure,
|
|
|
|
|
extract_zernike_figure_rms,
|
|
|
|
|
)
|
|
|
|
|
|
2026-01-27 12:02:30 -05:00
|
|
|
# Displacement extraction
|
|
|
|
|
from optimization_engine.extractors.extract_displacement import (
|
|
|
|
|
extract_displacement,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Mass extraction from BDF
|
|
|
|
|
from optimization_engine.extractors.extract_mass_from_bdf import (
|
|
|
|
|
extract_mass_from_bdf,
|
|
|
|
|
)
|
|
|
|
|
|
2025-12-06 13:40:14 -05:00
|
|
|
# Part mass and material extractor (from NX .prt files)
|
|
|
|
|
from optimization_engine.extractors.extract_part_mass_material import (
|
|
|
|
|
extract_part_mass_material,
|
|
|
|
|
extract_part_mass,
|
|
|
|
|
extract_part_material,
|
|
|
|
|
PartMassExtractor,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Von Mises stress extraction
|
|
|
|
|
from optimization_engine.extractors.extract_von_mises_stress import (
|
|
|
|
|
extract_solid_stress,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Principal stress extraction (Phase 2)
|
|
|
|
|
from optimization_engine.extractors.extract_principal_stress import (
|
|
|
|
|
extract_principal_stress,
|
|
|
|
|
extract_max_principal_stress,
|
|
|
|
|
extract_min_principal_stress,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Strain energy extraction (Phase 2)
|
|
|
|
|
from optimization_engine.extractors.extract_strain_energy import (
|
|
|
|
|
extract_strain_energy,
|
|
|
|
|
extract_total_strain_energy,
|
|
|
|
|
extract_strain_energy_density,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# SPC forces / reaction forces extraction (Phase 2)
|
|
|
|
|
from optimization_engine.extractors.extract_spc_forces import (
|
|
|
|
|
extract_spc_forces,
|
|
|
|
|
extract_total_reaction_force,
|
|
|
|
|
extract_reaction_component,
|
|
|
|
|
check_force_equilibrium,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Temperature extraction (Phase 3)
|
|
|
|
|
from optimization_engine.extractors.extract_temperature import (
|
|
|
|
|
extract_temperature,
|
|
|
|
|
extract_temperature_gradient,
|
|
|
|
|
extract_heat_flux,
|
|
|
|
|
get_max_temperature,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Modal mass extraction (Phase 3)
|
|
|
|
|
from optimization_engine.extractors.extract_modal_mass import (
|
|
|
|
|
extract_modal_mass,
|
|
|
|
|
extract_frequencies,
|
|
|
|
|
get_first_frequency,
|
|
|
|
|
get_modal_mass_ratio,
|
|
|
|
|
)
|
|
|
|
|
|
2025-12-20 13:47:21 -05:00
|
|
|
# Part introspection (Phase 4) - comprehensive .prt analysis
|
|
|
|
|
from optimization_engine.extractors.introspect_part import (
|
|
|
|
|
introspect_part,
|
|
|
|
|
get_expressions_dict,
|
|
|
|
|
get_expression_value,
|
|
|
|
|
print_introspection_summary,
|
|
|
|
|
)
|
|
|
|
|
|
2026-01-20 13:11:42 -05:00
|
|
|
# Custom extractor loader (Phase 5) - dynamic Python extractors from AtomizerSpec v2.0
|
|
|
|
|
from optimization_engine.extractors.custom_extractor_loader import (
|
|
|
|
|
CustomExtractor,
|
|
|
|
|
CustomExtractorLoader,
|
|
|
|
|
CustomExtractorContext,
|
|
|
|
|
ExtractorSecurityError,
|
|
|
|
|
ExtractorValidationError,
|
|
|
|
|
load_custom_extractors,
|
|
|
|
|
execute_custom_extractor,
|
|
|
|
|
validate_custom_extractor,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Spec extractor builder - builds extractors from AtomizerSpec
|
|
|
|
|
from optimization_engine.extractors.spec_extractor_builder import (
|
|
|
|
|
SpecExtractorBuilder,
|
|
|
|
|
build_extractors_from_spec,
|
|
|
|
|
get_extractor_outputs,
|
|
|
|
|
list_available_builtin_extractors,
|
|
|
|
|
)
|
|
|
|
|
|
2025-11-28 16:30:15 -05:00
|
|
|
__all__ = [
|
2026-01-27 12:02:30 -05:00
|
|
|
# Displacement extraction
|
|
|
|
|
"extract_displacement",
|
|
|
|
|
# Mass extraction (from BDF)
|
|
|
|
|
"extract_mass_from_bdf",
|
2025-12-06 13:40:14 -05:00
|
|
|
# Part mass & material (from .prt)
|
2026-01-27 12:02:30 -05:00
|
|
|
"extract_part_mass_material",
|
|
|
|
|
"extract_part_mass",
|
|
|
|
|
"extract_part_material",
|
|
|
|
|
"PartMassExtractor",
|
2025-12-06 13:40:14 -05:00
|
|
|
# Stress extractors
|
2026-01-27 12:02:30 -05:00
|
|
|
"extract_solid_stress",
|
|
|
|
|
"extract_principal_stress",
|
|
|
|
|
"extract_max_principal_stress",
|
|
|
|
|
"extract_min_principal_stress",
|
2025-12-06 13:40:14 -05:00
|
|
|
# Strain energy
|
2026-01-27 12:02:30 -05:00
|
|
|
"extract_strain_energy",
|
|
|
|
|
"extract_total_strain_energy",
|
|
|
|
|
"extract_strain_energy_density",
|
2025-12-06 13:40:14 -05:00
|
|
|
# SPC forces / reactions
|
2026-01-27 12:02:30 -05:00
|
|
|
"extract_spc_forces",
|
|
|
|
|
"extract_total_reaction_force",
|
|
|
|
|
"extract_reaction_component",
|
|
|
|
|
"check_force_equilibrium",
|
2025-12-22 21:03:19 -05:00
|
|
|
# Zernike (telescope mirrors) - Standard Z-only method
|
2026-01-27 12:02:30 -05:00
|
|
|
"ZernikeExtractor",
|
|
|
|
|
"extract_zernike_from_op2",
|
|
|
|
|
"extract_zernike_filtered_rms",
|
|
|
|
|
"extract_zernike_relative_rms",
|
2025-12-22 21:03:19 -05:00
|
|
|
# Zernike OPD (RECOMMENDED - uses actual geometry, no shape assumption)
|
2026-01-13 15:53:55 -05:00
|
|
|
# Supports annular apertures via inner_radius parameter
|
2026-01-27 12:02:30 -05:00
|
|
|
"ZernikeOPDExtractor",
|
|
|
|
|
"extract_zernike_opd",
|
|
|
|
|
"extract_zernike_opd_filtered_rms",
|
|
|
|
|
"compute_zernike_coefficients_annular",
|
2025-12-22 21:03:19 -05:00
|
|
|
# Zernike Analytic (parabola-based with lateral displacement correction)
|
2026-01-27 12:02:30 -05:00
|
|
|
"ZernikeAnalyticExtractor",
|
|
|
|
|
"extract_zernike_analytic",
|
|
|
|
|
"extract_zernike_analytic_filtered_rms",
|
|
|
|
|
"compare_zernike_methods",
|
2025-12-22 21:03:19 -05:00
|
|
|
# Backwards compatibility (deprecated)
|
2026-01-27 12:02:30 -05:00
|
|
|
"ZernikeFigureExtractor",
|
|
|
|
|
"extract_zernike_figure",
|
|
|
|
|
"extract_zernike_figure_rms",
|
2025-12-06 13:40:14 -05:00
|
|
|
# Temperature (Phase 3 - thermal)
|
2026-01-27 12:02:30 -05:00
|
|
|
"extract_temperature",
|
|
|
|
|
"extract_temperature_gradient",
|
|
|
|
|
"extract_heat_flux",
|
|
|
|
|
"get_max_temperature",
|
2025-12-06 13:40:14 -05:00
|
|
|
# Modal mass (Phase 3 - dynamics)
|
2026-01-27 12:02:30 -05:00
|
|
|
"extract_modal_mass",
|
|
|
|
|
"extract_frequencies",
|
|
|
|
|
"get_first_frequency",
|
|
|
|
|
"get_modal_mass_ratio",
|
2025-12-20 13:47:21 -05:00
|
|
|
# Part introspection (Phase 4)
|
2026-01-27 12:02:30 -05:00
|
|
|
"introspect_part",
|
|
|
|
|
"get_expressions_dict",
|
|
|
|
|
"get_expression_value",
|
|
|
|
|
"print_introspection_summary",
|
2026-01-20 13:11:42 -05:00
|
|
|
# Custom extractor loader (Phase 5)
|
2026-01-27 12:02:30 -05:00
|
|
|
"CustomExtractor",
|
|
|
|
|
"CustomExtractorLoader",
|
|
|
|
|
"CustomExtractorContext",
|
|
|
|
|
"ExtractorSecurityError",
|
|
|
|
|
"ExtractorValidationError",
|
|
|
|
|
"load_custom_extractors",
|
|
|
|
|
"execute_custom_extractor",
|
|
|
|
|
"validate_custom_extractor",
|
2026-01-20 13:11:42 -05:00
|
|
|
# Spec extractor builder
|
2026-01-27 12:02:30 -05:00
|
|
|
"SpecExtractorBuilder",
|
|
|
|
|
"build_extractors_from_spec",
|
|
|
|
|
"get_extractor_outputs",
|
|
|
|
|
"list_available_builtin_extractors",
|
2025-11-28 16:30:15 -05:00
|
|
|
]
|