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
82e152cb
Commit
82e152cb
authored
2 years ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
rm charm screenshot
parent
5a02494b
No related branches found
No related tags found
1 merge request
!1474
Webdoc: reflectometry ...
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
hugo/content/py/_index.md
+0
-4
0 additions, 4 deletions
hugo/content/py/_index.md
hugo/content/py/nodes_pycharm_ide.png
+0
-0
0 additions, 0 deletions
hugo/content/py/nodes_pycharm_ide.png
hugo/content/py/start/modify-script.md
+0
-59
0 additions, 59 deletions
hugo/content/py/start/modify-script.md
with
0 additions
and
63 deletions
hugo/content/py/_index.md
+
0
−
4
View file @
82e152cb
...
...
@@ -22,10 +22,6 @@ one can
*
extend the functionality of the BornAgain core, for instance
by adding particle form factors or correlation functions.
{{< figscg src="nodes_pycharm_ide.png" width="500" class="center"
caption="A BornAgain script running in the PyCharm IDE.">}}
## Installing the Python package
The installer for any supported platform includes, among others, a Python package ('wheel');
for instance, for Python 3.9, the package can be found under
`python/3.9/wheel`
folder.
...
...
This diff is collapsed.
Click to expand it.
hugo/content/py/nodes_pycharm_ide.png
deleted
100644 → 0
+
0
−
0
View file @
5a02494b
224 KiB
This diff is collapsed.
Click to expand it.
hugo/content/py/start/modify-script.md
deleted
100644 → 0
+
0
−
59
View file @
5a02494b
+++
title = "Modify the script"
weight = 40
+++
## Expanded simulation script
As a first step towards writing sample and simulation specifications
of your own, let us expand the simulation script
[
AlternatingLayers1.py
](
{{%
ref-src "Examples/specular/AlternatingLayers1.py" %}})
from the preceding pages.
Instead of the shorthand calls to modules
[
std_samples
](
{{%
ref-src "Wrap/Python/std_samples.py" %}}) and
[
std_simulations
](
{{%
ref-src "Wrap/Python/std_simulations.py" %}}),
we provide explicit code for the functions
`get_sample`
and
`get_simulation`
:
{{
<
highlightfile
file=
"Examples/specular/AlternatingLayers1.py"
>
}}
<p>
### Sample
`get_sample`
is a function without arguments.
It returns an object of type
[
MultiLayer
](
{{%
ref-api "classMultiLayer" %}}).
The return statement is preceded by three stances.
Each stance starts with a comment line,
{{
<
highlight
python
>
}}
# comment extends from hash character to end of line
{{
<
/
highlight
>
}}
BornAgain functions that start with a capital letter,
like
`MaterialBySLD`
or
`Layer`
are _constructors_ or
constructor-like global functions.
They return new _objects_. An object is an instance of a _class_.
The function
`MaterialBySLD`
instantiates an object of type
[
Material
](
{{%
ref-api "classMaterial" %}})
the function
`Layer`
an object of type
[
Layer
](
{{%
ref-api "classLayer" %}}).
Function like
`addLayer`
is a member function of class
[
MultiLayer
](
{{%
ref-api "classMultiLayer" %}}).
This can be seen from the two lines
{{
<
highlight
python
>
}}
sample = ba.MultiLayer()
sample.addLayer(ambient_layer)
{{
<
/
highlight
>
}}
where
`sample`
is created as a new instance of class
`MultiLayer`
.
### Simulation
`get_simulation(sample, scan_size=500)`
is a function with one
required argument (
`sample`
) and one optional keyword argument
(
`scan_size`
). If the function is called with only one argument,
then
`scan_size`
is assigned the default value 500.
`angstrom`
and
`deg`
are numeric constants. They are used to
convert physical quantities to internal units nanometer and radian.
The function returns an object of type
[
SpecularSimulation
](
{{%
ref-api "classSpecularSimulation" %}}).
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