TBTK
|
Need a break? Support the development by playing Polarity Puzzles |
Convert Properties to AnnotatedArrays. More...
#include <PropertyConverter.h>
Static Public Member Functions | |
template<typename DataType > | |
static AnnotatedArray< DataType, Subindex > | convert (const Property::AbstractProperty< DataType > &abstractProperty) |
template<typename DataType > | |
static AnnotatedArray< DataType, Subindex > | convert (const Property::AbstractProperty< DataType > &abstractProperty, const Index &pattern) |
Convert Properties to AnnotatedArrays.
If the Property is on the format Index::Descriptor::Format::None or IndexDescriptor::Format::Ranges, it can be converted to an AnnotatedArray using
where DataType is the data type of the Propertys data elements. If the property has a block structure, the last array subindex corresponds to this block index. For example, for a Property::EnergyResolvedProperty, the last subindex corresponds to energy.
Similart to above, if the Property is on the format IndexDescriptor::Format::Custom, it can be converted to an AnnotatedArray using
Here pattern is an Index that will be matched against every Index in the property to determine whether it should be included in the output or not. The resulting AnnotatedArray will have minimal possible ranges to conver all included Indices. The ranges for the AnnotatedArray start from zero, but the axes that can be obtained using
contains information about which Subindex that corresponds to which array entry. The Subindices for the nth dimension is contained in axes[n].
|
static |
Converts an AbstractProperty on the format IndexDescriptor::Format::None or IndexDescriptor::Format::Ranges to an AnnotatedArray.
abstractProperty | The property to convert. |
|
static |
Converts an AbstractProperty on the format IndexDescriptor::Format::Custom to an AnnotatedArray. The data for all points matching a given pattern Index will be extracted.
The dimension of the resulting AnnotatedArray will be equal to the number of wild cards (plus one if the block size is larger than one). The size of a given dimension is given by the difference between the largest and smallest Subindex for the corresponding Subindex position. For example, if the pattern is {a, 5, a} and the property contains data for {3, 5, 4}, {7, 5, 5}, {4, 5, 9}, the first dimension will range from 0 to 4 (= 7-3) and the second dimension will range from 0 to 6 (= 9-4). The corresponding axes will contain {3, 4, 5, 6, 7} and {4, 5, 6, 7, 8, 9}. If the property has a block size, the last dimension ranges from 0 to blockSize, with the corresponding axis containing {0, ..., blockSize-1}.
If the Indices are not dense, AnnotatedArray elements corresponding to "missing Indices" will be set to zero.
abstractProperty | The property to convert. |
pattern | Pattern that determines which points to extract the data for. |