id stringlengths 27 29 | content stringlengths 226 3.24k |
|---|---|
codereview_new_cpp_data_13020 | void ALFInstrumentModel::setData(ALFData const &dataType, MatrixWorkspace_sptr c
switch (dataType) {
case ALFData::SAMPLE:
setSample(workspace);
- return;
case ALFData::VANADIUM:
setVanadium(workspace);
- return;
}
- throw std::invalid_argument("ALFData must be one of { SAMPLE, VANADIUM }"... |
codereview_new_cpp_data_13021 | void update(std::string const &property, boost::optional<double> const &value, I
}
void update(std::string const &property, MatrixWorkspace_sptr const &workspace, IAlgorithmRuntimeProps &properties) {
- if (workspace) {
- properties.setProperty(property, workspace);
- }
}
void updateFromMap(IAlgorithmRunt... |
codereview_new_cpp_data_13023 | TimeSplitter::TimeSplitter(const Mantid::API::MatrixWorkspace_sptr &ws, const Da
"Size of x values must be one more than size of y values to construct TimeSplitter from MatrixWorkspace.");
}
- int64_t offset_ns{offset.totalNanoseconds()};
for (size_t i = 1; i < X.size(); i++) {
- auto timeStart = ... |
codereview_new_cpp_data_13024 | TimeSplitter::TimeSplitter(const Mantid::API::MatrixWorkspace_sptr &ws, const Da
auto timeEnd = Types::Core::DateAndTime(X[i], 0.0) + offset_ns;
auto index = static_cast<int>(Y[i - 1]);
if ((index != IGNORE_VALUE) && (valueAtTime(timeStart) != IGNORE_VALUE || valueAtTime(timeEnd) != IGNORE_VALUE)) {
- ... |
codereview_new_cpp_data_13025 | void EventList::filterByTimeAtSample(Types::Core::DateAndTime start, Types::Core
/** Filter this EventList into an output EventList, using TimeROI
* keeping only events within the >= start and < end pulse times.
* Detector IDs and the X axis are copied as well.
*
* @param timeRoi :: reference to TimeROI to ... |
codereview_new_cpp_data_13026 | void EventList::filterByTimeAtSample(Types::Core::DateAndTime start, Types::Core
/** Filter this EventList into an output EventList, using TimeROI
* keeping only events within the >= start and < end pulse times.
* Detector IDs and the X axis are copied as well.
*
* @param timeRoi :: reference to TimeROI to ... |
codereview_new_cpp_data_13027 | bool SplittersWorkspace::removeSplitter(size_t index) {
return removed;
}
Kernel::TimeSplitter SplittersWorkspace::convertToTimeSplitter() {
Kernel::TimeSplitter splitter;
- for (int i = 0; i < this->rowCount(); i++) {
Kernel::SplittingInterval interval = this->getSplitter(i);
splitter.addROI(inte... |
codereview_new_cpp_data_13029 | double TimeSeriesProperty<TYPE>::averageValueInFilter(const std::vector<Splittin
// TODO: Consider logs that aren't giving starting values.
// If there's just a single value in the log, return that.
- if (realSize() == 1) {
- return static_cast<double>(m_values.front().value());
- }
if (size() == 1) {
... |
codereview_new_cpp_data_13030 | void InstrumentDisplay::updateView(bool picking) {
}
}
-/// Return the size of the OpenGL or Qt display widget in logical pixels
-QSize InstrumentDisplay::widgetDimensions() const {
- auto sizeinLogicalPixels = [](const QWidget *w) -> QSize {
- const auto devicePixelRatio = w->window()->devicePixelRatio();
-... |
codereview_new_cpp_data_13032 | std::string NotebookWriter::markdownCell(const std::string &string_text) {
void NotebookWriter::headerComment() {
Json::Value strings(Json::arrayValue);
strings.append(Json::Value("This IPython Notebook was automatically "
- "generated by Mantid Workbench, version: "));
strings.ap... |
codereview_new_cpp_data_13033 |
#include <QButtonGroup>
#include <QCheckBox>
#include <QComboBox>
#include <QGridLayout>
#include <QGroupBox>
#include <QLabel>
#include <QPushButton>
#include <QVBoxLayout>
FindDialog::FindDialog(ScriptEditor *editor) : FindReplaceDialog(editor) {
- setWindowTitle(tr("MantidWorkbench") + " - " + tr("Find"... |
codereview_new_cpp_data_13034 | void FindFilesThreadPoolManager::cancelWorker() {
/** Check if a search is currently executing.
*
- * @returns true if the current worker object is null
*/
bool FindFilesThreadPoolManager::isSearchRunning() const { return poolInstance()->activeThreadCount() > 0; }
Is this comment still accurate?
void Find... |
codereview_new_cpp_data_13035 | void LoadDialog::enableNameSuggestion(const bool on) {
*/
void LoadDialog::accept() {
// If the LoadDialog is already loading data, or is populating, then ignore the accept
- if (!m_form.fileWidget->isSearching() && !m_populating) {
- m_userAccept = true;
- m_form.fileWidget->findFiles();
}
}
void ... |
codereview_new_cpp_data_13036 | void FindFilesThreadPoolManager::cancelWorker() {
/** Check if a search is currently executing.
*
- * @returns true if no worker threads are active
*/
bool FindFilesThreadPoolManager::isSearchRunning() const { return poolInstance()->activeThreadCount() > 0; }
Doesn't this code return true when there are 1 o... |
codereview_new_cpp_data_13039 | std::vector<std::shared_ptr<FitPeaksAlgorithm::PeakFitResult>> FitPeaks::fitPeak
PARALLEL_CHECK_INTERRUPT_REGION
if (all_spectra_peaks_not_enough_datapoints > 0)
- g_log.notice() << all_spectra_peaks_not_enough_datapoints << " peaks rejected: not enough X(Y) datapoints."
- << std::endl;
... |
codereview_new_cpp_data_13040 | void LoadNXSPE::exec() {
file.openData("psi");
file.getData(temporary);
psi = temporary.at(0);
- if (std::isnan(psi))
psi = 0.;
file.closeData();
}
I would be tempted to say we should post a warning about this. That way we are being transparent that we have not read from the file ex... |
codereview_new_cpp_data_13041 | void ALFAnalysisModel::openExternalPlot() const {
MatrixWorkspace_sptr ALFAnalysisModel::plottedWorkspace() const {
if (m_fitWorkspace) {
return m_fitWorkspace;
- } else if (m_extractedWorkspace) {
return m_extractedWorkspace;
- } else {
- return nullptr;
}
}
std::vector<int> ALFAnalysisModel... |
codereview_new_cpp_data_13042 | void FitPropertyBrowser::stringChanged(QtProperty *prop) {
tie->set(exp.toStdString());
h->addTie(parName + "=" + exp);
} catch (...) {
- std::string msg =
"Failed to update tie on " + parName.toStdString() + ". Expression " + exp.toStdString() + " is invalid.";
QMessageBox::c... |
codereview_new_cpp_data_13049 | void IndirectDataManipulation::instrumentLoadingDone(bool error) {
if (error) {
g_log.warning("Instument loading failed! This instrument (or "
"analyser/reflection configuration) may not be supported by "
- "the interface.");
return;
}
}
```suggestion
... |
codereview_new_cpp_data_13050 | using namespace DataObjects;
void Q1DWeighted::init() {
auto wsValidator = std::make_shared<CompositeValidator>(CompositeRelation::OR);
auto monoValidator = std::make_shared<CompositeValidator>(CompositeRelation::AND);
auto tofValidator = std::make_shared<CompositeValidator>(CompositeRelation::AND);
- mon... |
codereview_new_cpp_data_13053 | void IndirectSymmetrise::setFileExtensionsByName(bool filter) {
void IndirectSymmetrise::handleValueChanged(QtProperty *prop, double value) {
if (prop->propertyName() == "Spectrum No") {
m_view->replotNewSpectrum(value);
- }
- if (prop->propertyName() == "EMin") {
m_view->verifyERange(prop, value);
... |
codereview_new_cpp_data_13063 | void IFunction::sortTies() {
std::list<TieNode> orderedTieNodes;
for (size_t i = 0; i < nParams(); ++i) {
auto const tie = getTie(i);
- if (!tie) {
- continue;
- }
- // Ignore height ties for Gaussian peaks as component of a CrystalFieldFunction
- if (this->name() == "CrystalFieldFunction" ... |
codereview_new_cpp_data_13066 |
#include <Poco/Path.h>
#include <boost/algorithm/string/case_conv.hpp>
#include <boost/algorithm/string/predicate.hpp>
-#include <boost/range/algorithm/transform.hpp>
namespace Mantid::DataHandling {
I don't think you need this include. Might be a feature from the original PR for this change but compiles for ... |
codereview_new_cpp_data_13067 | void GetDetectorOffsets::exec() {
PARALLEL_CRITICAL(GetDetectorOffsets_setValue) {
// Use the same offset for all detectors from this pixel
for (const auto &det : dets) {
const auto mapEntry = pixel_to_wi.find(det);
if (mapEntry == pixel_to_wi.end())
continue;
- o... |
codereview_new_cpp_data_13068 | void Fit::initConcrete() {
std::map<std::string, std::string> Fit::validateInputs() {
std::map<std::string, std::string> issues;
- const auto possibleOperators = Mantid::API::Expression::DEFAULT_OPS_STR;
std::string constraints = getPropertyValue("Constraints");
if (constraints.size() > 0) {
auto ope... |
codereview_new_cpp_data_13069 | void Fit::initConcrete() {
std::map<std::string, std::string> Fit::validateInputs() {
std::map<std::string, std::string> issues;
- const auto possibleOperators = Mantid::API::Expression::DEFAULT_OPS_STR;
std::string constraints = getPropertyValue("Constraints");
if (constraints.size() > 0) {
auto ope... |
codereview_new_cpp_data_13070 | ProcessingInstructions PreviewModel::getProcessingInstructions() const {
}
void PreviewModel::setSelectedRegion(Selection const &selection) {
- // TODO We will need to allow for more complex selections, but for now the selection just consists two y indices
if (selection.size() % 2 != 0) {
throw std::runti... |
codereview_new_cpp_data_13072 | std::string ConvFunctionModel::buildFickFunctionString() const {
std::string ConvFunctionModel::buildChudleyElliotString() const {
return "name=ChudleyElliotSQE, Height=1, Tau=1.25, Centre=0, L=1.0, "
- "constraints=(Height>0, Tau>0)";
}
std::string ConvFunctionModel::buildHallRossString() const {
... |
codereview_new_cpp_data_13073 | ExperimentInfo::ExperimentInfo() : m_parmap(new ParameterMap()), sptr_instrument
* unlocked.
* @param source The source object from which to initialize
*/
-ExperimentInfo::ExperimentInfo(const ExperimentInfo &source) {
- this->copyExperimentInfoFrom(&source);
- setSpectrumDefinitions(source.spectrumInfo().shar... |
codereview_new_cpp_data_13074 | namespace {
* @returns true if there is exactly one string, else false.
*/
bool isSingleFile(const std::vector<std::vector<std::string>> &fileNames) {
- return fileNames.size() == 1 ? fileNames[0u].size() == 1 : false;
}
/**
Would `return fileNames.size() == 1 && fileNames[0].size() == 1` be slightly easier... |
codereview_new_cpp_data_13075 | void LoadPSIMuonBin::readInTemperatureFileHeader(const std::string &contents) {
std::string line = "";
for (const auto charecter : contents) {
if (charecter == '\n') {
- if (!line.empty() && line[0] == '!' && lineNo > uselessLines) {
- processHeaderLine(line);
- } else if (line.empty() || l... |
codereview_new_cpp_data_13076 | AffineMatrixParameter &AffineMatrixParameter::operator=(const AffineMatrixParame
if (this != &other) {
this->m_affineMatrix = other.m_affineMatrix;
this->m_isValid = other.m_isValid;
- size_t nx = m_affineMatrix.numRows();
- size_t ny = m_affineMatrix.numCols();
- m_rawMem = new coord_t[nx * ny];... |
codereview_new_cpp_data_13077 | void LoadSQW::readDNDDimensions(std::vector<Mantid::Geometry::MDHistoDimensionBu
// TODO: how to use it in our framework? -> it is B^-1 matrix possibly
// re-scaled
- // std::vector<double> u_to_Rlu(4 * 4); // the matrix transforming from lab to crystal frame with scaling
i0 += 4 * 4;
// [data.u_to_rlu,... |
codereview_new_cpp_data_13078 | void IqtFunctionModel::estimateExpParameters() {
auto const &x = m_estimationData[i].x;
auto const &y = m_estimationData[i].y;
auto lifeTime = (x[1] - x[0]) / (log(y[0]) - log(y[1]));
- if (lifeTime <= 0 || isnan(lifeTime))
lifeTime = 1.0;
auto const height = y[0] * exp(x[0] / lifeTime);
... |
codereview_new_cpp_data_13079 | void MuonPairingAsymmetry::validateGroupsWorkspaces(std::map<std::string, std::s
Workspace_sptr ws2 = this->getProperty("InputWorkspace2");
if (!ws1) {
errors["InputWorkspace1"] = "The InputWorkspace1 must be a Workspace.";
- return;
}
if (!ws2) {
errors["InputWorkspace2"] = "The InputWorkspac... |
codereview_new_cpp_data_13085 | void ConvertCWPDMDToSpectra::binMD(const API::IMDEventWorkspace_const_sptr &mdws
}
if (xindex >= static_cast<int>(vecy.size())) {
g_log.warning() << "Case unexpected: Event X = " << outx << ", Boundary = " << vecx[xindex] << "\n";
}
}
Please add a warning for the case t... |
codereview_new_cpp_data_13086 | void StepScan::generateCurve(const QString &var) {
MatrixWorkspace_sptr top = AnalysisDataService::Instance().retrieveWS<MatrixWorkspace>(m_plotWSName);
MatrixWorkspace_sptr bottom = norm->getProperty("OutputWorkspace");
top /= bottom;
- AnalysisDataService::Instance().addOrReplace(m_plotWSName, top)... |
codereview_new_cpp_data_13088 | size_t SpectrumInfo::size() const {
/// Return count of all detectors used within spectrum
size_t SpectrumInfo::detectorCount() const {
- return std::accumulate(m_spectrumDefinition->begin(), m_spectrumDefinition->end(), size_t(),
- [](auto x, const Mantid::SpectrumDefinition &spec) { retu... |
codereview_new_cpp_data_13089 | void LoadEventPreNexus2::procEvents(DataObjects::EventWorkspace_sptr &workspace)
}
// determine maximum pixel id
- detid_max = *(std::max_element(detIDs.cbegin(), detIDs.cend()));
// For slight speed up
loadOnlySomeSpectra = (!this->spectra_list.empty());
Not safe if `detIDs` can be empty.
void Loa... |
codereview_new_cpp_data_13090 | void LoadHFIRSANS::setBeamTrapRunProperty() {
std::vector<double> trapDiametersInUse;
trapDiametersInUse.reserve(trapIndexInUse.size());
std::transform(trapIndexInUse.cbegin(), trapIndexInUse.cend(), std::back_inserter(trapDiametersInUse),
- [trapDiameters](auto index) { return trapDiameters[i... |
codereview_new_cpp_data_13091 | void Workspace2D::init(const HistogramData::Histogram &histogram) {
Histogram1D spec(initializedHistogram.xMode(), initializedHistogram.yMode());
spec.setHistogram(initializedHistogram);
std::transform(data.begin(), data.end(), data.begin(),
- [spec](const auto &) { return std::move(std::make_... |
codereview_new_cpp_data_13092 | std::string CompositeImplicitFunction::toXMLString() const {
AutoPtr<Element> parameterListElement = pDoc->createElement("ParameterList");
functionElement->appendChild(parameterListElement);
- // this temporary object and following lines are to be replaced by std::transform_reduce, when available
- std::vect... |
codereview_new_cpp_data_13093 | std::vector<Mantid::detid_t> notInTubes(const std::vector<detail::TubeBuilder> &
std::vector<Mantid::detid_t> detIDs) {
std::vector<Mantid::detid_t> used;
std::for_each(tubes.cbegin(), tubes.cend(), [&used](const auto &tube) {
- std::transform((tube.detIDs()).cbegin(),... |
codereview_new_cpp_data_13094 | bool BatchJobManager::hasSelectedRowsRequiringProcessing(Group const &group) {
// If the group itself is selected, consider its rows to also be selected
auto processAllRowsInGroup = (m_processAll || isSelected(group));
- const auto it =
- std::find_if((group.rows()).cbegin(), (group.rows()).cend(), [this... |
codereview_new_cpp_data_13095 | std::vector<std::vector<std::string>> MuonPeriodInfo::makeCorrections(std::vecto
// Find max size of logs and assume to be the correct size
const auto it = std::max_element(logs.cbegin(), logs.cend(),
[](const auto &log1, const auto &log2) { return log1.size() < log2.size(); }... |
codereview_new_cpp_data_13274 |
Author: Hans Dembinski
*/
-#include <math.h>
#include "_rcont.h"
#include "logfactorial.h"
// helper function to access a 1D array like a C-style 2D array
tab_t *ptr(tab_t *m, int nr, int nc, int ir, int ic)
```suggestion
```
Apparently, this include causes problems for, I guess, `Python.h` and he... |
codereview_new_cpp_data_13275 |
Author: Hans Dembinski
*/
-#include <math.h>
#include "_rcont.h"
#include "logfactorial.h"
// helper function to access a 1D array like a C-style 2D array
tab_t *ptr(tab_t *m, int nr, int nc, int ir, int ic)
```suggestion
#include "logfactorial.h"
#include <math.h>
```
Author: Hans Dembinski
*/... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.