BornAgain
1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Functions | |
double | RelativeDifference (const SimulationResult &dat, const SimulationResult &ref) |
double | getRelativeDifference (const OutputData< double > &dat, const OutputData< double > &ref) |
bool | checkRelativeDifference (const OutputData< double > &dat, const OutputData< double > &ref, const double threshold) |
double | getRelativeDifference (const IHistogram &dat, const IHistogram &ref) |
double | coordinateToBinf (double coordinate, const IAxis &axis) |
double | coordinateFromBinf (double value, const IAxis &axis) |
void | coordinateToBinf (double &x, double &y, const OutputData< double > &data) |
void | coordinateFromBinf (double &x, double &y, const OutputData< double > &data) |
std::vector< std::vector< double > > | create2DArrayfromOutputData (const OutputData< double > &data) |
std::vector< std::vector< double > > | FT2DArray (const std::vector< std::vector< double >> &signal) |
std::unique_ptr< OutputData< double > > | createRelativeDifferenceData (const OutputData< double > &data, const OutputData< double > &reference) |
std::unique_ptr< OutputData< double > > | createRearrangedDataSet (const OutputData< double > &data, int n) |
std::unique_ptr< OutputData< double > > | createClippedDataSet (const OutputData< double > &origin, double x1, double y1, double x2, double y2) |
std::unique_ptr< OutputData< double > > | createOutputDatafrom2DArray (const std::vector< std::vector< double >> &array_2d) |
std::unique_ptr< OutputData< double > > | createFFT (const OutputData< double > &data) |
Functions to work with intensity data.
double IntensityDataFunctions::RelativeDifference | ( | const SimulationResult & | dat, |
const SimulationResult & | ref | ||
) |
Returns sum of relative differences between each pair of elements: (a, b) -> 2*abs(a - b)/(a + b) ( and zero if a-b=0 )
Returns sum of relative differences between each pair of elements: (a, b) -> 2*abs(a - b)/(|a| + |b|) ( and zero if a=b=0 within epsilon )
Definition at line 28 of file IntensityDataFunctions.cpp.
References SimulationResult::empty(), Numeric::GetRelativeDifference(), and SimulationResult::size().
double IntensityDataFunctions::getRelativeDifference | ( | const OutputData< double > & | dat, |
const OutputData< double > & | ref | ||
) |
Returns relative difference between two data sets sum(dat[i] - ref[i])/ref[i]).
Definition at line 44 of file IntensityDataFunctions.cpp.
References OutputData< T >::getAllocatedSize(), Numeric::GetRelativeDifference(), and OutputData< T >::hasSameDimensions().
Referenced by checkRelativeDifference(), and getRelativeDifference().
bool IntensityDataFunctions::checkRelativeDifference | ( | const OutputData< double > & | dat, |
const OutputData< double > & | ref, | ||
const double | threshold | ||
) |
Returns true is relative difference is below threshold; prints informative output.
Definition at line 69 of file IntensityDataFunctions.cpp.
References getRelativeDifference().
double IntensityDataFunctions::getRelativeDifference | ( | const IHistogram & | dat, |
const IHistogram & | ref | ||
) |
Definition at line 62 of file IntensityDataFunctions.cpp.
References IHistogram::getData(), getRelativeDifference(), and OutputData< T >::meanValues().
double IntensityDataFunctions::coordinateToBinf | ( | double | coordinate, |
const IAxis & | axis | ||
) |
Transforms coordinate on axis into the bin-fraction-coordinate.
Definition at line 189 of file IntensityDataFunctions.cpp.
References IAxis::findClosestIndex(), IAxis::getBin(), Bin1D::getBinSize(), and Bin1D::m_lower.
Referenced by coordinateToBinf().
double IntensityDataFunctions::coordinateFromBinf | ( | double | value, |
const IAxis & | axis | ||
) |
Transforms bin-fraction-coordinate into axis coordinate.
Definition at line 197 of file IntensityDataFunctions.cpp.
References IAxis::getBin(), Bin1D::getBinSize(), Bin1D::m_lower, Bin1D::m_upper, and IAxis::size().
Referenced by coordinateFromBinf().
void IntensityDataFunctions::coordinateToBinf | ( | double & | x, |
double & | y, | ||
const OutputData< double > & | data | ||
) |
Transforms x,y coordinate from OutputData axes coordinates to bin-fraction-coordinates.
Definition at line 216 of file IntensityDataFunctions.cpp.
References coordinateToBinf(), and OutputData< T >::getAxis().
void IntensityDataFunctions::coordinateFromBinf | ( | double & | x, |
double & | y, | ||
const OutputData< double > & | data | ||
) |
Transforms x,y coordinate from bin-fraction-coordinates to OutputData's axes coordinates.
Definition at line 222 of file IntensityDataFunctions.cpp.
References coordinateFromBinf(), and OutputData< T >::getAxis().
std::vector< std::vector< double > > IntensityDataFunctions::create2DArrayfromOutputData | ( | const OutputData< double > & | data | ) |
Creates a vector of vectors of double (2D Array) from OutputData.
Definition at line 230 of file IntensityDataFunctions.cpp.
References OutputData< T >::getAxis(), OutputData< T >::getRank(), and IAxis::size().
Referenced by createFFT().
std::vector< std::vector< double > > IntensityDataFunctions::FT2DArray | ( | const std::vector< std::vector< double >> & | signal | ) |
Creates a Fourier Transform of a 2D Array (vector of vectors).
Definition at line 257 of file IntensityDataFunctions.cpp.
References FourierTransform::fft(), and FourierTransform::fftshift().
Referenced by createFFT().
std::unique_ptr< OutputData< double > > IntensityDataFunctions::createRelativeDifferenceData | ( | const OutputData< double > & | data, |
const OutputData< double > & | reference | ||
) |
Definition at line 88 of file IntensityDataFunctions.cpp.
References OutputData< T >::clone(), Numeric::GetRelativeDifference(), and OutputData< T >::hasSameDimensions().
std::unique_ptr< OutputData< double > > IntensityDataFunctions::createRearrangedDataSet | ( | const OutputData< double > & | data, |
int | n | ||
) |
Returns new object with input data rotated by n*90 deg counterclockwise (n > 0) or clockwise (n < 0) Axes are swapped if the data is effectively rotated by 90 or 270 degrees Applicable to 2D arrays only.
Definition at line 102 of file IntensityDataFunctions.cpp.
References OutputData< T >::clone(), OutputData< T >::getAllocatedSize(), OutputData< T >::getAxesBinIndices(), OutputData< T >::getAxis(), OutputData< T >::getRank(), and IAxis::size().
std::unique_ptr< OutputData< double > > IntensityDataFunctions::createClippedDataSet | ( | const OutputData< double > & | origin, |
double | x1, | ||
double | y1, | ||
double | x2, | ||
double | y2 | ||
) |
Returns new IntensityData objects which axes clipped to represent the specified rectangle.
Definition at line 148 of file IntensityDataFunctions.cpp.
References OutputData< T >::begin(), IAxis::createClippedAxis(), OutputData< T >::end(), OutputData< T >::getAxis(), OutputData< T >::getAxisValue(), and OutputData< T >::getRank().
std::unique_ptr< OutputData< double > > IntensityDataFunctions::createOutputDatafrom2DArray | ( | const std::vector< std::vector< double >> & | array_2d | ) |
Creates OutputData from a 2D Array.
Definition at line 268 of file IntensityDataFunctions.cpp.
Referenced by createFFT().
std::unique_ptr< OutputData< double > > IntensityDataFunctions::createFFT | ( | const OutputData< double > & | data | ) |
Creates Fourier Transform (OutputData format) of intensity map (OutputData format).
Definition at line 291 of file IntensityDataFunctions.cpp.
References create2DArrayfromOutputData(), createOutputDatafrom2DArray(), and FT2DArray().