epyr.lineshapes.convspec
- epyr.lineshapes.convspec(spectrum, step_size, width, derivative=0, alpha=1.0, phase=0.0)[source]
Convolve spectrum with lineshape functions.
Applies broadening to stick spectra or other discrete data by convolution with Gaussian, Lorentzian, or pseudo-Voigt profiles.
Parameters:
- spectrumarray
Input spectrum to convolve
- step_sizefloat or array
Abscissa step size for each dimension
- widthfloat or array
Full width at half maximum for lineshape
- derivativeint or array, default=0
Derivative order (0=function, 1=first deriv, 2=second deriv)
- alphafloat or array, default=1.0
Shape parameter (1=Gaussian, 0=Lorentzian, 0-1=pseudo-Voigt)
- phasefloat or array, default=0.0
Phase (0=absorption, π/2=dispersion)
Returns:
- array
Convolved spectrum with same shape as input
Examples:
>>> # Simple 1D convolution >>> x = np.linspace(0, 100, 1000) >>> stick_spec = np.zeros_like(x) >>> stick_spec[500] = 1.0 # Delta peak at center >>> broadened = convspec(stick_spec, 0.1, 2.0) # Gaussian, FWHM=2 >>> >>> # Lorentzian broadening >>> lorentz = convspec(stick_spec, 0.1, 2.0, alpha=0.0) >>> >>> # First derivative >>> deriv = convspec(stick_spec, 0.1, 2.0, derivative=1)