Skip to content

v0.14.0

Latest

Choose a tag to compare

@github-actions github-actions released this 05 Nov 23:13
· 8 commits to master since this release
34c0370

BeamletOptics v0.14.0

Diff since v0.13.13

Breaking changes

  • Refractive indices are AbstractRefractiveIndex values. Every constructor that takes a refractive index (lenses, prisms, plate and cube beamsplitters, compensator plates, polarizers) throws a MethodError for a number or a function such as λ -> 1.5. Write ConstantRefractiveIndex(1.5), or use SellmeierEquation or DiscreteRefractiveIndex. For your own dispersion formula, define struct MyGlass <: BeamletOptics.AbstractRefractiveIndex end and (::MyGlass)(λ) = ....
  • BeamletOptics.RefractiveIndex is removed. Use BeamletOptics.AbstractRefractiveIndex as the type bound of a refractive index.
  • Detector readouts take a sampling instead of keywords. intensity(pd; n = 200, crop_factor = 5, x_min = a, x_max = b) becomes intensity(pd, RegularGrid(num_points = 200, crop_factor = 5, x_min = a, x_max = b)), and the same holds for electric_field and optical_power. Use RectilinearGrid(xs, zs) for your own axes. The keyword num_spots is gone, and a single bound such as x_min now applies on its own.
  • intensity(pd, Z) no longer takes a wave impedance. Write intensity(pd), which uses the refractive index of the hits.
  • electric_field(pd) of AstigmaticGaussianBeamlet hits returns 3D field vectors, as for PolarizedRay hits. Write sum.(abs2, E) instead of abs2.(E), or use intensity(pd).
  • solve_system! has no keyword retrace, and BeamletOptics.retrace_system! is removed. Every solve traces the beam from its start, so empty!(beam) before solving again is no longer needed. Child beams are new objects after each solve: read them again after every solve.
  • set_num_rays! is renamed num_rays!.
  • properties and default_properties are no longer exported and only accept objects, beams and groups. Write BeamletOptics.properties(x).
  • MeshDummy(path) is removed: write NonInteractableObject(path). The deprecated ConcaveSphericalMirror is removed: write SphericalMirror.
  • get_sdf_inside_step and the preference sdf_inside_step are removed without a replacement, since rays inside a shape now leave at its first exit. Delete the call.
  • BeamletOptics.hit_count(detector) is removed. Write length(detector).
  • BeamletOptics.beamlet_hit_field(hit, p) is removed. Write electric_field(hit, p), which returns a 3D vector for an AstigmaticGaussianBeamletHit.
  • BeamletOptics.AbstractSampling is renamed BeamletOptics.AbstractSourceSampling.
  • BeamletOptics.is_static(x) is removed. Write BeamletOptics.kinematic_trait_of(x) isa BeamletOptics.Static.
  • BeamletOptics.render_children(h) is removed. Write BeamletOptics.children(h), and define BeamletOptics.children for your own system render handles.
  • GaussianBeamletHit and AstigmaticGaussianBeamletHit store values and no longer refer to their beamlet: hit.gauss, hit.agb, hit.id and position(hit) are gone. Keep the beamlet yourself, and read a hit with direction(hit) and BeamletOptics.wavelength(hit).
  • WavefrontBeamletDecomposition and GaussianModeDecomposition take the position of the grid before dir, e.g. WavefrontBeamletDecomposition(x, y, amplitude, phase, pos, dir, λ). The keyword origin is gone. Pass zeros(3) for the previous placement.
  • GaussianBeamletDecomposition throws an ArgumentError if its beamlets are not narrower than the beam, i.e. for n_grid ≤ 4 with the default overlap. Use a larger n_grid.
  • GaussianBeamlet throws an ArgumentError for a support vector that is not orthogonal to the direction. Before, it built a wrong waist. Pass a vector normal to dir.
  • ObjectGroup is no longer an AbstractObject. A Vector{AbstractObject} cannot hold a group, methods typed ::AbstractObject do not receive groups, and BeamletOptics.shape(group) is gone. Write [lens, group] and BeamletOptics.objects(group). The type has one parameter: ObjectGroup{T}.
  • Moving a group or composite object whose parts share a shape, e.g. a DoubletLens together with its own front lens, throws an ArgumentError before anything moves. Before, the shared shape moved twice. Add each part to a group only once.
  • The field orientation of CollimatedSource, PointSource and AstigmaticBeamGroup is renamed dir. Read orientation(source). Your own AbstractBeamGroup types rename the field or define orientation and orientation!.
  • The OpticsBase extension loads with using OpticsBase. Remove the include(... "BeamletOpticsOpticsBaseExt.jl") line from the previous docs.
  • BeamletOptics.kinematic_trait_of throws for a type without a method instead of returning Static(). Declare it for your own types that use the kinematic verbs.
  • Your own AbstractSystem types must define BeamletOptics.objects(system), which every solve calls.
  • Your own AbstractObjectGroup types are no longer AbstractObjects. They are mutable structs with the fields objects, center::Point3{T} and dir::SMatrix{3,3,T,9}.
  • BeamletOptics.children! throws for a beam that already has children. Use BeamletOptics.relaunch! to replace them.
  • Your own AbstractDetector types are emptied by every move and by initialize!. Define Base.empty! for them.
  • BeamletOptics.thickness of a UnionSDF or DifferenceSDF counts every operand and throws for an operand without a thickness method. Define BeamletOptics.thickness for your own SDFs.
  • z0 of AstigmaticGaussianBeamlet is the offset of the waist from position, as for GaussianBeamlet. Before, the whole beamlet started at position + z0 * direction. For the previous beam, start at position + z0 * direction and pass z0_x - z0 and z0_y - z0.
  • A GaussianBeamlet stops tracing with a warning where its Lagrange invariant leaves get_lagrange_tolerance() (default 50 %) of its start value, e.g. behind a strong ball lens. Pass check_invariant = false to solve_system! to trace on as before.
  • The Lagrange check of AstigmaticGaussianBeamlet is relative to its start value within get_lagrange_tolerance(), so beamlets with M2 > 4 are no longer stopped, and threshold limits only the complex invariant. Change the limit with set_lagrange_tolerance! and restart Julia.
  • Moving a detector, also as part of a group, empties it. Read it out before moving it, or move it and solve again.
  • A detector without hits reads as zero field, intensity and power and as an empty spot diagram instead of throwing. Test length(pd) == 0 instead of catching the error.
  • intensity and optical_power of a detector are the flux through it, and electric_field is no longer projected. On a tilted detector, the intensity of rays scales with cos θ instead of cos² θ, that of polarized rays with cos θ instead of 1, and the field of beamlets is larger by 1/√cos θ. optical_power is the beam power at any angle of incidence.
  • The default window of GaussianBeamlet hits spans 3 beam radii instead of 1.5, and beamlet windows widen with 1/cos θ on a tilted detector, so default maps are wider and coarser. Pass RegularGrid(crop_factor = 1.5) for the previous window.
  • gauss_parameters(::GaussianBeamlet, z) returns as ψ the Gouy phase collected from the start of the beam, continuous at every surface. Before, it was relative to the local waist. gauss_parameters(gauss, z, 0) gives the previous value.
  • Beamlet sources carry P0 as their total power. CollimatedGaussianBeamletSource has a new keyword P0 (1 mW for the whole source; before, 1 mW per beamlet). SphericalGaussianBeamletSource, EllipticalGaussianBeamletSource and GaussianBeamletDecomposition no longer emit about 30 P0 and 0.95 P0 respectively. Their E0 sets only the polarization and phase.
  • num_rings of EllipticalGaussianBeamletSource counts the center as a ring, like the other sources. Pass num_rings + 1 for the previous rings.
  • Ring sources give each ring a number of rays in proportion to its area, so the edge ring of CollimatedSource, PointSource and the beamlet cone sources gets fewer rays. The first ray of UniformDiscSource and UniformPointSource is the center ray on the axis.
  • Invalid arguments of sources and num_rays! throw an ArgumentError instead of an ErrorException.
  • Beamsplitter coatings and polarizer films are drawn in saturated colors in both looks. Pass color and alpha to render! to change them.
  • Live beam plots hold one color per vertex. Set the color with BeamletOptics.render_settings!(h; color = ...) instead of on the plot. BeamletOptics.render_settings(h) includes color.

Features

  • Detector readouts on RegularGrid, RectilinearGrid or your own samplings (BeamletOptics.AbstractDetectorSampling); ray_hits gives the directions of the rays on a detector
  • UniformLineSource and UniformFanSource; path_segments lists a traced beam tree as flat segments
  • Prism(vertices, height, n) for convex polygons, EquilateralPrism, DovePrism, surface-based DoubletLens and TripletLens, NonInteractableObject(path) for mesh files
  • push!, delete!, pop! and popat! for ObjectGroup; your own assembly types via BeamletOptics.AbstractObjectGroup; initialize! and solve_system!(...; initialize = true) empty the detectors
  • The OpticsBase extension is declared and loads with using OpticsBase; PlaneField of beamlet hits
  • Rendering: color = :wavelength, wavelength_color(λ), show_bounding_sphere = true
  • Faster solves: bounding sphere pretest, aspheres about twice as fast, balanced threads for beam groups

Bugfixes

  • GaussianBeamlet: waist radius at tilted waists and for large M2, Gouy phase behind lenses, phase and field in media
  • AstigmaticGaussianBeamlet: field follows polarizers and Fresnel losses, children continue their parent, no Gouy phase jump at mirrors, power for M2 > 1 and twisted beams, rayleigh_range works
  • Detectors: orthogonally polarized beamlets no longer interfere, stored hits no longer change when a beam is solved again, beamlets pass a detector with stop = false
  • Rays inside lenses and mirrors leave at the first exit (off by up to 33 mm in menisci and concave lenses); mesh faces smaller than 30 µm are hit
  • Plate beamsplitters transmit the correct field of polarized rays and astigmatic beamlets; a convex ParabolicMirror has its full substrate
  • align3d! no longer ignores rotations below 0.17 mrad; shared parts of groups move once; ForwardDiff derivatives are correct for rays on the optical axis

Merged pull requests:

  • docs: drop citation workaround, require DocumenterVitepress 0.3.7 (#101) (@StackEnjoyer)
  • Saturated coatings in CAD and Modern look (#103) (@StackEnjoyer)
  • Feature: polygon prisms, EquilateralPrism, DovePrism (#105) (@TacHawkes)
  • Feature: path_segments, a traced beam tree as flat segments (#106) (@TacHawkes)
  • Add wavelength_color and color = :wavelength for beam rendering (#109) (@TacHawkes)
  • Feature: remove retracing, SDF miss exit (#111) (@StackEnjoyer)
  • Feature: bounding spheres for shapes, render_bounding_sphere! (#112) (@StackEnjoyer)
  • Fix align3d dropping rotations below ~0.17 mrad and wrong antiparallel case (#115) (@TacHawkes)
  • Feature: UniformLineSource, UniformFanSource, center ray (#116) (@StackEnjoyer)
  • Feature: NonInteractableObject(loadpath), MeshDummy deprecated (#117) (@StackEnjoyer)
  • Feature: surface-based DoubletLens and TripletLens constructors (#119) (@StackEnjoyer)
  • Feature: initialize!, keyword initialize of solve_system! (#120) (@StackEnjoyer)
  • Feature: OpticsBase extension loads with using OpticsBase (#122) (@StackEnjoyer)
  • CompatHelper: bump compat for BeamletOptics to 0.13 for package test, (keep existing compat) (#129) (@github-actions[bot])
  • CompatHelper: bump compat for BeamletOptics to 0.13 for package docs, (keep existing compat) (#130) (@github-actions[bot])
  • Fix 90° Gouy phase jump of AstigmaticGaussianBeamlet at mirrors (#128) (#131) (@TacHawkes)
  • Bugfix: optical_power 0.5 % low for a GaussianBeamlet (#132) (@StackEnjoyer)
  • Bugfix: GaussianBeamlet phase in media and behind lenses (#133) (@StackEnjoyer)
  • Bugfix: field amplitude of astigmatic beamlets (#134) (@StackEnjoyer)
  • Feature: ObjectGroup is a container, no AbstractObject (#135) (@StackEnjoyer)
  • Speed up the aspheric SDFs: Horner sums, cached edge values (#137) (@TacHawkes)
  • Collect the detector hits of a beam group per task (#140) (@TacHawkes)
  • Möller-Trumbore: test for parallel rays relative to the face size (#143) (@TacHawkes)
  • SDF ray marching: rays inside leave at the first exit (#144) (@TacHawkes)
  • Beam(pos, dir, λ, E0) with a complex field vector (#146) (@TacHawkes)
  • Fix AD on optical axis (#148) (@TacHawkes)
  • Internal: docs build again, nolebase plugin pinned to 2.18.x (#150) (@StackEnjoyer)
  • Ring sampling of sources: every ray represents the same area (#153) (@TacHawkes)
  • Fix/beamlet source normalization (#154) (@TacHawkes)
  • Tests: validation against analytic references (#156) (@TacHawkes)
  • Beamlet sources: P0 for CollimatedGaussianBeamletSource, E0 only polarization, consistent num_rings (#158) (@TacHawkes)
  • Feature: detector field of astigmatic beamlets as a 3D vector, Poynthing flux definition (#161) (@TacHawkes)
  • Feature: detector hits as values, moving a detector empties it (#164) (@StackEnjoyer)
  • Feature: detector samplings RegularGrid and RectilinearGrid (#171) (@StackEnjoyer)
  • Fix: SDF hits from outside are refined to the root of the SDF (#174) (@TacHawkes)
  • Bugfix: fields and powers of beamlets in a medium (#175) (@TacHawkes)
  • Feature: objects can be added to and removed from an ObjectGroup (#183) (@StackEnjoyer)
  • Bugfix: shared parts move once per kinematic motion (#187) (@StackEnjoyer)
  • Feature: core API of 0.14 follows the style guide (#193) (@StackEnjoyer)
  • Internal: style G1, core abstractions and kinematics (#194) (@StackEnjoyer)
  • Feature: generic beam contract, rays for every beam (#195) (@StackEnjoyer)
  • Feature: get_sdf_miss_distance, thickness of every SDF (#196) (@StackEnjoyer)
  • Internal: style G4, optical components (#197) (@StackEnjoyer)
  • Internal: style G5, detectors (#198) (@StackEnjoyer)
  • Internal: style G6, sources and beamlet decompositions (#199) (@StackEnjoyer)
  • Internal: style G7/G8, rendering (#200) (@StackEnjoyer)
  • Internal: OffAxisConicMirror takes its y-range from axial_extent (#201) (@StackEnjoyer)
  • Feature: PlaneField of beamlet hits, style G9 OpticsBase interop (#202) (@StackEnjoyer)
  • Docs: code style and agent workflow in AGENTS.md (#203) (@StackEnjoyer)
  • Docs: even aspheric coefficients start with A2 (r²), not A4 (#205) (@StackEnjoyer)
  • Bugfix: astigmatic beamlet z0, power for any M2, model limit (#206) (@StackEnjoyer)
  • Feature: empty detector readout improvement, ray_hits (#211) (@StackEnjoyer)
  • Bugfix: GaussianBeamlet w0 for tilted axes and M2, model limit (#212) (@StackEnjoyer)
  • Feature: AbstractRefractiveIndex, ConstantRefractiveIndex (#213) (@StackEnjoyer)
  • Bugfix: beamlets pass a Detector with stop = false (#214) (@StackEnjoyer)
  • Docs: Basics show usage, internals move to API design (#218) (@StackEnjoyer)
  • Bugfix: install_agent_skill works on network drives (#220) (@StackEnjoyer)

Closed issues:

  • Initialize objects when solving system (#38)
  • Bug: Detector hits change when their beam is solved again (#42)
  • Add docs to shape getter about multi-references (#46)
  • Docs: small follow-ups after the VitePress overhaul (#84) (#88)
  • Line beam sources (#91)
  • Rename MeshDummy constructor (#93)
  • GaussianBeamlet: validate that support is orthogonal to direction (#100)
  • Surface-based constructor for aspherical Doublets/Triplets (#118)
  • Bug: Detector ignores polarizers for astigmatic beamlets (#123)
  • Bug: Astigmatic beamlet gains power behind lens and splitter (#124)
  • Bug: GaussianBeamlet restarts the Gouy phase behind a lens (#125)
  • Bug: GaussianBeamlet phase is wrong in and before a medium (#126)
  • Bug: optical_power is 0.5 % low for a GaussianBeamlet (#127)
  • Bug: Astigmatic beamlet phase turns by 90° at every mirror (#128)
  • Aspheric SDFs re-evaluate constant edge values on every distance call (#136)
  • Solving a beam group gets slower with more threads when beams hit a detector (#139)
  • Mesh faces smaller than ~30 µm are never hit (#141)
  • Rays inside an SDF shape can leave at the wrong point (#142)
  • Beam(pos, dir, λ, E0) fails for a complex field vector (#145)
  • ForwardDiff gives wrong derivatives for rays on the optical axis (#147)
  • Internal: docs npm install fails, nolebase 2.21 needs VitePress 2 (#149)
  • Ring sampling of CollimatedSource and PointSource weights the edge twice (#151)
  • Beamlet sources and GaussianBeamletDecomposition do not carry the requested power (#152)
  • No tests against references independent of BMO (#155)
  • Beamlet sources: CollimatedGaussianBeamletSource has no power, E0 overrides P0, num_rings counts differently (#157)
  • Coherent sums of AstigmaticGaussianBeamlets with circular polarization get 90° phase errors (#159)
  • Detector field of astigmatic beamlets ignores their polarization: orthogonal polarizations interfere, circular ones get 90° phase errors (#160)
  • Feature: Detector readouts on arbitrary sample points (#168)
  • Feature: Detector readouts on a sampling with its own window (#170)
  • Feature: Objects can be added to and removed from an ObjectGroup (#182)
  • Docs: Agent skill forbids numbers as refractive index, constructors accept them (#184)
  • Docs: plate beamsplitter substrate lies towards +y, not −y (#185)
  • Bug: z0 of AstigmaticGaussianBeamlet is no waist offset (#186)
  • Bug: Astigmatic beamlet puts more power on a detector than its source has (#188)
  • Feature: A detector without hits reads as zero power and no spots (#189)
  • Feature: Directions of the rays that hit a detector (#191)
  • Feature: 0.14 public API uses existing verbs and typed dispatch (#192)
  • Bug: Astigmatic beamlet with M2 > 1 loses power on a detector (#208)
  • Bug: gauss_parameters gives a wrong w0 at a tilted waist (#209)
  • Bug: GaussianBeamlet w0 off by M2, invariant check never warns (#210)
  • Bug: install_agent_skill fails on a Windows network drive (#219)