The documentation for OpticSim.jl says that I should “Run this example to check that everything installed properly”. The example produces the following for me:
julia> using OpticSim
julia> Vis.draw(SphericalLens(OpticSim.GlassCat.SCHOTT.N_BK7, 0.0, 10.0, 10.0, 5.0, 5.0))
ERROR: UndefVarError: SCHOTT not defined
Stacktrace:
[1] getproperty(x::Module, f::Symbol)
@ Base ./Base.jl:31
[2] top-level scope
@ REPL[5]:1
System information:
julia> using Pkg
julia> Pkg.status("OpticSim")
Status `~/.julia/environments/v1.8/Project.toml`
[24114763] OpticSim v0.6.0 `https://github.com/brianguenter/OpticSim.jl#main`
Use Examples.Examples_N_BK7 instead of Schott. When that documentation was written we were using Schott glasses for many examples. But Schott kept changing the location of their glass catalog on their website which made it impossible to automatically download. That caused the examples to fail unpredictably.
Instead of using Schott glasses we switched to locally defined glass files. You can find them in the Examples module.
Most of the examples were rewritten to use locally defined glasses instead of Schott but we missed that one.
The repo has been updated with this fix to the documentation.
With your quick answer, the project seems supported (as documented; i.e. only by answering here question on discourse). I do see in the docs:
OpticSim.jl is optimized for use with Julia 1.7.x; using other versions will probably not work.
Julia 1.7 is no longer supported, so I take that as 1.8+ should work… but not older.
Off-topic:
I don’t know much about Microsoft’s three Julia packages/repos (two active): Microsoft · GitHub
except that they archived that repo, and it moved to your personal github. I was very intrigued to see your/Microsoft’s project at the time (that they were supporting Julia), your package seems substantial and impressive, as is this new one: GitHub - microsoft/MPNODE.jl (depending on e.g. RobotDynamics.jl):
The use of modeling and simulation in engineering is well recognized as a viable method to build surrogates for real-world systems. […] Simulation also plays a key role in AI […] A large amount of literature on data-driven simulations has explored the idea of building simulations through graph neural networks, such as the method in Learning to Simulate Complex Physics with Graph Networks. […] such approaches lack generalizability.
Given the inherent modularity of several real-life systems, we propose a method which places focus on individual nodes instead of the full graph. Our approach uses Neural Ordinary Differential Equations (NODE) to model a single dynamic entity.
From linked DeepMind/Google/Stanford paper:
Our framework—which we term “GraphNetwork-based Simulators” (GNS)
[…] Our GNS framework advances the state-of-the-art in learned physical simulation, and holds promise for solving a wide range of complex forward and inverse problems.
Nice! Thanks for the fix, and explanaition, I will test that the next time I work on that subject. Much appreciated.
I am taking an a course called “optical system engineering”, where it seems we will use Zemax’s Optics Studio (ZOS). It is explicitly not a course in ZOS, but it was clear that it will play a central role. I am running Linux, but have ZOS running in my virtual windows machine. I started looking into this package as a free and native linux alternative (I am a sucker for free and open source).
Is this a path worth investigating do you think? OpticSim as an alternative to follow along a class that uses ZOS?
I’ve worked with many optical engineers over the years and most of them have eventually encountered a problem that was better addressed by writing a program than using the Zemax UI. For these applications OpticSim could be better than Zemax.
We created OpticSim for just such a problem, designing multi-lens optics for head mounted displays. We found it difficult to use Zemax to create and simulate the complex systems we were developing.
The Zemax UI was not a practical way to specify and model these systems with hundreds or thousands of lenses, most of which used off axis freeform elements. It was much easier to write a program than to model them interactively. Julia was a better language for this purpose than the Zemax scripting language: Julia is more powerful, has better IDE support in the form of VSCode, executes more quickly, and is easier to debug.
OpticSim is also much faster than Zemax at non-sequential ray tracing of complex optical systems created with CSG operations. This was critical for our scattered light analyses.
However, Zemax has strong optimization features; OpticSim has limited support for optimization. We may improve OpticSim optimization but there are no firm plans to do so.
@TheLateKronos Create an issue on the OpticSim repo for the size error in Makie. I’ll get around to it. Makie changes frequently; this is probably a backward incompatibility problem because we updated to a newer version of Makie than we should have.