Attoworld Library for Attosecond Science

2026.1.2 · active · verified Thu Apr 16

The `attoworld` library provides essential tools for attosecond science, developed by the Attosecond science group at the Max Planck Institute of Quantum Optics. It offers functionalities for data acquisition, processing, and analysis in areas like FROG (Frequency-resolved optical gating) and time-frequency analysis. The library is actively maintained with frequent releases, often several per month or quarter, following a `YYYY.minor.patch` versioning scheme.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to load a FROG trace from a file (or create a dummy one), configure the reconstruction settings using `FROG_CONFIG`, and perform a basic FROG reconstruction to obtain the reconstructed pulse intensity.

import numpy as np
import os
from attoworld.frog.interface import FROG
from attoworld.frog.frog_config import FROG_CONFIG

# 1. Create a dummy FROG trace file for demonstration
dummy_file_path = "dummy_frog_trace.dat"
delay_axis = np.linspace(-100, 100, 128) # fs
freq_axis = np.linspace(2.0, 4.0, 128) # PHz
dummy_trace = np.random.rand(128, 128) * 100 + 10 # Base noise
dummy_trace[40:80, 40:80] += 500 # Add a feature to the trace

with open(dummy_file_path, "w") as f:
    f.write("# FROG trace data\n")
    f.write(f"# delay_axis {delay_axis.min()} {delay_axis.max()} {len(delay_axis)}\n")
    f.write(f"# freq_axis {freq_axis.min()} {freq_axis.max()} {len(freq_axis)}\n")
    np.savetxt(f, dummy_trace)

# 2. Initialize FROG processor and load the trace
frog_processor = FROG()
frog_processor.load_trace(dummy_file_path)

# 3. Configure FROG reconstruction settings
config = FROG_CONFIG()
config.max_iter = 10 # Keep iterations low for quick execution
config.pulse_width_estimate_fs = 50
config.wavelength_center_nm = 800
config.delay_steps = len(delay_axis)
config.freq_steps = len(freq_axis)
config.delay_max = delay_axis.max()
config.delay_min = delay_axis.min()
config.freq_max = freq_axis.max()
config.freq_min = freq_axis.min()

# 4. Perform reconstruction
print("Starting FROG reconstruction...")
frog_processor.reconstruct(config)
print("Reconstruction complete.")

# 5. Access results
reconstructed_pulse_intensity = frog_processor.reconstructed_intensity
print(f"Reconstructed pulse intensity shape: {reconstructed_pulse_intensity.shape}")

# 6. Clean up the dummy file
os.remove(dummy_file_path)

view raw JSON →