Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BornAgain
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mlz
BornAgain
Commits
f03af20e
Commit
f03af20e
authored
4 years ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
copy edit
parent
a430cd7d
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Core/Export/PyFmt2.cpp
+2
-1
2 additions, 1 deletion
Core/Export/PyFmt2.cpp
Param/Distrib/RangedDistributions.cpp
+34
-12
34 additions, 12 deletions
Param/Distrib/RangedDistributions.cpp
Tests/Functional/Python/Std/Check.cpp
+1
-1
1 addition, 1 deletion
Tests/Functional/Python/Std/Check.cpp
with
37 additions
and
14 deletions
Core/Export/PyFmt2.cpp
+
2
−
1
View file @
f03af20e
...
...
@@ -135,7 +135,8 @@ std::string printParameterDistribution(const ParameterDistribution& par_distr,
std
::
string
printRangedDistribution
(
const
RangedDistribution
&
distr
)
{
std
::
ostringstream
result
;
result
<<
pyfmt
::
indent
()
<<
"distribution = "
<<
distr
.
name
();
result
<<
pyfmt
::
indent
()
<<
"distribution = ba."
;
result
<<
distr
.
name
();
result
<<
"("
<<
distr
.
nSamples
()
<<
", "
<<
pyfmt
::
printDouble
(
distr
.
sigmaFactor
());
if
(
!
distr
.
limits
().
isLimitless
())
result
<<
pyfmt
::
printRealLimitsArg
(
distr
.
limits
());
...
...
This diff is collapsed.
Click to expand it.
Param/Distrib/RangedDistributions.cpp
+
34
−
12
View file @
f03af20e
...
...
@@ -18,11 +18,19 @@
#include
<limits>
namespace
{
template
<
class
T
>
std
::
unique_ptr
<
T
>
makeCopy
(
const
T
&
item
);
template
<
class
T
>
std
::
unique_ptr
<
T
>
makeCopy
(
const
T
&
item
)
{
return
std
::
make_unique
<
T
>
(
item
.
nSamples
(),
item
.
sigmaFactor
(),
item
.
limits
());
}
const
double
gate_stddev_factor
=
2.0
*
std
::
sqrt
(
3.0
);
}
// namespace
// ************************************************************************************************
// interface RangedDistribution
// ************************************************************************************************
RangedDistribution
::
RangedDistribution
()
:
m_n_samples
(
5
),
m_sigma_factor
(
2.0
),
m_limits
(
RealLimits
::
limitless
())
{
checkInitialization
();
...
...
@@ -97,6 +105,10 @@ void RangedDistribution::checkInitialization() {
"shall not exceed the upper one."
);
}
// ************************************************************************************************
// class RangedDistributionGate
// ************************************************************************************************
RangedDistributionGate
::
RangedDistributionGate
()
:
RangedDistribution
()
{}
RangedDistributionGate
::
RangedDistributionGate
(
size_t
n_samples
,
double
sigma_factor
,
...
...
@@ -112,7 +124,7 @@ RangedDistributionGate* RangedDistributionGate::clone() const {
}
std
::
string
RangedDistributionGate
::
name
()
const
{
return
"
ba.
RangedDistributionGate"
;
return
"RangedDistributionGate"
;
}
std
::
unique_ptr
<
IDistribution1D
>
RangedDistributionGate
::
distribution_impl
(
double
mean
,
...
...
@@ -122,6 +134,10 @@ std::unique_ptr<IDistribution1D> RangedDistributionGate::distribution_impl(doubl
return
std
::
make_unique
<
DistributionGate
>
(
x_min
,
x_max
);
}
// ************************************************************************************************
// class RangedDistributionLorentz
// ************************************************************************************************
RangedDistributionLorentz
::
RangedDistributionLorentz
()
:
RangedDistribution
()
{}
RangedDistributionLorentz
::
RangedDistributionLorentz
(
size_t
n_samples
,
double
hwhm_factor
,
...
...
@@ -137,7 +153,7 @@ RangedDistributionLorentz* RangedDistributionLorentz::clone() const {
}
std
::
string
RangedDistributionLorentz
::
name
()
const
{
return
"
ba.
RangedDistributionLorentz"
;
return
"RangedDistributionLorentz"
;
}
std
::
unique_ptr
<
IDistribution1D
>
RangedDistributionLorentz
::
distribution_impl
(
double
median
,
...
...
@@ -145,6 +161,10 @@ std::unique_ptr<IDistribution1D> RangedDistributionLorentz::distribution_impl(do
return
std
::
make_unique
<
DistributionLorentz
>
(
median
,
hwhm
);
}
// ************************************************************************************************
// class RangedDistributionGaussian
// ************************************************************************************************
RangedDistributionGaussian
::
RangedDistributionGaussian
()
:
RangedDistribution
()
{}
RangedDistributionGaussian
::
RangedDistributionGaussian
(
size_t
n_samples
,
double
sigma_factor
,
...
...
@@ -160,7 +180,7 @@ RangedDistributionGaussian* RangedDistributionGaussian::clone() const {
}
std
::
string
RangedDistributionGaussian
::
name
()
const
{
return
"
ba.
RangedDistributionGaussian"
;
return
"RangedDistributionGaussian"
;
}
std
::
unique_ptr
<
IDistribution1D
>
...
...
@@ -168,6 +188,10 @@ RangedDistributionGaussian::distribution_impl(double mean, double stddev) const
return
std
::
make_unique
<
DistributionGaussian
>
(
mean
,
stddev
);
}
// ************************************************************************************************
// class RangedDistributionLogNormal
// ************************************************************************************************
RangedDistributionLogNormal
::
RangedDistributionLogNormal
()
:
RangedDistribution
()
{}
RangedDistributionLogNormal
::
RangedDistributionLogNormal
(
size_t
n_samples
,
double
sigma_factor
,
...
...
@@ -183,7 +207,7 @@ RangedDistributionLogNormal* RangedDistributionLogNormal::clone() const {
}
std
::
string
RangedDistributionLogNormal
::
name
()
const
{
return
"
ba.
RangedDistributionLogNormal"
;
return
"RangedDistributionLogNormal"
;
}
std
::
unique_ptr
<
IDistribution1D
>
...
...
@@ -198,6 +222,10 @@ RangedDistributionLogNormal::distribution_impl(double mean, double stddev) const
return
std
::
make_unique
<
DistributionLogNormal
>
(
median
,
scale
);
}
// ************************************************************************************************
// class RangedDistributionCosine
// ************************************************************************************************
RangedDistributionCosine
::
RangedDistributionCosine
()
:
RangedDistribution
()
{}
RangedDistributionCosine
::
RangedDistributionCosine
(
size_t
n_samples
,
double
sigma_factor
,
...
...
@@ -213,16 +241,10 @@ RangedDistributionCosine* RangedDistributionCosine::clone() const {
}
std
::
string
RangedDistributionCosine
::
name
()
const
{
return
"
ba.
RangedDistributionCosine"
;
return
"RangedDistributionCosine"
;
}
std
::
unique_ptr
<
IDistribution1D
>
RangedDistributionCosine
::
distribution_impl
(
double
mean
,
double
stddev
)
const
{
return
std
::
make_unique
<
DistributionCosine
>
(
mean
,
stddev
);
}
namespace
{
template
<
class
T
>
std
::
unique_ptr
<
T
>
makeCopy
(
const
T
&
item
)
{
return
std
::
make_unique
<
T
>
(
item
.
nSamples
(),
item
.
sigmaFactor
(),
item
.
limits
());
}
}
// namespace
This diff is collapsed.
Click to expand it.
Tests/Functional/Python/Std/Check.cpp
+
1
−
1
View file @
f03af20e
...
...
@@ -50,7 +50,7 @@ std::unique_ptr<OutputData<double>> domainData(const std::string& test_name,
+
std
::
string
(
"set NOPLOT=TRUE"
)
+
" &
\"
"
+
BABuild
::
pythonExecutable
()
+
"
\"
-B "
+
py_command
;
#endif
std
::
cout
<<
"- system call: "
<<
sys_command
<<
std
::
endl
;
// flushing is important here
std
::
cout
<<
"- system call: "
<<
sys_command
<<
std
::
endl
;
int
ret
=
std
::
system
(
sys_command
.
c_str
());
if
(
ret
!=
0
)
{
std
::
stringstream
msg
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment