本文整理汇总了C++中AMDataSource::axisValue方法的典型用法代码示例。如果您正苦于以下问题:C++ AMDataSource::axisValue方法的具体用法?C++ AMDataSource::axisValue怎么用?C++ AMDataSource::axisValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AMDataSource
的用法示例。
在下文中一共展示了AMDataSource::axisValue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QPointF
void AM4DBinningABEditor::placeRangeRectangle()
{
AMDataSource* inputSource;
if(analysisBlock_->inputDataSourceCount() > 0 && (inputSource=analysisBlock_->inputDataSourceAt(0))) {
int sumAxis = analysisBlock_->sumAxis();
double dataMin = inputSource->axisValue(sumAxis,0);
double sumMin = inputSource->axisValue(sumAxis, analysisBlock_->sumRangeMin());
double sumMax = inputSource->axisValue(sumAxis, analysisBlock_->sumRangeMax());
double dataMax = inputSource->axisValue(sumAxis, inputSource->size(sumAxis)-1);
rangeRectangle1_->setYAxisTarget(plot_->axisScaleVerticalRelative()); // note: does nothing if already correct
rangeRectangle2_->setYAxisTarget(plot_->axisScaleVerticalRelative()); // note: does nothing if already correct
rangeRectangle1_->setXAxisTarget(plot_->axisScaleBottom()); // note: does nothing if already correct
rangeRectangle2_->setXAxisTarget(plot_->axisScaleBottom()); // note: does nothing if already correct
rangeRectangle1_->setRect(QRectF(QPointF(dataMin,0), QPointF(sumMin,1)).normalized());
rangeRectangle2_->setRect(QRectF(QPointF(sumMax,0), QPointF(dataMax,1)).normalized());
rangeRectangle1_->setVisible(true);
rangeRectangle2_->setVisible(true);
}
else {
rangeRectangle1_->setVisible(false);
rangeRectangle2_->setVisible(false);
}
}
示例2: writeMainTable
void VESPERSExporterSMAK::writeMainTable()
{
QTextStream ts(file_);
// 1. Column header.
if(option_->columnHeaderIncluded()) {
ts << "# ";
for(int c=0; c<mainTableDataSources_.count(); c++) {
setCurrentDataSource(mainTableDataSources_.at(c));
if(mainTableIncludeX_.at(c))
ts << "H" << option_->columnDelimiter() << "V" << option_->columnDelimiter();
ts << parseKeywordString(option_->columnHeader()) << option_->columnDelimiter();
}
}
ts << option_->newlineDelimiter() << option_->columnHeaderDelimiter() << option_->newlineDelimiter();
// 2. rows
VESPERS2DScanConfiguration *config = qobject_cast<VESPERS2DScanConfiguration *>(const_cast<AMScanConfiguration *>(currentScan_->scanConfiguration()));
if (!config)
return;
QString suffix;
if (config->ccdDetector().testFlag(VESPERS::Roper))
suffix = "spe";
else if (config->ccdDetector().testFlag(VESPERS::Mar))
suffix = "tif";
else if (config->ccdDetector().testFlag(VESPERS::Pilatus))
suffix = "tif";
QString ccdFileName = config->ccdFileName();
int yRange = yRange_ == -1 ? currentScan_->scanSize(1) : (yRange_-1);
int xRange = currentScan_->scanSize(0);
for(int y = 0; y < yRange; y++) {
for (int x = 0; x < xRange; x++){
// over rows within columns
for(int c=0; c<mainTableDataSources_.count(); c++) {
setCurrentDataSource(mainTableDataSources_.at(c));
AMDataSource* ds = currentScan_->dataSourceAt(currentDataSourceIndex_);
int precision = option_->exportPrecision(ds->name());
// print x and y column?
if(mainTableIncludeX_.at(c)) {
ts << ds->axisValue(0,x).toString(precision);
ts << option_->columnDelimiter();
ts << ds->axisValue(1, y).toString(precision);
ts << option_->columnDelimiter();
}
if(ds->name().contains("FileNumber"))
ts << QString("%1_%2.%3").arg(ccdFileName).arg(int(ds->value(AMnDIndex(x, y)))-1).arg(suffix); // The -1 is because the value stored here is the NEXT number in the scan. Purely a nomenclature setup from the EPICS interface.
else
ts << ds->value(AMnDIndex(x, y)).toString(precision);
ts << option_->columnDelimiter();
}
ts << option_->newlineDelimiter();
}
}
if (yRange_ != -1 && xIndex_ != -1){
for (int x = 0; x < xIndex_; x++){
// over rows within columns
for(int c=0; c<mainTableDataSources_.count(); c++) {
setCurrentDataSource(mainTableDataSources_.at(c));
AMDataSource* ds = currentScan_->dataSourceAt(currentDataSourceIndex_);
int precision = option_->exportPrecision(ds->name());
// print x and y column?
if(mainTableIncludeX_.at(c)) {
ts << ds->axisValue(0,x).toString(precision);
ts << option_->columnDelimiter();
ts << ds->axisValue(1, yRange_-1).toString(precision);
ts << option_->columnDelimiter();
}
if(ds->name().contains("FileNumber"))
ts << QString("%1_%2.%3").arg(ccdFileName).arg(int(ds->value(AMnDIndex(x, yRange_-1)))-1).arg(suffix); // The -1 is because the value stored here is the NEXT number in the scan. Purely a nomenclature setup from the EPICS interface.
else
ts << ds->value(AMnDIndex(x, yRange_-1)).toString(precision);
//.........这里部分代码省略.........
示例3: ts
void AMExporter2DAscii::writeMainTable()
{
QTextStream ts(file_);
// 1. Column header.
if(option_->columnHeaderIncluded()) {
ts << "# ";
for(int c=0; c<mainTableDataSources_.count(); c++) {
setCurrentDataSource(mainTableDataSources_.at(c));
if(mainTableIncludeX_.at(c))
ts << currentScan_->rawData()->scanAxisAt(0).name << option_->columnDelimiter() << currentScan_->rawData()->scanAxisAt(1).name << option_->columnDelimiter();
ts << parseKeywordString(option_->columnHeader()) << option_->columnDelimiter();
}
}
ts << option_->newlineDelimiter() << option_->columnHeaderDelimiter() << option_->newlineDelimiter();
// 2. rows
int yRange = yRange_ == -1 ? currentScan_->scanSize(1) : (yRange_-1);
int xRange = currentScan_->scanSize(0);
for(int y = 0; y < yRange; y++) {
for (int x = 0; x < xRange; x++){
// over rows within columns
for(int c=0; c<mainTableDataSources_.count(); c++) {
setCurrentDataSource(mainTableDataSources_.at(c));
AMDataSource* ds = currentScan_->dataSourceAt(currentDataSourceIndex_);
// print x and y column?
if(mainTableIncludeX_.at(c)) {
ts << ds->axisValue(0, x).toString();
ts << option_->columnDelimiter();
ts << ds->axisValue(1, y).toString();
ts << option_->columnDelimiter();
}
ts << ds->value(AMnDIndex(x, y)).toString();
ts << option_->columnDelimiter();
}
ts << option_->newlineDelimiter();
}
}
if (yRange_ != -1 && xIndex_ != -1){
for (int i = 0; i < xIndex_; i++){
// over rows within columns
for(int c=0; c<mainTableDataSources_.count(); c++) {
setCurrentDataSource(mainTableDataSources_.at(c));
AMDataSource* ds = currentScan_->dataSourceAt(currentDataSourceIndex_);
// print x and y column?
if(mainTableIncludeX_.at(c)) {
ts << ds->axisValue(0,i).toString();
ts << option_->columnDelimiter();
ts << ds->axisValue(1, yRange_-1).toString();
ts << option_->columnDelimiter();
}
ts << ds->value(AMnDIndex(i, yRange_-1)).toString();
ts << option_->columnDelimiter();
}
ts << option_->newlineDelimiter();
}
}
ts << option_->newlineDelimiter();
}
示例4: xAxis
void AM4DBinningABEditor::updateSeriesData()
{
AMDataSource *source = analysisBlock_->inputDataSourceAt(0);
if (source){
int sumAxis = analysisBlock_->sumAxis();
int sumAxisSize = source->size(sumAxis);
QVector<double> xAxis(sumAxisSize);
QVector<double> yAxis(sumAxisSize, 0);
for (int i = 0; i < sumAxisSize; i++)
xAxis[i] = double(source->axisValue(sumAxis, i));
switch (sumAxis){
case 0:{
for (int i = 0, iSize = analysisBlock_->size(0); i < iSize; i++){
for (int j = 0, jSize = analysisBlock_->size(1); j < jSize; j++){
for (int k = 0, kSize = analysisBlock_->size(2); k < kSize; k++){
QVector<double> temp(sumAxisSize);
source->values(AMnDIndex(0, i, j, k), AMnDIndex(sumAxisSize-1, i, j, k), temp.data());
for (int l = 0; l < sumAxisSize; l++)
yAxis[l] += temp.at(l);
}
}
}
break;
}
case 1:{
for (int i = 0, iSize = analysisBlock_->size(0); i < iSize; i++){
for (int j = 0, jSize = analysisBlock_->size(1); j < jSize; j++){
for (int k = 0, kSize = analysisBlock_->size(2); k < kSize; k++){
QVector<double> temp(sumAxisSize);
source->values(AMnDIndex(i, 0, j, k), AMnDIndex(i, sumAxisSize-1, j, k), temp.data());
for (int l = 0; l < sumAxisSize; l++)
yAxis[l] += temp.at(l);
}
}
}
break;
}
case 2:{
for (int i = 0, iSize = analysisBlock_->size(0); i < iSize; i++){
for (int j = 0, jSize = analysisBlock_->size(1); j < jSize; j++){
for (int k = 0, kSize = analysisBlock_->size(2); k < kSize; k++){
QVector<double> temp(sumAxisSize);
source->values(AMnDIndex(i, j, 0, k), AMnDIndex(i, j, sumAxisSize-1, k), temp.data());
for (int l = 0; l < sumAxisSize; l++)
yAxis[l] += temp.at(l);
}
}
}
break;
}
case 3:{
for (int i = 0, iSize = analysisBlock_->size(0); i < iSize; i++){
for (int j = 0, jSize = analysisBlock_->size(1); j < jSize; j++){
for (int k = 0, kSize = analysisBlock_->size(2); k < kSize; k++){
QVector<double> temp(sumAxisSize);
source->values(AMnDIndex(i, j, k, 0), AMnDIndex(i, j, k, sumAxisSize-1), temp.data());
for (int l = 0; l < sumAxisSize; l++)
yAxis[l] += temp.at(l);
}
}
}
break;
}
}
seriesData_->setValues(xAxis, yAxis);
}
}
示例5: writeSeparateSections
void AMExporterGeneralAscii::writeSeparateSections()
{
QTextStream ts(file_);
if (option_->higherDimensionsInRows()){
for(int s=0; s<separateSectionDataSources_.count(); s++) {
ts << option_->newlineDelimiter();
setCurrentDataSource(separateSectionDataSources_.at(s)); // sets currentDataSourceIndex_
AMDataSource* ds = currentScan_->dataSourceAt(currentDataSourceIndex_);
int precision = option_->exportPrecision(ds->name());
// section header?
if(option_->sectionHeaderIncluded()) {
ts << parseKeywordString(option_->sectionHeader());
ts << option_->newlineDelimiter();
}
// column header?
if(option_->columnHeaderIncluded()) {
// 1D data sources:
if(ds->rank() == 0) {
ts << parseKeywordString(option_->columnHeader()) << option_->columnDelimiter();
}
else if(ds->rank() == 1) {
if(separateSectionIncludeX_.at(s))
ts << parseKeywordString(option_->columnHeader()) << ".X" << option_->columnDelimiter();
ts << parseKeywordString(option_->columnHeader()) << option_->columnDelimiter();
}
else if(ds->rank() == 2) { // 2D
if(separateSectionIncludeX_.at(s))
ts << parseKeywordString(option_->columnHeader()) << ".X" << option_->columnDelimiter();
// need a loop over the second axis columns
for(int cc=0; cc<ds->size(1); cc++) {
setCurrentColumnIndex(cc);
ts << parseKeywordString(option_->columnHeader()) << "[" << ds->axisValue(1, cc).toString(precision) << ds->axisInfoAt(1).units << "]" << option_->columnDelimiter();
}
}
ts << option_->newlineDelimiter() << option_->columnHeaderDelimiter() << option_->newlineDelimiter();
}
// table
switch(ds->rank()) {
case 0:
ts << ds->value(AMnDIndex()).toString(precision) << option_->columnDelimiter() << option_->newlineDelimiter();
break;
case 1: {
int maxTableRows = ds->size(0);
for(int r=0; r<maxTableRows; r++) {
if(separateSectionIncludeX_.at(s)) {
ts << ds->axisValue(0,r).toString(precision) << option_->columnDelimiter();
}
ts << ds->value(r).toString(precision) << option_->columnDelimiter() << option_->newlineDelimiter();
}
}
break;
case 2: {
int maxTableRows = ds->size(0);
for(int r=0; r<maxTableRows; r++) {
if(separateSectionIncludeX_.at(s))
ts << ds->axisValue(0,r).toString(precision) << option_->columnDelimiter();
// need a loop over the second axis columns
for(int cc=0; cc<ds->size(1); cc++) {
ts << ds->value(AMnDIndex(r,cc)).toString(precision) << option_->columnDelimiter();
}
ts << option_->newlineDelimiter();
}
}
break;
default:
/// \todo Implement 3D
break;
}
}
}
// For writing out in columns. Essentially transposing the file.
else{
for(int s=0; s<separateSectionDataSources_.count(); s++) {
setCurrentDataSource(separateSectionDataSources_.at(s)); // sets currentDataSourceIndex_
AMDataSource* ds = currentScan_->dataSourceAt(currentDataSourceIndex_);
int precision = option_->exportPrecision(ds->name());
// section header?
if(option_->sectionHeaderIncluded()) {
ts << parseKeywordString(option_->sectionHeader());
ts << option_->newlineDelimiter();
}
// If including the X values.
if (separateSectionIncludeX_.at(s)){
switch(ds->rank()){
case 0:
break;
//.........这里部分代码省略.........
示例6: ts
void VESPERSExporter2DAscii::writeMainTable()
{
QTextStream ts(file_);
// 1. Column header.
if(option_->columnHeaderIncluded()) {
ts << "# ";
for(int c=0; c<mainTableDataSources_.count(); c++) {
setCurrentDataSource(mainTableDataSources_.at(c));
if(mainTableIncludeX_.at(c))
ts << currentScan_->rawData()->scanAxisAt(0).name << option_->columnDelimiter() << currentScan_->rawData()->scanAxisAt(1).name << option_->columnDelimiter();
ts << parseKeywordString(option_->columnHeader()) << option_->columnDelimiter();
}
}
ts << option_->newlineDelimiter() << option_->columnHeaderDelimiter() << option_->newlineDelimiter();
// 2. rows
VESPERS::CCDDetectors ccdDetector;
QString ccdFileName = "";
VESPERS2DScanConfiguration *configuration2D = qobject_cast<VESPERS2DScanConfiguration *>(const_cast<AMScanConfiguration *>(currentScan_->scanConfiguration()));
VESPERSTimedLineScanConfiguration *timedConfiguration = qobject_cast<VESPERSTimedLineScanConfiguration *>(const_cast<AMScanConfiguration *>(currentScan_->scanConfiguration()));
if (configuration2D){
ccdDetector = configuration2D->ccdDetector();
ccdFileName = configuration2D->ccdFileName();
}
else if (timedConfiguration){
ccdDetector = timedConfiguration->ccdDetector();
ccdFileName = timedConfiguration->ccdFileName();
}
else
return;
QString ccdString;
// This will return -1 if it fails. This means any checks inside this loop will always fail if the CCD was not included.
int yRange = yRange_ == -1 ? currentScan_->scanSize(1) : (yRange_-1);
int xRange = currentScan_->scanSize(0);
if (ccdDetector.testFlag(VESPERS::Roper))
ccdString = ccdFileName % "_%1.spe";
else if (ccdDetector.testFlag(VESPERS::Mar))
ccdString = ccdFileName % "_%1.tif";
else if (ccdDetector.testFlag(VESPERS::Pilatus))
ccdString = ccdFileName % "-%1.tif";
else
ccdString = "";
for(int y = 0; y < yRange; y++) {
for (int x = 0; x < xRange; x++){
// over rows within columns
for(int c=0; c<mainTableDataSources_.count(); c++) {
setCurrentDataSource(mainTableDataSources_.at(c));
AMDataSource* ds = currentScan_->dataSourceAt(currentDataSourceIndex_);
int precision = option_->exportPrecision(ds->name());
// print x and y column?
if(mainTableIncludeX_.at(c)) {
ts << ds->axisValue(0, x).toString(precision);
ts << option_->columnDelimiter();
ts << ds->axisValue(1, y).toString(precision);
ts << option_->columnDelimiter();
}
if(ds->name().contains("FileNumber"))
ts << QString(ccdString).arg(int(ds->value(AMnDIndex(x, y)))-1); // The -1 is because the value stored here is the NEXT number in the scan. Purely a nomenclature setup from the EPICS interface.
else
ts << ds->value(AMnDIndex(x, y)).toString(precision);
ts << option_->columnDelimiter();
}
ts << option_->newlineDelimiter();
}
}
if (yRange_ != -1 && xIndex_ != -1){
for (int x = 0; x < xIndex_; x++){
// over rows within columns
for(int c=0; c<mainTableDataSources_.count(); c++) {
//.........这里部分代码省略.........