diff --git a/Core/Background/PoissonNoiseBackground.cpp b/Core/Background/PoissonBackground.cpp similarity index 62% rename from Core/Background/PoissonNoiseBackground.cpp rename to Core/Background/PoissonBackground.cpp index 92f8163d9182a1153f1261c41b0ca0bb05322b44..c0a69402ad8fbbf7ac5a97b87ca8fbfe2b963fb9 100644 --- a/Core/Background/PoissonNoiseBackground.cpp +++ b/Core/Background/PoissonBackground.cpp @@ -2,8 +2,8 @@ // // BornAgain: simulate and fit reflection and scattering // -//! @file Core/Background/PoissonNoiseBackground.cpp -//! @brief Implements class PoissonNoiseBackground. +//! @file Core/Background/PoissonBackground.cpp +//! @brief Implements class PoissonBackground. //! //! @homepage http://www.bornagainproject.org //! @license GNU General Public License v3 or higher (see COPYING) @@ -12,20 +12,20 @@ // // ************************************************************************************************ -#include "Core/Background/PoissonNoiseBackground.h" +#include "Core/Background/PoissonBackground.h" #include "Base/Math/Functions.h" -PoissonNoiseBackground::PoissonNoiseBackground() +PoissonBackground::PoissonBackground() : IBackground({}) { } -PoissonNoiseBackground* PoissonNoiseBackground::clone() const +PoissonBackground* PoissonBackground::clone() const { - return new PoissonNoiseBackground; + return new PoissonBackground; } -double PoissonNoiseBackground::addBackground(double intensity) const +double PoissonBackground::addBackground(double intensity) const { return Math::GeneratePoissonRandom(intensity); } diff --git a/Core/Background/PoissonNoiseBackground.h b/Core/Background/PoissonBackground.h similarity index 60% rename from Core/Background/PoissonNoiseBackground.h rename to Core/Background/PoissonBackground.h index 25002bdbce7cd8052d6b88e7330adf0e936739ba..ea8f6315f75501e59fcee88749e6ae0e7e9f2528 100644 --- a/Core/Background/PoissonNoiseBackground.h +++ b/Core/Background/PoissonBackground.h @@ -2,8 +2,8 @@ // // BornAgain: simulate and fit reflection and scattering // -//! @file Core/Background/PoissonNoiseBackground.h -//! @brief Defines class PoissonNoiseBackground. +//! @file Core/Background/PoissonBackground.h +//! @brief Defines class PoissonBackground. //! //! @homepage http://www.bornagainproject.org //! @license GNU General Public License v3 or higher (see COPYING) @@ -12,8 +12,8 @@ // // ************************************************************************************************ -#ifndef BORNAGAIN_CORE_BACKGROUND_POISSONNOISEBACKGROUND_H -#define BORNAGAIN_CORE_BACKGROUND_POISSONNOISEBACKGROUND_H +#ifndef BORNAGAIN_CORE_BACKGROUND_POISSONBACKGROUND_H +#define BORNAGAIN_CORE_BACKGROUND_POISSONBACKGROUND_H #include "Core/Background/IBackground.h" @@ -21,14 +21,14 @@ //! //! @ingroup simulation -class PoissonNoiseBackground : public IBackground { +class PoissonBackground : public IBackground { public: - PoissonNoiseBackground(); - PoissonNoiseBackground* clone() const override; - std::string className() const final { return "PoissonNoiseBackground"; } + PoissonBackground(); + PoissonBackground* clone() const override; + std::string className() const final { return "PoissonBackground"; } // const auto tooltip = "class_tooltip"; double addBackground(double intensity) const override; }; -#endif // BORNAGAIN_CORE_BACKGROUND_POISSONNOISEBACKGROUND_H +#endif // BORNAGAIN_CORE_BACKGROUND_POISSONBACKGROUND_H diff --git a/Core/Export/SimulationToPython.cpp b/Core/Export/SimulationToPython.cpp index 92311368aadde467437ea480a767f71c2844eedc..e2101ed1e881accfc79eed28ddf1c95df794e752 100644 --- a/Core/Export/SimulationToPython.cpp +++ b/Core/Export/SimulationToPython.cpp @@ -16,7 +16,7 @@ #include "Base/Py/PyFmt.h" #include "Base/Util/Algorithms.h" #include "Core/Background/ConstantBackground.h" -#include "Core/Background/PoissonNoiseBackground.h" +#include "Core/Background/PoissonBackground.h" #include "Core/Export/PyFmt2.h" #include "Core/Export/PyFmtLimits.h" #include "Core/Export/SampleToPython.h" @@ -401,8 +401,8 @@ std::string defineBackground(const ISimulation* simulation) << Py::Fmt::printScientificDouble(constant_bg->backgroundValue()) << ")\n"; result << indent() << "simulation.setBackground(background)\n"; } - } else if (dynamic_cast<const PoissonNoiseBackground*>(bg)) { - result << indent() << "background = ba.PoissonNoiseBackground()\n"; + } else if (dynamic_cast<const PoissonBackground*>(bg)) { + result << indent() << "background = ba.PoissonBackground()\n"; result << indent() << "simulation.setBackground(background)\n"; } return result.str(); diff --git a/Examples/fit52_Advanced/fit_along_slices.py b/Examples/fit52_Advanced/fit_along_slices.py index acb2281096ae3730302ff38d7842927ff7fe7d33..5da829154d4a40cf2b63b95eccf6a841a5ce5b68 100755 --- a/Examples/fit52_Advanced/fit_along_slices.py +++ b/Examples/fit52_Advanced/fit_along_slices.py @@ -68,7 +68,7 @@ def create_real_data(): # retrieving simulated data in the form of numpy array simulation = get_simulation(params, add_masks=False) - simulation.setBackground(ba.PoissonNoiseBackground()) + simulation.setBackground(ba.PoissonBackground()) simulation.runSimulation() return simulation.result().array() diff --git a/GUI/Model/Item/BackgroundItems.cpp b/GUI/Model/Item/BackgroundItems.cpp index 3cf6d02170105a1dfb5360bc44543670673a330c..99c3f2a03d372cdbe6cb9d84e3d2ca0c33db9bbb 100644 --- a/GUI/Model/Item/BackgroundItems.cpp +++ b/GUI/Model/Item/BackgroundItems.cpp @@ -14,7 +14,7 @@ #include "GUI/Model/Item/BackgroundItems.h" #include "Core/Background/ConstantBackground.h" -#include "Core/Background/PoissonNoiseBackground.h" +#include "Core/Background/PoissonBackground.h" #include "GUI/Model/Types/DoubleDescriptor.h" #include "GUI/Model/XML/Serializer.h" @@ -35,9 +35,9 @@ void ConstantBackgroundItem::serialize(Serializer& s) s.rw(m_backgroundValue); } -std::unique_ptr<IBackground> PoissonNoiseBackgroundItem::createBackground() const +std::unique_ptr<IBackground> PoissonBackgroundItem::createBackground() const { - return std::make_unique<PoissonNoiseBackground>(); + return std::make_unique<PoissonBackground>(); } std::unique_ptr<IBackground> NoBackgroundItem::createBackground() const diff --git a/GUI/Model/Item/BackgroundItems.h b/GUI/Model/Item/BackgroundItems.h index 4b3cca613bf65979468020ba345c76b25e720d16..0df45095136f0fde7511db7e2b7d328dd194ea8b 100644 --- a/GUI/Model/Item/BackgroundItems.h +++ b/GUI/Model/Item/BackgroundItems.h @@ -43,7 +43,7 @@ public: DOUBLE_PROPERTY(backgroundValue, BackgroundValue); }; -class PoissonNoiseBackgroundItem : public BackgroundItem { +class PoissonBackgroundItem : public BackgroundItem { public: std::unique_ptr<IBackground> createBackground() const override; }; diff --git a/GUI/Model/MakeItem/BackgroundItemCatalog.cpp b/GUI/Model/MakeItem/BackgroundItemCatalog.cpp index ac68f40da8949cfd683314380993fac0a6a3c423..a86aba7d143a0c3f09eae858f206839425692fe2 100644 --- a/GUI/Model/MakeItem/BackgroundItemCatalog.cpp +++ b/GUI/Model/MakeItem/BackgroundItemCatalog.cpp @@ -24,7 +24,7 @@ BackgroundItem* BackgroundItemCatalog::create(Type type) case Type::Constant: return new ConstantBackgroundItem(); case Type::Poission: - return new PoissonNoiseBackgroundItem(); + return new PoissonBackgroundItem(); } ASSERT(false); } @@ -53,7 +53,7 @@ BackgroundItemCatalog::Type BackgroundItemCatalog::type(const BackgroundItem* it return Type::None; if (dynamic_cast<const ConstantBackgroundItem*>(item)) return Type::Constant; - if (dynamic_cast<const PoissonNoiseBackgroundItem*>(item)) + if (dynamic_cast<const PoissonBackgroundItem*>(item)) return Type::Poission; ASSERT(false); diff --git a/GUI/View/FromDomain/FromDomain.cpp b/GUI/View/FromDomain/FromDomain.cpp index 60ec2aec1c6d8202a95faf177b3f4d3597ba2469..ce51174f29ce1829676662a9d2bb6f1ea5fd1bdc 100644 --- a/GUI/View/FromDomain/FromDomain.cpp +++ b/GUI/View/FromDomain/FromDomain.cpp @@ -15,7 +15,7 @@ #include "GUI/View/FromDomain/FromDomain.h" #include "Base/Const/Units.h" #include "Core/Background/ConstantBackground.h" -#include "Core/Background/PoissonNoiseBackground.h" +#include "Core/Background/PoissonBackground.h" #include "Core/Scan/AlphaScan.h" #include "Core/Scan/ScanResolution.h" #include "Core/Simulation/includeSimulations.h" @@ -743,8 +743,8 @@ void GUI::Transform::FromDomain::setBackground(InstrumentItem* instrument_item, auto* constant_bg_item = instrument_item->setBackgroundType<ConstantBackgroundItem>(); double value = p_constant_bg->backgroundValue(); constant_bg_item->setBackgroundValue(value); - } else if (dynamic_cast<const PoissonNoiseBackground*>(p_bg)) - instrument_item->setBackgroundType<PoissonNoiseBackgroundItem>(); + } else if (dynamic_cast<const PoissonBackground*>(p_bg)) + instrument_item->setBackgroundType<PoissonBackgroundItem>(); } void GUI::Transform::FromDomain::setFootprintFactor(const IFootprintFactor* footprint, diff --git a/Wrap/Swig/libBornAgainCore.i b/Wrap/Swig/libBornAgainCore.i index 1bb1c1c3f0fea15054a888af67a737fcac0f98ae..9611ec8e3cda0611a8eb496fde42e2047e9f52d6 100644 --- a/Wrap/Swig/libBornAgainCore.i +++ b/Wrap/Swig/libBornAgainCore.i @@ -60,7 +60,7 @@ #include "Sample/Scattering/ISampleNode.h" #include "Core/Background/ConstantBackground.h" -#include "Core/Background/PoissonNoiseBackground.h" +#include "Core/Background/PoissonBackground.h" #include "Core/Export/ExportToPython.h" #include "Core/Fitting/FitObjective.h" #include "Core/Fitting/IterationInfo.h" @@ -115,7 +115,7 @@ %include "Core/Background/IBackground.h" %include "Core/Background/ConstantBackground.h" -%include "Core/Background/PoissonNoiseBackground.h" +%include "Core/Background/PoissonBackground.h" %include "Core/Export/ExportToPython.h" diff --git a/hugo/static/files/python/fitting/ex02_AdvancedExamples/fit_along_slices.py b/hugo/static/files/python/fitting/ex02_AdvancedExamples/fit_along_slices.py index 29d734681f1bdecb7f1515cd11ac1d2178b25581..b2cbe0162eb43b32925b6b6c0271c0953cc4cbb0 100644 --- a/hugo/static/files/python/fitting/ex02_AdvancedExamples/fit_along_slices.py +++ b/hugo/static/files/python/fitting/ex02_AdvancedExamples/fit_along_slices.py @@ -68,7 +68,7 @@ def create_real_data(): # retrieving simulated data in the form of numpy array simulation = get_simulation(params, add_masks=False) - simulation.setBackground(ba.PoissonNoiseBackground()) + simulation.setBackground(ba.PoissonBackground()) simulation.runSimulation() return simulation.result().array()