| Name | Modified | Size | Downloads / Week |
|---|---|---|---|
| Parent folder | |||
| Consistency Release source code.tar.gz | 2026-11-26 | 12.4 MB | |
| Consistency Release source code.zip | 2026-11-26 | 12.5 MB | |
| README.md | 2026-11-26 | 5.4 kB | |
| Totals: 3 Items | 24.9 MB | 0 | |
Thanks to @rcgiri-physics and @antonsoo for pointing out the time inconsistency exp(-iωt) or exp(+iωt) used for near and far field calculations. This release addresses that problem and fixes a number of minor inconsistencies and edge cases.
The time convention can now be configured by the user so that all calculated results are consistent with the selected time convention.
python
mie.get_time_convention() # "+" (default)
mie.set_time_convention("-") # exp(-iωt)
mie.set_time_convention("-+") # exp(+iωt)
In total
-
behaviour change: one time convention for every complex result, chosen by the new
set_time_convention,get_time_conventionand the context managertime_convention. The default is exp(+jωt), which goes with m = n - ik and with Wiscombe's MIEV0;"-"gives exp(-iωt), the convention of Bohren & Huffman, Jackson and scattnlay. The two differ only by complex conjugation, and efficiencies, g and intensities are the same in both. Before, the package mixed them:S1_S2andphase_matrixwere exp(+jωt) whilecoefficientsand every field function were exp(-iωt), which is what let thee_farerror below go unnoticed. Under the default,S1_S2,rayleigh.S1_S2andphase_matrixare unchanged;coefficientsreturns the conjugates of its previous values;e_near,h_near,eh_near, their Cartesian forms ande_farreturn the conjugates of their previous fields, and a caller'sabcdmust come fromcoefficientsunder the same convention;- the
miepython.vshharmonics use h_n^(2) outside the sphere, and takem_indexin the form that matches the active convention.
Inside
time_convention("-")the coefficients, fields and harmonics match 3.3.1, whileS1_S2returns Bohren & Huffman's amplitudes andphase_matrixputs S34 where their eq. 3.16 does. The raw kernels (an_bn,cn_dn,_S1_S2) ignore the setting and always return exp(-iωt);_S1_S2no longer conjugates its sum a second time -
e_farnow broadcastsr,thetaandphias its docstring promised, returning shape(3, ...). An arrayrorphiwith a scalartheta, or a 2-Dtheta, used to raise; all-scalar input now returns shape(3,)likee_nearinstead of(3, 1) m = 0is now an exact perfect conductor inefficiencies_mx, as it already was incoefficients, the field functions,rayleighand for x < 0.1. It used to be replaced by1 - 10000jfor x >= 0.1efficiencies_mxraisesValueErrorfor ann_polebeyondwiscombe_terms(x), asS1_S2does, instead of returning ~0single_sphereandcore.normalization_factorconjugate an index with a positive imaginary part themselves; the small-sphere branch used to give a negative qext for onecn_dndefaultsn_poleto 0 likean_bn, on both backendsnorm='qsca'no longer returns NaN for a zero-size sphererayleigh.efficiencies_mxaccepts a list ofxand raises the same error asefficiencies_mxfor mismatched lengths- clarify that
coefficientsreturns orders 1 throughn_pole - treat zero-dimensional NumPy arrays for
mandxas scalar inputs throughout the public Mie API, including the JIT backend - return length-one arrays from the Rayleigh angular functions when
muis scalar, matching the full Mie API; correct thevsh.M_oddusage example - normalize the sign of an absorbing sphere's index before evaluating its interior near fields. Previously, a positive imaginary input produced the same scattering coefficients as its conjugate but different interior E and H fields, breaking boundary continuity. Both input signs now give the same fields in either time convention
- make
docs/13_resonance.ipynbconstruct silver indices as m = n - ik while plotting the positive absorption magnitude k, and clarify thatm_imindocs/01_basics.ipynbis positive while Im(m) is negative - compare the scattnlay reference fields component by component, phase included, rather than only as magnitudes, which could not see a conjugated field
- stop flipping the sign of S34 by hand in
docs/07_algorithm.ipynb: Bohren's sample calculation now runs insidetime_convention("-")and matches his table directly.docs/01_basics.ipynbexplains both conventions, anddocs/14_boundary_conditions.ipynbuses eps = n**2 for exp(+jωt) - fix the phase of
e_far(#36, thanks @rcgiri-physics and @antonsoo). It conjugated the whole field, outgoingexp(ikr)included, so the radial phase ran backwards for the exp(-iωt) convention, andE_phihad the wrong sign relative toE_theta. Only S1 and S2 are conjugated now, andE_phicarries the-S1 sin(phi)of Bohren & Huffman eq. 4.74.e_farnow agrees withe_near(..., include_incident=False)to O(1/kr) in every complex component; before, it was off by O(1). The old test compared magnitudes at theta = phi = 45 degrees, which could see neither error. Magnitudes, and so intensities, are unchanged - add PEP 723 inline metadata to
docs/data/generate_scattnlay_reference_fields.pysouv runbuilds scattnlay 2.4 for it on demand. scattnlay stays out of the project extras, because nothing else needs it