Physical units and pulse area¶
After the atom model, check the units before setting a waveform. CASCAQit uses µm for coordinates, µs for time, rad/µs for angular frequencies and radians for phase. A float does not carry these units automatically; the API's stated convention determines its meaning.
One MHz is one cycle per microsecond. An angular frequency counts radians, so Ω [rad/µs] = 2π f [MHz]. Mixing these two frequency conventions changes the experiment by a factor of 2π.
"""Convert a cyclic frequency to an angular frequency before choosing a pulse."""
from __future__ import annotations
import json
from math import pi, sin
def experiment() -> dict[str, object]:
frequency_mhz, duration_us = 1.0, 0.5
omega = 2 * pi * frequency_mhz
correct_area = omega * duration_us
mistaken_area = frequency_mhz * duration_us
return {
"frequency_mhz": frequency_mhz,
"omega_rad_per_us": omega,
"duration_us": duration_us,
"pulse_area_rad": correct_area,
"on_resonance_excitation": sin(correct_area / 2) ** 2,
"excitation_if_2pi_is_omitted": sin(mistaken_area / 2) ** 2,
}
if __name__ == "__main__":
print(json.dumps(experiment(), sort_keys=True))
python examples/learning/foundations/physical_units.py
{
"duration_us": 0.5,
"excitation_if_2pi_is_omitted": 0.06120871905481365,
"frequency_mhz": 1.0,
"omega_rad_per_us": 6.283185307179586,
"on_resonance_excitation": 1.0,
"pulse_area_rad": 3.141592653589793
}
For a resonant isolated two-level system, the pulse area is Ωt and the excitation probability is sin²(Ωt/2). At f = 1 MHz and t = 0.5 µs, the area is π and the excitation probability is one. Omitting 2π produces a probability near 0.061 instead. The formula is a reference for this simple model, not a general prediction for an interacting array.
Make conversions visible¶
Write the converted value into a clearly named variable, such as omega_rad_per_us, before passing it to Waveform.constant. Avoid burying conversion factors inside several expressions. Record the original quantity and its unit in the experiment notes.
Exercise: a paper gives a drive frequency as Ω/(2π) = 2 MHz. What value belongs in the SDK's angular-frequency field? How long is an ideal resonant π pulse at that drive?
Answer
Use Ω = 4π rad/µs. A π pulse lasts π/Ω = 0.25 µs. Check whether a source reports Ω or Ω/(2π); the symbol alone is not enough. A Target may impose further duration or amplitude constraints, so the physical calculation does not replace program validation.
Next: noise, sampling and numerical precision. The shared physical conventions reference is the place to check SDK units.