A specialized Python toolkit for fitting Josephson junction current-phase relationships with background polynomial terms using automatic frequency detection via Lomb-Scargle periodogram and parameter optimization with lmfit.
This toolkit implements fitting for three types of Josephson junction equations:
I_s(Φ_ext) = I_c·sin(2πf(Φ_ext-d)-φ₀) / √(1-T·sin²((2πf(Φ_ext-d)-φ₀)/2)) + k(Φ_ext-d)² + r(Φ_ext-d) + C
I_s(Φ_ext) = I_c·[sin(2πf(Φ_ext-d)-φ₀) + sin²(2×(2πf(Φ_ext-d)-φ₀))/2] / √(1-T·sin²((2πf(Φ_ext-d)-φ₀)/2)) + k(Φ_ext-d)² + r(Φ_ext-d) + C
I_s(Φ_ext) = I_c·[sin(2πf(Φ_ext-d)-φ₀) + sin²(2×(2πf(Φ_ext-d)-φ₀))/2 + sin³(3×(2πf(Φ_ext-d)-φ₀))/3] / √(1-T·sin²((2πf(Φ_ext-d)-φ₀)/2)) + k(Φ_ext-d)² + r(Φ_ext-d) + C
All models describe the total measured current (I_s) as a function of an external controlling parameter (Φ_ext) in Josephson junction systems, combining:
- Josephson component: Non-sinusoidal current-phase relationship with junction transparency effects
- Background component: Quadratic polynomial representing systematic effects and noise
The higher-order models include additional harmonic contributions that can arise from:
- Higher-order tunneling processes
- Complex multi-mode coupling
- Strongly anharmonic junction potentials
- Non-equilibrium superconducting states
- Multi-junction array effects
- 🔬 Advanced Josephson Junction Analysis: Complex current-phase characteristics
- 🧲 Quantum Interference Devices: SQUID arrays and complex geometries
- ⚡ Nonlinear Superconducting Circuits: Transmon qubits, flux qubits
- 📊 Harmonic Analysis: Multi-mode and anharmonic effects
- 🔄 Higher-Order Physics: Third-order tunneling and coupling effects
- 🎯 Model Selection: Determining optimal complexity for physical systems
pip install numpy matplotlib scipy astropy lmfitRequired packages:
- numpy >= 1.19.0
- matplotlib >= 3.3.0
- scipy >= 1.5.0
- astropy >= 4.0.0
- lmfit >= 1.0.0
| Parameter | Symbol | Physical Meaning | Typical Range |
|---|---|---|---|
| Ic | I_c | Critical current (maximum superconducting current) | 1nA - 1mA |
| T | T | Junction transparency (0-1) | 0.0 - 0.99 |
| f | f | Conversion factor (Φ_ext to phase scaling) | 0.01 - 10.0 |
| d | d | Horizontal shift (zero-point offset) | -10.0 - 10.0 |
| phi0 | φ₀ | Intrinsic phase offset (radians) | -π - π |
| k | k | Quadratic background coefficient | -1.0 - 1.0 |
| r | r | Linear background coefficient | -10.0 - 10.0 |
| C | C | Overall current offset | -10.0 - 10.0 |
import numpy as np
from josephson_fit import JosephsonFitter
import matplotlib.pyplot as plt
# Load your data
phi_ext = np.loadtxt('your_data.txt', usecols=0)
current = np.loadtxt('your_data.txt', usecols=1)
# Create fitter instance
fitter = JosephsonFitter()
# Fit with Model 1 (Standard Josephson Junction)
result1 = fitter.fit_model1(phi_ext, current)
# Fit with Model 2 (Second-Order)
result2 = fitter.fit_model2(phi_ext, current)
# Fit with Model 3 (Third-Order)
result3 = fitter.fit_model3(phi_ext, current)
# Compare models and select best fit
best_model = fitter.compare_models([result1, result2, result3])
# Plot results
fitter.plot_fit_comparison(phi_ext, current, [result1, result2, result3])
plt.show()- 🔍 Automatic Frequency Detection: Uses Lomb-Scargle periodogram for initial parameter estimation
- 🎯 Robust Parameter Optimization: Leverages lmfit for non-linear least squares fitting
- 📈 Model Comparison: Statistical tools for selecting optimal model complexity
- 🎨 Visualization: Comprehensive plotting utilities for data analysis
- 📊 Error Analysis: Uncertainty propagation and confidence interval estimation
- 🔧 Flexible Interface: Easy-to-use API with sensible defaults
See the examples/ directory for detailed usage examples:
basic_fitting.py: Simple fitting workflowadvanced_analysis.py: Parameter uncertainty analysismodel_comparison.py: Comparing different model orderssynthetic_data.py: Working with simulated data
MIT License - see LICENSE file for details.
Contributions welcome! Please see CONTRIBUTING.md for guidelines.