Files
Atomizer/tools/analyze_wfe_annular.bat

75 lines
3.1 KiB
Batchfile
Raw Normal View History

@echo off
REM Atomizer WFE Analyzer - ANNULAR APERTURE VERSION
REM For mirrors with central holes (e.g., M1 Mirror with 271.5mm hole)
REM Excludes central hole from Zernike fitting and RMS calculations
echo ======================================================================
echo ATOMIZER WFE ANALYZER - ANNULAR APERTURE
echo Excludes central hole from Zernike fitting
echo Default: 271.5mm diameter hole (135.75mm radius)
echo ======================================================================
echo.
REM Use PowerShell to open file dialog
for /f "delims=" %%I in ('powershell -NoProfile -Command "Add-Type -AssemblyName System.Windows.Forms; $f = New-Object System.Windows.Forms.OpenFileDialog; $f.Filter = 'OP2 Files (*.op2)|*.op2|All Files (*.*)|*.*'; $f.Title = 'Select OP2 Results File'; $f.InitialDirectory = '%USERPROFILE%'; if ($f.ShowDialog() -eq 'OK') { $f.FileName }"') do set "OP2_FILE=%%I"
if "%OP2_FILE%"=="" (
echo No file selected. Exiting.
pause
exit /b 1
)
echo Selected: %OP2_FILE%
echo.
REM Get the directory of the OP2 file for finding output HTMLs
for %%F in ("%OP2_FILE%") do set "OP2_DIR=%%~dpF"
for %%F in ("%OP2_FILE%") do set "OP2_BASE=%%~nF"
REM Initialize conda and activate atomizer environment
call "%USERPROFILE%\anaconda3\Scripts\activate.bat" atomizer
echo Running Zernike analysis with ANNULAR aperture...
echo (Excluding 271.5mm diameter central hole)
echo.
REM Run the annular HTML generator with default inner radius (135.75mm for M1 Mirror)
python "%~dp0zernike_html_generator_annular.py" "%OP2_FILE%" --inner-radius 135.75
if %ERRORLEVEL% neq 0 (
echo.
echo ======================================================================
echo ERROR: Analysis failed. See errors above.
echo ======================================================================
pause
exit /b 1
)
echo.
echo ======================================================================
echo Opening generated HTML files in browser...
echo ======================================================================
REM Find and open the ANNULAR HTML files
for /f "delims=" %%H in ('powershell -NoProfile -Command "Get-ChildItem -Path '%OP2_DIR%' -Filter '%OP2_BASE%_*_40_vs_20_ANNULAR.html' | Sort-Object LastWriteTime -Descending | Select-Object -First 1 -ExpandProperty FullName"') do (
echo Opening: %%~nxH
start "" "%%H"
)
for /f "delims=" %%H in ('powershell -NoProfile -Command "Get-ChildItem -Path '%OP2_DIR%' -Filter '%OP2_BASE%_*_60_vs_20_ANNULAR.html' | Sort-Object LastWriteTime -Descending | Select-Object -First 1 -ExpandProperty FullName"') do (
echo Opening: %%~nxH
start "" "%%H"
)
for /f "delims=" %%H in ('powershell -NoProfile -Command "Get-ChildItem -Path '%OP2_DIR%' -Filter '%OP2_BASE%_*_90_mfg_ANNULAR.html' | Sort-Object LastWriteTime -Descending | Select-Object -First 1 -ExpandProperty FullName"') do (
echo Opening: %%~nxH
start "" "%%H"
)
echo.
echo ======================================================================
echo ANALYSIS COMPLETE (ANNULAR APERTURE)
echo ======================================================================
echo.
pause