Loading...
Searching...
No Matches
BALL::Spectrum< DataT, PeakT, PositionT > Class Template Reference
Molecular Modeling » Nuclear Magnetic Resonance Spectroscopy » NMR spectra and related classes

`#include <BALL/NMR/spectrum.h>`

## Public Types

typedef DataT | DataType
| The datatype used to store the spectrum.
typedef PositionT | PositionType
| the data type used to store a position (for peaks and data)
typedef PeakT | PeakType
| The peak type.
typedef DataT::Iterator | Iterator
| An iterator.
typedef DataT::ConstIterator | ConstIterator
| A constant iterator.

## Public Member Functions

| Spectrum ()
| Spectrum (const DataType &data)
| Spectrum (const std::vector< PeakType > &peaks, const PositionType &origin, const PositionType &dimension, const PositionType &spacing)
virtual | ~Spectrum ()

## Accessors

std::vector< float > | normal_moments
| precomputed normal moments
std::vector< float > | central_moments
| precomputed central moments
std::vector< float > | standardized_moments
| precomputed standardized moments
DataType | data_
std::vector< PeakType > | sticks_
PositionType | spacing_
PositionType | min_
PositionType | max_
std::vector< float > | Hu_invariants_
const DataType & | getData () const
DataType & | getData ()
const std::vector< float > & | getHuInvariants () const
std::vector< float > & | getHuInvariants ()
virtual void | clear ()
virtual void | clearSticks ()
virtual double | difference (const Spectrum< DataT, PeakT, PositionT > &spectrum) const
virtual Spectrum< DataT, PeakT, PositionT > | differenceSpectrum (const Spectrum< DataT, PeakT, PositionT > &spectrum)
virtual double | earthMoversDistance (const Spectrum< DataT, PeakT, PositionT > &spectrum) const
virtual void | convertToGaussian ()
virtual void | convertToLorentzian ()
virtual void | computeAllMoments (int moment_number)
virtual void | setSpacing (const PositionType &spacing)
virtual PositionType | getSpacing () const
virtual void | setSticks (std::vector< PeakType > sticks)
virtual std::vector< PeakType > | getSticks () const
virtual double | getAbsIntegral () const
virtual void | computeHuInvariants ()
virtual std::vector< float > | computeHuInvariantsDifferences (std::vector< Spectrum< DataT, PeakT, PositionT > > &spectra)
virtual double | getFourierDifference (const Spectrum< DataT, PeakT, PositionT > &spectrum, float min_freq=1e6, float max_freq=-1e6)
virtual double | getNormalMomentsDifference (Spectrum< DataT, PeakT, PositionT > &spectrum, int moment_number)
virtual double | getCentralMomentsDifference (Spectrum< DataT, PeakT, PositionT > &spectrum, int moment_number)
virtual double | getStandardizedMomentsDifference (Spectrum< DataT, PeakT, PositionT > &spectrum, int moment_number)
void | binaryWrite (const String &filename)
| This function requires that DataT has a binaryWrite method.
void | binaryRead (const String &filename)
| This function requires that DataT has a binaryRead method.

## Detailed Description

template<typename DataT, typename PeakT, typename PositionT = typename PeakT::Position>
class BALL::Spectrum< DataT, PeakT, PositionT >

A generic NMR spectrum class.

Definition at line 46 of file spectrum.h.

## Member Typedef Documentation

## ConstIterator

template<typename DataT, typename PeakT, typename PositionT = typename PeakT::Position>

typedef DataT::ConstIterator BALL::Spectrum< DataT, PeakT, PositionT >::ConstIterator

A constant iterator.

Definition at line 62 of file spectrum.h.

## DataType

template<typename DataT, typename PeakT, typename PositionT = typename PeakT::Position>

typedef DataT BALL::Spectrum< DataT, PeakT, PositionT >::DataType

The datatype used to store the spectrum.

Typedefs

Definition at line 54 of file spectrum.h.

## Iterator

template<typename DataT, typename PeakT, typename PositionT = typename PeakT::Position>

typedef DataT::Iterator BALL::Spectrum< DataT, PeakT, PositionT >::Iterator

An iterator.

Definition at line 60 of file spectrum.h.

## PeakType

template<typename DataT, typename PeakT, typename PositionT = typename PeakT::Position>

typedef PeakT BALL::Spectrum< DataT, PeakT, PositionT >::PeakType

The peak type.

Definition at line 58 of file spectrum.h.

## PositionType

template<typename DataT, typename PeakT, typename PositionT = typename PeakT::Position>

typedef PositionT BALL::Spectrum< DataT, PeakT, PositionT >::PositionType

the data type used to store a position (for peaks and data)

Definition at line 56 of file spectrum.h.

## Constructor & Destructor Documentation

## Spectrum() [1/3]

template<typename DataT, typename PeakT, typename PositionT = typename PeakT::Position>

BALL::Spectrum< DataT, PeakT, PositionT >::Spectrum | ( |  | ) |

inline

Constructors and Destructor

Definition at line 69 of file spectrum.h.

## Spectrum() [2/3]

template<typename DataT, typename PeakT, typename PositionT = typename PeakT::Position>

BALL::Spectrum< DataT, PeakT, PositionT >::Spectrum | ( | const DataType & | data | ) |

inline

Definition at line 77 of file spectrum.h.

## Spectrum() [3/3]

template<typename DataT, typename PeakT, typename PositionT = typename PeakT::Position>

BALL::Spectrum< DataT, PeakT, PositionT >::Spectrum | ( | const std::vector< PeakType > & | peaks,
|  | const PositionType & | origin,
|  | const PositionType & | dimension,
|  | const PositionType & | spacing )

inline

Definition at line 85 of file spectrum.h.

## ~Spectrum()

template<typename DataT, typename PeakT, typename PositionT = typename PeakT::Position>

virtual BALL::Spectrum< DataT, PeakT, PositionT >::~Spectrum | ( |  | ) |

inline virtual

Destructor

Definition at line 90 of file spectrum.h.

## Member Function Documentation

## binaryRead()

template<typename DataT, typename PeakT, typename PositionT = typename PeakT::Position>

void BALL::Spectrum< DataT, PeakT, PositionT >::binaryRead | ( | const String & | filename | ) |

This function requires that DataT has a binaryRead method.

## binaryWrite()

template<typename DataT, typename PeakT, typename PositionT = typename PeakT::Position>

void BALL::Spectrum< DataT, PeakT, PositionT >::binaryWrite | ( | const String & | filename | ) |

This function requires that DataT has a binaryWrite method.

## clear()

template<typename DataT, typename PeakT, typename PositionT>

void BALL::Spectrum< DataT, PeakT, PositionT >::clear | ( |  | ) |

virtual

Clear the spectrum. Sets all data to zero. // TODO: what about the spacing?

Definition at line 170 of file spectrum.h.

## clearSticks()

template<typename DataT, typename PeakT, typename PositionT>

void BALL::Spectrum< DataT, PeakT, PositionT >::clearSticks | ( |  | ) |

virtual

Definition at line 177 of file spectrum.h.

## computeAllMoments()

template<typename DataT, typename PeakT, typename PositionT = typename PeakT::Position>

virtual void BALL::Spectrum< DataT, PeakT, PositionT >::computeAllMoments | ( | int | moment_number | ) |

virtual

## computeHuInvariants()

template<typename DataT, typename PeakT, typename PositionT>

void BALL::Spectrum< DataT, PeakT, PositionT >::computeHuInvariants | ( |  | ) |

virtual

Definition at line 293 of file spectrum.h.

## computeHuInvariantsDifferences()

template<typename DataT, typename PeakT, typename PositionT>

std::vector< float > BALL::Spectrum< DataT, PeakT, PositionT >::computeHuInvariantsDifferences | ( | std::vector< Spectrum< DataT, PeakT, PositionT > > & | spectra | ) |

virtual

Definition at line 300 of file spectrum.h.

## convertToGaussian()

template<typename DataT, typename PeakT, typename PositionT = typename PeakT::Position>

virtual void BALL::Spectrum< DataT, PeakT, PositionT >::convertToGaussian | ( |  | ) |

virtual

## convertToLorentzian()

template<typename DataT, typename PeakT, typename PositionT = typename PeakT::Position>

virtual void BALL::Spectrum< DataT, PeakT, PositionT >::convertToLorentzian | ( |  | ) |

virtual

## difference()

template<typename DataT, typename PeakT, typename PositionT>

double BALL::Spectrum< DataT, PeakT, PositionT >::difference | ( | const Spectrum< DataT, PeakT, PositionT > & | spectrum | ) | const

virtual

Calculate the difference between two spectra.

Definition at line 187 of file spectrum.h.

## differenceSpectrum()

template<typename DataT, typename PeakT, typename PositionT = typename PeakT::Position>

virtual Spectrum< DataT, PeakT, PositionT > BALL::Spectrum< DataT, PeakT, PositionT >::differenceSpectrum | ( | const Spectrum< DataT, PeakT, PositionT > & | spectrum | ) |

virtual

## earthMoversDistance()

template<typename DataT, typename PeakT, typename PositionT = typename PeakT::Position>

virtual double BALL::Spectrum< DataT, PeakT, PositionT >::earthMoversDistance | ( | const Spectrum< DataT, PeakT, PositionT > & | spectrum | ) | const

virtual

## getAbsIntegral()

template<typename DataT, typename PeakT, typename PositionT = typename PeakT::Position>

virtual double BALL::Spectrum< DataT, PeakT, PositionT >::getAbsIntegral | ( |  | ) | const

virtual

## getCentralMomentsDifference()

template<typename DataT, typename PeakT, typename PositionT>

double BALL::Spectrum< DataT, PeakT, PositionT >::getCentralMomentsDifference | ( | Spectrum< DataT, PeakT, PositionT > & | spectrum,
|  | int | moment_number )

virtual

Definition at line 234 of file spectrum.h.

## getData() [1/2]

template<typename DataT, typename PeakT, typename PositionT>

DataT & BALL::Spectrum< DataT, PeakT, PositionT >::getData | ( |  | ) |

Definition at line 270 of file spectrum.h.

## getData() [2/2]

template<typename DataT, typename PeakT, typename PositionT>

const DataT & BALL::Spectrum< DataT, PeakT, PositionT >::getData | ( |  | ) | const

Definition at line 264 of file spectrum.h.

## getFourierDifference()

template<typename DataT, typename PeakT, typename PositionT>

double BALL::Spectrum< DataT, PeakT, PositionT >::getFourierDifference | ( | const Spectrum< DataT, PeakT, PositionT > & | spectrum,
|  | float | min_freq = 1e6,
|  | float | max_freq = -1e6 )

virtual

Computes the difference between the spectra in Fourier space. max_freq and min_freq can be used to include only a certain range into the comparison. In this case, we only use the positive frequencies (the negative ones are redundant anyhow) and assume that 0<=min_freq<max_freq<=1, where min_freq and max_freq are interpreted as percentages, e.g. calling this function with min_freq=0 and max_freq=0.5 would include the lower half of the positive frequencies.

Definition at line 308 of file spectrum.h.

## getHuInvariants() [1/2]

template<typename DataT, typename PeakT, typename PositionT>

std::vector< float > & BALL::Spectrum< DataT, PeakT, PositionT >::getHuInvariants | ( |  | ) |

Definition at line 285 of file spectrum.h.

## getHuInvariants() [2/2]

template<typename DataT, typename PeakT, typename PositionT>

const std::vector< float > & BALL::Spectrum< DataT, PeakT, PositionT >::getHuInvariants | ( |  | ) | const

Definition at line 279 of file spectrum.h.

## getNormalMomentsDifference()

template<typename DataT, typename PeakT, typename PositionT>

double BALL::Spectrum< DataT, PeakT, PositionT >::getNormalMomentsDifference | ( | Spectrum< DataT, PeakT, PositionT > & | spectrum,
|  | int | moment_number )

virtual

Computes the difference according to the precomputed normal moments up to moment_number. If the values have not been precomputed so far, we regenerate them.

Definition at line 219 of file spectrum.h.

## getSpacing()

template<typename DataT, typename PeakT, typename PositionT>

Spectrum< DataT, PeakT, PositionT >::PositionType BALL::Spectrum< DataT, PeakT, PositionT >::getSpacing | ( |  | ) | const

virtual

Return the spacing.

Definition at line 196 of file spectrum.h.

## getStandardizedMomentsDifference()

template<typename DataT, typename PeakT, typename PositionT>

double BALL::Spectrum< DataT, PeakT, PositionT >::getStandardizedMomentsDifference | ( | Spectrum< DataT, PeakT, PositionT > & | spectrum,
|  | int | moment_number )

virtual

Definition at line 249 of file spectrum.h.

## getSticks()

template<typename DataT, typename PeakT, typename PositionT = typename PeakT::Position>

virtual std::vector< PeakType > BALL::Spectrum< DataT, PeakT, PositionT >::getSticks | ( |  | ) | const

inline virtual

Definition at line 121 of file spectrum.h.

## setSpacing()

template<typename DataT, typename PeakT, typename PositionT = typename PeakT::Position>

void BALL::Spectrum< DataT, PeakT, PositionT >::setSpacing | ( | const PositionType & | spacing | ) |

virtual

Set the spacing.

Definition at line 204 of file spectrum.h.

## setSticks()

template<typename DataT, typename PeakT, typename PositionT = typename PeakT::Position>

virtual void BALL::Spectrum< DataT, PeakT, PositionT >::setSticks | ( | std::vector< PeakType > | sticks | ) |

inline virtual

Definition at line 120 of file spectrum.h.

## Member Data Documentation

## central_moments

template<typename DataT, typename PeakT, typename PositionT = typename PeakT::Position>

std::vector<float> BALL::Spectrum< DataT, PeakT, PositionT >::central_moments

precomputed central moments

Definition at line 147 of file spectrum.h.

## data_

template<typename DataT, typename PeakT, typename PositionT = typename PeakT::Position>

DataType BALL::Spectrum< DataT, PeakT, PositionT >::data_

protected

Definition at line 158 of file spectrum.h.

## Hu_invariants_

template<typename DataT, typename PeakT, typename PositionT = typename PeakT::Position>

std::vector<float> BALL::Spectrum< DataT, PeakT, PositionT >::Hu_invariants_

protected

Definition at line 163 of file spectrum.h.

## max_

template<typename DataT, typename PeakT, typename PositionT = typename PeakT::Position>

PositionType BALL::Spectrum< DataT, PeakT, PositionT >::max_

protected

Definition at line 162 of file spectrum.h.

## min_

template<typename DataT, typename PeakT, typename PositionT = typename PeakT::Position>

PositionType BALL::Spectrum< DataT, PeakT, PositionT >::min_

protected

Definition at line 161 of file spectrum.h.

## normal_moments

template<typename DataT, typename PeakT, typename PositionT = typename PeakT::Position>

std::vector<float> BALL::Spectrum< DataT, PeakT, PositionT >::normal_moments

precomputed normal moments

Definition at line 145 of file spectrum.h.

## spacing_

template<typename DataT, typename PeakT, typename PositionT = typename PeakT::Position>

PositionType BALL::Spectrum< DataT, PeakT, PositionT >::spacing_

protected

Definition at line 160 of file spectrum.h.

## standardized_moments

template<typename DataT, typename PeakT, typename PositionT = typename PeakT::Position>

std::vector<float> BALL::Spectrum< DataT, PeakT, PositionT >::standardized_moments

precomputed standardized moments

Definition at line 149 of file spectrum.h.

## sticks_

template<typename DataT, typename PeakT, typename PositionT = typename PeakT::Position>

std::vector<PeakType> BALL::Spectrum< DataT, PeakT, PositionT >::sticks_

protected

Definition at line 159 of file spectrum.h.