From 94563e0425492c0ce67052ac55c32972bc7afe03 Mon Sep 17 00:00:00 2001 From: Joachim Wuttke <j.wuttke@fz-juelich.de> Date: Wed, 15 Mar 2023 11:36:59 +0100 Subject: [PATCH 1/5] Beam: some setters rm from Py --- Device/Beam/Beam.h | 10 ++++++---- hugo/content/py/instr/beam/_index.md | 14 ++++++++++++++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Device/Beam/Beam.h b/Device/Beam/Beam.h index 0407e4ea581..f5889845621 100644 --- a/Device/Beam/Beam.h +++ b/Device/Beam/Beam.h @@ -41,10 +41,6 @@ public: static Beam horizontalBeam(); //... Setters: - void setIntensity(double intensity); - void setWavelength(double wavelength); - void setInclination(double alpha); - void setAzimuthalAngle(double value); void setFootprintFactor(const IFootprintFactor& shape_factor); void setPolarization(R3 polarization); @@ -56,6 +52,12 @@ public: return "Beam"; } + //... Setters: + void setIntensity(double intensity); + void setWavelength(double wavelength); + void setInclination(double alpha); + void setAzimuthalAngle(double value); + std::vector<const INode*> nodeChildren() const override; //... Getters diff --git a/hugo/content/py/instr/beam/_index.md b/hugo/content/py/instr/beam/_index.md index 784870eb190..bdd9339e080 100644 --- a/hugo/content/py/instr/beam/_index.md +++ b/hugo/content/py/instr/beam/_index.md @@ -5,4 +5,18 @@ weight = 20 ## Beam model +The incident beam must be specified for scattering simulations with 2D detector +(SAS and GISAS). +For other simulations, the beam is set internally according to the +given [scan](../scan) model. + +To create a beam, use +```python +ba.InBeam(intensity, wavelength, alpha, phi=0) +``` +For the wavelenth, use unit multiplier `*nm` or `*angstrom`. +For the glancing angle $\alpha\_\text{i}$, use unit multiplier `*deg`. +The azimuthal angle $\varphi\_\text{i}$ can be omitted, +as in most applications the default value 0 is pertinent. + {{% children %}} -- GitLab From 950185a1ceb76090c48016fd81a78235ee9d9bfa Mon Sep 17 00:00:00 2001 From: Joachim Wuttke <j.wuttke@fz-juelich.de> Date: Wed, 15 Mar 2023 11:42:58 +0100 Subject: [PATCH 2/5] webdoc beam ctd --- hugo/content/py/instr/beam/_index.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/hugo/content/py/instr/beam/_index.md b/hugo/content/py/instr/beam/_index.md index bdd9339e080..0beb95d8b15 100644 --- a/hugo/content/py/instr/beam/_index.md +++ b/hugo/content/py/instr/beam/_index.md @@ -12,11 +12,19 @@ given [scan](../scan) model. To create a beam, use ```python -ba.InBeam(intensity, wavelength, alpha, phi=0) +beam = ba.InBeam(intensity, wavelength, alpha, phi=0) ``` For the wavelenth, use unit multiplier `*nm` or `*angstrom`. For the glancing angle $\alpha\_\text{i}$, use unit multiplier `*deg`. The azimuthal angle $\varphi\_\text{i}$ can be omitted, as in most applications the default value 0 is pertinent. +After creation of a beam, special properties can be set with +```python +beam.setFootprintFactor(footprint) +beam.setPolarization(polarization) +``` +For the arguments, see [footprint](footprint) and [polarization](../polarized). + + {{% children %}} -- GitLab From 0b9ee8d8fbef5293da401bf7306a299999da382c Mon Sep 17 00:00:00 2001 From: Joachim Wuttke <j.wuttke@fz-juelich.de> Date: Wed, 15 Mar 2023 11:59:39 +0100 Subject: [PATCH 3/5] + devtools/code/hugo-shortcode-usage.py --- devtools/code/hugo-shortcode-usage.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 devtools/code/hugo-shortcode-usage.py diff --git a/devtools/code/hugo-shortcode-usage.py b/devtools/code/hugo-shortcode-usage.py new file mode 100755 index 00000000000..50aff8de6e0 --- /dev/null +++ b/devtools/code/hugo-shortcode-usage.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python3 + +# run over `fmd` + +import edtools as et +import os, re, sys + +flist = os.listdir('/G/sw/ba/hugo/layouts/shortcodes') +smap = {} +for fname in flist: + smap[fname.split('.')[0]] = 0 + +def user_edit(fn, t): + + for sn in smap.keys(): + for m in re.finditer(r'\W'+sn+r'\W', t): + smap[sn] += 1 + + return t + +et.ed_argfiles(user_edit) + +for sn, count in sorted(smap.items()): + print(f'{sn} used {count} times') -- GitLab From 82376233d757d7a08d068741639a9ece9f61e0c6 Mon Sep 17 00:00:00 2001 From: Joachim Wuttke <j.wuttke@fz-juelich.de> Date: Wed, 15 Mar 2023 12:23:39 +0100 Subject: [PATCH 4/5] rm unused shortcodes --- hugo/layouts/shortcodes/collapse.html | 14 -------------- hugo/layouts/shortcodes/readfile.html | 6 ------ hugo/layouts/shortcodes/ref-manual.html | 1 - hugo/layouts/shortcodes/ref-tarball.html | 1 - hugo/layouts/shortcodes/toc.html | 1 - 5 files changed, 23 deletions(-) delete mode 100644 hugo/layouts/shortcodes/collapse.html delete mode 100644 hugo/layouts/shortcodes/readfile.html delete mode 100644 hugo/layouts/shortcodes/ref-manual.html delete mode 100644 hugo/layouts/shortcodes/ref-tarball.html delete mode 100644 hugo/layouts/shortcodes/toc.html diff --git a/hugo/layouts/shortcodes/collapse.html b/hugo/layouts/shortcodes/collapse.html deleted file mode 100644 index ef41f9a8775..00000000000 --- a/hugo/layouts/shortcodes/collapse.html +++ /dev/null @@ -1,14 +0,0 @@ - -{{- $title := .Get "title" -}} -{{- $id := .Get "id" -}} - -<p> -<a class="btn btn-light" data-toggle="collapse" href="#{{ $id }}" role="button" aria-expanded="false" aria-controls="{{ $id }}"> -{{ $title }} -</a> -<div class="collapse" id="{{ $id }}"> - <div class="card card-body"> - {{.Inner}} - </div> -</div> -</p> diff --git a/hugo/layouts/shortcodes/readfile.html b/hugo/layouts/shortcodes/readfile.html deleted file mode 100644 index 6860b0f1115..00000000000 --- a/hugo/layouts/shortcodes/readfile.html +++ /dev/null @@ -1,6 +0,0 @@ -{{$file := .Get "file"}} -{{- if eq (.Get "markdown") "true" -}} -{{- $file | readFile | markdownify -}} -{{- else -}} -{{ $file | readFile | safeHTML }} -{{- end -}} diff --git a/hugo/layouts/shortcodes/ref-manual.html b/hugo/layouts/shortcodes/ref-manual.html deleted file mode 100644 index d4ae99a1ffe..00000000000 --- a/hugo/layouts/shortcodes/ref-manual.html +++ /dev/null @@ -1 +0,0 @@ -{{.Site.Params.url_doc}}/PhysicsManual.pdf diff --git a/hugo/layouts/shortcodes/ref-tarball.html b/hugo/layouts/shortcodes/ref-tarball.html deleted file mode 100644 index cd2026cab7b..00000000000 --- a/hugo/layouts/shortcodes/ref-tarball.html +++ /dev/null @@ -1 +0,0 @@ -{{.Site.Params.url_exe}}/BornAgain-{{.Site.Params.version_mmp}}.tar.gz diff --git a/hugo/layouts/shortcodes/toc.html b/hugo/layouts/shortcodes/toc.html deleted file mode 100644 index 3303672a5d1..00000000000 --- a/hugo/layouts/shortcodes/toc.html +++ /dev/null @@ -1 +0,0 @@ -{{ .Page.TableOfContents}} -- GitLab From 21eb161830515b63785e6517438bce00ebaad77e Mon Sep 17 00:00:00 2001 From: Joachim Wuttke <j.wuttke@fz-juelich.de> Date: Wed, 15 Mar 2023 12:26:11 +0100 Subject: [PATCH 5/5] rm last link to Doxy API --- hugo/content/py/sample/multilayer.md | 3 +-- hugo/layouts/shortcodes/ref-api.html | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) delete mode 100644 hugo/layouts/shortcodes/ref-api.html diff --git a/hugo/content/py/sample/multilayer.md b/hugo/content/py/sample/multilayer.md index dfd6ba19552..370f425c9e7 100644 --- a/hugo/content/py/sample/multilayer.md +++ b/hugo/content/py/sample/multilayer.md @@ -9,8 +9,7 @@ weight = 35 The ***Define materials*** stance defines four materials in terms of their scattering length density (SLD). The arguments of the constructor-like global function -[MaterialBySLD]({{% ref-api "group__materials" %}}) -are `name`, `real_sld`, `imag_sld`. +MaterialBySLD are `name`, `real_sld`, `imag_sld`. Both `real_sld` and `imag_sld` are in units of inverse square angstroms. SLD values for a wide variety of materials can be found on https://sld-calculator.appspot.com diff --git a/hugo/layouts/shortcodes/ref-api.html b/hugo/layouts/shortcodes/ref-api.html deleted file mode 100644 index cfec9169fc4..00000000000 --- a/hugo/layouts/shortcodes/ref-api.html +++ /dev/null @@ -1 +0,0 @@ -{{.Site.Params.url_userapi}}/{{ .Get 0}}.html -- GitLab