Skip to content
Snippets Groups Projects
Commit fda70c1d authored by Matthias Puchner's avatar Matthias Puchner
Browse files

rename methods/vars to their actual function; docu

parent 09299349
No related branches found
No related tags found
1 merge request!81Refactorings no. 2 for the upcoming removing of "region of interest" (ROI)
......@@ -37,7 +37,7 @@ std::unique_ptr<OutputData<double>> initUserWeights(const OutputData<double>& sh
return result;
}
bool detHasSameDimensions(const IDetector& detector, const OutputData<double>& data)
bool haveSameDimensions(const IDetector& detector, const OutputData<double>& data)
{
if (data.rank() != detector.dimension())
return false;
......@@ -55,16 +55,17 @@ bool detHasSameDimensions(const IDetector& detector, const OutputData<double>& d
SimulationResult convertData(const ISimulation& simulation, const OutputData<double>& data)
{
const ICoordSystem* converter = simulation.createCoordSystem();
auto roi_data = converter->createOutputData(converter->defaultUnits());
const ICoordSystem* coordSystem = simulation.createCoordSystem();
auto roi_data = coordSystem->createOutputData(coordSystem->defaultUnits());
if (roi_data->hasSameDimensions(data)) {
// data is already cropped to ROI
simulation.detector().iterateOverNonMaskedPoints([&](IDetector::const_iterator it) {
(*roi_data)[it.roiIndex()] = data[it.roiIndex()];
});
} else if (detHasSameDimensions(simulation.detector(), data)) {
// exp data has same shape as the detector, we have to put orig data to smaller roi map
} else if (haveSameDimensions(simulation.detector(), data)) {
// experimental data has same shape as the detector, we have to put orig data to smaller roi
// map
simulation.detector().iterateOverNonMaskedPoints([&](IDetector::const_iterator it) {
(*roi_data)[it.roiIndex()] = data[it.detectorIndex()];
});
......@@ -72,7 +73,7 @@ SimulationResult convertData(const ISimulation& simulation, const OutputData<dou
throw std::runtime_error(
"FitObject::init_dataset: Detector and experimental data have different shape");
return SimulationResult(*roi_data, std::move(converter));
return SimulationResult(*roi_data, std::move(coordSystem));
}
} // namespace
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment