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
Attributes:
data
style
lines
- 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
- classmethod get_mixed_signals(*args, 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
- 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, orca_version=6, **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 UV/vis 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) – what type of data to plot: uv-vis, uv-vis-velocity, ecd, ecd-velocity, transmittance, transmittance-velocity
peak_type (str) – any value allowed by
Signals.get_plot_datakwargs – keywords for
Signals.get_spectrum_functions
most other input is passed to
Signals.plot_spectrum
- class AaronTools.spectra.Shift(x_var, **kwargs)¶
- class AaronTools.spectra.NMR(*args, n_atoms=0, coupling=None, **kwargs)¶
- parse_orca_lines(lines, *args, **kwargs)¶
parse data from ORCA output files related to this spectrum
- parse_gaussian_lines(lines, *args, **kwargs)¶
parse data from Gaussian output files related to this spectrum
- classmethod get_mixed_signals(signal_groups, weights, data_attr='data', **kwargs)¶
get signals for a mixture of components or conformers
- Parameters:
signal_groups (list(Signal)) –
list of Signals() instances or list of lists of Signals()
a list of Signals() is a group of conformers
weights (iterable) – weights for each conformer, organized according to signal_groups
data_attr (str) – attribute of Signals() for data
kwargs – passed to cls.__init__, along with a new list of data
- get_spectrum_functions(fwhm=2.5, peak_type='lorentzian', voigt_mixing=0.5, scalar_scale=0.0, linear_scale=-1.0, quadratic_scale=0.0, intensity_attr='intensity', data_attr='data', pulse_frequency=60.0, equivalent_nuclei=None, geometry=None, graph=None, coupling_threshold=0.0, element='H', couple_with=('H', 'Li', 'Be', 'B', 'F', 'Na', 'Al', 'P', 'Cl', 'K', 'Sc', 'V', 'Mn', 'Co', 'Cu', 'Ga', 'As', 'Br', 'Rb', 'Y', 'Nb', 'Rh', 'Ag', 'In', 'Sb', 'I', 'Xe', 'Cs', 'La', 'Pr', 'Pm', 'Eu', 'Tb', 'Dy', 'Ho', 'Tm', 'Lu', 'Ta', 'Re', 'Ir', 'Pt', 'Au'), shifts_only=False)¶
returns a list of functions that can be evaluated to produce a spectrum
- Parameters:
fwhm (float) – full width at half max of each peak (Hz)
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’ = scalar_scale - linear_scale * x - quadratic_scale * x^2
intensity_attr (str) – attribute of Signal used for the intensity of that signal
data_attr (str) – attribute of self for the list of Signal()
pulse_frequency (float) – magnet pulse frequency (megahertz)
equivalent_nuclei (list) – list of lists of equivalent nuclei
geometry (Geometry) – used to determine equivalent nuclei if equivalent_nuclei is not given
graph (list) – used to determine equivalent nuclei if given. See
Geometry.get_graphfor example graphs.coupling_threshold (float) – coupling threshold for whether or not to split into multiplet
element (list) – include signals with these specified elements
couple_with (list) – list of element symbols to use when determining which nuclei cause splitting
shifts_only (bool) – only determine centers of shifts and not complete splitting pattern
For nuclei to be coupling-equivalent, the must be equivalent nuclei, the same number of bonds away from the coupled nucleus, and the sign of their coupling constant must be the same.
- plot_nmr(figure, centers=None, widths=None, exp_data=None, plot_type='nmr', peak_type='lorentzian', reverse_x=True, y_label=None, point_spacing=None, normalize=False, fwhm=2.5, rotate_x_ticks=False, show_functions=None, pulse_frequency=60.0, scalar_scale=0.0, linear_scale=-1.0, quadratic_scale=0.0, **kwargs)¶
plot NMR 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
Signals.get_plot_datapeak_type (str) – any value allowed by
Signals.get_plot_datapulse_frequency (float) – pulse frequency in MHz
kwargs – keywords for
NMR.get_spectrum_functions
other keyword arguments are passed to
NMR.get_spectrum_functionsorSignals.plot_spectrum