TwissGrid
This application performs one- or two-dimensional grid scans of lattice parameters and visualizes their effect on selected optics functions.
Installation
The application can be installed from the Python Package Index (PyPI):
pip install twissgrid
Usage
The application can be used from the command line in the following way:
python -m twissgrid /path/to/script.madx a_param
It expects at least two arguments:
- The file path to a MADX script.
- The name of a lattice parameter. It needs to be given as
label->attrwhere the->attrpart is optional (it will be inferred from the element type). The corresponding element must be accessible in MADX via the providedlabel(internally the parameter will be updated aslabel->attr = value;so that must be an effective statement).
This example will create a 2D-plot of the beta functions in dependence on that parameter:
3D Plots
A second parameter can be provided, following the first one, in order to perform a two-dimensional parameter scan and create a corresponding 3D-plot:
python -m twissgrid /path/to/script.madx a_param b_param
Customization
The application supports various other arguments for customizing the parameter scan or the resulting plots.
The full set of available parameters can be found via --help:
$ python -m twissgrid --help
usage: python -m twissgrid [-h] [--p1lb P1LB] [--p1ub P1UB]
[--p1delta P1DELTA] [--p1margin P1MARGIN]
[--p1n P1N] [--p2lb P2LB] [--p2ub P2UB]
[--p2delta P2DELTA] [--p2margin P2MARGIN]
[--p2n P2N] [--funcs FUNCS [FUNCS ...]]
[--target TARGET] [--beta0 BETA0]
[--threshold [THRESHOLD [THRESHOLD ...]]]
[--figsize FIGSIZE FIGSIZE]
script p1 [p2]
positional arguments:
script File path to MADX script
p1 Lattice parameter 1 (format: label[->attribute])
p2 Lattice parameter 2 (format: label[->attribute])
(default: None)
optional arguments:
-h, --help show this help message and exit
--funcs FUNCS [FUNCS ...]
Optics functions to plot (default: ('betx', 'bety'))
--target TARGET Label of the target element where optics functions are
observed (default: #e)
--beta0 BETA0 Label of BETA0 command (this must be part of the MADX
script) (default: None)
--threshold [THRESHOLD [THRESHOLD ...]]
Plot threshold line on each optics plot (default:
None)
--figsize FIGSIZE FIGSIZE
Figure size in inches (default: (14, 10))
Parameter 1:
--p1lb P1LB Lower boundary for parameter scan (default: None)
--p1ub P1UB Upper boundary for parameter scan (default: None)
--p1delta P1DELTA Compute missing boundaries as a distance to the
current value (i.e. "lb = value - delta" and "ub =
value + delta"); --delta takes precedence over
--margin (default: None)
--p1margin P1MARGIN Compute missing boundaries as a fraction of the
current value (i.e. "lb = (1 - margin)*value" and "ub
= (1 + margin)*value") (default: 0.01)
--p1n P1N Number of grid points for parameter scan (default:
100)
Parameter 2:
--p2lb P2LB Lower boundary for parameter scan (default: None)
--p2ub P2UB Upper boundary for parameter scan (default: None)
--p2delta P2DELTA Compute missing boundaries as a distance to the
current value (i.e. "lb = value - delta" and "ub =
value + delta"); --delta takes precedence over
--margin (default: None)
--p2margin P2MARGIN Compute missing boundaries as a fraction of the
current value (i.e. "lb = (1 - margin)*value" and "ub
= (1 + margin)*value") (default: 0.01)
--p2n P2N Number of grid points for parameter scan (default:
100)
Metadata
Release files for TwissGrid 0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| TwissGrid-0.3.tar.gz | 5.5 kB | Without provenance | Details for TwissGrid-0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| TwissGrid-0.3-py3-none-any.whl | Python 3 | none | any | Details for TwissGrid-0.3-py3-none-any.whl |
Total release size: 12.0 kB
Release files / TwissGrid-0.3.tar.gz
| Download URL | TwissGrid-0.3.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e4b472f6f308fde45599038b26fdca8d700d4c61f7b49f7964f7ce1b81309565
|
|
BLAKE2b-256 checksum How to use checksums |
cdbc3e769689b68a3dde1d658a35c6d19309550a69e5ca472561e0bd63fbe0a7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.5.0.1 requests/2.9.1 setuptools/34.2.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.5.2
|
Release files / TwissGrid-0.3-py3-none-any.whl
| Download URL | TwissGrid-0.3-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b32936b001ad6ab56f089cd9859482e504c3e442c5219e74c656d6d4ce712902
|
|
BLAKE2b-256 checksum How to use checksums |
e197c1addfe4f2d88fafe224445bcd32192556c28418dd647fdf28a85a689025
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.5.0.1 requests/2.9.1 setuptools/34.2.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.5.2
|
Security for TwissGrid 0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.