Repository navigation
BeamletOptics v0.14.0
Breaking changes
- Refractive indices are
AbstractRefractiveIndexvalues. Every constructor that takes a refractive index (lenses, prisms, plate and cube beamsplitters, compensator plates, polarizers) throws aMethodErrorfor a number or a function such asλ -> 1.5. WriteConstantRefractiveIndex(1.5), or useSellmeierEquationorDiscreteRefractiveIndex. For your own dispersion formula, definestruct MyGlass <: BeamletOptics.AbstractRefractiveIndex endand(::MyGlass)(λ) = .... BeamletOptics.RefractiveIndexis removed. UseBeamletOptics.AbstractRefractiveIndexas 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)becomesintensity(pd, RegularGrid(num_points = 200, crop_factor = 5, x_min = a, x_max = b)), and the same holds forelectric_fieldandoptical_power. UseRectilinearGrid(xs, zs)for your own axes. The keywordnum_spotsis gone, and a single bound such asx_minnow applies on its own. intensity(pd, Z)no longer takes a wave impedance. Writeintensity(pd), which uses the refractive index of the hits.electric_field(pd)ofAstigmaticGaussianBeamlethits returns 3D field vectors, as forPolarizedRayhits. Writesum.(abs2, E)instead ofabs2.(E), or useintensity(pd).solve_system!has no keywordretrace, andBeamletOptics.retrace_system!is removed. Every solve traces the beam from its start, soempty!(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 renamednum_rays!.propertiesanddefault_propertiesare no longer exported and only accept objects, beams and groups. WriteBeamletOptics.properties(x).MeshDummy(path)is removed: writeNonInteractableObject(path). The deprecatedConcaveSphericalMirroris removed: writeSphericalMirror.get_sdf_inside_stepand the preferencesdf_inside_stepare removed without a replacement, since rays inside a shape now leave at its first exit. Delete the call.BeamletOptics.hit_count(detector)is removed. Writelength(detector).BeamletOptics.beamlet_hit_field(hit, p)is removed. Writeelectric_field(hit, p), which returns a 3D vector for anAstigmaticGaussianBeamletHit.BeamletOptics.AbstractSamplingis renamedBeamletOptics.AbstractSourceSampling.BeamletOptics.is_static(x)is removed. WriteBeamletOptics.kinematic_trait_of(x) isa BeamletOptics.Static.BeamletOptics.render_children(h)is removed. WriteBeamletOptics.children(h), and defineBeamletOptics.childrenfor your own system render handles.GaussianBeamletHitandAstigmaticGaussianBeamletHitstore values and no longer refer to their beamlet:hit.gauss,hit.agb,hit.idandposition(hit)are gone. Keep the beamlet yourself, and read a hit withdirection(hit)andBeamletOptics.wavelength(hit).WavefrontBeamletDecompositionandGaussianModeDecompositiontake the position of the grid beforedir, e.g.WavefrontBeamletDecomposition(x, y, amplitude, phase, pos, dir, λ). The keywordoriginis gone. Passzeros(3)for the previous placement.GaussianBeamletDecompositionthrows anArgumentErrorif its beamlets are not narrower than the beam, i.e. forn_grid ≤ 4with the defaultoverlap. Use a largern_grid.GaussianBeamletthrows anArgumentErrorfor asupportvector that is not orthogonal to the direction. Before, it built a wrong waist. Pass a vector normal todir.ObjectGroupis no longer anAbstractObject. AVector{AbstractObject}cannot hold a group, methods typed::AbstractObjectdo not receive groups, andBeamletOptics.shape(group)is gone. Write[lens, group]andBeamletOptics.objects(group). The type has one parameter:ObjectGroup{T}.- Moving a group or composite object whose parts share a shape, e.g. a
DoubletLenstogether with its own front lens, throws anArgumentErrorbefore anything moves. Before, the shared shape moved twice. Add each part to a group only once. - The field
orientationofCollimatedSource,PointSourceandAstigmaticBeamGroupis renameddir. Readorientation(source). Your ownAbstractBeamGrouptypes rename the field or defineorientationandorientation!. - The OpticsBase extension loads with
using OpticsBase. Remove theinclude(... "BeamletOpticsOpticsBaseExt.jl")line from the previous docs. BeamletOptics.kinematic_trait_ofthrows for a type without a method instead of returningStatic(). Declare it for your own types that use the kinematic verbs.- Your own
AbstractSystemtypes must defineBeamletOptics.objects(system), which every solve calls. - Your own
AbstractObjectGrouptypes are no longerAbstractObjects. They aremutable structs with the fieldsobjects,center::Point3{T}anddir::SMatrix{3,3,T,9}. BeamletOptics.children!throws for a beam that already has children. UseBeamletOptics.relaunch!to replace them.- Your own
AbstractDetectortypes are emptied by every move and byinitialize!. DefineBase.empty!for them. BeamletOptics.thicknessof aUnionSDForDifferenceSDFcounts every operand and throws for an operand without athicknessmethod. DefineBeamletOptics.thicknessfor your own SDFs.z0ofAstigmaticGaussianBeamletis the offset of the waist fromposition, as forGaussianBeamlet. Before, the whole beamlet started atposition + z0 * direction. For the previous beam, start atposition + z0 * directionand passz0_x - z0andz0_y - z0.- A
GaussianBeamletstops tracing with a warning where its Lagrange invariant leavesget_lagrange_tolerance()(default 50 %) of its start value, e.g. behind a strong ball lens. Passcheck_invariant = falsetosolve_system!to trace on as before. - The Lagrange check of
AstigmaticGaussianBeamletis relative to its start value withinget_lagrange_tolerance(), so beamlets withM2 > 4are no longer stopped, andthresholdlimits only the complex invariant. Change the limit withset_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) == 0instead of catching the error. intensityandoptical_powerof a detector are the flux through it, andelectric_fieldis 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_poweris the beam power at any angle of incidence.- The default window of
GaussianBeamlethits 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. PassRegularGrid(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
P0as their total power.CollimatedGaussianBeamletSourcehas a new keywordP0(1 mW for the whole source; before, 1 mW per beamlet).SphericalGaussianBeamletSource,EllipticalGaussianBeamletSourceandGaussianBeamletDecompositionno longer emit about 30P0and 0.95P0respectively. TheirE0sets only the polarization and phase. num_ringsofEllipticalGaussianBeamletSourcecounts the center as a ring, like the other sources. Passnum_rings + 1for the previous rings.- Ring sources give each ring a number of rays in proportion to its area, so the edge ring of
CollimatedSource,PointSourceand the beamlet cone sources gets fewer rays. The first ray ofUniformDiscSourceandUniformPointSourceis the center ray on the axis. - Invalid arguments of sources and
num_rays!throw anArgumentErrorinstead of anErrorException. - Beamsplitter coatings and polarizer films are drawn in saturated colors in both looks. Pass
colorandalphatorender!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)includescolor.
Features
- Detector readouts on
RegularGrid,RectilinearGridor your own samplings (BeamletOptics.AbstractDetectorSampling);ray_hitsgives the directions of the rays on a detector UniformLineSourceandUniformFanSource;path_segmentslists a traced beam tree as flat segmentsPrism(vertices, height, n)for convex polygons,EquilateralPrism,DovePrism, surface-basedDoubletLensandTripletLens,NonInteractableObject(path)for mesh filespush!,delete!,pop!andpopat!forObjectGroup; your own assembly types viaBeamletOptics.AbstractObjectGroup;initialize!andsolve_system!(...; initialize = true)empty the detectors- The OpticsBase extension is declared and loads with
using OpticsBase;PlaneFieldof 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 largeM2, Gouy phase behind lenses, phase and field in mediaAstigmaticGaussianBeamlet: field follows polarizers and Fresnel losses, children continue their parent, no Gouy phase jump at mirrors, power forM2 > 1and twisted beams,rayleigh_rangeworks- 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
ParabolicMirrorhas 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
shapegetter 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
supportis orthogonal todirection(#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)