Skip to content
This repository has been archived by the owner on Oct 23, 2022. It is now read-only.

Allow for surface type extensibility in AxisymmetricOpticalSystem #179

Merged
merged 14 commits into from
May 13, 2021
Merged
22 changes: 11 additions & 11 deletions src/Examples/other_examples.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ function cooketriplet(::Type{T} = Float64, detpix::Int = 1000) where {T<:Real}
DataFrame(
SurfaceType = ["Object", "Standard", "Standard", "Standard", "Stop", "Standard", "Standard", "Image"],
Radius = [Inf, 26.777, 66.604, -35.571, 35.571, 35.571, -26.777, Inf],
OptimizeRadius = [false, true, true, true, true, true, true, false],
# OptimizeRadius = [false, true, true, true, true, true, true, false],
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These columns can be reintroduced later when the Optimization code is more mature. But they shouldn't be used within the AxisymmetricOpticalSystem constructor. Instead, we should have some kind of AxisymmetricOptimization constructor which parses the extra columns.

Thickness = [Inf, 4.0, 2.0, 4.0, 2.0, 4.0, 44.748, missing],
OptimizeThickness = [false, true, true, true, true, true, true, false],
# OptimizeThickness = [false, true, true, true, true, true, true, false],
Material = [Air, SCHOTT.N_SK16, Air, SCHOTT.N_SF2, Air, SCHOTT.N_SK16, Air, missing],
SemiDiameter = [Inf, 8.580, 7.513, 7.054, 6.033, 7.003, 7.506, 15.0]
),
Expand Down Expand Up @@ -77,9 +77,9 @@ function doubleconvex(frontradius::T,rearradius::T) where{T<:Real}
DataFrame(
SurfaceType = ["Object", "Standard", "Standard", "Image"],
Radius = [convert(T, Inf64), frontradius, rearradius, convert(T, Inf64)],
OptimizeRadius = [false, true, true, false],
# OptimizeRadius = [false, true, true, false],
Thickness = [convert(T, Inf64), convert(T, 10.0), convert(T, 57.8), missing],
OptimizeThickness = [false, false, false, false],
# OptimizeThickness = [false, false, false, false],
Material = [Air, SCHOTT.N_BK7, Air, missing],
SemiDiameter = [convert(T, Inf64), convert(T, 9.0), convert(T, 9.0), convert(T, 15.0)]
)
Expand All @@ -91,11 +91,11 @@ function doubleconvexconic(::Type{T} = Float64) where {T<:Real}
DataFrame(
SurfaceType = ["Object", "Standard", "Standard", "Image"],
Radius = [Inf64, 60, -60, Inf64],
OptimizeRadius = [false, true, true, false],
# OptimizeRadius = [false, true, true, false],
Thickness = [Inf64, 10.0, 57.8, missing],
OptimizeThickness = [false, false, false, false],
# OptimizeThickness = [false, false, false, false],
Conic = [missing, 0.01, 0.01, missing],
OptimizeConic = [false, true, true, false],
# OptimizeConic = [false, true, true, false],
Material = [Air, SCHOTT.N_BK7, Air, missing],
SemiDiameter = [Inf64, 9.0, 9.0, 15.0]
)
Expand All @@ -107,9 +107,9 @@ function doubleconvexlensonly(frontradius::T,rearradius::T) where{T<:Real}
DataFrame(
SurfaceType = ["Object", "Standard", "Standard", "Image"],
Radius = [convert(T, Inf64), frontradius, rearradius, convert(T, Inf64)],
OptimizeRadius = [false, true, true, false],
# OptimizeRadius = [false, true, true, false],
Thickness = [convert(T, Inf64), convert(T, 10.0), convert(T, 57.8), missing],
OptimizeThickness = [false, false, false, false],
# OptimizeThickness = [false, false, false, false],
Material = [Air, SCHOTT.N_BK7, Air, missing],
SemiDiameter = [convert(T, Inf64), convert(T, 9.0), convert(T, 9.0), convert(T, 15.0)]
)
Expand All @@ -125,9 +125,9 @@ function doubleconvex(
DataFrame(
SurfaceType = ["Object", "Standard", "Standard", "Image"],
Radius = [Inf64, 60, -60, Inf64],
OptimizeRadius = [false, true, true, false],
# OptimizeRadius = [false, true, true, false],
Thickness = [Inf64, 10.0, 57.8, missing],
OptimizeThickness = [false, true, true, false],
# OptimizeThickness = [false, true, true, false],
Material = [Air, SCHOTT.N_BK7, Air, missing],
SemiDiameter = [Inf64, 9.0, 9.0, 15.0]
);
Expand Down
9 changes: 4 additions & 5 deletions src/Optical/OpticalSystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -233,17 +233,16 @@ function validate_axisymmetricopticalsystem_dataframe(prescription::DataFrame)
"Thickness" => Real,
"Material" => GlassCat.AbstractGlass,
"SemiDiameter" => Real,
"Conic" => Real,
"Reflectance" => Real,
"Parameters" => Vector{<:Real},
"OptimizeRadius" => Bool,
"OptimizeThickness" => Bool,
)
cols = names(prescription)

supported_surface_types = ["Object", "Stop", "Image", "Standard", "Aspheric", "Zernike"]
surface_types = prescription[!, "SurfaceType"]

comma_join(l::Vector{<:AbstractString}) = join(l, ", ", ", and ")
comma_join(l::Vector{<:AbstractString}) = join(l, ", ", " and ")

missing_cols = setdiff(required_cols, cols)
@assert isempty(missing_cols) "missing required columns: $(comma_join(missing_cols))"
Expand Down Expand Up @@ -284,8 +283,8 @@ end

Optical system which has lens elements and an image detector, created from a `DataFrame` containing prescription data.

These tags are supported for columns: `:Radius`, `:SemiDiameter`, `:SurfaceType`, `:Thickness`, `:Conic`, `:Aspherics`,
`:Reflectance`, `:Material`, `:OptimizeRadius`, `:OptimizeThickness`, `:OptimizeConic`.
These tags are supported for columns: `:Radius`, `:SemiDiameter`, `:SurfaceType`, `:Thickness`, `:Conic`, `:Parameters`,
`:Reflectance`, `:Material`.

These tags are supported for entries in a `SurfaceType` column: `Object`, `Image`, `Stop`. Assumes the `Image` row will
be the last row in the `DataFrame`.
Expand Down