Converted from roc to curvature
This commit is contained in:
24
app/Main.hs
24
app/Main.hs
@@ -15,7 +15,7 @@ import Petzval.Calculations
|
||||
import Petzval.Optimization
|
||||
import Petzval.Types
|
||||
import System.Environment (getArgs)
|
||||
import System.IO (hPrint, stderr)
|
||||
import System.IO (hPrint, hPutStrLn, stderr)
|
||||
import Linear
|
||||
import Numeric.AD.Mode (Scalar, Mode)
|
||||
import qualified Numeric.LinearAlgebra as L
|
||||
@@ -34,19 +34,19 @@ n_ssk8 = SellemeierMat [ (1.44857867, 1.17965926e-01)
|
||||
|
||||
system1 =
|
||||
[ Stop{_thickness = 0, _outsideRadius=5}
|
||||
, Surface{_material = bk7, _thickness = 10, _roc = 100, _outsideRadius=10}
|
||||
, Surface{_material = air, _thickness = 95, _roc = -100, _outsideRadius=10}
|
||||
, Surface{_material = bk7, _thickness = 10, _curvature = 1/100, _outsideRadius=10}
|
||||
, Surface{_material = air, _thickness = 95, _curvature = -1/100, _outsideRadius=10}
|
||||
]
|
||||
|
||||
system2 =
|
||||
[
|
||||
Surface{_material = s_sk16, _outsideRadius=11.5, _roc=42.98790, _thickness = 4}
|
||||
, Surface{_material = air, _outsideRadius = 11.5, _roc = -248.07740, _thickness = 10.51018}
|
||||
, Surface{_material = s_f4, _outsideRadius = 9.852, _roc = -38.21035, _thickness = 2.5}
|
||||
, Surface{_material = air, _outsideRadius = 8.885, _roc = 43.95894, _thickness = 0}
|
||||
Surface{_material = s_sk16, _outsideRadius=11.5, _curvature=1/42.98790, _thickness = 4}
|
||||
, Surface{_material = air, _outsideRadius = 11.5, _curvature = -1/248.07740, _thickness = 10.51018}
|
||||
, Surface{_material = s_f4, _outsideRadius = 9.852, _curvature = -1/38.21035, _thickness = 2.5}
|
||||
, Surface{_material = air, _outsideRadius = 8.885, _curvature = 1/43.95894, _thickness = 0}
|
||||
, Stop{_outsideRadius = 8.6762522794, _thickness = 9.86946}
|
||||
, Surface{_material=s_sk16, _outsideRadius = 11, _roc=656.66349, _thickness = 4.5}
|
||||
, Surface{_material = air, _outsideRadius = 11, _roc = -33.50754, _thickness = 86.48643}
|
||||
, Surface{_material=s_sk16, _outsideRadius = 11, _curvature=1/656.66349, _thickness = 4.5}
|
||||
, Surface{_material = air, _outsideRadius = 11, _curvature = -1/33.50754, _thickness = 86.48643}
|
||||
]
|
||||
where s_sk16 = constMat 1.620408 :: SellemeierMat
|
||||
s_f4 = constMat 1.616589
|
||||
@@ -75,9 +75,11 @@ doOptimize steps = runWriterT $ optimizeDLS cfg vars merit system1
|
||||
, DynMerit $ TW 0 1 $ SpotSize Nothing
|
||||
, DynMerit $ TW 0 1 $ SpotSize (Just $ TraceConditions 7 0.587618)
|
||||
, DynMerit $ TW 0 1 $ SpotSize (Just $ TraceConditions 15 0.587618)
|
||||
, DynMerit $ TW 1 100 $ Vign (TraceConditions 15 wl)
|
||||
]
|
||||
wl = 0.5875618
|
||||
vars :: VariableSet
|
||||
vars = (ix 1 . roc) `adjoin` (ix 2 . roc) `adjoin` (ix 2.thickness)
|
||||
vars = (ix 1 . curvature) `adjoin` (ix 2 . curvature) `adjoin` (ix 2.thickness)
|
||||
cfg = def{maxSteps = steps,eps1=0,eps2=0}
|
||||
|
||||
|
||||
@@ -90,8 +92,10 @@ main =
|
||||
in do
|
||||
[arg] <- getArgs
|
||||
let steps = read arg
|
||||
hPrint stderr system1
|
||||
print $ L.norm_2 (L.fromList [3.0 , 4.0] :: L.Vector Double)
|
||||
(result, tr) <- doOptimize steps
|
||||
hPutStrLn stderr $ "Result BFL: " ++ (show . rearFocalLength . lensRTM . bake 0.5875618) result
|
||||
hPrint stderr result
|
||||
putStrLn "---"
|
||||
mapM_ (putStrLn . DL.intercalate "," . map show) tr
|
||||
|
||||
Reference in New Issue
Block a user