[HN Gopher] Opticsim.jl: Optical Simulation Software
       ___________________________________________________________________
        
       Opticsim.jl: Optical Simulation Software
        
       Author : newswasboring
       Score  : 148 points
       Date   : 2021-03-22 08:32 UTC (14 hours ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | spicybright wrote:
       | I have no idea what optical simulation means. Is it like a
       | raytracer that acts more like a simulation of an eye?
        
         | qart wrote:
         | Not my domain, but there are a lot of graphical examples here:
         | https://microsoft.github.io/OpticSim.jl/dev/examples/
         | 
         | Looks like a modeling toolkit for lenses, telescopes, etc.
         | 
         | Most real systems of that sort suffer from artefacts like
         | chromatic abberation, diffraction, etc. I wonder if such
         | software can be used for modeling those things too.
        
         | photonic54 wrote:
         | We do optical simulation to understand the behavior of optical
         | systems, along input and output parameters that matter to the
         | goals of the system.
         | 
         | Suppose you want to make a telescope with a certain spec for
         | magnification and resolution.
         | 
         | Or, suppose you wish to design a headlight for a car with
         | bright and even illumination over a given angular range.
         | 
         | Or, imagine you need to specify an interferometer for precision
         | displacement measurement at the nanometer level.
         | 
         | For each of these systems, there are first principles equations
         | and approximations that describe ideal and slightly-different-
         | from-ideal behavior, but for anything other than very simple
         | optical systems, these first principles approaches become
         | unwieldy very fast. An optical simulation represents the
         | physics of the design and approximates the output you would
         | measure when you build the system. This allows you to optimize
         | and perturb the design over manufacturing tolerances at the
         | design stage, rather than iterating through these at the
         | manufacturing stage (a rather impractical alternative).
         | 
         | The capability of any simulation approach depends on the
         | phenomenon you need to model, and the degree of abstraction
         | appropriate to that phenomenon.
         | 
         | An "exact" physical representation of an optical system
         | essentially entails solving Maxwell's equations along the
         | initial and boundary conditions of the optical system. There
         | are times when this is both necessary and practical, but
         | (outside of semiconductor applications) that tends to be rare.
         | 
         | Ray tracing, which you mentioned, is a very popular and useful
         | approximation for imaging and illumination. It's especially
         | useful when the wave properties of light are either not very
         | relevant or they are very well behaved. Other simulation
         | techniques incorporate more of the wave nature of light:
         | Fourier techniques, field tracing, coupled waves, finite
         | difference time domain, etc. It takes some domain knowledge in
         | the application space to know which to apply.
        
       | the_only_law wrote:
       | I've been wanting to get into optics, but have no ideas where to
       | start. I imagine it starts with the typical engineering math, but
       | where from there?
        
         | cornellwright wrote:
         | Optics by Eugene Hecht is a fantastic reference to start with.
         | It's a bit expensive, but you can find used copies if you look
         | around a little bit.
        
         | myself248 wrote:
         | I don't work in the field, but I've found this material to be
         | informative: https://www.visiononline.org/certified-vision-
         | professional-b...
        
         | buescher wrote:
         | What do you want to do with optics?
        
           | the_only_law wrote:
           | Mostly learn about and play with lasers and lens design for
           | those lasers.
        
             | buescher wrote:
             | Again, though, what do you want to do with lasers? What do
             | you want a lens for a laser to do?
             | 
             | Holography makes a great hobby project, by the way, and you
             | can get started with a laser pointer (or equivalent) as
             | your laser.
        
       | imvetri wrote:
       | been waiting for something like this, let me go and look at the
       | project to see if that's something I wanted.
       | 
       | Basically looking for something to build neural networks based on
       | optical computing or at the least, some sensor simulator that
       | responds to light.
       | 
       | after looking at the docs.
       | 
       | Damn, it has eye model. Something that bridges a gap in my notes
       | - https://github.com/imvetri/artificial-
       | intelligence/blob/mast....
       | 
       | next, wait with patience for a neuron simulator(which is already
       | there, just want to see it in the newsfeed).
       | 
       | Eye model and a neuron simulator will help to build a self
       | learning system.
        
       | joeberon wrote:
       | I'm confused about what this does.
       | 
       | Is it time domain or frequency domain?
       | 
       | Is it compatible with a FINESSE style description of the setup?
       | 
       | Does it have higher order mode analysis?
       | 
       | Can you add signals to modulate mirrors?
       | 
       | Can you propagate quantum noise through the system?
        
         | notretarded wrote:
         | Yes
        
       | teruakohatu wrote:
       | I didn't know Microsoft was using Julia for any research. Does
       | anyone know to what extent MSFT researchers are using it?
        
         | WanderPanda wrote:
         | I don't know to what "extent" they use it, but I'm sure they
         | are big on "extend"
        
         | johnnycerberus wrote:
         | Judging by the number of contributors, only 2 people are
         | contributing to that project. It could be that other teams
         | don't have their work open-sourced.
        
       | snystrom wrote:
       | I have literally no skin in the game here, but here's another
       | interesting group that totally bailed on a similar project
       | because I guess they hated Julia so much. Good to see something
       | else crop up.
       | 
       | github.com/JuliaOptics/About
        
         | etik wrote:
         | Ah, that's too bad, but I can't really blame them. Going from a
         | fully-featured Python codebase they already had in
         | https://github.com/brandondube/prysm and translating into Julia
         | would need to be motivated by much more than speed - after all
         | the limiting factor here is FFT and heavy computations like
         | cis, so I'm pleasantly surprised they reported gains from their
         | simple port compared to numpy. It's also much easier to go from
         | a C/C++ computational code to Julia than it is from a Python
         | one, because the mental performance models are more similar.
         | 
         | For reference, we (metalenz.com) have a large Julia codebase
         | centered around optical design, simulation, and analysis. The
         | motivation for that is more along the lines of composability
         | and clarity of abstractions (aided by multiple-dispatch). We
         | can differentiate through our physical optics solver code
         | (forward or reverse) for optimization/ML, plug in our designs
         | across a hierarchy of different E&M solvers, run on GPU, and
         | write very efficient code when our profiling identifies a
         | bottleneck. If we just had to perform one thing (physical
         | optics simulations), then our investment wouldn't be as
         | justified.
        
         | ruph123 wrote:
         | Interesting! This really speaks to me. In my opinion your
         | language can have the most foreign concepts or unusual ways how
         | you should optimize code.
         | 
         | But only if it is well documented. And that is really the
         | problem with Julia. Besides some video tutorials, which I don't
         | find helpful, you only have the manual which is not that good.
         | 
         | I said this before here but if you look at Rust which has
         | unique characteristics like the borrow checker and is often
         | described as having a steep learning curve: I was never
         | overwhelmed by it or even felt it was difficult because there
         | is much high-quality material to help you: The amazing book,
         | rust by example and a lot of great third party resources like
         | cheats.rs or the "rust in simple language".
         | 
         | The other day I was trying to look for julia books. Most of
         | them were outdated and people advised against buying them (or
         | the publisher pulled them already).
        
           | cbkeller wrote:
           | I think people often underestimate (or just plain don't know
           | about) the degree to which a multiple-dispatch-based
           | programming language like Julia effectively implies its whole
           | own dispatch-oriented programming paradigm, with both some
           | amazing advantages (composability [1], and an IMO excellent
           | balance of speed and interactivity when combined with JAOT
           | compilation), but also some entirely new pitfalls to watch
           | out for (particularly, _type-instability_ [2,3]). Meanwhile,
           | some habits and code patterns that may be seen as  "best
           | practices" in Python, Matlab can be detrimental and lead to
           | excess allocations in Julia [4], so it may almost be easier
           | to switch to Julia (and get good performance from day 1) if
           | you are coming from a language like C where you are used to
           | thinking about allocations, in-place methods, and loops being
           | fast.
           | 
           | Things are definitely stabilizing a bit post-1.0, but it's
           | still a young language, so it'll take a while for
           | documentation to fully catch up; in the meanwhile, the best
           | option in my experience has been to lurk the various chat
           | forums (slack/zulip/etc. [5]) and pick up best-practices from
           | the folks on the cutting edge by osmosis.
           | 
           | [1] https://www.youtube.com/watch?v=kc9HwsxE1OY
           | 
           | [2] https://www.johnmyleswhite.com/notebook/2013/12/06/writin
           | g-t...
           | 
           | [3] https://docs.julialang.org/en/v1.5/manual/performance-
           | tips/#...
           | 
           | [4] https://github.com/brenhinkeller/JuliaAdviceForMatlabProg
           | ram...
           | 
           | [5] https://julialang.org/community/#official_channels
        
           | queuebert wrote:
           | As an avid Rust and Julia user, I often use Rust even when
           | it's harder because I know I'll never get stuck. And when it
           | finally compiles I'll be rewarded by ludicrous speed.
           | 
           | Hell, even C has decent man pages for the standard library.
           | 
           | Although in Julia's defense (or is it?), they've changed the
           | language a lot over the versions from 0.4 to 1.5, so maybe
           | it's hard to keep docs up to date.
        
             | adgjlsfhk1 wrote:
             | The language has been pretty stable (no breaking changes)
             | since 1.0. The bigger issue is that unlike many of the
             | other newer programming languages (Go, Rust, Swift etc)
             | Julia doesn't have a fortune 500 company sponsoring it, so
             | there aren't any people who's job is documentation. It's
             | all open-source. Hopefully this is fixable through Google
             | Summer of Docs and/or the community sponsoring people to
             | work on this.
        
               | queuebert wrote:
               | What does Julia Computing do?
        
               | cbkeller wrote:
               | They do what they can, including things like [1] recently
               | discussed here, but they're not exactly a Fortune-500
               | company yet.
               | 
               | [1] https://news.ycombinator.com/item?id=26425659
        
         | markkitti wrote:
         | The last time I talked to him he was trying to write his own
         | discrete Fourier transform so he could avoid shifting around
         | his matrix.
         | 
         | https://github.com/JuliaOptics/Fourier.jl
        
       | Jenz wrote:
       | The quality of Julias ecosystem continues to surprise me.
       | 
       | See also:
       | 
       | - https://diffeq.sciml.ai/stable/
       | 
       | - https://juliadynamics.github.io/DynamicalSystems.jl/latest/
       | 
       | - https://clima.github.io/OceananigansDocumentation/stable/
       | 
       | etc
        
         | phonebucket wrote:
         | Just continuing on with this list a little bit more:
         | 
         | - https://fluxml.ai/Flux.jl/stable/
         | 
         | - https://turing.ml/stable/
         | 
         | Later in the year we should see https://mtk.sciml.ai/stable/
         | maturing somewhat, which is a chunky project unlocking a lot
         | modularity for scientific computing.
         | 
         | I feel like the language is reaching an inflection point with
         | regards to the ecosystem richness.
        
       | cycomanic wrote:
       | This is interesting zemax costs ~$5k, if you want up to date
       | material and part catalogues that's a yearly fee. I wonder if MS
       | also keeps those catalogues up to date. This seems to largely be
       | the selling arguments of the commercial offerings.
        
         | analog31 wrote:
         | I'm a long time Zemax user. The subscription is just a cost of
         | doing business for my employer.
         | 
         | It's cheap compared to hiring an optics consultant. ;-)
         | 
         | But this is pretty common for specialized engineering software.
         | My company maintains several seats of mechanical and electrical
         | CAD software. Not surprisingly, the landscape of FOSS tools
         | gets more and more sparse, the further you get away from
         | software development.
         | 
         | A problem in optics is that just having the software won't
         | teach you optics unless you're already trained in an adjacent
         | field such as physics. The people who can do it, can simply
         | demand that the employer pay for the software.
         | 
         | Oddly enough I'm interested in this package, and have
         | bookmarked it. It's not like I need an alternative to Zemax,
         | but that there are some ideas I'd like to explore that would
         | benefit from further automation, but that don't need the
         | breadth of features provided by Zemax. And maybe I'd like to
         | try some things at home.
        
       | neolog wrote:
       | What is "Microsoft HART group"?
        
         | cinntaile wrote:
         | This is just a guess but maybe it stands for Holographic
         | Augmented Reality Technologies?
        
           | Flex247A wrote:
           | As A Service ;)
        
       ___________________________________________________________________
       (page generated 2021-03-22 23:02 UTC)