BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
IntensityDataFunctions Namespace Reference

Functions to work with intensity data. More...

Functions

double 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 ) More...
 
double getRelativeDifference (const OutputData< double > &dat, const OutputData< double > &ref)
 Returns relative difference between two data sets sum(dat[i] - ref[i])/ref[i]).
 
bool checkRelativeDifference (const OutputData< double > &dat, const OutputData< double > &ref, const double threshold)
 Returns true is relative difference is below threshold; prints informative output.
 
double getRelativeDifference (const IHistogram &dat, const IHistogram &ref)
 
double coordinateToBinf (double coordinate, const IAxis &axis)
 Transforms coordinate on axis into the bin-fraction-coordinate.
 
double coordinateFromBinf (double value, const IAxis &axis)
 Transforms bin-fraction-coordinate into axis coordinate.
 
void coordinateToBinf (double &x, double &y, const OutputData< double > &data)
 Transforms x,y coordinate from OutputData axes coordinates to bin-fraction-coordinates.
 
void coordinateFromBinf (double &x, double &y, const OutputData< double > &data)
 Transforms x,y coordinate from bin-fraction-coordinates to OutputData's axes coordinates.
 
std::vector< std::vector< double > > create2DArrayfromOutputData (const OutputData< double > &data)
 Creates a vector of vectors of double (2D Array) from OutputData.
 
std::vector< std::vector< double > > FT2DArray (const std::vector< std::vector< double >> &signal)
 Creates a Fourier Transform of a 2D Array (vector of vectors).
 
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)
 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.
 
std::unique_ptr< OutputData< double > > 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.
 
std::unique_ptr< OutputData< double > > createOutputDatafrom2DArray (const std::vector< std::vector< double >> &array_2d)
 Creates OutputData from a 2D Array.
 
std::unique_ptr< OutputData< double > > createFFT (const OutputData< double > &data)
 Creates Fourier Transform (OutputData format) of intensity map (OutputData format).
 

Detailed Description

Functions to work with intensity data.

Function Documentation

◆ RelativeDifference()

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.