---
title: 'DeepFMKit: DFMI Simulation Toolbox'
url: https://www.emergentmind.com/topics/deepfmkit
type: topic
---

# DeepFMKit: DFMI Simulation Toolbox

Searching arXiv for the DeepFMKit paper and related terminology to ground the article in the current literature.
DeepFMKit is an open-source Python toolbox for the end-to-end simulation and analysis of Deep Frequency Modulation Interferometry (DFMI), introduced to unify physical signal generation, realistic noise injection, parameter estimation, and large-scale experimentation within a single framework [2508.11195]. In the DFMI context, it is intended to support prototyping of DFMI systems, investigation of systematic effects, comparison of readout algorithms, and precision metrology workflows. DFMI itself is presented as an emerging laser interferometry technique capable of picometer-level displacement measurement and potentially absolute length determination with sub-wavelength accuracy, but one whose design space is shaped by nonlinear signal dependence, dynamic interferometer motion, laser and detector noise, waveform distortion, and algorithmic readout choices [2508.11195].

## 1. DFMI context and the rationale for DeepFMKit

DeepFMKit was motivated by a gap in the DFMI software landscape. The package is described as addressing the full DFMI workflow rather than a single layer of the problem: physical modeling, signal corruption by realistic noise, parameter recovery, and systematic exploration of design trade-offs [2508.11195]. The paper frames DFMI as computationally demanding because performance depends on the coupled behavior of interferometer physics, laser technology, multiple noise sources, and the estimation algorithm used to recover phase-related parameters.

The stated motivation is comparative as well as constructive. Existing tools are described as partial solutions: **Finesse** is characterized as strong for frequency-domain optical simulation but not for the time-domain, dynamically modulated DFMI signal model; optical design environments such as **Zemax OpticStudio** and **Code V** are described as modeling geometry and aberrations but not DFMI readout or noise propagation; and **PyTDI** is identified as providing specific DSP utilities such as time shifting rather than the full DFMI pipeline [2508.11195]. DeepFMKit is therefore positioned as a framework that combines high-fidelity physics simulation with interchangeable readout algorithms and high-throughput experimentation.

A useful point of disambiguation is that DeepFMKit is unrelated to the recommender-systems framework **DeepFM**, which combines factorization machines and deep neural networks for CTR prediction [1804.04950]. Despite the lexical similarity, the two names refer to different technical domains: DFMI metrology in one case and click-through-rate prediction in the other.

## 2. Physical signal model and simulation engine

The core simulation engine is implemented in `physics.py` and centered on the `SignalGenerator` class [2508.11195]. Its purpose is to model the full DFMI signal chain beyond an idealized sinusoidal approximation. The detector voltage is written as

$$
v(t)=A\left[1+k\cos\!\left(\Delta\Phi_{\text{total}}(t)\right)\right],
$$

where \(A\) is the mean optical power term, \(k\) is the fringe visibility, and \(\Delta\Phi_{\text{total}}(t)\) is the total phase difference between the interferometer arms [2508.11195]. The exact phase difference is expressed as

$$
\Delta\Phi_{\text{total}}(t)=\phi_{\text{laser}}(t-\tau_r(t))-\phi_{\text{laser}}(t-\tau_m(t)),
$$

which explicitly incorporates time-of-flight delays in both paths [2508.11195].

A major design feature is support for dynamic interferometers with time-varying path lengths,

$$
\tau_r(t)=\frac{l_r(t)}{c}, \qquad \tau_m(t)=\frac{l_m(t)}{c},
$$

so that the delay can vary continuously over time rather than being approximated by a fixed or Taylor-expanded quantity [2508.11195]. DeepFMKit implements these delays through `dsp.timeshift` using high-order Lagrange interpolation, which is intended to preserve accuracy when the delay in sample units is both non-integer and time-dependent. The package also uses a pad-and-crop strategy: additional samples are simulated at the beginning and end of the interval so that the interpolation filter has valid boundary support, after which the output is cropped to the requested time range [2508.11195].

The treatment of laser modulation is similarly generalized. The `LaserConfig` object accepts a user-defined `waveform_func`, allowing arbitrary modulation waveforms rather than constraining the simulation to a purely sinusoidal drive [2508.11195]. In the ideal sinusoidal case, the modulation is given by

$$
f_{\text{mod}}(t)=\Delta f \cos(\omega_m t+\psi),
$$

with phase modulation

$$
\phi_{\text{mod}}(t)=\frac{\Delta f}{f_m}\sin(\omega_m t+\psi).
$$

This generality is important because the paper explicitly identifies modulation waveform distortions as one of the systematic complications in practical DFMI design [2508.11195].

The package also defines a structured simulation pipeline. The sequence reported in the paper is: compute dynamic path lengths and delays; generate the modulation waveform; time-shift the modulation phase to each arm; time-shift laser frequency noise separately for both arms; assemble carrier phase, DFMI phase, and laser-noise contributions; then apply amplitude noise and sensing noise [2508.11195]. This explicitly models differential cancellation of common-mode laser noise in unequal-arm interferometers.

## 3. Noise modeling and realistic non-idealities

DeepFMKit includes colored-noise generation for both laser and interferometer subsystems [2508.11195]. Each supported noise source is parameterized by a spectral exponent \(\alpha\) with

$$
\mathrm{PSD}\propto \frac{1}{f^\alpha}, \qquad \alpha\in[0,2].
$$

The paper identifies three canonical cases: \(\alpha=0\) for white noise, \(\alpha=1\) for flicker or pink noise, and \(\alpha=2\) for random-walk or red noise [2508.11195]. The implementation in `noise.py` uses the numerically stable method of **Plaszczynski**, realized as a cascade of first-order IIR filters and accelerated with **Numba JIT** compilation.

The supported noise terms are enumerated explicitly: laser frequency noise \(f_n\), tuning amplitude noise \(df_n\), relative intensity noise \(r_n\), OPD noise \(arml_n\), and sensing noise \(s_n\) [2508.11195]. The paper reports validation plots in which the generated amplitude spectral densities match the expected \(1/f^{\alpha/2}\) slopes, which is presented as evidence that the synthetic noise has the intended spectral character.

In the low-delay approximation, the ideal DFMI phase and voltage reduce to

$$
\Delta\Phi_{\text{total}}(t)=\Phi + m\cos(\omega_m t+\psi),
$$

with

$$
m=\frac{2\pi \Delta f \Delta l}{c}, \qquad \Phi=\frac{2\pi f_0 \Delta l}{c},
$$

and

$$
v(t)=A\left[1+k\cos\!\left(\Phi + m\cos(\omega_m t+\psi)\right)\right].
$$

These expressions serve as the analytical baseline from which the higher-fidelity engine departs when dynamic delays, arbitrary modulation, and colored disturbances are introduced [2508.11195].

A plausible implication is that the package is intended not merely for nominal signal synthesis but for controlled stress-testing of DFMI readout pipelines under specific non-ideal mechanisms. That interpretation is consistent with the package’s stated role in studying systematic errors and noise coupling [2508.11195].

## 4. Parameter-estimation algorithms

DeepFMKit organizes its estimators in `fitters.py` according to a **Strategy pattern**, making the readout stage interchangeable within a common workflow [2508.11195]. The principal offline estimator is the frequency-domain nonlinear least-squares implementation `StandardNLS`, while the real-time estimators are `StandardEKF` and `IntegratedEKF`.

`StandardNLS` fits the parameter vector

$$
\mathbf{x}=(C,m,\Phi,\psi),
$$

where \(C\) is the AC amplitude, \(m\) the effective modulation depth, \(\Phi\) the interferometric phase, and \(\psi\) the modulation phase [2508.11195]. Its frequency-domain model uses harmonic amplitudes

$$
\alpha_n(\mathbf{x}) = 2C\,J_n(m)\cos\!\left(\Phi+n\frac{\pi}{2}\right)e^{-in\psi},
$$

derived from the Jacobi–Anger expansion of the ideal DFMI signal [2508.11195]. The fitter minimizes a sum-of-squared-residuals objective between measured and modeled harmonic amplitudes. The implementation is described as an optimized Levenberg–Marquardt algorithm that computes SSQ, the Jacobian, and the gradient, tests candidate damping parameters \(\lambda\), accepts the first improving step, and iterates to convergence [2508.11195]. Robustness measures include smart \(\psi\) initialization through a one-dimensional scan and a grid-search fallback over \(m\) if the initial fit quality is poor. Performance-oriented features include vectorized NumPy harmonic and Jacobian evaluation, parallel processing across buffers, and warm-starting from the previous buffer’s solution [2508.11195].

The real-time branch comprises two Extended Kalman Filter variants. `StandardEKF` uses a random-walk process model with state

$$
\mathbf{x}_k=
\begin{bmatrix}
C_k & m_k & \Phi_k & \psi_k & A_k
\end{bmatrix}^\top,
$$

state-transition matrix \(\mathbf{F}=\mathbf{I}\), and measurement model

$$
h(\mathbf{x}_k)=C_k\cos\!\left(\Phi_k+m_k\cos(\omega_m t_k+\psi_k)\right)+A_k.
$$

It is described as simple, stable, and suited to quasi-static or stochastic parameter evolution [2508.11195].

`IntegratedEKF` extends this to an integrated random walk, or constant-velocity, model with 10-dimensional state

$$
\mathbf{x}_k=
\left[
C_k,\dot C_k,m_k,\dot m_k,\Phi_k,\dot\Phi_k,\psi_k,\dot\psi_k,A_k,\dot A_k
\right]^\top,
$$

and a block-diagonal transition matrix built from repeated kinematic blocks

$$
\mathbf{F}_{\text{block}}=
\begin{bmatrix}
1 & \Delta t\\
0 & 1
\end{bmatrix}.
$$

This variant is intended for signals with persistent drift or approximately constant velocity in parameter space [2508.11195].

The paper gives the standard EKF recursion: predict \(\hat{\mathbf{x}}_{k|k-1}\) and \(\mathbf{P}_{k|k-1}\), linearize the measurement model through \(\mathbf{H}_k\), compute the innovation \(\tilde y_k\), form the Kalman gain \(\mathbf{K}_k\), and update the state and covariance [2508.11195]. It emphasizes the role of \(\mathbf{Q}\) and \(R\): larger \(\mathbf{Q}\) yields faster tracking but noisier estimates, while smaller \(\mathbf{Q}\) gives smoother estimates with more lag.

## 5. Experimentation framework and large-scale studies

DeepFMKit includes an experimentation framework in `experiments.py` for parameter sweeps and Monte Carlo analyses [2508.11195]. The paper describes the user interface in terms of four declarations: static parameters, swept axes, stochastic variables, and analyses to run. The framework then constructs the Cartesian product of the sweep axes, generates Monte Carlo trials at each grid point, executes each trial as an atomic simulate-and-analyze job, aggregates the outputs into structured \(N\)-dimensional arrays, and computes statistics such as mean and standard deviation [2508.11195].

For multiprocessing robustness, the framework uses an `ExperimentFactory` class. The stated reason is that parallel execution in Python requires picklable objects, so experiment-specific configuration is encapsulated in a serializable factory object that can be dispatched to worker processes [2508.11195]. The paper identifies this as important for avoiding nested parallelism problems.

The paper’s principal case study is a second harmonic distortion (SHD) analysis [2508.11195]. In that experiment, the framework sweeps the true modulation depth \(m\) and the distortion amplitude \(\epsilon\), samples unknown phases \(\Phi\) and \(\psi_2\) by Monte Carlo, and estimates the bias in \(\hat m\) using NLS. The distorted modulation is modeled as

$$
f_{\rm mod}(t)=\Delta f\left[\cos(\omega_m t+\psi)+\epsilon\cos(2\omega_m t+\psi_2)\right],
$$

which induces a perturbation

$$
\delta\phi(t)=m\epsilon\cos(2\omega_m t+\psi_2),
$$

and an approximate signal error

$$
\delta v(t)\approx -C m \epsilon \cos(2\omega_m t+\psi_2)\sin(\Phi + m\cos(\omega_m t+\psi)).
$$

The resulting study reveals what the paper calls “robustness valleys,” where the bias is suppressed; analytically, these correspond to extrema of \(J_2(2m)\), satisfying

$$
J_2'(2m)=0.
$$

The experiment is reported to have been carried out with **50 million simulated and fitted trials**, which the paper presents as evidence that the framework is suitable for very large studies [2508.11195].

This suggests that DeepFMKit is intended not only for single-scenario simulation but also for systematic operating-point discovery, especially in problems where estimator bias depends nontrivially on waveform imperfections and latent phase variables.

## 6. Software architecture, workflow, and computational performance

The package uses an object-oriented architecture in which `LaserConfig` and `IfoConfig` combine into `SimConfig`, `DeepFrame` acts as the central controller, `RawData` stores raw time series, and `FitData` stores fit outputs [2508.11195]. The paper explicitly states that the design follows a **Composition pattern** for physics objects and a **Strategy pattern** for fitters. `DeepFrame` orchestrates the `.simulate()` and `.fit()` stages, while `BaseFitter` is subclassed by `StandardNLS`, `StandardEKF`, and `IntegratedEKF` [2508.11195].

The reported benchmark uses a 100-second, 200 kHz dataset comprising 20 million samples [2508.11195]. Throughput figures are given for Apple M4 Max and Intel Core Ultra 7 hardware.

| Algorithm | Apple M4 Max | Intel Core Ultra 7 |
|---|---:|---:|
| StandardNLS, sequential | 3,804 kS/s | 1,889 kS/s |
| StandardNLS, parallel | 13,334 kS/s | 11,940 kS/s |
| StandardEKF | 904 kS/s | 726 kS/s |
| IntegratedEKF | 398 kS/s | 310 kS/s |

The paper’s stated conclusions from these measurements are that parallel NLS is fastest overall, that the EKF implementations are fast enough for real-time use, and that the 5D random-walk EKF is significantly faster than the 10D integrated or constant-velocity EKF [2508.11195]. These results align with the architectural split between high-throughput offline fitting and state-space tracking for real-time estimation.

The practical value claimed for the package is correspondingly broad: prototyping DFMI instruments before hardware construction, investigating systematic errors such as waveform distortion and nonlinearity, comparing offline and real-time readout methods, studying noise coupling and dynamic effects in unequal-arm interferometers, and supporting reproducible precision-metrology research [2508.11195].

## 7. Significance, scope, and terminology

DeepFMKit is presented as a validated, open-source DFMI simulation-and-analysis environment that bridges theoretical DFMI models and practical precision-measurement workflows [2508.11195]. Its defining features are physically faithful treatment of dynamic delays and colored noise, interchangeable estimators spanning frequency-domain NLS and time-domain EKFs, and a high-throughput experimental layer for sweeps and Monte Carlo studies.

A recurring source of confusion is nomenclature. The term “DeepFM” is established in recommender systems as an end-to-end wide-and-deep CTR framework with shared embeddings for FM and deep components [1804.04950], and it has generated a family of derivatives such as DexDeepFM [2104.01924]. DeepFMKit, by contrast, denotes a toolkit for **Deep Frequency Modulation Interferometry** rather than a library for factorization-machine-based recommendation. The shared prefix therefore reflects an acronym collision rather than a methodological relationship.

Within precision interferometry, the package’s significance lies in unifying modeling, estimation, and large-scale study under one software boundary. A plausible implication is that this integration lowers the cost of iterating between theoretical signal models, algorithm selection, and tolerance analysis. That interpretation is consistent with the paper’s bottom-line characterization of DeepFMKit as a tool for turning DFMI into a computationally testable and optimizable engineering platform [2508.11195].

Source: https://www.emergentmind.com/topics/deepfmkit