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
0b323002
Commit
0b323002
authored
10 years ago
by
Pospelov, Gennady
Browse files
Options
Downloads
Patches
Plain Diff
Fix in release script, new example
parent
51d0049d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Examples/python/simulation/ex03_InterferenceFunctions/Interference2DLaticeSumOfRotated.py
+88
-0
88 additions, 0 deletions
...InterferenceFunctions/Interference2DLaticeSumOfRotated.py
dev-tools/release/utils/prepare_release.py
+1
-0
1 addition, 0 deletions
dev-tools/release/utils/prepare_release.py
with
89 additions
and
0 deletions
Examples/python/simulation/ex03_InterferenceFunctions/Interference2DLaticeSumOfRotated.py
0 → 100644
+
88
−
0
View file @
0b323002
# 2D lattice with different disorder (IsGISAXS example #6), sum of rotated lattices
import
numpy
import
matplotlib
import
pylab
from
bornagain
import
*
phi_min
,
phi_max
=
0.0
,
2.0
alpha_min
,
alpha_max
=
0.0
,
2.0
def
get_sample
(
xi_value
):
"""
Build and return the sample representing 2D lattice with different disorder
rotated lattice
"""
m_ambience
=
HomogeneousMaterial
(
"
Air
"
,
0.0
,
0.0
)
m_substrate
=
HomogeneousMaterial
(
"
Substrate
"
,
6e-6
,
2e-8
)
m_particle
=
HomogeneousMaterial
(
"
Particle
"
,
6e-4
,
2e-8
)
air_layer
=
Layer
(
m_ambience
)
substrate_layer
=
Layer
(
m_substrate
)
p_interference_function
=
InterferenceFunction2DLattice
.
createSquare
(
25.0
*
nanometer
,
xi_value
)
pdf
=
FTDistribution2DCauchy
(
300.0
*
nanometer
/
2.0
/
numpy
.
pi
,
100.0
*
nanometer
/
2.0
/
numpy
.
pi
)
p_interference_function
.
setProbabilityDistribution
(
pdf
)
particle_layout
=
ParticleLayout
()
ff_cyl
=
FormFactorCylinder
(
3.0
*
nanometer
,
3.0
*
nanometer
)
position
=
kvector_t
(
0.0
,
0.0
,
0.0
)
cylinder
=
Particle
(
m_particle
,
ff_cyl
.
clone
())
particle_info
=
ParticleInfo
(
cylinder
,
position
,
1.0
)
particle_layout
.
addParticleInfo
(
particle_info
)
particle_layout
.
addInterferenceFunction
(
p_interference_function
)
air_layer
.
addLayout
(
particle_layout
)
multi_layer
=
MultiLayer
()
multi_layer
.
addLayer
(
air_layer
)
multi_layer
.
addLayer
(
substrate_layer
)
return
multi_layer
def
get_simulation
():
"""
Create and return GISAXS simulation with beam and detector defined
"""
simulation
=
Simulation
()
simulation
.
setDetectorParameters
(
100
,
phi_min
*
degree
,
phi_max
*
degree
,
100
,
alpha_min
*
degree
,
alpha_max
*
degree
)
simulation
.
setBeamParameters
(
1.0
*
angstrom
,
0.2
*
degree
,
0.0
*
degree
)
return
simulation
def
run_simulation
():
"""
Run several simulations, sum up intensities from different rotated lattices and plot results
"""
simulation
=
get_simulation
()
OutputData_total
=
simulation
.
getIntensityData
()
nbins
=
3
xi_min
=
0.0
*
degree
xi_max
=
240.0
*
degree
# xi= StochasticSampledParameter(StochasticDoubleGate(xi_min, xi_max), nbins, xi_min, xi_max)
total_weight
=
0.0
xi_distr
=
DistributionGate
(
xi_min
,
xi_max
)
xi_samples
=
xi_distr
.
generateValueList
(
nbins
,
0.0
)
for
i
in
range
(
len
(
xi_samples
)):
xi_value
=
xi_samples
[
i
]
probability
=
xi_distr
.
probabilityDensity
(
xi_value
)
total_weight
+=
probability
p_sample
=
get_sample
(
xi_value
)
simulation
.
setSample
(
p_sample
)
simulation
.
runSimulation
()
single_output
=
simulation
.
getIntensityData
()
single_output
.
scaleAll
(
probability
)
OutputData_total
+=
single_output
OutputData_total
.
scaleAll
(
1.0
/
total_weight
)
result
=
OutputData_total
.
getArray
()
+
1
# for log scale
pylab
.
imshow
(
numpy
.
rot90
(
result
,
1
),
norm
=
matplotlib
.
colors
.
LogNorm
(),
extent
=
[
0.0
,
2.0
,
0
,
2.0
])
pylab
.
show
()
if
__name__
==
'
__main__
'
:
run_simulation
()
This diff is collapsed.
Click to expand it.
dev-tools/release/utils/prepare_release.py
+
1
−
0
View file @
0b323002
...
@@ -61,6 +61,7 @@ def update_upload_dir():
...
@@ -61,6 +61,7 @@ def update_upload_dir():
print
"
\n
Updating directory for upload ...
"
print
"
\n
Updating directory for upload ...
"
run_command
(
"
mv %s/BornAgain*.tar.gz %s/old
"
%
(
get_upload_dir
(),
get_upload_dir
()))
run_command
(
"
mv %s/BornAgain*.tar.gz %s/old
"
%
(
get_upload_dir
(),
get_upload_dir
()))
run_command
(
"
mv %s/BornAgain*-win32.exe %s/old
"
%
(
get_upload_dir
(),
get_upload_dir
()))
run_command
(
"
mv %s/BornAgain*-win32.exe %s/old
"
%
(
get_upload_dir
(),
get_upload_dir
()))
run_command
(
"
mv %s/BornAgain-*-macosx64-*.dmg %s/old
"
%
(
get_upload_dir
(),
get_upload_dir
()))
run_command
(
"
mv %s/*Manual-*.pdf %s/old
"
%
(
get_upload_dir
(),
get_upload_dir
()))
run_command
(
"
mv %s/*Manual-*.pdf %s/old
"
%
(
get_upload_dir
(),
get_upload_dir
()))
run_command
(
"
cp %s/BornAgain-%s.tar.gz %s
"
%
(
get_build_dir
(),
get_version
(),
get_upload_dir
()))
run_command
(
"
cp %s/BornAgain-%s.tar.gz %s
"
%
(
get_build_dir
(),
get_version
(),
get_upload_dir
()))
run_command
(
"
cp %s/CHANGELOG %s
"
%
(
get_source_dir
(),
get_upload_dir
()))
run_command
(
"
cp %s/CHANGELOG %s
"
%
(
get_source_dir
(),
get_upload_dir
()))
...
...
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