Spectra#
classes for storing signal data and plotting various spectra (IR, UV/vis, etc.)
- class AaronTools.spectra.Signal(x_var, **kwargs)#
parent class for each signal in a spectrum
- class AaronTools.spectra.Signals(data, style='gaussian', *args, **kwargs)#
parent class for storing data for different signals in the spectrum and plotting a simulated spectrum
- parse_gaussian_lines(lines, *args, **kwargs)#
parse data from Gaussian output files related to this spectrum
- parse_orca_lines(lines, *args, **kwargs)#
parse data from ORCA output files related to this spectrum
- parse_psi4_lines(lines, *args, **kwargs)#
parse data from Psi4 output files related to this spectrum
- parse_qchem_lines(lines, *args, **kwargs)#
parse data from Q-Chem output files related to this spectrum
- filter_data(signal)#
used to filter out some data from the spectrum (e.g. imaginary modes from an IR spec) return False if signal should not be in the spectrum
- get_spectrum_functions(fwhm=15.0, peak_type='pseudo-voigt', voigt_mixing=0.5, scalar_scale=0.0, linear_scale=0.0, quadratic_scale=0.0, intensity_attr='intensity', data_attr='data')#
returns a list of functions that can be evaluated to produce a spectrum
- Parameters:
fwhm (float) – full width at half max of each peak
peak_type (str) – gaussian, lorentzian, pseudo-voigt, or delta
voigt_mixing (float) – ratio of pseudo-voigt that is gaussian
scalar_scale (float) – shift x data
linear_scale (float) – scale x data
quadratic_scale (float) –
scale x data
x’ = (1 - linear_scale * x - quadratic_scale * x^2 - scalar_scale)
intensity_attr (str) – attribute of Signal used for the intensity of that signal
data_attr (str) – attribute of self for the list of Signal()
- static get_plot_data(functions, signal_centers, point_spacing=None, transmittance=False, peak_type='pseudo-voigt', normalize=True, fwhm=15.0, change_x_unit_func=None, show_functions=None)#
- Returns:
arrays of x_values, y_values for a spectrum
- Parameters:
point_spacing (float) – spacing between points, default is higher resolution around each peak (i.e. not uniform) this is pointless if peak_type == delta
fwhm (float) – full width at half max
transmittance (bool) – if true, take 10^(2 - y_values) before returning to get transmittance as a %
peak_type (str) – pseudo-voigt, gaussian, lorentzian, or delta
voigt_mixing (float) – fraction of pseudo-voigt that is gaussian
linear_scale (float) – subtract linear_scale * frequency off each mode
quadratic_scale (float) – subtract quadratic_scale * frequency^2 off each mode
- classmethod plot_spectrum(figure, x_values, y_values, other_y_values=None, other_y_style=None, centers=None, widths=None, exp_data=None, reverse_x=None, y_label=None, plot_type='transmittance', x_label='wavenumber (cm$^{-1}$)', peak_type='pseudo-voigt', rotate_x_ticks=False)#
plot the x_data and y_data on figure (matplotlib figure) this is intended for IR spectra
- Parameters:
centers (np.ndarray) –
array-like of float, plot is split into sections centered on the frequency specified by centers
default is to not split into sections
widths (np.ndarray) – array-like of float, defines the width of each section
exp_data (list) – other data to plot should be a list of (x_data, y_data, color)
reverse_x (bool) – if True, 0 cm^-1 will be on the right
- classmethod get_mixed_signals(signal_groups, weights, fractions=None, data_attr='data', **kwargs)#
get signals for a mixture of components or conformers
- Parameters:
signal_groups (list(Signal)|list(list(Signal))) –
list of Signals() instances or list of lists of Signals()
a list of Signals() is a group of conformers
a list of lists of Signals() are the different components
weights (iterable) – weights for each conformer, organized according to signal_groups
fractions (iterable) – fraction of each component in the mixture default: all components have equal fractions
data_attr (str) – attribute of Signals() for data
kwargs – passed to cls.__init__, along with a new list of data
- class AaronTools.spectra.HarmonicVibration(x_var, **kwargs)#
- class AaronTools.spectra.AnharmonicVibration(x_var, **kwargs)#
- class AaronTools.spectra.Frequency(*args, harmonic=True, hpmodes=None, **kwargs)#
for spectra in the IR/NIR region based on vibrational modes
- parse_gaussian_lines(lines, *args, hpmodes=None, harmonic=True, **kwargs)#
parse data from Gaussian output files related to this spectrum
- parse_qchem_lines(lines, *args, **kwargs)#
parse data from Q-Chem output files related to this spectrum
- parse_orca_lines(lines, *args, **kwargs)#
parse lines of orca output related to frequency hpmodes is not currently used
- parse_psi4_lines(lines, *args, **kwargs)#
parse lines of psi4 output related to frequencies hpmodes is not used
- filter_data(signal)#
used to filter out some data from the spectrum (e.g. imaginary modes from an IR spec) return False if signal should not be in the spectrum
- plot_ir(figure, centers=None, widths=None, exp_data=None, plot_type='transmittance', peak_type='pseudo-voigt', reverse_x=True, y_label=None, point_spacing=None, normalize=True, fwhm=15.0, anharmonic=False, rotate_x_ticks=False, show_functions=None, **kwargs)#
plot IR data on figure
- Parameters:
figure (matplotlib.pyplot.Figure) – matplotlib figure
centers (np.ndarray) –
array-like of float, plot is split into sections centered on the frequency specified by centers
default is to not split into sections
widths (np.ndarray) – array-like of float, defines the width of each section
exp_data (list) –
other data to plot
should be a list of (x_data, y_data, color)
reverse_x (bool) – if True, 0 cm^-1 will be on the right
plot_type (str) – see Frequency.get_plot_data
peak_type (str) – any value allowed by Frequency.get_plot_data
kwargs – keywords for Frequency.get_spectrum_functions
- class AaronTools.spectra.ValenceExcitation(x_var, **kwargs)#
- class AaronTools.spectra.SOCExcitation(x_var, **kwargs)#
- class AaronTools.spectra.TransientExcitation(*args, **kwargs)#
- class AaronTools.spectra.ValenceExcitations(*args, **kwargs)#
for UV/vis data, primarily from TD-DFT
- parse_gaussian_lines(lines, *args, **kwargs)#
parse data from Gaussian output files related to this spectrum
- parse_orca_lines(lines, *args, **kwargs)#
parse data from ORCA output files related to this spectrum
- parse_psi4_lines(lines, *args, **kwargs)#
parse data from Psi4 output files related to this spectrum
- parse_qchem_lines(lines, *args, **kwargs)#
parse data from Q-Chem output files related to this spectrum
- static nm_to_ev(x)#
convert x nm to eV
- static ev_to_nm(x)#
convert x eV to nm
- plot_uv_vis(figure, centers=None, widths=None, exp_data=None, plot_type='uv-vis-veloctiy', peak_type='gaussian', reverse_x=False, y_label=None, point_spacing=None, normalize=True, fwhm=15.0, units='nm', rotate_x_ticks=False, show_functions=None, transient=False, **kwargs)#
plot IR data on figure
- Parameters:
figure (matplotlib.pyplot.Figure) – matplotlib figure
centers (np.ndarray) –
array-like of float, plot is split into sections centered on the frequency specified by centers
default is to not split into sections
widths (np.ndarray) – array-like of float, defines the width of each section
exp_data (list) –
other data to plot
should be a list of (x_data, y_data, color)
reverse_x (bool) – if True, 0 cm^-1 will be on the right
plot_type (str) – see Frequency.get_plot_data
peak_type (str) – any value allowed by Frequency.get_plot_data
kwargs – keywords for Frequency.get_spectrum_functions