Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/src/assets/examples/live_empty_table_showcase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ add(obj, code, label) = add_component!(gui, obj; code, label, select = false)

laser = add(CollimatedSource([0.0, 0, 0], [0.0, 1, 0], 5e-3, 632.8e-9),
"CollimatedSource([0.0, 0, 0], [0.0, 1, 0], 5e-3, 632.8e-9)", "laser")
lens1 = add(ThinLens(50e-3, -50e-3, 12.7e-3, 1.5), "ThinLens(50e-3, -50e-3, 12.7e-3, 1.5)", "lens1")
lens2 = add(ThinLens(100e-3, -100e-3, 25.4e-3, 1.5), "ThinLens(100e-3, -100e-3, 25.4e-3, 1.5)", "lens2")
lens1 = add(ThinLens(50e-3, -50e-3, 12.7e-3, ConstantRefractiveIndex(1.5)), "ThinLens(50e-3, -50e-3, 12.7e-3, ConstantRefractiveIndex(1.5))", "lens1")
lens2 = add(ThinLens(100e-3, -100e-3, 25.4e-3, ConstantRefractiveIndex(1.5)), "ThinLens(100e-3, -100e-3, 25.4e-3, ConstantRefractiveIndex(1.5))", "lens2")
mirror = add(RoundPlanoMirror(25.4e-3, 6e-3), "RoundPlanoMirror(25.4e-3, 6e-3)", "mirror")
detector = add(Detector(15e-3), "Detector(15e-3)", "detector")

Expand Down
8 changes: 4 additions & 4 deletions docs/src/components.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ with the controls and solves the systems again:
beam = Beam([0.0, 0, 0], [0.0, 1, 0])
gui = live_view(System() => beam)

lens = ThinLens(50e-3, -50e-3, 25.4e-3, 1.5)
lens = ThinLens(50e-3, -50e-3, 25.4e-3, ConstantRefractiveIndex(1.5))
translate_to3d!(lens, [0, 0.1, 0])
add_component!(gui, lens; label = "lens")

Expand Down Expand Up @@ -153,7 +153,7 @@ The button "remove" at the end of the page "Pose" of the card of a component or
key `Delete` remove it again, from the view and from all its systems; a component without a system,
e.g. an extra, can be removed the same way. The added and removed
components are part of the code of [`export_changes`](@ref), which writes a glass as its
`SellmeierEquation` and a constant refractive index as `λ -> n`, such that the code runs without
`SellmeierEquation` and a constant refractive index as `ConstantRefractiveIndex(n)`, such that the code runs without
BeamletOpticsGUI. An added source is its constructor at the origin along +y, the `rotate3d!` and
`translate_to3d!` to its pose and the `solve_system!` that traces it; a removed source that the
view started with is a comment.
Expand Down Expand Up @@ -245,8 +245,8 @@ Julia code. Add it as `code` constructs it and move it afterwards, since the scr
followed by the change of the pose since it was added:

```julia
code = "SphericalLens(0.05, -0.05, 5e-3, 25.4e-3, 1.5)"
lens = add_component!(gui, SphericalLens(0.05, -0.05, 5e-3, 25.4e-3, 1.5); code, label = "lens")
code = "SphericalLens(0.05, -0.05, 5e-3, 25.4e-3, ConstantRefractiveIndex(1.5))"
lens = add_component!(gui, SphericalLens(0.05, -0.05, 5e-3, 25.4e-3, ConstantRefractiveIndex(1.5)); code, label = "lens")
retrace!(gui) do
translate_to3d!(lens, [0, 0.1, 0])
end
Expand Down
4 changes: 2 additions & 2 deletions docs/src/examples/live_empty_table.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ add(obj, code, label) = add_component!(gui, obj; code, label, select = false)

laser = add(CollimatedSource([0.0, 0, 0], [0.0, 1, 0], 5e-3, 632.8e-9),
"CollimatedSource([0.0, 0, 0], [0.0, 1, 0], 5e-3, 632.8e-9)", "laser")
lens1 = add(ThinLens(50e-3, -50e-3, 12.7e-3, 1.5), "ThinLens(50e-3, -50e-3, 12.7e-3, 1.5)", "lens1")
lens2 = add(ThinLens(100e-3, -100e-3, 25.4e-3, 1.5), "ThinLens(100e-3, -100e-3, 25.4e-3, 1.5)", "lens2")
lens1 = add(ThinLens(50e-3, -50e-3, 12.7e-3, ConstantRefractiveIndex(1.5)), "ThinLens(50e-3, -50e-3, 12.7e-3, ConstantRefractiveIndex(1.5))", "lens1")
lens2 = add(ThinLens(100e-3, -100e-3, 25.4e-3, ConstantRefractiveIndex(1.5)), "ThinLens(100e-3, -100e-3, 25.4e-3, ConstantRefractiveIndex(1.5))", "lens2")
mirror = add(RoundPlanoMirror(25.4e-3, 6e-3), "RoundPlanoMirror(25.4e-3, 6e-3)", "mirror")
detector = add(Detector(15e-3), "Detector(15e-3)", "detector")
```
Expand Down
2 changes: 1 addition & 1 deletion skills/beamletopticsgui/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ attaches the chosen component to the mouse, a click drops it, `Esc` cancels, `De
selected component or source. It moves in the plane of the table (perpendicular to `rotation_axis`,
at the height of the source of its system) and snaps onto beams while `snap` is on; the first component or source of
an empty view is placed at the origin. `export_changes` writes a glass as `SellmeierEquation(...)` and a constant
refractive index as `λ -> n`; an added source is its constructor at the origin along +y, its
refractive index as `ConstantRefractiveIndex(n)`; an added source is its constructor at the origin along +y, its
`rotate3d!`/`translate_to3d!` and `solve_system!(system, name)`, a removed source of the start a comment.

`kinematic_controls!(ax, hsys; on_change, constraints, rotation_axis, fine_step)` adds the mouse and
Expand Down
2 changes: 1 addition & 1 deletion skills/beamletopticsgui/WIDGETS.md
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ of values next to the box, like the laser lines of the sources) and one
`CatalogGlass(name = "glass"; default = "N-BK7", n = 1.5, keyword)` per refractive index. The default
of a number is in the units of the constructor (SI), the box shows `value / scale` with the `unit`. A
glass is chosen in a menu of the glasses of `catalog_glasses()` and "constant" (a box for the number,
default `n`); the constructor gets the glass as stored there (a `SellmeierEquation`) or `λ -> n`. A
default `n`); the constructor gets the glass as stored there (a `SellmeierEquation`) or `ConstantRefractiveIndex(n)`. A
parameter with `keyword = :name` is passed as that keyword argument, the others positionally in order.
The constructor should be a function or type that a script can call by name, since `export_changes`
prints the call. An entry with `source = true` is a source: its constructor is called as
Expand Down
17 changes: 8 additions & 9 deletions src/API.jl
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ member of `sys2` as well, like "+" of that system in the window. It stays one ob
pose, one card and one set of plots, and the beams of all its systems are traced through it, e.g.
a mirror that the transmitter and the receiver of a lidar share.

`code` is the constructor call of `obj` as Julia code, e.g. `"ThinLens(0.05, -0.05, 0.0254, 1.5)"`,
`code` is the constructor call of `obj` as Julia code, e.g. `"ThinLens(0.05, -0.05, 0.0254, ConstantRefractiveIndex(1.5))"`,
which constructs `obj` in the pose that it has when it is added. [`export_script`](@ref) then writes
this call followed by the change of the pose of `obj` since it was added, like for a component of
the catalog; without `code` the constructor is not known and the script marks where to construct
Expand Down Expand Up @@ -451,7 +451,7 @@ constructor call of the `source` in its current pose, as for a component.
```julia
gui = live_view(System())
add_component!(gui, Beam([0.0, 0, 0], [0.0, 1, 0], 632.8e-9); label = "laser")
lens = ThinLens(50e-3, -50e-3, 25.4e-3, 1.5)
lens = ThinLens(50e-3, -50e-3, 25.4e-3, ConstantRefractiveIndex(1.5))
translate_to3d!(lens, [0, 0.1, 0])
add_component!(gui, lens; label = "lens")
```
Expand Down Expand Up @@ -598,8 +598,7 @@ is chosen at first, or `"constant"`; a name that [`catalog_glasses`](@ref) does
`ArgumentError`. `name` and `keyword` as for [`CatalogParam`](@ref).

The constructor gets the glass as it is stored in [`catalog_glasses`](@ref), e.g. a
`SellmeierEquation`, and for "constant" a function `λ -> n`, which every constructor of
BeamletOptics with a refractive index takes.
`SellmeierEquation`, and for "constant" a `ConstantRefractiveIndex(n)`.
"""
struct CatalogGlass
name::String
Expand Down Expand Up @@ -686,15 +685,15 @@ end
catalog_glasses() -> Vector{Pair{String, Any}}

The glasses that the component catalog of [`live_view`](@ref) offers for the entries with a
[`CatalogGlass`](@ref), as `name => n`, where `n(λ)` is the refractive index at the wavelength `λ`
[m] as BeamletOptics takes it, e.g. a `SellmeierEquation`. The built-in glasses are common optical
[`CatalogGlass`](@ref), as `name => n`, where `n` is a `BeamletOptics.AbstractRefractiveIndex`, e.g.
a `SellmeierEquation`. The built-in glasses are common optical
glasses and crystals with the dispersion formulas of the database refractiveindex.info: N-BK7,
fused silica, CaF2, N-SF11, N-SF10, N-SF6HT, N-SF5, N-F2, N-BAF10 and N-LAK22.

A package adds its glasses to the returned vector; views opened afterwards show them.
[`export_changes`](@ref) prints a `SellmeierEquation` and a `DiscreteRefractiveIndex` as their
constructor call and any other glass via `repr`, hence an own glass should be one of the two or a
named function.
[`export_changes`](@ref) prints a `SellmeierEquation`, a `DiscreteRefractiveIndex` and a
`ConstantRefractiveIndex` as their constructor call and any other glass via `repr`, hence an own
glass should be one of the three or an own subtype whose `repr` is valid code.

```julia
push!(catalog_glasses(), "My glass" => SellmeierEquation(1.04, 0.23, 1.01, 0.006, 0.02, 103.6))
Expand Down
6 changes: 3 additions & 3 deletions src/LiveCatalog.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ _catalog_default(p::CatalogGlass) = p.default == _GLASS_CONSTANT ? p.n : p.defau
"""
The argument of the constructor for the value `v` of the parameter `p`: the number (an `Int` for a
parameter with `integer`), the glass with the name `v` (see `_glass`) or, for a constant refractive
index `v`, the function `λ -> v`.
index `v`, a `ConstantRefractiveIndex`.
"""
_catalog_arg(p::CatalogParam, v::Real) = p.integer ? Int(v) : Float64(v)
_catalog_arg(::CatalogGlass, v::AbstractString) = _glass(v)
_catalog_arg(::CatalogGlass, v::Real) = (n = Float64(v); λ -> n)
_catalog_arg(::CatalogGlass, v::Real) = ConstantRefractiveIndex(Float64(v))

"""The argument of the constructor for the value `v` of the parameter `p` as Julia code, see `_catalog_arg`."""
_catalog_arg_code(p::CatalogParam, v::Real) = repr(_catalog_arg(p, v))
_catalog_arg_code(::CatalogGlass, v::AbstractString) = _glass_code(_glass(v))
_catalog_arg_code(::CatalogGlass, v::Real) = "λ -> $(repr(Float64(v)))"
_catalog_arg_code(p::CatalogGlass, v::Real) = _glass_code(_catalog_arg(p, v))

"""
_catalog_args([f,] entry, values) -> (positional, keywords)
Expand Down
5 changes: 3 additions & 2 deletions src/LiveGlasses.jl
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,11 @@ end
_glass_code(n) -> String

The glass `n` as Julia code for [`export_changes`](@ref), which runs without this package: the call
of the constructor of a `SellmeierEquation` and of a `DiscreteRefractiveIndex`, `repr` otherwise,
e.g. the name of a function.
of the constructor of a `SellmeierEquation`, a `DiscreteRefractiveIndex` and a
`ConstantRefractiveIndex`, `repr` otherwise.
"""
_glass_code(n) = repr(n)
_glass_code(n::BMO.ConstantRefractiveIndex) = "ConstantRefractiveIndex($(repr(n.n)))"
_glass_code(n::BMO.SellmeierEquation) =
"SellmeierEquation(" * join(repr.((n.B1, n.B2, n.B3, n.C1, n.C2, n.C3)), ", ") * ")"
function _glass_code(n::BMO.DiscreteRefractiveIndex)
Expand Down
8 changes: 4 additions & 4 deletions test/TestLiveCardRows.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ const GUI = BeamletOpticsGUI
end

@testset "lens, beamsplitters, polarizer" begin
lens = SphericalLens(0.05, -0.05, 5e-3, 25.4e-3, 1.5)
lens = SphericalLens(0.05, -0.05, 5e-3, 25.4e-3, ConstantRefractiveIndex(1.5))
translate3d!(lens, [0, 0.05, 0])
bs = RoundThinBeamsplitter(25e-3; reflectance = 0.3)
translate3d!(bs, [0, 0.1, 0])
cube = CubeBeamsplitter(10e-3, λ -> 1.5)
cube = CubeBeamsplitter(10e-3, ConstantRefractiveIndex(1.5))
translate3d!(cube, [0, 0.2, 0])
pol = RoundLinearPolarizer(25e-3, 1e-3, 1e-3, λ -> 1.5)
pol = RoundLinearPolarizer(25e-3, 1e-3, 1e-3, ConstantRefractiveIndex(1.5))
translate3d!(pol, [0, 0.3, 0])
gui = _live_view(System([lens, bs, cube, pol]), Beam([0.0, 0, 0], [0.0, 1, 0], 633e-9))
_select!(gui, lens)
Expand Down Expand Up @@ -343,7 +343,7 @@ const GUI = BeamletOpticsGUI
end

@testset "solve in the background" begin
lens = SphericalLens(0.05, -0.05, 5e-3, 25.4e-3, 1.5)
lens = SphericalLens(0.05, -0.05, 5e-3, 25.4e-3, ConstantRefractiveIndex(1.5))
translate3d!(lens, [0, 0.05, 0])
m, pd = _fixture()
gui = _live_view(System([lens, m, pd]), Beam([0.0, 0, 0], [0.0, 1, 0], 633e-9))
Expand Down
2 changes: 1 addition & 1 deletion test/TestLiveCatalog.jl
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ ray_of(λ::Real) = Beam([0.0, 0, 0], [0.0, 1, 0], λ)
@test filter(b -> b in w.boxes, gui.custom.boxes) == w.boxes
@test length(gui.custom.boxes) == (layout == :app ? 7 : 4)
w.boxes[4].displayed_string[] = "1.7"
@test code() == "ThinLens(0.05, -0.05, 0.012, λ -> 1.7)"
@test code() == "ThinLens(0.05, -0.05, 0.012, ConstantRefractiveIndex(1.7))"
GUI._place_catalog!(gui, GUI._catalog_entry(widget), GUI._catalog_strings(widget))
@test BMO.refractive_index(gui.components.placement.obj, 1e-6) == 1.7
GUI._end_placement!(gui)
Expand Down
6 changes: 3 additions & 3 deletions test/TestLiveCatalogEntries.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const GUI = BeamletOpticsGUI
flat = GUI._catalog_object(entry, constant)
@test nameof(typeof(flat)) === nameof(typeof(obj))
code = GUI._catalog_code(entry, constant)
@test occursin("λ -> 1.6", code) && !occursin("SellmeierEquation", code)
@test occursin("ConstantRefractiveIndex(1.6)", code) && !occursin("SellmeierEquation", code)
@test nameof(typeof(Core.eval(@__MODULE__, Meta.parse(code)))) === nameof(typeof(obj))
end
end
Expand Down Expand Up @@ -183,7 +183,7 @@ const GUI = BeamletOpticsGUI
@test [p.name for p in lens.params] == ["R1", "R2", "diameter", "glass"]
@test _defaults(lens) == [50e-3, -50e-3, 25.4e-3, "N-BK7"]
@test GUI._catalog_code(lens, _defaults(lens)) == "ThinLens(0.05, -0.05, 0.0254, $bk7)"
@test GUI._catalog_code(lens, [50e-3, -50e-3, 25.4e-3, 1.7]) == "ThinLens(0.05, -0.05, 0.0254, λ -> 1.7)"
@test GUI._catalog_code(lens, [50e-3, -50e-3, 25.4e-3, 1.7]) == "ThinLens(0.05, -0.05, 0.0254, ConstantRefractiveIndex(1.7))"
# the glass disperses, a constant refractive index does not
index(obj, λ) = BMO.refractive_index(obj, λ)
for constructor in (ThinLens, GUI._surface_lens, CubeBeamsplitter, RightAnglePrism)
Expand All @@ -209,7 +209,7 @@ const GUI = BeamletOpticsGUI
cube = _entry(entries, CubeBeamsplitter)
@test GUI._catalog_code(cube, _defaults(cube)) == "CubeBeamsplitter(0.0254, $bk7; reflectance = 0.5)"
prism = _entry(entries, RightAnglePrism)
@test GUI._catalog_code(prism, [10e-3, 10e-3, 1.7]) == "RightAnglePrism(0.01, 0.01, λ -> 1.7)"
@test GUI._catalog_code(prism, [10e-3, 10e-3, 1.7]) == "RightAnglePrism(0.01, 0.01, ConstantRefractiveIndex(1.7))"
detector = _entry(entries, Detector)
@test GUI._catalog_code(detector, [5e-3]) == "Detector(0.005)"
# an angle in degrees as a keyword
Expand Down
16 changes: 8 additions & 8 deletions test/TestLiveComponents.jl
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,8 @@ const GUI = BeamletOpticsGUI
@test n == 0 && occursin("# no changes", code)

# a lens of the catalog: constructed, placed, added, then moved
lens = ThinLens(50e-3, -50e-3, 25.4e-3, 1.5)
origin = (; code = "ThinLens(0.05, -0.05, 0.0254, 1.5)", pose0 = GUI._pose(lens))
lens = ThinLens(50e-3, -50e-3, 25.4e-3, ConstantRefractiveIndex(1.5))
origin = (; code = "ThinLens(0.05, -0.05, 0.0254, ConstantRefractiveIndex(1.5))", pose0 = GUI._pose(lens))
rotate3d!(lens, normalize([1.0, 2, 3]), 0.3)
translate_to3d!(lens, [0.01, 0.1, -0.02])
add_component!(gui, lens; origin, label = "lens")
Expand All @@ -419,7 +419,7 @@ const GUI = BeamletOpticsGUI
_key!(gui, Keyboard.left)
code, n = GUI._export_code(gui)
@test n == 1
@test occursin("# lens ($(nameof(typeof(lens)))), added\nlens = ThinLens(0.05, -0.05, 0.0254, 1.5)\n" *
@test occursin("# lens ($(nameof(typeof(lens)))), added\nlens = ThinLens(0.05, -0.05, 0.0254, ConstantRefractiveIndex(1.5))\n" *
"push!(system, lens)\nrotate3d!(lens, [", code)
@test count("translate_to3d!(lens, ", code) == 1
@test !occursin("# no changes", code)
Expand All @@ -431,12 +431,12 @@ const GUI = BeamletOpticsGUI
@test _same_pose(copy, lens)

# in the pose as constructed: no pose lines
lens2 = ThinLens(50e-3, -50e-3, 25.4e-3, 1.5)
lens2 = ThinLens(50e-3, -50e-3, 25.4e-3, ConstantRefractiveIndex(1.5))
add_component!(gui, lens2; label = "lens2", select = false,
origin = (; code = "ThinLens(0.05, -0.05, 0.0254, 1.5)", pose0 = GUI._pose(lens2)))
origin = (; code = "ThinLens(0.05, -0.05, 0.0254, ConstantRefractiveIndex(1.5))", pose0 = GUI._pose(lens2)))
code, n = GUI._export_code(gui)
@test n == 2
@test occursin("lens2 = ThinLens(0.05, -0.05, 0.0254, 1.5)\npush!(system, lens2)\n", code)
@test occursin("lens2 = ThinLens(0.05, -0.05, 0.0254, ConstantRefractiveIndex(1.5))\npush!(system, lens2)\n", code)
@test !occursin("(lens2, [", code)
objs = _run(code)
@test length(objs) == 2 && _same_pose(objs[2], lens2)
Expand Down Expand Up @@ -464,8 +464,8 @@ const GUI = BeamletOpticsGUI
close(gui)

# a group with an origin, moved as a whole before and after it is added
_pair() = ObjectGroup([RoundPlanoMirror(25e-3, 5e-3), SphericalLens(0.05, -0.05, 5e-3, 25.4e-3, 1.5)])
pair_code = "ObjectGroup([RoundPlanoMirror(25e-3, 5e-3), SphericalLens(0.05, -0.05, 5e-3, 25.4e-3, 1.5)])"
_pair() = ObjectGroup([RoundPlanoMirror(25e-3, 5e-3), SphericalLens(0.05, -0.05, 5e-3, 25.4e-3, ConstantRefractiveIndex(1.5))])
pair_code = "ObjectGroup([RoundPlanoMirror(25e-3, 5e-3), SphericalLens(0.05, -0.05, 5e-3, 25.4e-3, ConstantRefractiveIndex(1.5))])"
sys = System()
gui = _live_view(sys => _beam(); fine_step = 1e-3, fine_angle = 1e-2)
g = _pair()
Expand Down
2 changes: 1 addition & 1 deletion test/TestLiveDebugPage.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ GUI._debug_kind(::GUI.LiveView, ::DebugPageBroken) = Any[() -> error("broken row

@testset "rows of a lens, a doublet, a group, a source, a beam group and a detector" begin
m, pd, lens = _fixture()
doublet = SphericalDoubletLens(40e-3, -30e-3, -120e-3, 6e-3, 2.5e-3, 25e-3, _ -> 1.62, _ -> 1.72)
doublet = SphericalDoubletLens(40e-3, -30e-3, -120e-3, 6e-3, 2.5e-3, 25e-3, ConstantRefractiveIndex(1.62), ConstantRefractiveIndex(1.72))
translate3d!(doublet, [0.0, 0.0, 0.1])
l1 = SphericalLens(0.1, -0.1, 4e-3, 25.4e-3)
l2 = SphericalLens(-0.1, 0.1, 2e-3, 25.4e-3)
Expand Down
6 changes: 3 additions & 3 deletions test/TestLiveDebugSpheres.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ const GUI = BeamletOpticsGUI
# groups with a main sphere, in contrast to the group with the mesh
function _setup()
lens = _lens(0.05)
doublet = SphericalDoubletLens(0.1, -0.08, -0.2, 6e-3, 3e-3, 0.02, 1.6, 1.7)
doublet = SphericalDoubletLens(0.1, -0.08, -0.2, 6e-3, 3e-3, 0.02, ConstantRefractiveIndex(1.6), ConstantRefractiveIndex(1.7))
translate3d!(doublet, [0, 0.1, 0])
cube = CubeBeamsplitter(0.02, 1.5)
cube = CubeBeamsplitter(0.02, ConstantRefractiveIndex(1.5))
translate3d!(cube, [0, 0.15, 0])
inner = _lens(0.2)
dummy = BMO.NonInteractableObject(BMO.CubeMesh(0.01))
Expand Down Expand Up @@ -333,7 +333,7 @@ const GUI = BeamletOpticsGUI

# added while the mode is off: drawn when it is switched on
GUI._set_debug!(gui, false)
cube = CubeBeamsplitter(0.02, 1.5)
cube = CubeBeamsplitter(0.02, ConstantRefractiveIndex(1.5))
translate3d!(cube, [0.1, 0.1, 0])
add_component!(gui, cube)
GUI._debug_attached!(gui, cube)
Expand Down
2 changes: 1 addition & 1 deletion test/TestLiveEdit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ const GUI = BeamletOpticsGUI
newer = only(sys.objects)
@test newer !== new
@test gui.components.origin[newer].strings[4] == "1.7"
@test occursin("λ -> 1.7", gui.components.origin[newer].code)
@test occursin("ConstantRefractiveIndex(1.7)", gui.components.origin[newer].code)
close(gui)
end

Expand Down
2 changes: 1 addition & 1 deletion test/TestLiveExportScript.jl
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ const GUI = BeamletOpticsGUI
@testset "objects added with their code" begin
gui = _live_view(System())
# built in code, e.g. by an agent: added in the pose of its code, moved afterwards
lens_code = "SphericalLens(0.05, -0.05, 0.005, 0.0254, 1.5)"
lens_code = "SphericalLens(0.05, -0.05, 0.005, 0.0254, ConstantRefractiveIndex(1.5))"
lens = add_component!(gui, include_string(@__MODULE__, lens_code); code = lens_code,
label = "lens", select = false)
laser_code = "GaussianBeamlet([0.0, -0.05, 0.0], [0.0, 1.0, 0.0], 1.064e-6, 0.001)"
Expand Down
Loading
Loading