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
1bfda63c
Commit
1bfda63c
authored
11 years ago
by
Van Herck, Walter
Browse files
Options
Downloads
Patches
Plain Diff
Remove smearing from z-axis tilting in Simulation
parent
6ad3c001
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Core/Algorithms/inc/Simulation.h
+0
-11
0 additions, 11 deletions
Core/Algorithms/inc/Simulation.h
Core/Algorithms/src/Simulation.cpp
+0
-74
0 additions, 74 deletions
Core/Algorithms/src/Simulation.cpp
with
0 additions
and
85 deletions
Core/Algorithms/inc/Simulation.h
+
0
−
11
View file @
1bfda63c
...
@@ -129,9 +129,6 @@ public:
...
@@ -129,9 +129,6 @@ public:
ParameterPool
*
external_pool
,
ParameterPool
*
external_pool
,
int
copy_number
=-
1
)
const
;
int
copy_number
=-
1
)
const
;
//! Apply smearing of intensity due to tilting of z-axis (DEPRECATED)
void
smearIntensityFromZAxisTilting
();
protected
:
protected
:
Simulation
(
const
Simulation
&
other
);
Simulation
(
const
Simulation
&
other
);
...
@@ -160,14 +157,6 @@ protected:
...
@@ -160,14 +157,6 @@ protected:
#endif
#endif
bool
m_is_normalized
;
bool
m_is_normalized
;
const
ProgramOptions
*
mp_options
;
const
ProgramOptions
*
mp_options
;
//TODO: investigate usage:
double
deltaAlpha
(
double
alpha
,
double
zeta
)
const
;
double
deltaPhi
(
double
alpha
,
double
phi
,
double
zeta
)
const
;
void
createZetaAndProbVectors
(
std
::
vector
<
double
>&
zetas
,
std
::
vector
<
double
>&
probs
,
size_t
nbr_zetas
,
double
zeta_sigma
)
const
;
void
addToIntensityMap
(
double
alpha
,
double
phi
,
double
value
);
};
};
#endif
/* SIMULATION_H_ */
#endif
/* SIMULATION_H_ */
...
...
This diff is collapsed.
Click to expand it.
Core/Algorithms/src/Simulation.cpp
+
0
−
74
View file @
1bfda63c
...
@@ -305,33 +305,6 @@ std::string Simulation::addParametersToExternalPool(
...
@@ -305,33 +305,6 @@ std::string Simulation::addParametersToExternalPool(
return
new_path
;
return
new_path
;
}
}
void
Simulation
::
smearIntensityFromZAxisTilting
()
{
size_t
nbr_zetas
=
5
;
double
zeta_sigma
=
45
*
Units
::
degree
;
std
::
vector
<
double
>
zetas
;
std
::
vector
<
double
>
probs
;
createZetaAndProbVectors
(
zetas
,
probs
,
nbr_zetas
,
zeta_sigma
);
OutputData
<
double
>
*
p_clone
=
m_intensity_map
.
clone
();
m_intensity_map
.
setAllTo
(
0.
);
OutputData
<
double
>::
const_iterator
it_clone
=
p_clone
->
begin
();
while
(
it_clone
!=
p_clone
->
end
())
{
double
old_phi
=
p_clone
->
getValueOfAxis
(
BA
::
PHI_AXIS_NAME
,
it_clone
.
getIndex
());
double
old_alpha
=
p_clone
->
getValueOfAxis
(
BA
::
ALPHA_AXIS_NAME
,
it_clone
.
getIndex
());
for
(
size_t
zeta_index
=
0
;
zeta_index
<
zetas
.
size
();
++
zeta_index
)
{
double
newphi
=
old_phi
+
deltaPhi
(
old_alpha
,
old_phi
,
zetas
[
zeta_index
]);
double
newalpha
=
old_alpha
+
deltaAlpha
(
old_alpha
,
zetas
[
zeta_index
]);
double
prob
=
probs
[
zeta_index
];
addToIntensityMap
(
newalpha
,
newphi
,
prob
*
(
*
it_clone
++
));
}
}
}
void
Simulation
::
init_parameters
()
void
Simulation
::
init_parameters
()
{
{
}
}
...
@@ -405,43 +378,6 @@ void Simulation::setDetectorResolutionFunction(
...
@@ -405,43 +378,6 @@ void Simulation::setDetectorResolutionFunction(
m_instrument
.
setDetectorResolutionFunction
(
p_resolution_function
);
m_instrument
.
setDetectorResolutionFunction
(
p_resolution_function
);
}
}
double
Simulation
::
deltaAlpha
(
double
alpha
,
double
zeta
)
const
{
return
std
::
sin
(
alpha
)
*
(
1.0
/
std
::
cos
(
zeta
)
-
1
);
}
double
Simulation
::
deltaPhi
(
double
alpha
,
double
phi
,
double
zeta
)
const
{
double
qy2
=
std
::
sin
(
phi
)
*
std
::
sin
(
phi
)
-
std
::
sin
(
alpha
)
*
std
::
sin
(
alpha
)
*
std
::
tan
(
zeta
)
*
std
::
tan
(
zeta
);
return
std
::
sqrt
(
qy2
)
-
std
::
sin
(
phi
);
}
void
Simulation
::
createZetaAndProbVectors
(
std
::
vector
<
double
>&
zetas
,
std
::
vector
<
double
>&
probs
,
size_t
nbr_zetas
,
double
zeta_sigma
)
const
{
double
zeta_step
;
if
(
nbr_zetas
<
2
)
{
zeta_step
=
0
;
}
else
{
zeta_step
=
2
*
zeta_sigma
/
(
nbr_zetas
-
1
);
}
double
zeta_start
=
-
zeta_sigma
;
double
prob_total
=
0
;
for
(
size_t
i
=
0
;
i
<
nbr_zetas
;
++
i
)
{
double
zeta
=
zeta_start
+
i
*
zeta_step
;
double
prob
=
MathFunctions
::
Gaussian
(
zeta
,
0.
,
zeta_sigma
);
zetas
.
push_back
(
zeta
);
probs
.
push_back
(
prob
);
prob_total
+=
prob
;
}
assert
(
prob_total
!=
0
);
for
(
size_t
i
=
0
;
i
<
nbr_zetas
;
++
i
)
{
probs
[
i
]
/=
prob_total
;
}
}
void
Simulation
::
addToIntensityMaps
(
DWBASimulation
*
p_dwba_simulation
)
void
Simulation
::
addToIntensityMaps
(
DWBASimulation
*
p_dwba_simulation
)
{
{
m_intensity_map
+=
p_dwba_simulation
->
getDWBAIntensity
();
m_intensity_map
+=
p_dwba_simulation
->
getDWBAIntensity
();
...
@@ -450,16 +386,6 @@ void Simulation::addToIntensityMaps(DWBASimulation* p_dwba_simulation)
...
@@ -450,16 +386,6 @@ void Simulation::addToIntensityMaps(DWBASimulation* p_dwba_simulation)
}
}
}
}
void
Simulation
::
addToIntensityMap
(
double
alpha
,
double
phi
,
double
value
)
{
const
IAxis
*
p_alpha_axis
=
m_intensity_map
.
getAxis
(
BA
::
ALPHA_AXIS_NAME
);
const
IAxis
*
p_phi_axis
=
m_intensity_map
.
getAxis
(
BA
::
PHI_AXIS_NAME
);
std
::
vector
<
int
>
coordinates
;
coordinates
.
push_back
((
int
)
p_alpha_axis
->
findClosestIndex
(
alpha
));
coordinates
.
push_back
((
int
)
p_phi_axis
->
findClosestIndex
(
phi
));
m_intensity_map
[
m_intensity_map
.
toIndex
(
coordinates
)]
+=
value
;
}
OutputData
<
double
>*
Simulation
::
getPolarizedIntensityData
(
int
row
,
int
column
)
const
OutputData
<
double
>*
Simulation
::
getPolarizedIntensityData
(
int
row
,
int
column
)
const
{
{
const
OutputData
<
Eigen
::
Matrix2d
>
*
p_data_pol
=
getPolarizedOutputData
();
const
OutputData
<
Eigen
::
Matrix2d
>
*
p_data_pol
=
getPolarizedOutputData
();
...
...
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