epyr.lineshapes.lineshape_class
Unified Lineshape class for EPR spectroscopy
Provides a single interface for all lineshape types with consistent API.
Functions
|
Create Gaussian lineshape |
|
Create Lorentzian lineshape |
|
Create pseudo-Voigt lineshape |
|
Create Voigt lineshape |
Classes
|
Unified lineshape class for EPR spectroscopy. |
- class epyr.lineshapes.lineshape_class.Lineshape(shape_type='gaussian', width=1.0, alpha=1.0, derivative=0, phase=0.0, normalize=True)[source]
Unified lineshape class for EPR spectroscopy.
This class provides a consistent interface for generating all types of EPR lineshapes including Gaussian, Lorentzian, Voigt, and pseudo-Voigt profiles with support for derivatives, phase rotation, and convolution.
Parameters:
- shape_typestr, default=’gaussian’
Type of lineshape (‘gaussian’, ‘lorentzian’, ‘voigt’, ‘pseudo_voigt’)
- widthfloat or tuple
Full width at half maximum - For single shapes: float - For Voigt: (gaussian_width, lorentzian_width) - For pseudo-Voigt: float (both components use same width)
- alphafloat, default=1.0
Shape parameter for pseudo-Voigt (1=Gaussian, 0=Lorentzian)
- derivativeint, default=0
Derivative order (0, 1, 2, or -1 for integral)
- phasefloat, default=0.0
Phase rotation in radians (0=absorption, π/2=dispersion)
- normalizebool, default=True
Whether to maintain area normalization
Examples:
>>> # Create Gaussian lineshape >>> gauss = Lineshape('gaussian', width=5.0) >>> x = np.linspace(-10, 10, 100) >>> y = gauss(x, center=0) >>> >>> # Lorentzian with first derivative >>> lorentz_deriv = Lineshape('lorentzian', width=4.0, derivative=1) >>> y_deriv = lorentz_deriv(x, center=2) >>> >>> # Voigt profile with different widths >>> voigt = Lineshape('voigt', width=(3.0, 2.0)) >>> y_voigt = voigt(x, center=0) >>> >>> # Pseudo-Voigt 50/50 mix >>> pv = Lineshape('pseudo_voigt', width=5.0, alpha=0.5) >>> y_pv = pv(x, center=0)
- SUPPORTED_SHAPES = {'gaussian': <function gaussian>, 'general': <function lshape>, 'lorentzian': <function lorentzian>, 'pseudo_voigt': <function pseudo_voigt>, 'voigt': <function voigtian>}
- __init__(shape_type='gaussian', width=1.0, alpha=1.0, derivative=0, phase=0.0, normalize=True)[source]
- __call__(x, center, **override_params)[source]
Generate lineshape at specified points.
Parameters:
- xarray
Abscissa points
- centerfloat
Peak center position
- **override_paramsdict
Parameters to override for this call only
Returns:
- array
Lineshape values
- both_components(x, center)[source]
Generate both absorption and dispersion components.
Returns:
- tuple
(absorption, dispersion) arrays
- epyr.lineshapes.lineshape_class.create_gaussian(width=1.0, **kwargs)[source]
Create Gaussian lineshape
- epyr.lineshapes.lineshape_class.create_lorentzian(width=1.0, **kwargs)[source]
Create Lorentzian lineshape