16 #include "Base/Axis/Frame.h"
17 #include "Base/Axis/IAxis.h"
18 #include "Device/Coord/AxisNames.h"
19 #include "Device/Data/Datafield.h"
27 std::vector<Coords> specularUnits()
29 std::vector<Coords> result;
30 for (
const auto& pair : DataUtils::AxisNames::specAxis)
31 result.push_back(pair.first);
36 std::map<size_t, std::vector<Coords>> available_units = {{1u, specularUnits()},
37 {2u, {Coords::NBINS}}};
42 : m_data(std::move(
other.m_data))
43 , m_coords(
other.m_coords)
48 : m_data(units == Coords::NBINS && data ?
GUI::Util::IO::
binifyAxes(*data) : std::move(data))
55 : m_data(std::move(data))
62 :
ImportDataInfo(std::make_unique<Datafield>(std::move(data)), units)
68 ImportDataInfo::operator bool()
const
70 return static_cast<bool>(m_data);
77 return std::unique_ptr<Datafield>(
m_data->clone());
82 return std::move(m_data);
102 const size_t rank =
m_data->rank();
104 return axis_index == 0 ?
"X [nbins]" :
"Y [nbins]";
107 return "Signal [a.u.]";
108 return QString::fromStdString(DataUtils::AxisNames::specAxis.at(
m_coords));
110 throw Error(
"Error in ImportDataInfo::axisLabel: unsupported data type");
117 auto iter = available_units.find(
m_data->rank());
118 if (iter == available_units.end())
119 throw Error(
"Error in ImportDataInfo constructor: unsupported data type");
120 for (
auto& value : iter->second)
124 throw Error(
"Error in ImportDataInfo constructor: inacceptable units passed.");
Defines namespace GUI::Util::CoordName.
Defines namespace GUI::Util::IO.
Defines ImportDataInfo helper struct.
@ other
The unit has no enum value defined in here (e.g. when defined as an explicit string)
Carries information about loaded data.
size_t dataRank() const
Returns number of dimensions.
QString unitsLabel() const
std::unique_ptr< Datafield > clonedData() const &
QString axisLabel(size_t axis_index) const
std::unique_ptr< Datafield > m_data
ImportDataInfo(std::unique_ptr< Datafield > data, Coords units)
std::unique_ptr< Datafield > intensityData() &&
Coords coordFromName(const QString &name)
Returns domain axes units type from their GUI name.
QString nameFromCoord(Coords units)
Returns axes units names from their domain counterpart.
std::unique_ptr< Datafield > binifyAxes(const Datafield &data)
Creates Datafield with bin-valued axes.