Skip to main content

GASFIR (v2.0)

General Approximator for Strong Field Ionization Rates — JAX-native differentiable strong-field ionization rates in gases and solids (Agarwal, Scrinzi & Yakovlev, Phys. Rev. A 113, L021101, 2026).

Documentation: with pip install -e ".[docs]", build via sphinx-build -b html -W docs docs/_build/html, or browse docs/ (start at docs/user_guide/getting_started.rst).

Overview

GASFIR computes sub-cycle ionization rates and total ionization probabilities for arbitrary laser pulses by integrating an oscillatory kernel over a two-dimensional grid of ionization moment t and excursion half-time T. Version 2.0 is built on JAX so that the entire computation is end-to-end differentiable, vectorized across pulses and pump–probe delays, and runs unchanged on CPUs and GPUs:

  • Derivatives with respect to pulse and medium parameters. ∂P/∂(intensity, CEP, FWHM, delay) and ∂P/∂(a0..a6, m_eff, alpha_pol) are available via automatic differentiation — enabling gradient-based pulse characterization, TIPTOE, and NPS waveform retrieval.
  • Unified arbitrary-polarization tensor kernel. Linear (n_pol=1), in-plane elliptical/circular (n_pol=2), and full 3-D (n_pol=3) fields share a single bilinear-form code path, with support for anisotropic inverse effective-mass and Stark polarizability tensors.
  • Precomputed pump–probe, TIPTOE, and NPS setups. PumpProbe, TIPTOE, and NPS precompute the shared grid and field integrals across an entire delay scan with probe-rate Nyquist delay sampling (return_delay_array), evaluating differential ionization yields or orthogonal residual drift currents in vectorized, memory-budgeted batches.
  • About 1.5× faster than GASFIR v1.x on CPU on the same grid (51-pulse scan: 1093 vs. 1652 ms per evaluation at dT = 0.125; benchmarks/RESULTS_v1_speedup.md), and 444× faster on an NVIDIA A100 GPU than a single CPU core on 100-pulse batches (904 pulses/s). The default dT is twice as fine as v1's, to keep a small a1 resolved, so a default evaluation costs more than v1's did.

Parameter fitting (gasfir.retrieval) runs a three-phase pipeline (CMA-ES global search, Levenberg–Marquardt local polish, and Goodman–Weare ensemble MCMC). The local polish defaults to finite differences (lm_fd_step=1e-6), which need no more memory than the residual itself; forward-mode AD ("columnwise" or "batched") remains selectable via RetrievalConfig(lm_jacobian_mode=...).

CHANGELOG.md tracks the release history.

Install

From PyPI

# Core package (ionization kernel, pulses, pump-probe/TIPTOE/NPS, parameter sets)
pip install gasfir

# With parameter retrieval and diagnostic plots
pip install "gasfir[retrieval]"

# With CUDA 12 GPU support
pip install "gasfir[retrieval]" "jax[cuda12]"

From the Git repository (source / development)

git clone https://gitlab.mpcdf.mpg.de/gaf/gasfir.git
cd gasfir
pip install -e ".[dev,docs]"

Or using Conda:

git clone https://gitlab.mpcdf.mpg.de/gaf/gasfir.git
cd gasfir
conda env create -f environment.yml && conda activate gasfir
pip install -e ".[dev,docs]"

Float64 precision is required (jax_enable_x64 is enabled on import) because the kernel integrates an oscillatory phase across many orders of magnitude. Do not install jax-metal on Apple silicon: it lacks float64 support and will silently lose precision. Use the default CPU backend on macOS, or jax[cuda12] on CUDA GPUs.

Quick Start

A probability in three lines (probability_from_pulse builds the grid and field integrals automatically):

from gasfir import create_pulse, get_parameters, probability_from_pulse

pulse  = create_pulse(800.0, 1e14, 0.0, 2.0)   # nm, W/cm², CEP, cycles FWHM
params = get_parameters("H_diabatic")
P      = probability_from_pulse(pulse, params) # 1.064600e-02

Gradients with respect to pulse parameters:

import jax

jax.grad(lambda I: probability_from_pulse(create_pulse(800.0, I, 0.0, 2.0), params))(1e14)
# 5.169048e-16 per W/cm²

When the pulse is fixed and evaluated across many medium parameter sets (e.g. during parameter fitting), precompute the grid and field integrals once with prepare:

from gasfir import Grid, ionization_probability
from gasfir.observables import prepare

t_min, t_max = pulse.time_interval()
grid   = Grid(t_min=t_min, t_max=t_max, dt=2.0, dT=0.25)
fields = prepare(pulse, grid)                            # once-only precomputation
P      = ionization_probability(fields, grid, params.to_kernel_params())

Pump–probe (TIPTOE and NPS):

from gasfir import NPS, TIPTOE, create_pulse

pump = create_pulse(800.0, 1e14, 0.0, 2.0)
probe = create_pulse(800.0, 1e11, 0.0, 4.0)

tiptoe = TIPTOE(pump, probe)
delays = tiptoe.return_delay_array(oversample=8)
diff_yield = tiptoe.signal("H_diabatic", delays)

nps = NPS(pump, probe)
delays_sio2 = nps.return_delay_array(oversample=8)
j_probe = nps.signal("SiO2_Ulmic", delays_sio2, gate_only=True)

Fitting parameters with the retrieval pipeline (pip install "gasfir[retrieval]"):

from gasfir import KernelParams, ionization_probability_batch
from gasfir.retrieval import Parameters, RetrievalConfig, retrieve

params = Parameters()
params.add("a0", 6.5, vary=True, min=1e-6, max=100.0)
params.add("a1", 3.5, vary=False)
params.add("a2", 3.4, vary=True, min=-5.0, max=20.0)
params.add("a3", 3.2, vary=True, min=-5.0, max=20.0)
params.add("a4", -0.5, vary=False)

result = retrieve(residual_fn, params, RetrievalConfig(verbose=True),
                  phases="global,local,mcmc")

From a source checkout with the benchmark datasets, a full end-to-end validation and fitting run (writing corner plots, walker traces, HDF5 chains, and a compilable LaTeX report to benchmarks/validation_H/) can also be launched via:

python benchmarks/scan_retrieval.py --medium H --calibrate \
    --phases global,local,mcmc --mcmc-steps 400

GPU vs CPU Performance

One batch of 100 pulses (2-cycle, 400–1200 nm, 1e14 W/cm², Argon, float64, 4 M kernel elements each), timed as a fit evaluation:

device host cores time (s) pulses/s vs 1 CPU core
Xeon Platinum 8360Y (Icelake) 1 49.2 2.0 1×
Xeon Platinum 8360Y (Icelake) 2 24.7 4.0 2.0×
NVIDIA A100 40 GB 1 0.111 904 444×
  • One A100 matches ~440 CPU cores for this kernel; CPU scaling is linear (2 cores = 2.0×) in the measured range.
  • The GPU needs one host core. 1 and 18 host cores yield the same runtime, with minimal host CPU utilization while the GPU computes.
  • Full-rate float64 throughput is critical: consumer GPUs with 1/32-rate float64 (e.g., Quadro P400, 17.7 s on the same batch) are slower than CPU.

Full benchmark details and caveats: benchmarks/RESULTS_raven.md.

The layered design

An optimizer step should recompute as little as possible:

Layer What Reruns when
0 Pulse pulse parameters (differentiable leaves) —
1 PulseFields dense-grid A, E, ∫A, ∫AᵢAⱼ, ∫EᵢEⱼ pulse changes
2 ContractedFields mass / polarizability tensors folded in m_eff, α change
3 kernel the (n_T × n_t) hot loop every parameter update

Fitting a0…a6 pays only Layer 3. The integrals are stored as tensors rather than pre-contracted scalars so that fitting an anisotropic mass does not invalidate Layer 1.

A pulse is defined by a single vector potential function A(t). The electric field E(t) = −dA/dt is computed via jax.jacfwd, and the quadratic field moments are integrated via mean-detrended cumulative Simpson quadrature.

Development

black --check src tests benchmarks docs && isort --check-only src tests benchmarks docs
flake8 src tests benchmarks
mypy src/gasfir
pytest tests/ -m "not slow"
sphinx-build -b html -W docs docs/_build/html

pre-commit install --hook-type pre-commit --hook-type pre-push runs the formatters on commit.

The test suite is property-based: published constants, analytic limits, round trips and invariants. See docs/development/contributing.rst for contributor guidelines, and docs/examples/performance.rst for default optimizations and memory tuning.

Metadata

Release files for gasfir 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gasfir 2.0.0
File Size Uploaded Provenance Actions
gasfir-2.0.0.tar.gz 2.6 MB Without provenance Details for gasfir-2.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gasfir 2.0.0
File Interpreter ABI Platform Actions
gasfir-2.0.0-py3-none-any.whl Python 3 none any Details for gasfir-2.0.0-py3-none-any.whl

Total release size: 2.8 MB

Release files / gasfir-2.0.0.tar.gz

Download URL gasfir-2.0.0.tar.gz
Size 2.6 MB
Tags Source
SHA-256 checksum
How to use checksums
de36b2c747384f34c12d53c9646f1f894dfc0f25c715dbd43a2f754f68deebef
BLAKE2b-256 checksum
How to use checksums
c159b4ad1947e74b65d43aea16ac89edd2201a1ab5537c29c94e876bb1228eff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release files / gasfir-2.0.0-py3-none-any.whl

Download URL gasfir-2.0.0-py3-none-any.whl
Size 156.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cf08e83b1965606bac2642c550b2308f21c8b2486bba82a226e491edfced5c68
BLAKE2b-256 checksum
How to use checksums
498aaf4d970683f2daf62d6ba647ccf64be5668f95e38713fb41a342e8f062b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Security for gasfir 2.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page