BornAgain
1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Templated class to store data of type double or CumulativeValue in multi-dimensional space. More...
Public Types | |
typedef OutputDataIterator< const T, const OutputData< T > > | const_iterator |
Read-only iterator type. More... | |
typedef OutputDataIterator< T, OutputData< T > > | iterator |
Read/write iterator type. More... | |
using | value_type = T |
Public Member Functions | |
OutputData () | |
OutputData (const OutputData &)=delete | |
OutputData (OutputData &&) | |
~OutputData () | |
void | addAxis (const IAxis &new_axis) |
void | addAxis (const std::string &name, size_t size, double start, double end) |
void | allocate () |
memory allocation for current dimensions configuration More... | |
const IAxis & | axis (size_t serial_number) const |
returns axis with given serial number More... | |
iterator | begin () |
Returns read/write iterator that points to the first element. More... | |
const_iterator | begin () const |
Returns read-only iterator that points to the first element. More... | |
void | clear () |
Sets object into initial state (no dimensions, data) More... | |
OutputData * | clone () const |
void | copyFrom (const OutputData< T > &x) |
template<class U > | |
void | copyShapeFrom (const OutputData< U > &other) |
iterator | end () |
Returns read/write iterator that points to the one past last element. More... | |
const_iterator | end () const |
Returns read-only iterator that points to the one past last element. More... | |
size_t | findGlobalIndex (const std::vector< double > &coordinates) const |
Returns global index for specified axes values. More... | |
size_t | getAllocatedSize () const |
Returns total size of data buffer (product of bin number in every dimension). More... | |
std::vector< size_t > | getAllSizes () const |
Returns all sizes of its axes. More... | |
PyObject * | getArray () const |
returns data as Python numpy array More... | |
std::vector< int > | getAxesBinIndices (size_t global_index) const |
Returns vector of axes indices for given global index. More... | |
std::vector< double > | getAxesValues (size_t global_index) const |
Returns values on all defined axes for given globalbin number. More... | |
Bin1D | getAxisBin (size_t global_index, const std::string &axis_name) const |
Returns bin of selected axis for given global_index. More... | |
Bin1D | getAxisBin (size_t global_index, size_t i_selected_axis) const |
Returns bin of selected axis for given global_index. More... | |
size_t | getAxisBinIndex (size_t global_index, const std::string &axis_name) const |
Returns axis bin index for given global index. More... | |
size_t | getAxisBinIndex (size_t global_index, size_t i_selected_axis) const |
Returns axis bin index for given global index. More... | |
double | getAxisValue (size_t global_index, const std::string &axis_name) const |
Returns the value of selected axis for given global_index. More... | |
double | getAxisValue (size_t global_index, size_t i_selected_axis) const |
Returns the value of selected axis for given global_index. More... | |
std::vector< T > | getRawDataVector () const |
Returns copy of raw data vector. More... | |
double | getValue (size_t index) const |
Returns value or summed value, depending on T. More... | |
template<class U > | |
bool | hasSameDimensions (const OutputData< U > &right) const |
Returns true if object have same dimensions and number of axes bins. More... | |
template<class U > | |
bool | hasSameShape (const OutputData< U > &right) const |
Returns true if objects a) have same dimensions b) bin boundaries of axes coincide. More... | |
bool | isInitialized () const |
returns true if object is correctly initialized More... | |
OutputData< double > * | meanValues () const |
const OutputData< T > & | operator*= (const OutputData< T > &right) |
multiplication-assignment operator for two output data More... | |
const OutputData< T > & | operator+= (const OutputData< T > &right) |
addition-assignment operator for two output data More... | |
const OutputData< T > & | operator-= (const OutputData< T > &right) |
substraction-assignment operator for two output data More... | |
const OutputData< T > & | operator/= (const OutputData< T > &right) |
division-assignment operator for two output data More... | |
const OutputData & | operator= (const OutputData &)=delete |
T & | operator[] (size_t index) |
indexed accessor More... | |
const T & | operator[] (size_t index) const |
indexed accessor (const) More... | |
size_t | rank () const |
Returns number of dimensions. More... | |
void | scaleAll (const T &factor) |
multiply every item of this output data by value More... | |
void | setAllTo (const T &value) |
Sets content of output data to specific value. More... | |
void | setAxisSizes (size_t rank, int *n_dims) |
Adds 'rank' axes with indicated sizes. More... | |
void | setRawDataArray (const T *source) |
Sets new values to raw data array. More... | |
void | setRawDataVector (const std::vector< T > &data_vector) |
Sets new values to raw data vector. More... | |
size_t | toGlobalIndex (const std::vector< unsigned > &axes_indices) const |
Returns global index for specified indices of axes. More... | |
T | totalSum () const |
Returns sum of all values in the data structure. More... | |
Private Member Functions | |
bool | axisNameExists (const std::string &axis_name) const |
checks if given axis name exists More... | |
size_t | getAxisIndex (const std::string &axis_name) const |
returns serial number of axis with given name More... | |
Private Attributes | |
LLData< T > * | m_ll_data |
SafePointerVector< IAxis > | m_value_axes |
Friends | |
class | OutputDataIterator< const T, const OutputData< T > > |
class | OutputDataIterator< T, OutputData< T > > |
Templated class to store data of type double or CumulativeValue in multi-dimensional space.
Definition at line 32 of file OutputData.h.
typedef OutputDataIterator<const T, const OutputData<T> > OutputData< T >::const_iterator |
Read-only iterator type.
Definition at line 84 of file OutputData.h.
typedef OutputDataIterator<T, OutputData<T> > OutputData< T >::iterator |
Read/write iterator type.
Definition at line 81 of file OutputData.h.
using OutputData< T >::value_type = T |
Definition at line 34 of file OutputData.h.
OutputData< T >::OutputData |
Definition at line 248 of file OutputData.h.
References OutputData< T >::allocate().
|
delete |
OutputData< T >::OutputData | ( | OutputData< T > && | other | ) |
Definition at line 239 of file OutputData.h.
OutputData< T >::~OutputData |
Definition at line 253 of file OutputData.h.
void OutputData< T >::addAxis | ( | const IAxis & | new_axis | ) |
Definition at line 295 of file OutputData.h.
References IAxis::clone(), IAxis::getName(), and IAxis::size().
Referenced by Histogram1D::Histogram1D(), Histogram2D::Histogram2D(), IHistogram::IHistogram(), QREDataLoader::createOutputDataFromParsingResult(), Histogram2D::initFromShape(), DetectorMask::initMaskData(), OutputDataReadReflectometry::readOutputData(), OutputDataReadWriteINT::readOutputData(), SpecularSimulation::result(), OffSpecularSimulation::transferDetectorImage(), and OffSpecularSimulation::updateIntensityMap().
void OutputData< T >::addAxis | ( | const std::string & | name, |
size_t | size, | ||
double | start, | ||
double | end | ||
) |
Definition at line 308 of file OutputData.h.
References RealSpace::Particles::name().
void OutputData< T >::allocate |
memory allocation for current dimensions configuration
Definition at line 542 of file OutputData.h.
Referenced by OutputData< T >::OutputData().
const IAxis & OutputData< T >::axis | ( | size_t | serial_number | ) | const |
returns axis with given serial number
Definition at line 318 of file OutputData.h.
Referenced by RegionOfInterest::RegionOfInterest(), Histogram2D::addContent(), ConvolutionDetectorResolution::apply1dConvolution(), ConvolutionDetectorResolution::apply2dConvolution(), MaskUnitsConverter::convert(), DataUtils::coordinateFromBinf(), DataUtils::coordinateToBinf(), OutputData< T >::copyShapeFrom(), DataUtils::create2DArrayfromOutputData(), DataUtils::createClippedDataSet(), DataUtils::createRearrangedDataSet(), ImportDataUtils::CreateSimplifiedOutputData(), OutputData< T >::hasSameDimensions(), OutputData< T >::hasSameShape(), DetectorMask::initMaskData(), OutputDataReadWriteNumpyTXT::write1DRepresentation(), OutputDataReadWriteNumpyTXT::write2DRepresentation(), OutputDataReadWriteINT::writeOutputData(), IHistogram::xAxis(), and IHistogram::yAxis().
|
private |
OutputData< T >::iterator OutputData< T >::begin |
Returns read/write iterator that points to the first element.
Definition at line 343 of file OutputData.h.
Referenced by ConvolutionDetectorResolution::apply2dConvolution(), DataUtils::createClippedDataSet(), Histogram1D::crop(), Histogram2D::crop(), IntensityDataItem::dataRange(), SpecularDataItem::dataRange(), Data1DViewItem::dataRange(), DataFormatUtils::fillOutputData(), IHistogram::getMaximum(), IHistogram::getMaximumBinIndex(), IHistogram::getMinimum(), IHistogram::getMinimumBinIndex(), and OutputDataReadWriteINT::writeOutputDataDoubles().
OutputData< T >::const_iterator OutputData< T >::begin |
Returns read-only iterator that points to the first element.
Definition at line 349 of file OutputData.h.
void OutputData< T >::clear |
Sets object into initial state (no dimensions, data)
Definition at line 470 of file OutputData.h.
Referenced by DetectorMask::addMask(), DetectorMask::initMaskData(), and OffSpecularSimulation::updateIntensityMap().
OutputData< T > * OutputData< T >::clone |
Definition at line 259 of file OutputData.h.
References OutputData< T >::m_ll_data, and OutputData< T >::m_value_axes.
Referenced by MaskResultsPresenter::backup_data(), JobModelFunctions::copyRealDataItem(), MaskResultsPresenter::createMaskPresentation(), FitObjectiveBuilder::createOutputData(), QREDataLoader::createOutputDataFromParsingResult(), DataUtils::createRearrangedDataSet(), DataUtils::createRelativeDifferenceData(), and OffSpecularSimulation::result().
void OutputData< T >::copyFrom | ( | const OutputData< T > & | x | ) |
Definition at line 267 of file OutputData.h.
References OutputData< T >::m_ll_data, and OutputData< T >::m_value_axes.
Referenced by DetectorMask::DetectorMask(), IHistogram::IHistogram(), OffSpecularSimulation::OffSpecularSimulation(), and DetectorMask::operator=().
void OutputData< T >::copyShapeFrom | ( | const OutputData< U > & | other | ) |
Definition at line 277 of file OutputData.h.
References OutputData< T >::axis(), and OutputData< T >::rank().
Referenced by DetectorMask::createHistogram(), IHistogram::createOutputData(), and IHistogram::init_from_data().
|
inline |
Returns read/write iterator that points to the one past last element.
Definition at line 93 of file OutputData.h.
References OutputData< T >::getAllocatedSize().
Referenced by ConvolutionDetectorResolution::apply2dConvolution(), DataUtils::createClippedDataSet(), Histogram1D::crop(), Histogram2D::crop(), IntensityDataItem::dataRange(), SpecularDataItem::dataRange(), Data1DViewItem::dataRange(), DataFormatUtils::fillOutputData(), IHistogram::getMaximum(), IHistogram::getMaximumBinIndex(), IHistogram::getMinimum(), IHistogram::getMinimumBinIndex(), and OutputDataReadWriteINT::writeOutputDataDoubles().
|
inline |
Returns read-only iterator that points to the one past last element.
Definition at line 96 of file OutputData.h.
References OutputData< T >::getAllocatedSize().
size_t OutputData< T >::findGlobalIndex | ( | const std::vector< double > & | coordinates | ) | const |
Returns global index for specified axes values.
coordinates | Vector of axes coordinates for all specified axes in this dataset |
Definition at line 416 of file OutputData.h.
References ASSERT.
Referenced by Histogram2D::fill(), and IHistogram::findGlobalBin().
|
inline |
Returns total size of data buffer (product of bin number in every dimension).
Definition at line 59 of file OutputData.h.
References OutputData< T >::m_ll_data.
Referenced by DetectorMask::createHistogram(), MaskResultsPresenter::createMaskPresentation(), DataUtils::createRearrangedDataSet(), OutputData< T >::end(), IHistogram::getTotalNumberOfBins(), IHistogram::init_from_data(), DetectorMask::process_masks(), DataUtils::relativeDataDifference(), OffSpecularSimulation::transferDetectorImage(), and OffSpecularSimulation::transferResultsToIntensityMap().
|
inline |
PyObject* OutputData< T >::getArray | ( | ) | const |
returns data as Python numpy array
std::vector< int > OutputData< T >::getAxesBinIndices | ( | size_t | global_index | ) | const |
Returns vector of axes indices for given global index.
global_index | The global index of this data structure. |
Definition at line 355 of file OutputData.h.
References ASSERT.
Referenced by DataUtils::createRearrangedDataSet().
std::vector< double > OutputData< T >::getAxesValues | ( | size_t | global_index | ) | const |
Returns values on all defined axes for given globalbin number.
global_index | The global index of this data structure. |
Definition at line 442 of file OutputData.h.
Bin1D OutputData< T >::getAxisBin | ( | size_t | global_index, |
const std::string & | axis_name | ||
) | const |
Returns bin of selected axis for given global_index.
global_index | The global index of this data structure. |
axis_name | The name of selected axis. |
Definition at line 459 of file OutputData.h.
Bin1D OutputData< T >::getAxisBin | ( | size_t | global_index, |
size_t | i_selected_axis | ||
) | const |
Returns bin of selected axis for given global_index.
global_index | The global index of this data structure. |
i_selected_axis | Serial number of selected axis. |
Definition at line 452 of file OutputData.h.
Referenced by DetectorMask::process_masks().
size_t OutputData< T >::getAxisBinIndex | ( | size_t | global_index, |
const std::string & | axis_name | ||
) | const |
Returns axis bin index for given global index.
global_index | The global index of this data structure. |
axis_name | The name of selected axis. |
Definition at line 386 of file OutputData.h.
size_t OutputData< T >::getAxisBinIndex | ( | size_t | global_index, |
size_t | i_selected_axis | ||
) | const |
Returns axis bin index for given global index.
global_index | The global index of this data structure. |
i_selected_axis | Serial number of selected axis. |
Definition at line 370 of file OutputData.h.
References ASSERT.
Referenced by IHistogram::xAxisIndex(), and IHistogram::yAxisIndex().
|
private |
double OutputData< T >::getAxisValue | ( | size_t | global_index, |
const std::string & | axis_name | ||
) | const |
Returns the value of selected axis for given global_index.
global_index | The global index of this data structure. |
axis_name | The name of selected axis. |
Definition at line 437 of file OutputData.h.
double OutputData< T >::getAxisValue | ( | size_t | global_index, |
size_t | i_selected_axis | ||
) | const |
Returns the value of selected axis for given global_index.
global_index | The global index of this data structure. |
i_selected_axis | Serial number of selected axis. |
Definition at line 430 of file OutputData.h.
Referenced by DataUtils::createClippedDataSet(), Histogram1D::crop(), Histogram2D::crop(), SpecularPlot::setDataFromItem(), IHistogram::xAxisValue(), and IHistogram::yAxisValue().
|
inline |
Returns copy of raw data vector.
Definition at line 334 of file OutputData.h.
References ASSERT.
Referenced by ConvolutionDetectorResolution::apply1dConvolution(), ConvolutionDetectorResolution::apply2dConvolution(), ISimulation::convertData(), IUnitConverter::createConvertedData(), UnitConverter1D::createConvertedData(), ImportDataUtils::CreateSimplifiedOutputData(), DataViewUtils::getTranslatedData(), and JobItemUtils::updateDataAxes().
double OutputData< T >::getValue | ( | size_t | index | ) | const |
Returns value or summed value, depending on T.
|
inline |
Returns true if object have same dimensions and number of axes bins.
Returns true if object have same dimensions.
Definition at line 575 of file OutputData.h.
References OutputData< T >::axis(), OutputData< T >::isInitialized(), OutputData< T >::rank(), and IAxis::size().
Referenced by DataUtils::createRelativeDifferenceData(), IHistogram::hasSameDimensions(), and DataUtils::relativeDataDifference().
bool OutputData< T >::hasSameShape | ( | const OutputData< U > & | right | ) | const |
Returns true if objects a) have same dimensions b) bin boundaries of axes coincide.
Returns true if object have same dimensions and shape of axis.
Definition at line 592 of file OutputData.h.
References OutputData< T >::axis(), and HaveSameNameAndShape().
Referenced by IHistogram::hasSameShape().
bool OutputData< T >::isInitialized |
returns true if object is correctly initialized
Definition at line 524 of file OutputData.h.
Referenced by OutputData< T >::hasSameDimensions().
OutputData< double > * OutputData< T >::meanValues |
Definition at line 285 of file OutputData.h.
Referenced by HistoUtils::getRelativeDifference().
const OutputData< T > & OutputData< T >::operator*= | ( | const OutputData< T > & | right | ) |
multiplication-assignment operator for two output data
Definition at line 517 of file OutputData.h.
References ASSERT, and OutputData< T >::m_ll_data.
const OutputData< T > & OutputData< T >::operator+= | ( | const OutputData< T > & | right | ) |
addition-assignment operator for two output data
Definition at line 503 of file OutputData.h.
References ASSERT, and OutputData< T >::m_ll_data.
const OutputData< T > & OutputData< T >::operator-= | ( | const OutputData< T > & | right | ) |
substraction-assignment operator for two output data
Definition at line 510 of file OutputData.h.
References ASSERT, and OutputData< T >::m_ll_data.
const OutputData< T > & OutputData< T >::operator/= | ( | const OutputData< T > & | right | ) |
division-assignment operator for two output data
Definition at line 535 of file OutputData.h.
References ASSERT, and OutputData< T >::m_ll_data.
|
delete |
|
inline |
indexed accessor
Definition at line 192 of file OutputData.h.
References ASSERT, and OutputData< T >::m_ll_data.
|
inline |
indexed accessor (const)
Definition at line 199 of file OutputData.h.
References ASSERT, and OutputData< T >::m_ll_data.
|
inline |
Returns number of dimensions.
Definition at line 56 of file OutputData.h.
References OutputData< T >::m_value_axes, and SafePointerVector< T >::size().
Referenced by RegionOfInterest::RegionOfInterest(), ConvolutionDetectorResolution::apply1dConvolution(), ConvolutionDetectorResolution::apply2dConvolution(), ConvolutionDetectorResolution::applyDetectorResolution(), OutputData< T >::copyShapeFrom(), DataUtils::create2DArrayfromOutputData(), DataUtils::createClippedDataSet(), IUnitConverter::createConvertedData(), UnitConverter1D::createConvertedData(), IHistogram::createHistogram(), DataUtils::createRearrangedDataSet(), ImportDataUtils::CreateSimplifiedOutputData(), OutputData< T >::hasSameDimensions(), IHistogram::init_from_data(), DetectorMask::initMaskData(), RealDataItem::setOutputData(), IntensityDataItem::setOutputData(), SpecularDataItem::setOutputData(), OutputDataReadWriteINT::writeOutputData(), and OutputDataReadWriteNumpyTXT::writeOutputData().
void OutputData< T >::scaleAll | ( | const T & | factor | ) |
multiply every item of this output data by value
Definition at line 484 of file OutputData.h.
void OutputData< T >::setAllTo | ( | const T & | value | ) |
Sets content of output data to specific value.
Definition at line 476 of file OutputData.h.
Referenced by DetectorMaskDelegate::createIntensityDataItem(), DataFormatUtils::fillOutputData(), DetectorMask::process_masks(), IHistogram::reset(), SpecularSimulation::result(), and OffSpecularSimulation::updateIntensityMap().
void OutputData< T >::setAxisSizes | ( | size_t | rank, |
int * | n_dims | ||
) |
Adds 'rank' axes with indicated sizes.
Definition at line 492 of file OutputData.h.
References RealSpace::Particles::name().
|
inline |
Sets new values to raw data array.
Definition at line 566 of file OutputData.h.
|
inline |
Sets new values to raw data vector.
Definition at line 556 of file OutputData.h.
Referenced by ConvolutionDetectorResolution::apply1dConvolution(), IDetector::applyDetectorResolution(), QREDataLoader::createOutputDataFromParsingResult(), OutputDataReadReflectometry::readOutputData(), and SpecularSimulation::result().
size_t OutputData< T >::toGlobalIndex | ( | const std::vector< unsigned > & | axes_indices | ) | const |
Returns global index for specified indices of axes.
axes_indices | Vector of axes indices for all specified axes in this dataset |
Definition at line 392 of file OutputData.h.
References ASSERT.
Referenced by IHistogram::getGlobalBin().
|
inline |
|
friend |
Definition at line 73 of file OutputData.h.
|
friend |
Definition at line 73 of file OutputData.h.
|
private |
Definition at line 232 of file OutputData.h.
Referenced by OutputData< T >::clone(), OutputData< T >::copyFrom(), OutputData< T >::getAllocatedSize(), OutputData< T >::operator*=(), OutputData< T >::operator+=(), OutputData< T >::operator-=(), OutputData< T >::operator/=(), and OutputData< T >::operator[]().
|
private |
Definition at line 231 of file OutputData.h.
Referenced by OutputData< T >::clone(), OutputData< T >::copyFrom(), and OutputData< T >::rank().