tesliper.glassware.spectra
Objects representing spectra.
Classes
|
Represents a single spectrum: experimental, averaged from set of conformers, or calculated for only one conformer. |
|
Represents a collection of spectra calculated for a number of conformers. |
- class tesliper.glassware.spectra.SingleSpectrum(genre: str, values: Sequence[float], abscissa: Sequence[float], width: float = 0.0, fitting: str = 'n/a', scaling: float = 1.0, offset: float = 0.0, filenames: Optional[Sequence[str]] = None, averaged_by: Optional[str] = None)[source]
Represents a single spectrum: experimental, averaged from set of conformers, or calculated for only one conformer.
Notes
Calling
len()on this class’ instance will show a number of data points in the spectrum.- Parameters
genre (str) – Name of data genre that this object represents.
values (Sequence[float]) – List of intensity values for each point on the x-axis.
abscissa (Sequence[float]) – List of x-axis values.
width (float, optional) – Full width at half maximum used to calculate spectrum, if applies. Provided for the record only, by default 0.0.
fitting (str, optional) – Name of the fitting function used to calculate spectrum, if applies. Provided for the record only, by default “n/a”.
scaling (float, optional) – Multiplyier for correction of signal intensity, by default 1.0.
offset (float, optional) – Correction of the spectrum’s shift. Positive value indicates a bathochromic shift, negative value indicates a hypsochromic shift. By default 0.0.
filenames (Optional[Sequence[str]], optional) – List of identifiers of conformers that were used to calculate average spectrum, if applies.
averaged_by (Optional[str], optional) – Energies genre used to calculate average spectrum, if applies.
- property spectra_type
‘vibrational’, ‘electronic’, or ‘scattering’.
- Type
Returns type of spectra
- property units: Dict[str, str]
Units in which spectral data is stored. It provides a unit for
width,start,stop,step,x, andy.abscissaandvaluesare stored in the same units asxandyrespectively.
- property scaling: Union[int, float]
A factor for correcting the scale of spectra. Setting it to new value changes the
yattribute as well. It should be anintorfloat.
- property offset: Union[int, float]
A factor for correcting the shift of spectra. Positive value indicates a bathochromic shift, negative value indicates a hypsochromic shift. Setting it to new value changes the
xattribute as well. It should be anintorfloat.
- scale_to(spectrum: tesliper.glassware.spectra.SingleSpectrum) None[source]
Establishes a scaling factor to best match a scale of the spectrum values.
- Parameters
spectrum (SingleSpectrum) – This spectrum’s y-axis values will be treated as a reference. If spectrum has its own scaling factor, it will be taken into account.
- shift_to(spectrum: tesliper.glassware.spectra.SingleSpectrum) None[source]
Establishes an offset factor to best match given spectrum.
- Parameters
spectrum (SingleSpectrum) – This spectrum will be treated as a reference. If spectrum has its own offset factor, it will be taken into account.
- class tesliper.glassware.spectra.Spectra(genre: str, filenames: Sequence[str], values: Sequence[Sequence[float]], abscissa: Sequence[float], width: float = 0.0, fitting: str = 'n/a', scaling: float = 1.0, offset: float = 0.0, allow_data_inconsistency: bool = False)[source]
Represents a collection of spectra calculated for a number of conformers.
Changed in version 0.9.1: Corrected
len()behavior.Notes
Calling
len()on this class’ instance will show how many conformers’ spectra it contains.- Parameters
genre (str) – Name of data genre that this object represents.
filenames (Optional[Sequence[str]], optional) – List of conformers’ identifiers that were used to calculate spectra.
values (Sequence[float]) – List of intensity values for each point on the x-axis.
abscissa (Sequence[float]) – List of x-axis values.
width (float, optional) – Full width at half maximum used to calculate spectra. Provided for the record only, by default 0.0.
fitting (str, optional) – Name of the fitting function used to calculate spectra. Provided for the record only, by default “n/a”.
scaling (float, optional) – Multiplyier for correction of signal intensity, by default 1.0.
offset (float, optional) – Correction of the spectra’s shift. Positive value indicates a bathochromic shift, negative value indicates a hypsochromic shift. By default 0.0.
allow_data_inconsistency (bool, optional) – Flag signalizing if instance should allow data inconsistency (see
ArrayPropetyfor details).
- property offset: Union[int, float]
A factor for correcting the shift of spectra. Positive value indicates a bathochromic shift, negative value indicates a hypsochromic shift. Setting it to new value changes the
xattribute as well. It should be anintorfloat.
- property scaling: Union[int, float]
A factor for correcting the scale of spectra. Setting it to new value changes the
yattribute as well. It should be anintorfloat.
- property spectra_type
‘vibrational’, ‘electronic’, or ‘scattering’.
- Type
Returns type of spectra
- property units: Dict[str, str]
Units in which spectral data is stored. It provides a unit for
width,start,stop,step,x, andy.abscissaandvaluesare stored in the same units asxandyrespectively.
- average(energies: tesliper.glassware.arrays.Energies) tesliper.glassware.spectra.SingleSpectrum[source]
A method for averaging spectra by population of conformers. If this object is empty, averaged spectrum will be a flat line at 0.0 intensity.
- Parameters
energies (Energies) – Object with
populationsandgenreattributes containing respectively: list of populations values asnumpy.ndarrayand string specifying energy genre.- Returns
Averaged spectrum.
- Return type
- scale_to(spectrum: tesliper.glassware.spectra.SingleSpectrum, average_by: Optional[tesliper.glassware.arrays.Energies] = None) None[source]
Establishes a scaling factor to best match a scale of the spectrum values. An average spectrum is calculated prior to calculating the factor. If average_by is given, it is used to average by population of each conformer. Otherwise an arithmetic average of spectra is calculated, which may lead to inaccurate results.
- Parameters
spectrum (SingleSpectrum) – This spectrum’s y-axis values will be treated as a reference. If spectrum has its own scaling factor, it will be taken into account.
average_by (Energies, optional) – Energies object, used to calculate average spectrum prior to calculating the factor. If not given, a simple arithmetic average of the spectra will be calculated.
- shift_to(spectrum: tesliper.glassware.spectra.SingleSpectrum, average_by: Optional[tesliper.glassware.arrays.Energies] = None) None[source]
Establishes an offset factor to best match given spectrum. An average spectrum is calculated prior to calculating the factor. If average_by is given, it is used to average by population of each conformer. Otherwise an arithmetic average of spectra is calculated, which may lead to inaccurate results.
- Parameters
spectrum (SingleSpectrum) – This spectrum will be treated as a reference. If spectrum has its own offset factor, it will be taken into account.
average_by (Energies, optional) – Energies object, used to calculate average spectrum prior to calculating the factor. If not given, a simple arithmetic average of the spectra will be calculated.