这篇教程C++ AMDataSource类代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中AMDataSource类的典型用法代码示例。如果您正苦于以下问题:C++ AMDataSource类的具体用法?C++ AMDataSource怎么用?C++ AMDataSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。 在下文中一共展示了AMDataSource类的23个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: QPointFvoid 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); }}
开发者ID:anukat2015,项目名称:acquaman,代码行数:31,
示例2: inputDataSourceAtvoid AMAnalysisBlock::onInputSourceDeleted(void* deletedSource) { // this implementation is just like calling setInputDataSources() with an empty list, except we don't want to call deregisterObserver() on the deleted input source. (In a single-threaded situation, this would be okay, but if the deleted() signal came through a queued signal-slot connection, then that object might already be deleted) for(int i=0; i<inputDataSourceCount(); i++) { AMDataSource* oldSource = inputDataSourceAt(i); if(oldSource != deletedSource) { disconnect(oldSource->signalSource(), SIGNAL(deleted(void*)), this, SLOT(onInputSourceDeleted(void*))); oldSource->deregisterObserver(this); } }
开发者ID:acquaman,项目名称:acquaman,代码行数:9,
示例3: onDataSourceDescriptionChangedvoid AMDataSourcesEditor::onDataSourceDescriptionChanged(){ QModelIndex index = scanSetView_->currentIndex(); AMDataSource *dataSource = model_->dataSourceAt(index.parent().row(), index.row()); if (dataSource){ descriptionEdit_->setText(dataSource->description()); scanSetView_->update(index); }}
开发者ID:anukat2015,项目名称:acquaman,代码行数:10,
示例4: MPlotImageBasicvoid AM2DSummingABEditor::onAnalysisBlockInputDataSourcesChanged() { if(image_) { delete image_; image_ = 0; } AMDataSource* inputSource; if(analysisBlock_->inputDataSourceCount() > 0 && (inputSource=analysisBlock_->inputDataSourceAt(0))) { // inputSource is a valid data source axisSelector_->setEnabled(false); rangeMinControl_->setEnabled(true); rangeMaxControl_->setEnabled(true); QList<AMAxisInfo> inputSourceAxes = inputSource->axes(); // we know (according to AM2DSummingAB's check of input source validity) that there are two axes here. axisSelector_->setItemText(0, inputSourceAxes.at(0).name + ": " + inputSourceAxes.at(0).description); axisSelector_->setItemText(1, inputSourceAxes.at(1).name + ": " + inputSourceAxes.at(1).description); // set the current status of the controls to reflect the (but don't have then trigger our slots) int sumAxis = analysisBlock_->sumAxis(); axisSelector_->blockSignals(true); axisSelector_->setCurrentIndex(sumAxis); axisSelector_->blockSignals(false); rangeMinControl_->blockSignals(true); rangeMinControl_->setMaximum(inputSourceAxes.at(sumAxis).size-1); rangeMinControl_->setValue(analysisBlock_->sumRangeMin()); rangeMinControl_->blockSignals(false); rangeMaxControl_->blockSignals(true); rangeMaxControl_->setMaximum(inputSourceAxes.at(sumAxis).size-1); rangeMaxControl_->setValue(analysisBlock_->sumRangeMax()); rangeMaxControl_->blockSignals(false); image_ = new MPlotImageBasic(); AMDataSourceImageData *model = new AMDataSourceImageData; model->setDataSource(inputSource); image_->setModel(model, true); plot_->addItem(image_); } else { // no input source. Not much we can do. axisSelector_->setEnabled(false); rangeMinControl_->setEnabled(false); rangeMaxControl_->setEnabled(false); } placeRangeRectangle();}
开发者ID:acquaman,项目名称:acquaman,代码行数:54,
示例5: void AM4DBinningABEditor::populateComboBox(){ AMDataSource *tempSource = 0; for (int i = 0; i < analysisBlock_->inputDataSourceCount(); i++){ tempSource = analysisBlock_->inputDataSourceAt(i); if (analysisBlock_->name() != tempSource->name()) names_->addItem(tempSource->description(), tempSource->name()); }}
开发者ID:anukat2015,项目名称:acquaman,代码行数:12,
示例6: void AM1DBasicIntegralABEditor::populateComboBox(){ AMDataSource *tempSource = 0; for (int i = 0; i < analysisBlock_->inputDataSourceCount(); i++) { tempSource = analysisBlock_->inputDataSourceAt(i); if (analysisBlock_->name() != tempSource->name() && !tempSource->hiddenFromUsers()) names_->addItem(tempSource->description(), tempSource->name()); }}
开发者ID:Cpppro,项目名称:acquaman,代码行数:12,
示例7: QStringvoid AMDataSourcesEditor::onCloseButtonClicked(const QModelIndex &index) { // handle data source-level indexes only: if(!index.parent().isValid()) return; int dataSourceIndex = index.row(); int scanIndex = index.parent().row(); AMScan* scan = model_->scanAt(scanIndex); if(!scan || dataSourceIndex >= scan->dataSourceCount()) return; if (dataSourceIndex < scan->rawDataSourceCount()){ QMessageBox::warning(this, "Can not remove raw data sources.", QString("Acquaman does not allow the deletion of raw data sources.")); return; } AMDataSource* dataSource = scan->dataSourceAt(dataSourceIndex); int response = QMessageBox::question(this, "Remove Data Source?", QString("Remove this data source? /n/n'%1' (%2)/n/nThe data source will be deleted, and no longer visible in any plots. Any other data sources that depend on this data source will be reset. Raw data will NOT be deleted, and you can re-create the data source later if you need it.").arg(dataSource->description()).arg(dataSource->name()), QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Ok); if(response == QMessageBox::Ok) scan->deleteDataSourceAt(dataSourceIndex);}
开发者ID:anukat2015,项目名称:acquaman,代码行数:25,
示例8: populateComboBoxvoid AMOrderReductionABEditor::populateComboBox(){ AMDataSource *source = 0; for (int i = 0, size = analysisBlock_->inputDataSourceCount(); i < size; i++){ source = analysisBlock_->inputDataSourceAt(i); if (analysisBlock_->name() != source->name()) sourceNames_->addItem(source->description(), source->name()); } if (analysisBlock_->rank() != 0){ for (int i = 0, size = analysisBlock_->currentInputSource()->rank(); i < size; i++) reducedAxisOptions_->insertItem(i, analysisBlock_->currentInputSource()->axisInfoAt(i).description, i); }}
开发者ID:Cpppro,项目名称:acquaman,代码行数:18,
示例9: switchvoid AMExternalScanDataSourceAB::copyValues(int dataSourceIndex){ AMDataSource* ds = scan_->dataSourceAt(dataSourceIndex); const AMnDIndex size = ds->size(); switch(ds->rank()) { case 0: values_.clear(); values_ << ds->value(AMnDIndex()); break; case 1: { values_.resize(size.i()); for(int i=0; i<size.i(); i++) values_[i] = ds->value(i); break; } case 2: { values_.resize(size.i()*size.j()); for(int i=0; i<size.i(); i++) for(int j=0; j<size.j(); j++) values_[i*size.j() + j] = ds->value(AMnDIndex(i,j)); break; } case 3: { values_.resize(size.i()*size.j()*size.k()); for(int i=0; i<size.i(); i++) for(int j=0; j<size.j(); j++) for(int k=0; k<size.k(); k++) values_[i*size.j()*size.k() + j*size.k() + k] = ds->value(AMnDIndex(i,j,k)); break; } case 4: { values_.resize(size.i()*size.j()*size.k()*size.l()); for(int i=0; i<size.i(); i++) for(int j=0; j<size.j(); j++) for(int k=0; k<size.k(); k++) for(int l=0; l<size.l(); l++) values_[i*size.j()*size.k()*size.l() + j*size.k()*size.l() + k*size.l() + l] = ds->value(AMnDIndex(i,j,k,l)); break; } case 5: { values_.resize(size.i()*size.j()*size.k()*size.l()*size.m()); for(int i=0; i<size.i(); i++) for(int j=0; j<size.j(); j++) for(int k=0; k<size.k(); k++) for(int l=0; l<size.l(); l++) for(int m=0; m<size.m(); m++) values_[i*size.j()*size.k()*size.l()*size.m() + j*size.k()*size.l()*size.m() + k*size.l()*size.m() + l*size.m() + m] = ds->value(AMnDIndex(i,j,k,l,m)); /// /todo oh god, we really need a block copy or a multi-dimensional iterator for AMDataSource::value()... break; } }}
开发者ID:Cpppro,项目名称:acquaman,代码行数:54,
示例10: removeDetailEditorvoid AMDataSourcesEditor::onSetViewIndexChanged(const QModelIndex &selected, const QModelIndex &deselected) { removeDetailEditor(); // Nothing selected? //////////////////////// if(!selected.isValid()) { nameEdit_->clear(); descriptionEdit_->clear(); descriptionEdit_->setReadOnly(true); addDataSourceButton_->setDisabled(true); return; } addDataSourceButton_->setEnabled(true); // Scan selected? (No selected data source) ///////////////////////// if(!selected.parent().isValid()) { nameEdit_->clear(); descriptionEdit_->clear(); descriptionEdit_->setReadOnly(true); return; } // Data source selected. ///////////////// // Remove old connection to the data source description. int oldSi = deselected.parent().row(); int oldDi = deselected.row(); AMDataSource *oldDataSource = model_->dataSourceAt(oldSi, oldDi); if (oldDataSource) disconnect(oldDataSource->signalSource(), SIGNAL(infoChanged()), this, SLOT(onDataSourceDescriptionChanged())); // Setup new data source. int si = selected.parent().row(); int di = selected.row(); AMDataSource* dataSource = model_->dataSourceAt(si, di); if(!dataSource) return; connect(dataSource->signalSource(), SIGNAL(infoChanged()), this, SLOT(onDataSourceDescriptionChanged())); nameEdit_->setText(dataSource->name()); descriptionEdit_->setText(dataSource->description()); descriptionEdit_->setReadOnly(false); installDetailEditor(dataSource->createEditorWidget()); // Set the new selected data source as the exclusive view preference. model_->setExclusiveDataSourceByName(dataSource->name());}
开发者ID:anukat2015,项目名称:acquaman,代码行数:54,
示例11: // responds to GUI eventsvoid AM2DSummingABEditor::onSumAxisControlChanged(int newSumAxis) { if(newSumAxis == analysisBlock_->sumAxis()) return; // adjust the maximums for the ranges AMDataSource* inputSource; if(analysisBlock_->inputDataSourceCount() > 0 && (inputSource=analysisBlock_->inputDataSourceAt(0))) { int newRangeMax = inputSource->size(newSumAxis)-1; rangeMinControl_->setMaximum(newRangeMax); rangeMaxControl_->setMaximum(newRangeMax); } analysisBlock_->setSumAxis(newSumAxis); placeRangeRectangle();}
开发者ID:acquaman,项目名称:acquaman,代码行数:20,
示例12: copyAxisValuesvoid AMExternalScanDataSourceAB::copyAxisValues(int dataSourceIndex){ AMDataSource* ds = scan_->dataSourceAt(dataSourceIndex); const AMnDIndex size = ds->size(); axisValues_.clear(); for(int mu=0; mu<size.rank(); mu++) { // for each axis QVector<AMNumber> av; if(!axes_.at(mu).isUniform) { int axisLength = size.at(mu); for(int i=0; i<axisLength; i++) // copy all the axis values av << axisValue(mu, i); } axisValues_ << av; }}
开发者ID:Cpppro,项目名称:acquaman,代码行数:19,
示例13: QStringbool AMAnalysisBlock::setInputDataSources(const QList<AMDataSource*>& dataSources) { // if a non-empty set of data sources has been provided, and they are not acceptable, return false. (An empty list must always be acceptable) if(!dataSources.isEmpty() && !areInputDataSourcesAcceptable(dataSources)) { AMErrorMon::report(AMErrorReport(this, AMErrorReport::Alert, -98, QString("There was an error connecting the input data sources to this analysis component '%1: %2'. The data sources provided weren't acceptable. This can happen if they have the wrong dimension, don't provide enough data, etc.").arg(name()).arg(description()))); return false; } for(int i=0; i<inputDataSourceCount(); i++) { AMDataSource* oldSource = inputDataSourceAt(i); disconnect(oldSource->signalSource(), SIGNAL(deleted(void*)), this, SLOT(onInputSourceDeleted(void*))); oldSource->deregisterObserver(this); } for(int i=0; i<dataSources.count(); i++) { AMDataSource* newSource = dataSources.at(i); connect(newSource->signalSource(), SIGNAL(deleted(void*)), this, SLOT(onInputSourceDeleted(void*))); dataSources.at(i)->registerObserver(this); } setInputDataSourcesImplementation(dataSources); emit inputSourcesChanged(); return true;}
开发者ID:acquaman,项目名称:acquaman,代码行数:24,
示例14: void AM3DNormalizationABEditor::populateComboBox(){ AMDataSource *tempSource = 0; int inputCount = analysisBlock_->inputDataSourceCount(); for (int i = 0; i < inputCount; i++){ tempSource = analysisBlock_->inputDataSourceAt(i); if (analysisBlock_->name() != tempSource->name()){ dataNames_->addItem(tempSource->description(), tempSource->name()); normalizationNames_->addItem(tempSource->description(), tempSource->name()); } }}
开发者ID:acquaman,项目名称:acquaman,代码行数:16,
示例15: QStringvoid REIXSAppController::onScanAddedToEditor(AMGenericScanEditor *editor, AMScan *scan){ QString exclusiveName = QString(); for (int i = 0, count = scan->analyzedDataSourceCount(); i < count && exclusiveName.isNull(); i++){ AMDataSource *source = scan->analyzedDataSources()->at(i); if (source->name().contains("TEYNorm") && !source->hiddenFromUsers()) exclusiveName = source->name(); if (source->name().contains("xesSpectrum") && !source->hiddenFromUsers()) exclusiveName = source->name(); } if (!exclusiveName.isNull()) editor->setExclusiveDataSourceByName(exclusiveName); else if (editor->scanAt(0)->analyzedDataSourceCount()) editor->setExclusiveDataSourceByName(editor->scanAt(0)->analyzedDataSources()->at(editor->scanAt(0)->analyzedDataSourceCount()-1)->name());}
开发者ID:acquaman,项目名称:acquaman,代码行数:21,
示例16: setCurrentDataSourcebool AMExporter2DAscii::writeSeparateFiles(const QString &destinationFolderPath){ if (option_->higherDimensionsInRows()){ for (int s = 0, sSize = separateFileDataSources_.size(); s < sSize; s++) { setCurrentDataSource(separateFileDataSources_.at(s)); // sets currentDataSourceIndex_ AMDataSource* source = currentScan_->dataSourceAt(currentDataSourceIndex_); QFile output; QString separateFileName = parseKeywordString( destinationFolderPath % "/" % option_->separateSectionFileName() ); separateFileName = removeNonPrintableCharacters(separateFileName); if(!openFile(&output, separateFileName)) { AMErrorMon::report(AMErrorReport(this, AMErrorReport::Alert, -4, "Export failed (partially): You selected to create separate files for certain data sets. Could not open the file '" % separateFileName % "' for writing. Check that you have permission to save files there, and that a file with that name doesn't already exists.")); return false; } int spectraSize = source->size(2); QString columnDelimiter = option_->columnDelimiter(); QString newLineDelimiter = option_->newlineDelimiter(); QTextStream out(&output); 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++){ QVector<double> data(spectraSize); source->values(AMnDIndex(x, y, 0), AMnDIndex(x, y, spectraSize-1), data.data()); for (int i = 0; i < spectraSize; i++) out << data.at(i) << columnDelimiter; out << newLineDelimiter; } } if (yRange_ != -1 && xIndex_ != -1){ for (int i = 0; i < xIndex_; i++){ QVector<double> data(spectraSize); source->values(AMnDIndex(i, yRange_-1, 0), AMnDIndex(i, yRange_-1, spectraSize-1), data.data()); for (int i = 0; i < spectraSize; i++) out << data.at(i) << columnDelimiter; out << newLineDelimiter; } out << newLineDelimiter; } output.close(); } } else{ for (int s = 0, sSize = separateFileDataSources_.size(); s < sSize; s++) { setCurrentDataSource(separateFileDataSources_.at(s)); // sets currentDataSourceIndex_ AMDataSource* source = currentScan_->dataSourceAt(currentDataSourceIndex_); QFile output; QString separateFileName = parseKeywordString( destinationFolderPath % "/" % option_->separateSectionFileName() ); separateFileName = removeNonPrintableCharacters(separateFileName); if(!openFile(&output, separateFileName)) { AMErrorMon::report(AMErrorReport(this, AMErrorReport::Alert, -4, "Export failed (partially): You selected to create separate files for certain data sets. Could not open the file '" % separateFileName % "' for writing. Check that you have permission to save files there, and that a file with that name doesn't already exists.")); return false; } int spectraSize = source->size(2); QString columnDelimiter = option_->columnDelimiter(); QString newLineDelimiter = option_->newlineDelimiter(); QTextStream out(&output); int yRange = yRange_ == -1 ? currentScan_->scanSize(1) : (yRange_-1); int xRange = currentScan_->scanSize(0); for (int i = 0; i < spectraSize; i++){ for (int y = 0; y < yRange; y++) for (int x = 0; x < xRange; x++) out << double(source->value(AMnDIndex(x, y, i))) << columnDelimiter; if (yRange_ != -1 && xIndex_ != -1){ for (int x = 0; x < xIndex_; x++) out << double(source->value(AMnDIndex(x, yRange_-1, i))) << columnDelimiter; } out << newLineDelimiter; } output.close(); } }//.........这里部分代码省略.........
开发者ID:anukat2015,项目名称:acquaman,代码行数:101,
示例17: disconnectvoid AMDataSourcesEditor::onNewDataSourceNamed() { if(!editingNewDataSourceName_) return; editingNewDataSourceName_ = false; QString chName = nameEdit_->text(); disconnect(nameEdit_, SIGNAL(editingFinished()), this, SLOT(onNewDataSourceNamed())); nameEdit_->clearFocus(); nameEdit_->setReadOnly(true); int si = currentScanIndex(); if(si < 0 || si >= model_->scanCount()) { // this should have never happened. How did we get here? You shouldn't have been able to press the addNewChannel button without a current scan. return; } if(chName.isEmpty()) return; if(model_->scanAt(si)->indexOfDataSource(chName) != -1) { AMErrorMon::report(AMErrorReport(this, AMErrorReport::Alert, -1, QString("Couldn't create a new data source with the name /"%1/". Make sure to choose a name that doesn't exist already in this scan.").arg(chName))); scanSetView_->setCurrentIndex(scanSetView_->currentIndex()); return; } AMScan* scan = model_->scanAt(si); QList<AMDataSource*> singleDimDataSources; QList<AMDataSource *> twoDimDataSources; QList<AMDataSource *> threeDimDataSources; AMAnalysisBlock *newAnalysisBlock = 0; AMDataSource *tempSource = 0; // find out all the available 1D and 2D data sources, to use for inputs on this new data source. /// /todo Currently this only provides access to the raw data sources, until we can figure out a way to detect or work-around the circular reference problem if analyzed data sources could be used as input. /// /note DH: I have changed this to use all of the data sources. There currently is still no work-around for the circular reference problem. We are just going to have to be careful about using this. for(int i=0; i<scan->dataSourceCount(); i++){ tempSource = scan->dataSourceAt(i); if(tempSource->rank() == 1) singleDimDataSources << tempSource; else if(tempSource->rank() == 2) twoDimDataSources << tempSource; else if (tempSource->rank() == 3) threeDimDataSources << tempSource; } newAnalysisBlock = qobject_cast<AMAnalysisBlock *>(AMDbObjectSupport::s()->objectInfoForClass(nameOfAnalysisBlockToBeAdded_)->metaObject->newInstance(Q_ARG(QString, chName))); // This should always happen. But just to be safe. if (newAnalysisBlock){ if (newAnalysisBlock->desiredInputRank() == 1) newAnalysisBlock->setInputDataSources(singleDimDataSources); else if (newAnalysisBlock->desiredInputRank() == 2) newAnalysisBlock->setInputDataSources(twoDimDataSources); else if (newAnalysisBlock->desiredInputRank() == 3) newAnalysisBlock->setInputDataSources(threeDimDataSources); scan->addAnalyzedDataSource(newAnalysisBlock); } int di = scan->dataSourceCount()-1; scanSetView_->setCurrentIndex(model_->indexForDataSource(si, di)); // this should automatically create a new detail editor for this new scan.}
开发者ID:anukat2015,项目名称:acquaman,代码行数:74,
示例18: tsvoid 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();}
开发者ID:anukat2015,项目名称:acquaman,代码行数:82,
示例19: tsvoid 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;//.........这里部分代码省略.........
开发者ID:acquaman,项目名称:acquaman,代码行数:101,
示例20: xAxisvoid 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); }}
开发者ID:anukat2015,项目名称:acquaman,代码行数:100,
示例21: QVariantQVariant AMScanSetModel::data(const QModelIndex & index, int role) const { if(!index.isValid()) return QVariant(); // scan-level index: /////////////////////////// if(index.internalId() == -1 && index.row() < scans_.count() && index.column() == 0) { AMScan* scan = scans_.at(index.row()); switch(role) { case Qt::DisplayRole: { QString rv = scan->fullName(); if(scan->modified()) rv.append( " (modified)"); return rv; } break; case Qt::DecorationRole: /// /bug this is temporary and meaningless. It's just the color of the first data source in the scan. if(scan->dataSourceCount() > 0) return sourcePlotSettings_.at(index.row()).at(0).linePen.color(); else return QVariant(); break; case Qt::ToolTipRole: return QString("%1, #%2 (sample: %3): %4").arg(scan->name()).arg(scan->number()).arg(scan->sampleName()).arg(AMDateTimeUtils::prettyDateTime(scan->dateTime(), "h:mm:ssap")); break; case AM::DescriptionRole: return QString("%1, on %2").arg(AMDateTimeUtils::prettyDateTime(scan->dateTime())).arg(scan->sampleName()); case AM::DateTimeRole: return scan->dateTime(); case Qt::CheckStateRole: return QVariant(); /// /todo For now... No checking/unchecking scans. break; case AM::PointerRole: return qVariantFromValue(scan); break; case AM::ModifiedRole: return scan->modified(); case AM::CanCloseRole: // allows views to show the 'close' button beside each scan, to delete it. Do we want this on? return true; case AM::NameRole: { return scan->fullName(); } break; default: return QVariant(); break; } } // data source-level index: //////////////////////////// if(index.internalId() >= 0 && index.internalId() < scans_.count() ) { AMScan* scan = scans_.at(index.internalId()); if(index.row() < scan->dataSourceCount() && index.column() == 0) { AMDataSource* dataSource = scan->dataSourceAt(index.row()); switch(role) { case Qt::DisplayRole: return QString("%1 (%2)").arg(dataSource->description(), dataSource->name()); break; case Qt::DecorationRole: return sourcePlotSettings_.at(index.internalId()).at(index.row()).linePen.color(); break; case Qt::ToolTipRole: case AM::NameRole: return dataSource->name(); case AM::DescriptionRole: return dataSource->description(); case AM::DetailedDescriptionRole: return QString("%1 (%2) From scan: %3/n%4").arg(dataSource->description(), dataSource->name(), scan->name(), //scan->evaluatedName(), dataSource->typeDescription()); break; case Qt::CheckStateRole: // this controls visibility on plots. if(isVisible(index.internalId(), index.row())) return Qt::Checked; else return Qt::Unchecked; break; case AM::PointerRole: return qVariantFromValue(dataSource); break; case AM::PriorityRole: return sourcePlotSettings_.at(index.internalId()).at(index.row()).priority; break; case AM::CanCloseRole: // allows views to show the 'close' button beside each scan, to delete it. return true; case AM::LinePenRole: return sourcePlotSettings_.at(index.internalId()).at(index.row()).linePen; case AM::RankRole: return dataSource->rank(); case AMScanSetModel::ColorMapRole: return qVariantFromValue(sourcePlotSettings_.at(index.internalId()).at(index.row()).colorMap); case AMScanSetModel::MarkerColorRole://.........这里部分代码省略.........
开发者ID:acquaman,项目名称:acquaman,代码行数:101,
示例22: XASvoid BioXASXASScanActionController::buildScanControllerImplementation(){ BioXASBeamline *bioxas = BioXASBeamline::bioXAS(); // Identify current beamline settings. scan_->setScanInitialConditions(bioxas->defaultXASScanControlInfos()); // Identify exporter option. AMExporterOptionXDIFormat *exportXDI = 0; if (bioXASConfiguration_) { exportXDI = BioXAS::buildStandardXDIFormatExporterOption("BioXAS XAS (XDI Format)", bioXASConfiguration_->edge().split(" ").first(), bioXASConfiguration_->edge().split(" ").last(), true); if (exportXDI->id() > 0) AMAppControllerSupport::registerClass<BioXASXASScanConfiguration, AMExporterXDIFormat, AMExporterOptionXDIFormat>(exportXDI->id()); // Clear the option of any previous data sources. exportXDI->clearDataSources(); } // Identify and setup the zebra trigger source. AMZebraDetectorTriggerSource *zebraTriggerSource = bioxas->zebraTriggerSource(); if (zebraTriggerSource) { zebraTriggerSource->removeAllDetectors(); zebraTriggerSource->removeAllDetectorManagers(); if (usingDetector(bioxas->i0Detector())) zebraTriggerSource->addDetector(bioxas->i0Detector()); if (usingDetector(bioxas->i1Detector())) zebraTriggerSource->addDetector(bioxas->i1Detector()); if (usingDetector(bioxas->i2Detector())) zebraTriggerSource->addDetector(bioxas->i2Detector()); if (usingScaler()) zebraTriggerSource->addDetectorManager(bioxas->scaler()); AMDetectorSet *geDetectors = bioxas->ge32ElementDetectors(); for (int i = 0, count = geDetectors->count(); i < count; i++) { AMDetector *detector = geDetectors->at(i); if (usingDetector(detector)) { zebraTriggerSource->addDetector(geDetectors->at(i)); zebraTriggerSource->addDetectorManager(geDetectors->at(i)); } } } // Identify data sources for the scaler channels and the scaler dwell time. AMDataSource *i0DetectorSource = detectorDataSource(bioxas->i0Detector()); AMDataSource *i1DetectorSource = detectorDataSource(bioxas->i1Detector()); AMDataSource *i2DetectorSource = detectorDataSource(bioxas->i2Detector()); AMDataSource *diodeDetectorSource = detectorDataSource(bioxas->diodeDetector()); AMDataSource *pipsDetectorSource = detectorDataSource(bioxas->pipsDetector()); AMDataSource *lytleDetectorSource = detectorDataSource(bioxas->lytleDetector()); AMDataSource *dwellTimeSource = detectorDataSource(bioxas->scalerDwellTimeDetector()); // Create analyzed data source for the absorbance. AM1DExpressionAB *absorbanceSource = 0; if (i0DetectorSource && i1DetectorSource && i2DetectorSource) { absorbanceSource = new AM1DExpressionAB("Absorbance"); absorbanceSource->setDescription("Absorbance"); absorbanceSource->setInputDataSources(QList<AMDataSource*>() << i0DetectorSource << i1DetectorSource << i2DetectorSource); absorbanceSource->setExpression(QString("ln(%1/%2)").arg(i1DetectorSource->name(), i2DetectorSource->name())); scan_->addAnalyzedDataSource(absorbanceSource, true, false); } // Create analyzed data source for the derivative of the absorbance. AM1DDerivativeAB *derivAbsorbanceSource = 0; if (absorbanceSource) { derivAbsorbanceSource = new AM1DDerivativeAB("DerivAbsorbance"); derivAbsorbanceSource->setInputDataSources(QList<AMDataSource*>() << absorbanceSource); scan_->addAnalyzedDataSource(derivAbsorbanceSource, true, false); } // Create analyzed data sources for the dark current corrected scaler channel detectors. AM1DDarkCurrentCorrectionAB *i0CorrectedDetectorSource = 0; if (dwellTimeSource && i0DetectorSource && exportXDI) { i0CorrectedDetectorSource = new AM1DDarkCurrentCorrectionAB(QString("%1_DarkCorrect").arg(i0DetectorSource->name())); i0CorrectedDetectorSource->setDescription(QString("%1 Dark Current Corrected").arg(i0DetectorSource->name())); i0CorrectedDetectorSource->setDataName(i0DetectorSource->name()); i0CorrectedDetectorSource->setDwellTimeName(dwellTimeSource->name()); i0CorrectedDetectorSource->setDarkCurrent(bioxas->exposedDetectorByName(i0DetectorSource->name())->darkCurrentValue()); i0CorrectedDetectorSource->setInputDataSources(QList<AMDataSource*>() << i0DetectorSource << dwellTimeSource); i0CorrectedDetectorSource->setTimeUnitMultiplier(0.001); connect( bioxas->i0Detector(), SIGNAL(darkCurrentValueChanged(double)), i0CorrectedDetectorSource, SLOT(setDarkCurrent(double)) ); scan_->addAnalyzedDataSource(i0CorrectedDetectorSource, true, false);//.........这里部分代码省略.........
开发者ID:acquaman,项目名称:acquaman,代码行数:101,
示例23: tsvoid 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);//.........这里部分代码省略.........
开发者ID:acquaman,项目名称:acquaman,代码行数:101,
注:本文中的AMDataSource类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ AMnDIndex类代码示例 C++ AInventory类代码示例 |