Instruction for AEcroscoPy WaveGenerator#
\(_{Yongtao}\) \(_{Liu,}\) \(_{liuy3@ornl.gov}\)
\(_{February}\) \(_{2026}\)
Overview#
WaveGenerator is the AEcroscoPy module for building voltage waveforms to be output through the DAQ card. It provides factory functions for common waveform shapes used in scanning probe microscopy experiments, including square pulses, chirp sweeps, triangular FORC waveforms, and Band Excitation (BE) excitation signals.
All generator functions return (t, wave) — a time array and the corresponding voltage array — which can be plotted with matplotlib or passed directly to PyWaveVI for hardware output.
Import#
from aecroscopywave.wavebuilding import WaveGenerator
import matplotlib.pyplot as plt
Square Wave#
Generates a continuous square wave at a specified frequency and amplitude. Useful for periodic modulation or testing.
# Generate a 10 Hz square wave, 2V amplitude, 50% duty cycle
t, wave = WaveGenerator.square_wave(frequency=10, amplitude=2.0, duty=0.5, duration=0.1)
plt.figure()
plt.plot(t, wave)
plt.show()
Square Pulse (Single)#
Generates a single voltage pulse with configurable rise time, hold time, and fall time. Commonly used for domain switching in ferroelectric experiments.
# Single 5V pulse: 0.1s 0V → 0.5s xV → 0.1s 0V
t, wave = WaveGenerator.square_pulse(amplitude=5.0, pulse_duration=(0.1, 0.5, 0.1))
plt.figure()
plt.plot(t, wave)
plt.show()
Square Pulse (Multiple)#
Generates a train of repeated pulses. Specify num_pulses to repeat the same pulse waveform multiple times.
# 5 pulses with same timing
t, wave = WaveGenerator.square_pulse(amplitude=2.0, pulse_duration=(0.05, 0.2, 0.05),
repeats=5)
plt.figure()
plt.plot(t, wave)
plt.show()
Chirp Wave#
Generates a frequency-swept sinusoidal wave (chirp) from frequency_start to frequency_end. Used for frequency response characterization.
# Sweep from 100 Hz to 1000 Hz over 2 seconds
t, wave = WaveGenerator.chirp_wave(frequency_start=100, frequency_end=1000,
duration=2.0, amplitude=1.0)
plt.plot(t, wave)
plt.show()
Multi-Frequency Wave#
Generates a superposition of multiple sinusoidal components, each with its own frequency and amplitude. Useful for intermodulation or multi-frequency imaging experiments.
# Two frequencies for beat/intermodulation testing
components = [(1000, 1.0), (1100, 1.0)] # (frequency_Hz, amplitude)
t, wave = WaveGenerator.composite_wave(components, duration=0.01)
# Results in 100 Hz beat frequency
plt.plot(t, wave)
plt.show()
Triangular Wave#
Generates a triangular (sawtooth-like) voltage sweep over a specified number of cycles and amplitude. Used in FORC-style measurements and bias spectroscopy.
# # 5 cycles with fine discretization
steps, wave = WaveGenerator.triangular(
cycle_amplitude=10.0,
cycle_number=5,
steps_per_cycle=64,
points_per_step=10 # Dwell time per voltage
)
plt.plot(steps, wave)
plt.show()
Triangular Modulated Pulse#
Combines a triangular voltage envelope with a pulsed modulation at each step. Useful for switching spectroscopy with interleaved read pulses.
# Each voltage step: 100 samples ON, 100 samples OFF
steps, wave = WaveGenerator.triangular_modulated_pulse(
cycle_amplitude=10.0,
steps_per_cycle=32,
points_per_step=100)
plt.plot(steps, wave)
plt.show()
FORC Wave#
Generates a First-Order Reversal Curve (FORC) waveform with a configurable number of amplitude steps. Used to map hysteresis and switching distributions in ferroelectrics.
# 10 amplitude steps from 1V to 10V
steps, wave = WaveGenerator.forc(
forc_segment_number=10,
forc_start_amplitude=1.0,
forc_end_amplitude=10.0,
steps_per_cycle=32)
plt.plot(steps, wave)
plt.show()
FORC Modulated Pulse#
Combines a FORC voltage sweep with a modulated pulse at each step, allowing simultaneous switching and readout.
# Pulsed FORC with 10 amplitude steps
steps, wave = WaveGenerator.forc_modulated_pulse(
forc_segment_number=10,
forc_start_amplitude=2.0,
forc_end_amplitude=10.0,
steps_per_cycle=32,
points_per_step=50 # 50 ON + 50 OFF per step
)
plt.plot(steps, wave)
plt.show()