BornAgain
1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
|
Interface for one-dimensional distributions.
Definition at line 33 of file Distributions.h.
Public Member Functions | |
IDistribution1D (const std::vector< double > &PValues) | |
void | checkNodeArgs () const |
Raises exception if a parameter value is invalid. More... | |
virtual std::string | className () const =0 |
Returns the class name, to be hard-coded in each leaf class that inherits from INode. More... | |
IDistribution1D * | clone () const override=0 |
virtual std::vector< double > | equidistantPoints (size_t nbr_samples, double sigma_factor, const RealLimits &limits=RealLimits()) const =0 |
Returns equidistant interpolation points, with range computed in distribution-specific way from mean and width parameter, taking into account limits and sigma_factor. More... | |
virtual std::vector< double > | equidistantPointsInRange (size_t nbr_samples, double xmin, double xmax) const |
Returns equidistant interpolation points from xmin to xmax. More... | |
std::vector< ParameterSample > | equidistantSamples (size_t nbr_samples, double sigma_factor=0., const RealLimits &limits=RealLimits()) const |
Returns equidistant samples, using intrinsic parameters, weighted with probabilityDensity(). More... | |
std::vector< ParameterSample > | equidistantSamplesInRange (size_t nbr_samples, double xmin, double xmax) const |
Returns equidistant samples from xmin to xmax, weighted with probabilityDensity(). More... | |
virtual bool | isDelta () const =0 |
Returns true if the distribution is in the limit case of a Dirac delta distribution. More... | |
virtual double | mean () const =0 |
Returns the distribution-specific mean. More... | |
virtual std::vector< const INode * > | nodeChildren () const |
Returns all children. More... | |
std::vector< const INode * > | nodeOffspring () const |
Returns all descendants. More... | |
virtual std::vector< ParaMeta > | parDefs () const |
Returns the parameter definitions, to be hard-coded in each leaf class. More... | |
virtual double | probabilityDensity (double x) const =0 |
Returns the distribution-specific probability density for value x. More... | |
virtual std::string | pythonConstructor (const std::string &units) const =0 |
Prints distribution with constructor parameters in given units. ba.DistributionGaussian(2.0*deg, 0.02*deg) More... | |
virtual void | transferToCPP () |
Used for Python overriding of clone (see swig/tweaks.py) More... | |
Protected Member Functions | |
void | adjustMinMaxForLimits (double &xmin, double &xmax, const RealLimits &limits) const |
modifies xmin and xmax if they are outside of limits More... | |
std::vector< ParameterSample > | generateSamplesFromValues (const std::vector< double > &sample_values) const |
Returns weighted samples from given interpolation points and probabilityDensity(). More... | |
Protected Attributes | |
std::vector< double > | m_P |
IDistribution1D::IDistribution1D | ( | const std::vector< double > & | PValues | ) |
Definition at line 36 of file Distributions.cpp.
|
protected |
modifies xmin and xmax if they are outside of limits
Definition at line 81 of file Distributions.cpp.
References RealLimits::hasLowerLimit(), RealLimits::hasUpperLimit(), RealLimits::lowerLimit(), and RealLimits::upperLimit().
Referenced by DistributionGate::equidistantPoints(), DistributionLorentz::equidistantPoints(), DistributionGaussian::equidistantPoints(), DistributionLogNormal::equidistantPoints(), DistributionCosine::equidistantPoints(), and DistributionTrapezoid::equidistantPoints().
|
inherited |
Raises exception if a parameter value is invalid.
Definition at line 27 of file INode.cpp.
References ASSERT, RealLimits::check(), INode::className(), INF, RealLimits::limited(), RealLimits::limitless(), INode::m_P, ParaMeta::name, RealLimits::nonnegative(), INode::parDefs(), ParaMeta::vMax, and ParaMeta::vMin.
Referenced by BarGauss::BarGauss(), BarLorentz::BarLorentz(), Bipyramid4::Bipyramid4(), Box::Box(), CantellatedCube::CantellatedCube(), Cone::Cone(), ConstantBackground::ConstantBackground(), CosineRippleBox::CosineRippleBox(), CosineRippleGauss::CosineRippleGauss(), CosineRippleLorentz::CosineRippleLorentz(), Cylinder::Cylinder(), DistributionCosine::DistributionCosine(), DistributionGate::DistributionGate(), DistributionGaussian::DistributionGaussian(), DistributionLogNormal::DistributionLogNormal(), DistributionLorentz::DistributionLorentz(), DistributionTrapezoid::DistributionTrapezoid(), Dodecahedron::Dodecahedron(), EllipsoidalCylinder::EllipsoidalCylinder(), FootprintGauss::FootprintGauss(), FootprintSquare::FootprintSquare(), FuzzySphere::FuzzySphere(), GaussSphere::GaussSphere(), HemiEllipsoid::HemiEllipsoid(), HollowSphere::HollowSphere(), HorizontalCylinder::HorizontalCylinder(), Icosahedron::Icosahedron(), LongBoxGauss::LongBoxGauss(), LongBoxLorentz::LongBoxLorentz(), PlatonicOctahedron::PlatonicOctahedron(), PlatonicTetrahedron::PlatonicTetrahedron(), Prism3::Prism3(), Prism6::Prism6(), Profile1DCauchy::Profile1DCauchy(), Profile1DCosine::Profile1DCosine(), Profile1DGate::Profile1DGate(), Profile1DGauss::Profile1DGauss(), Profile1DTriangle::Profile1DTriangle(), Profile1DVoigt::Profile1DVoigt(), Profile2DCauchy::Profile2DCauchy(), Profile2DCone::Profile2DCone(), Profile2DGate::Profile2DGate(), Profile2DGauss::Profile2DGauss(), Profile2DVoigt::Profile2DVoigt(), Pyramid2::Pyramid2(), Pyramid3::Pyramid3(), Pyramid4::Pyramid4(), Pyramid6::Pyramid6(), RotationEuler::RotationEuler(), RotationX::RotationX(), RotationY::RotationY(), RotationZ::RotationZ(), SawtoothRippleBox::SawtoothRippleBox(), SawtoothRippleGauss::SawtoothRippleGauss(), SawtoothRippleLorentz::SawtoothRippleLorentz(), Sphere::Sphere(), Spheroid::Spheroid(), TruncatedCube::TruncatedCube(), TruncatedSphere::TruncatedSphere(), and TruncatedSpheroid::TruncatedSpheroid().
|
pure virtualinherited |
Returns the class name, to be hard-coded in each leaf class that inherits from INode.
Implemented in Particle, SphericalDetector, SpecularSimulation, ScatteringSimulation, OffspecSimulation, DepthProbeSimulation, PoissonBackground, ConstantBackground, GaussSphere, FuzzySphere, RotationEuler, RotationZ, RotationY, RotationX, IdentityRotation, ParticleCoreShell, ParticleComposition, MesoCrystal, Crystal, MultiLayer, Layer, Lattice3D, HexagonalLattice2D, SquareLattice2D, BasicLattice2D, LayerRoughness, LayerInterface, TruncatedSpheroid, TruncatedSphere, TruncatedCube, Spheroid, Sphere, SawtoothRippleLorentz, SawtoothRippleGauss, SawtoothRippleBox, Pyramid6, Pyramid4, Pyramid3, Pyramid2, Prism6, Prism3, PlatonicTetrahedron, PlatonicOctahedron, LongBoxLorentz, LongBoxGauss, Icosahedron, HorizontalCylinder, HollowSphere, HemiEllipsoid, EllipsoidalCylinder, Dodecahedron, Cylinder, CosineRippleLorentz, CosineRippleGauss, CosineRippleBox, Cone, CantellatedCube, Box, Bipyramid4, BarLorentz, BarGauss, Profile2DVoigt, Profile2DCone, Profile2DGate, Profile2DGauss, Profile2DCauchy, Profile1DVoigt, Profile1DCosine, Profile1DTriangle, Profile1DGate, Profile1DGauss, Profile1DCauchy, MisesGaussPeakShape, MisesFisherGaussPeakShape, LorentzFisherPeakShape, GaussFisherPeakShape, IsotropicLorentzPeakShape, IsotropicGaussPeakShape, ParticleLayout, InterferenceTwin, InterferenceRadialParaCrystal, InterferenceNone, InterferenceHardDisk, InterferenceFinite3DLattice, InterferenceFinite2DLattice, Interference3DLattice, Interference2DSuperLattice, Interference2DParaCrystal, Interference2DLattice, Interference1DLattice, DistributionTrapezoid, DistributionCosine, DistributionLogNormal, DistributionGaussian, DistributionLorentz, DistributionGate, ResolutionFunction2DGaussian, ConvolutionDetectorResolution, PolFilter, RectangularDetector, FootprintSquare, FootprintGauss, and Beam.
Referenced by INode::checkNodeArgs(), ExemplarySamples::createBasic2DParaCrystalWithFTDis(), IProfile1D::pythonConstructor(), IProfile2D::pythonConstructor(), IFormFactor::pythonConstructor(), and IFormFactor::shapeName().
|
overridepure virtual |
Implements ICloneable.
Implemented in DistributionTrapezoid, DistributionCosine, DistributionLogNormal, DistributionGaussian, DistributionLorentz, and DistributionGate.
Referenced by ParameterDistribution::ParameterDistribution().
|
pure virtual |
Returns equidistant interpolation points, with range computed in distribution-specific way from mean and width parameter, taking into account limits and sigma_factor.
Implemented in DistributionTrapezoid, DistributionCosine, DistributionLogNormal, DistributionGaussian, DistributionLorentz, and DistributionGate.
Referenced by equidistantSamples().
|
virtual |
Returns equidistant interpolation points from xmin to xmax.
Definition at line 70 of file Distributions.cpp.
References mean().
Referenced by DistributionGate::equidistantPoints(), DistributionLorentz::equidistantPoints(), DistributionGaussian::equidistantPoints(), DistributionLogNormal::equidistantPoints(), DistributionCosine::equidistantPoints(), DistributionTrapezoid::equidistantPoints(), and equidistantSamplesInRange().
std::vector< ParameterSample > IDistribution1D::equidistantSamples | ( | size_t | nbr_samples, |
double | sigma_factor = 0. , |
||
const RealLimits & | limits = RealLimits() |
||
) | const |
Returns equidistant samples, using intrinsic parameters, weighted with probabilityDensity().
Definition at line 43 of file Distributions.cpp.
References equidistantPoints(), generateSamplesFromValues(), isDelta(), and mean().
std::vector< ParameterSample > IDistribution1D::equidistantSamplesInRange | ( | size_t | nbr_samples, |
double | xmin, | ||
double | xmax | ||
) | const |
Returns equidistant samples from xmin to xmax, weighted with probabilityDensity().
Definition at line 58 of file Distributions.cpp.
References equidistantPointsInRange(), generateSamplesFromValues(), isDelta(), and mean().
|
protected |
Returns weighted samples from given interpolation points and probabilityDensity().
Definition at line 99 of file Distributions.cpp.
References probabilityDensity().
Referenced by equidistantSamples(), and equidistantSamplesInRange().
|
pure virtual |
Returns true if the distribution is in the limit case of a Dirac delta distribution.
Implemented in DistributionTrapezoid, DistributionCosine, DistributionLogNormal, DistributionGaussian, DistributionLorentz, and DistributionGate.
Referenced by equidistantSamples(), and equidistantSamplesInRange().
|
pure virtual |
Returns the distribution-specific mean.
Implemented in DistributionTrapezoid, DistributionCosine, DistributionLogNormal, DistributionGaussian, DistributionLorentz, and DistributionGate.
Referenced by equidistantPointsInRange(), equidistantSamples(), equidistantSamplesInRange(), DepthProbeSimulation::validateParametrization(), OffspecSimulation::validateParametrization(), and SpecularSimulation::validateParametrization().
|
virtualinherited |
Returns all children.
Reimplemented in ISimulation2D, ISimulation, ParticleCoreShell, ParticleComposition, Particle, MesoCrystal, IParticle, Crystal, MultiLayer, Layer, LayerInterface, ParticleLayout, InterferenceRadialParaCrystal, InterferenceFinite3DLattice, InterferenceFinite2DLattice, Interference3DLattice, Interference2DSuperLattice, Interference2DParaCrystal, Interference2DLattice, Interference1DLattice, ConvolutionDetectorResolution, IDetector, and Beam.
Definition at line 56 of file INode.cpp.
Referenced by NodeUtils::AllDescendantsOfType(), NodeUtils::ChildNodesOfType(), ISampleNode::containedMaterials(), and INode::nodeOffspring().
|
inherited |
Returns all descendants.
Definition at line 61 of file INode.cpp.
References INode::nodeChildren().
|
inlinevirtualinherited |
Returns the parameter definitions, to be hard-coded in each leaf class.
Reimplemented in ConstantBackground, GaussSphere, FuzzySphere, RotationEuler, RotationZ, RotationY, RotationX, Crystal, Layer, HexagonalLattice2D, SquareLattice2D, BasicLattice2D, LayerRoughness, TruncatedSpheroid, TruncatedSphere, TruncatedCube, Spheroid, Sphere, SawtoothRippleLorentz, SawtoothRippleGauss, SawtoothRippleBox, Pyramid6, Pyramid4, Pyramid3, Pyramid2, Prism6, Prism3, PlatonicTetrahedron, PlatonicOctahedron, LongBoxLorentz, LongBoxGauss, Icosahedron, HorizontalCylinder, HollowSphere, HemiEllipsoid, EllipsoidalCylinder, Dodecahedron, Cylinder, CosineRippleLorentz, CosineRippleGauss, CosineRippleBox, Cone, CantellatedCube, Box, Bipyramid4, BarLorentz, BarGauss, Profile2DVoigt, Profile2DCone, Profile2DGate, Profile2DGauss, Profile2DCauchy, Profile1DVoigt, Profile1DCosine, Profile1DTriangle, Profile1DGate, Profile1DGauss, Profile1DCauchy, MisesGaussPeakShape, MisesFisherGaussPeakShape, LorentzFisherPeakShape, GaussFisherPeakShape, IsotropicLorentzPeakShape, IsotropicGaussPeakShape, ParticleLayout, InterferenceTwin, InterferenceRadialParaCrystal, InterferenceHardDisk, Interference2DSuperLattice, Interference2DParaCrystal, Interference1DLattice, DistributionTrapezoid, DistributionCosine, DistributionLogNormal, DistributionGaussian, DistributionLorentz, DistributionGate, ResolutionFunction2DGaussian, PolFilter, FootprintSquare, and FootprintGauss.
Definition at line 51 of file INode.h.
Referenced by INode::checkNodeArgs(), and IFormFactor::pythonConstructor().
|
pure virtual |
Returns the distribution-specific probability density for value x.
Implemented in DistributionTrapezoid, DistributionCosine, DistributionLogNormal, DistributionGaussian, DistributionLorentz, and DistributionGate.
Referenced by generateSamplesFromValues().
|
pure virtual |
Prints distribution with constructor parameters in given units. ba.DistributionGaussian(2.0*deg, 0.02*deg)
Implemented in DistributionTrapezoid, DistributionCosine, DistributionLogNormal, DistributionGaussian, DistributionLorentz, and DistributionGate.
|
inlinevirtualinherited |
Used for Python overriding of clone (see swig/tweaks.py)
Definition at line 32 of file ICloneable.h.
|
protectedinherited |
Definition at line 63 of file INode.h.
Referenced by IFootprintFactor::IFootprintFactor(), INode::checkNodeArgs(), IProfile1D::pythonConstructor(), IProfile2D::pythonConstructor(), IFormFactor::pythonConstructor(), Profile1DVoigt::pythonConstructor(), and Profile2DVoigt::pythonConstructor().