Troubleshooting
Common Issues
“Equilibration Not Detected”
Problem: The algorithm fails to identify a stationary region, or returns an unexpectedly large equilibration index.
Solutions:
Increase
maximum_equilibration_stepto allow more warm-up stepsUse
initial_run_lengthto provide sufficient initial dataConsider if your observable is appropriate for equilibration detection (some quantities may oscillate without reaching stationarity)
Check your simulation setup for convergence issues
Use
ignore_endto exclude non-stationary tail behavior
“Failed to Compute UCL”
Problem: Insufficient data for reliable uncertainty quantification, or the UCL method cannot produce a valid estimate.
Solutions:
Reduce
relative_accuracyorabsolute_accuracyrequirementsIncrease
maximum_run_lengthto collect more dataCheck for constant or near-constant data (see “Edge Cases” below)
Verify that
minimum_sample_sizerequirements are metTry a different UCL method (MSER-m, Heidelberger-Welch, etc.)
“Relative Accuracy Ill-Defined”
Problem: The confidence interval includes zero, making relative accuracy calculations meaningless.
Solutions:
Use
absolute_accuracyinstead ofrelative_accuracy
“Performance Issues with Large Datasets”
Problem: Long simulations or high-frequency sampling cause slow computation.
Solutions:
Enable
fft=True(default) for fast correlation calculationsReduce
minimum_correlation_timeto truncate autocorrelation sums earlierUse
number_of_coresfor parallel processing with multiple variablesIncrease
nskipinestimate_equilibration_lengthfor faster scanningConsider subsampling your data if temporal resolution exceeds correlation time
“Statistical Inefficiency Returns Data Size”
Problem: si equals the full data size (worst-case correlation).
Causes:
Constant or near-constant time series (zero variance)
Computational precision issues with very small variance
Autocorrelation function fails to decay
Solutions:
Add small numerical noise to constant data (see “Edge Cases” below)
Check data variance exceeds machine precision (
np.std(data) > 1e-15)Verify your simulation is producing meaningful fluctuations
Edge Cases
Constant or Near-Constant Data
Many statistical methods require finite variance. For testing or degenerate cases you can temporarily inject numerical noise, but be aware that you are altering the physics:
Warning
Adding artificial noise makes the algorithm happy, not the science. Always investigate why your simulation returns constant data and choose the noise magnitude relative to the physical scale of the observable.
A minimal helper that keeps you in control:
def get_trajectory(step: int, args: dict) -> np.ndarray:
"""Run the simulation and return the time-series."""
data = your_simulation(step, **args) # shape (step,)
# Let the caller decide whether to perturb
noise = args.get("noise", 1e-8) # physical scale
if np.std(data) < noise:
warnings.warn(
"Constant data detected – adding artificial noise of magnitude "
f"{noise}. Review science before production.", UserWarning,
stacklevel=2
)
data = data + np.random.normal(0.0, noise, step)
return data
Insufficient Sample Size
Error: “not enough data points” or CRSampleSizeError.
Fix:
Ensure
initial_run_length> minimum requirements (varies by method)Geyer methods require ≥4 points, split methods require ≥8 points
Increase data collection before calling analysis functions
Non-Finite Values (NaN/inf)
Error: “non-finite or not-number” detected.
Fix: Clean your data in the get_trajectory function:
def get_trajectory(nstep):
data = your_simulation(nstep)
# Replace NaN/inf with neighboring values or remove
mask = np.isfinite(data)
if not np.all(mask):
# Simple linear interpolation for missing values
data = np.interp(np.arange(nstep),
np.where(mask)[0],
data[mask])
return data
Unexpected Convergence Behavior
If convergence seems too fast or too slow:
Check that accuracy requirements are physically meaningful for your observable
Verify UCL method assumptions match your data characteristics
Use diagnostic tools (Geweke z-scores, autocorrelation plots) to inspect data
Compare results across multiple UCL methods for consistency
Deadlock or hang inside simulations
If your simulation (e.g., LAMMPS with OpenMP) deadlocks or severely slows down when using kim-convergence, set the following environment variable before launching the simulation:
export KIM_CONV_FORCE_SUBPROC=1
This forces correlation and FFT computations into isolated subprocesses, preventing threading conflicts with the host simulator’s parallelism.
Important performance note:
In production simulations with large datasets: moderate overhead (typically 10–30%).
In unit tests or with small data: extremely high overhead (can be 1000x slower) due to process spawning costs, especially on macOS.
Never set this variable when running tests. It is intended only as an escape hatch for real simulation runs that exhibit threading deadlocks.
If the problem persists after enabling this flag, please open an issue with details about your simulation setup and kim-convergence version.
Debugging Tips
Start simple: Use default parameters first, then customize
Validate inputs: Check data shape, dtype, and range before passing
Use diagnostic outputs: Set
fp='return'to examine detailed statisticsTest with synthetic data: Create known-cases to verify behavior
Check module-specific documentation: Each module may have specific requirements
For further assistance, consult the API documentation or module examples.