18 KiB
Changelog
All notable changes to BD Fresnel are documented in this file.
The format is based on Keep a Changelog.
[3.0] - 2026-11-14
Added
-
Semi-analytical algorithm, selectable from a third toggle in the Operation mode box alongside Fresnel propagation:
- Instead of propagating the exit field to the detector by FFT, it uses closed-form expressions for the power difference and total at the detector, already integrated over the detector plane. Only an integral over time at each delay remains.
- The time window runs +/- 5T about each delay, where T = tau_p/tau_e.
- Transmission is the energy total normalised to its value before the pump arrives: the first delay point when fitting, and min(-3 rho, -3) tau_e when simulating, so a thin sample with rho -> 0 still normalises away from the peak.
X_numandX_maxare disabled in this mode: the expressions are already integrated over space, so there is no spatial grid.- Applies to both measurement modes. In pump probe the probe is centred, x_0 = 0, so the deflection term vanishes identically and the transmission alone is calculated.
- Both algorithms are kept so results can be compared. Switching discards the current result, which belongs to the other method.
- The algorithm is saved with the other settings and recorded in the parameter log.
- The absorptive term in the deflection expression carries a
PROVISIONAL coefficient,
SA_ABSORPTIVE_FACTOR. As derived, that term matched neither the sign nor the magnitude of the Fresnel result: a purely absorptive mechanism disagreed by a factor of about -69, with correlation exactly -1. Dividing by D = d / (pi w_0_p^2 / lambda_p) = d / z_0_p accounts for the distance and wavelength dependence exactly, and is independent of sample thickness at constant alpha_2_exp*l; the remaining -1/(1 + 2W^2) was measured against the Fresnel path rather than derived. With it the two methods agree to 0.5% for mechanisms with a refractive part and 4.5% for purely absorptive ones. It is isolated in one function pending a corrected derivation.
-
The parameter log's
Calculated Parameters (pump)section reportssigma_e, the normalised pump linear absorptionalpha_e * L / 2. It sits next toT_lin, which restates it: with no pump two-photon absorptionT_lin = (1 - R_p) exp(-2 sigma_e). Read from the parameters rather than the result, so it is reported for either algorithm. -
The
Otherpanel and the parameter log'sOthersection both reporteta (peak)andGamma (peak), the largest nonlinear phase and absorption exponent anywhere on the grid, from whichever algorithm produced the result. These are the only readouts in those panels that come from the result rather than from the parameters, since they are peaks over the whole (T, T_d) grid and cannot be had without running the calculation. They therefore show--until a Fit or Simulate completes, and return to--whenever that result is discarded, so a stale phase is never displayed beside freshly edited parameters.eta (peak)is the yardstick for the semi-analytical algorithm's validity: itsdPis first order in the response while Fresnel propagation keeps every order, so the two agree only while the phase is small. On the 4-layer mechanisms the peak ofDeltaEoEsits at the same delay to within 0.0003 tau_e ateta (peak)= 0.14, but 0.0035 at 1.41, 0.077 at 5.6 and 0.36 at 14.1. Holdingeta (peak)fixed, the agreement is unaffected by sample thickness (0.05 to 2 mm), by walk-off (rho0.04 to 1.7) and by pump absorption (sigma_e0 to 10), so this one number sets the regime. Both algorithms report it to within 2e-5 of each other.
Changed
-
Both beams are now explicitly subscripted: the pump carries
_e(excitation) and the probe carries_p. This restores the convention the original MATLAB used, which the Python port had partly inverted (_pfor the pump) and partly dropped (no suffix for the probe). No beam quantity is unsubscripted any more; the only unsuffixed parameters left are the ones belonging to neither beam -- the sampling grid, the sample geometry (l,d,shift), the relative offsetx_0, and the walk-offrho.pump: was now probe: was now E_pE_etau_FWHMtau_p_FWHMtau_p_FWHMtau_e_FWHMw_0w_0_pw_0pw_0_elambda_lambda_plambda_plambda_eRR_pR_pR_ealphaalpha_palpha_palpha_enn_pn_pn_edndldndl_pdndl_pdndl_etautau_palpha_2dalpha_2d_engng_ptau_ptau_ez_0z_0_psigma_psigma_eTlinTlin_pI_0_pI_0_eng_png_ez_0_pz_0_eTlin_pTlin_esigma_p2/sigma_p20sigma_e2/sigma_e20a_p_0,W_0_p,I_p_pulsea_e_0,W_0_e,I_e_pulseNote that six probe names --
tau_p_FWHM,lambda_p,R_p,alpha_p,n_p,dndl_p-- are spelled exactly like what were pump names before this release. Reading an old log or settings file alongside a new one needs care; see the settings note below for how the program itself is protected.The pump pass renamed 389 identifier occurrences textually; the probe pass was done by rewriting 116 exact AST node positions instead, because
n,R,alphaandtauare overloaded in this codebase (lambda parameters, the author's initials in the copyright line, the semi-analytical formula's geometricR, a diagnostics dict key) and no text pattern distinguishes them.was now was now E_pE_etau_ptau_etau_p_FWHMtau_e_FWHMsigma_psigma_ew_0pw_0_eI_0_pI_0_elambda_plambda_eng_png_eR_pR_ez_0_pz_0_ealpha_palpha_eTlin_pTlin_en_pn_esigma_p2sigma_e2dndl_pdndl_esigma_p20sigma_e20alpha_2dalpha_2d_ea_p_0a_e_0w_0pgains the separating underscore it was missing, so the field name finally matches the variable that held it (w_0_p) and its siblingsz_0_eandI_0_e.alpha_2d_ekeeps thedfor degenerate. -
The Electronic mechanism's parameters are renamed
alpha_2e->alpha_2elandn_2e->n_2el, since theiremeant electronic and would otherwise collide with_efor excitation -- the pump's degenerate two-photon coefficient would have wanted the namealpha_2e, which was taken._enow means excitation and nothing else. -
BD_3_level_triplet,I_e_funcandexcite_propneeded no renaming at all: transliterated from the MATLAB, they already used_efor the pump and_pfor the probe, son_g_p,v_pandI_pinside them were correct all along. With both beams now subscribed to that convention, the whole file reads against the MATLAB without translation. -
last_settings.jsonwritten by an earlier version is now refused rather than misread. Saved settings carry asettings_schemastamp, and a file without the current one is rejected with a message explaining why. This is not housekeeping: because six probe field names are spelled exactly like former pump keys, loading an old file by name alone would have installed the pump's wavelength, index, reflectivity, absorption and dispersion as the probe's -- every number plausible, every result wrong. Re-enter the parameters once and they save in the new layout. Any other unrecognised key is still dropped with a note on stderr. -
Log and panel labels follow their fields on both sides:
n_g_e,sigma_e,T_lin_e,z_0_e,I_0_efor the pump andn_g_p,T_lin_p,z_0_pfor the probe, with the beam parameters and material blocks likewise. The GUI's pump calculated-parameters panel also gains asigma_ereadout, which it had not displayed before. -
T_lin_pandT_lin_eare labelledT_lin_p (transmission)andT_lin_e (transmission)in both the panel and the log, so the quantity is named and not just abbreviated. The log's value column moved from 25 to 29 to fit them, and the panel's label column from 20 to 23 characters -- which also squares upz_0_p (Rayleigh range),z_0_e (Rayleigh range)andI_0_e (peak irradiance), all of which had been overrunning the old 20 and pushing their own values out of line. -
The rename is numerically inert: across 8 mechanism types x 2 algorithms x 3 pump-absorption configurations (49 cases, 3275 values),
DeltaEoE,T,Delta_n,eta_peakandGamma_peakare bit-identical to the pre-rename code, andpyflakesreports zero warnings before and after. -
Transmission y-axis tick labels are limited to three significant digits, so "99.75" reads "99.8". The count is a floor rather than a cap: a shallow scan spanning a few hundredths of a percent would round every tick to "100", so digits are added only where that would happen. The deflection axis is unaffected.
-
The reference list in the README and the parameter log follows Optica style: every author listed, initials first, abbreviated journal, volume, full page range, year. Author lists and page ranges were checked against the published papers.
-
The duplicate supplementary-material citation is dropped, leaving two references.
-
The parameter log is written as UTF-8. The citations use typographic quotes and an en dash, which the locale's encoding cannot always represent.
Fixed
- The instantaneous (Electronic) response for a sample with both
walk-off and pump absorption is evaluated through the scaled
complementary error function
erfcxinstead of the form inBD_Fresnel_func_ni.m. That form multipliedexp(sigma_e^2/rho^2 + 2 sigma_e u/rho)by a difference of error functions falling to zero, so the product was lost to cancellation well before it overflowed: atrho = 0.4336(l = 0.5 mm) it was already wrong over 8.6% of the delay axis atsigma_e = 2.5(alpha_e = 100 cm^-1), returning exactly 0.0 with no NaN to signal it, and returned NaN abovesigma_e = 3. The usable ceiling onalpha_efor an Electronic mechanism at that thickness was therefore about 60 cm^-1, not the ~120 where NaN first appeared. The rearrangement is algebraic, with every surviving exponent non-positive; it reproduces the original evaluated at 600 decimal digits to 1e-16..3e-13 relative oversigma_e= 0.25 to 10 andu= -3 to 18, both where the original works and where it does not. - Pump absorption is applied to non-instantaneous mechanisms when the
walk-off is exactly zero. Substituting
T1 = (T+T_d) - rho + rho*zetashows therho != 0branch to be a depth average overatten_fac, whoserho -> 0limit is the response at one instant times the mean ofatten_fac; the original used the bare response. The dropped factor is(1 - exp(-2 sigma_e))/(2 sigma_e)for linear pump absorption, so the response was previously independent ofalpha_ealtogether in this case -- identical atalpha_e= 0 and 200 cm^-1. It was 1.27x too large atalpha_e= 10 cm^-1 and l = 0.5 mm, and 10x at 200 cm^-1. The two branches now agree to nine digits acrossrho = 0. This affects only samples withng_pexactly equal tong_e(for example no dispersion entered at either wavelength) and non-zero pump absorption; withalpha_e = alpha_2d_e = 0the mean is exactly 1 and results are bit-identical to before. - Pump absorption through the sample depth,
atten_fac, is computed from the closed-form solution ofdI_e/dz = -alpha_e I_e - alpha_2d_e I_e^2rather than the two-branch expression carried over fromBD_Fresnel_func_ni.m. That expression's pump two-photon branch,sqrt((B1 B2)/sigma_e), failed three ways: it did not reduce to its ownsigma_e2 == 0branch asalpha_2d_e -> 0(it decayed at half the correct rate), it divided by zero wheneveralpha_ewas zero, and it took the square root of a negative number wheneversigma_e20 > sigma_e. The net effect was that every run combining a non-zeroalpha_2d_ewith a non-instantaneous mechanism returned NaN at every delay -- pump two-photon absorption worked only for the Electronic mechanism, which does not useatten_fac. Dropping the stray square root recovers that expression as the linearisation of the exact one insigma_e20, which is how the intent was identified. Results foralpha_2d_e = 0are bit-identical to before; the new form agrees with numerical integration of the pump propagation equation to 2e-12 relative oversigma_eandsigma_e20from 0 to 20, including both limits. - A negative
alpha_2d_elarge enough to make the pump diverge inside the sample (two-photon gain, no finite depth average) is now refused with a message naming the largest|alpha_2d_e|that works for the current thickness and pump irradiance, rather than silently returning a meaningless attenuation of order 1e12. mpmathis imported only where it is used, in the pump two-photon absorption term. Importing it at module level made an optional dependency fatal at startup, so the program would not run at all without it. If that term is ever reached without mpmath installed, the error now says which package is missing and why.
[2.6] - 2026-09-30
Added
- Simulation run mode: a second toggle in the Operation mode box, offering Fitting and Simulation. Fitting is the default and behaves as before.
- Simulation mode, for computing a signal without a measurement:
- No file is imported. Import... and the data column and delimiter fields are disabled.
- The delay range is entered as
T_d_minandT_d_max(intau_p) in the Simulation parameters box. In Fitting mode these are taken from the imported scan and the fields are disabled. - Only the calculated curves are plotted, without data markers, and the plot legend reads Simulated rather than Fit.
- The Fit button is relabelled Simulate, and is enabled by valid parameters alone rather than by an imported file.
- The export holds the calculated signals on their own delay grid, with no data columns to pair them with. The parameter log omits the import path and the data column section.
- The mode combines with the measurement mode: Pump probe and Simulation together give a single Transmission panel and a two-column table, as Pump probe does when fitting.
- The run mode is saved with the other settings and recorded in the parameter log.
Changed
- The Mode box is renamed Operation mode and moved to the top of the parameter panel, above Data columns. The parameter log and status messages use the new name, and the log records both modes on one line.
- Changing run mode discards the current result, which described the other mode's delay range or a measurement the new mode does not show. Switching to Simulation sets the imported scan aside and switching back reloads it. The run mode cannot be changed while a fit runs.
inputs_validtakes arequire_dataargument, so Simulation can enable its action button without an imported file. Fitting is unaffected.
[2.5] - 2026-09-21
Added
- Mode box, below Data columns: a two-button toggle selecting Beam deflection or Pump probe. Beam deflection is the default and behaves as before.
- Pump probe mode, for measurements with the probe centred on the pump:
- Only the delay and transmission columns are required, so a two-column scan can be imported. The DeltaEoE column is ignored and its field disabled.
x_0is fixed at 0 and cannot be edited.- Only the Transmission plot is displayed and exported. The exported
image is named
<name>_fit_transmission.jpg/.svgand is 3.25 in wide, a single column. The exported data table holds delay, T (data) and T (fit). - The mechanism pull-downs offer the absorptive (NLA) and mixed (both) mechanisms; a mixed mechanism contributes its absorptive part. The purely refractive (NLR) mechanisms, which cannot change the transmission, are excluded. Switching to pump probe empties any slot holding one; switching back restores it, provided the slot is still empty.
- The selected mode is saved with the other settings and recorded in the parameter log.
Changed
- Changing mode discards the current fit, which was computed with the other mode's settings, and re-reads the imported file under the new mode's column requirements. A file the new mode cannot use is cleared with an explanation, and loaded again on switching back. The mode cannot be changed while a fit runs.
- The source files carry the GPLv3 notice.
Fixed
- Values such as
nan,infor1e999are rejected in parameter fields. They previously turned the fit to NaN, and crashed the mechanism parameters dialog. - An invalid entry in a numeric field reverts to its previous value, as the integer fields and the mechanism dialog already did, instead of becoming 0.
- Every parameter change is saved as it is made. Numeric fields, mechanism choices and the diagnostics option were previously saved only on Import, Fit, Export or Exit, so a crash lost them.
- Changing a column number or the delimiter re-reads only a file imported in the current session. Straight after launch it could load the previous session's file, or report an error about one that had since moved.
- When a file cannot be read with a new column number or delimiter, its data and fit are cleared. They previously stayed on screen, and could be exported, under settings that no longer described them.
- The data columns in use must each be different. Two quantities could previously be read from the same column without any warning.
- The x tick label at the join between the Transmission and Deflection plots is hidden when it collides with its neighbour. A rounding error let some such labels through.
[2.4] - 2026-09-21
First release recorded in this changelog. Earlier history is not documented here.
Fixed
- README parameter tables corrected to match the program's window: the default T and DeltaEoE data columns were swapped, and several defaults, labels and descriptions disagreed with what the interface shows.