可视化Twiss参数,用于晶格参数的一维或二维网格扫描。

TwissGrid的Python项目详细描述


TwissGrid公司

此应用程序执行晶格参数的一维或二维网格扫描 并将它们对所选光学功能的影响可视化。在

安装

可以从Python包索引(PyPI)安装应用程序:

pip install twissgrid

使用

可以通过以下方式从命令行使用该应用程序:

^{pr2}$

它至少需要两个参数:

  1. MADX脚本的文件路径。在
  2. 晶格参数的名称。它需要给出为label->attr,其中->attr部分是可选的(它将从元素类型中推断)。必须通过提供的label在MADX中访问相应的元素(参数在内部将更新为label->attr = value;,因此必须是有效语句)。在

此示例将根据该参数创建beta函数的二维图:

Example1D

3D绘图

可以在第一个参数之后提供第二个参数,以便执行二维参数扫描 并创建相应的3D打印:

python -m twissgrid /path/to/script.madx a_param b_param

Example2D

定制

应用程序支持其他各种参数,用于自定义参数扫描或结果图。 {5>可通过

$ 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)

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java如何在安卓 studio中使用调用jaxws web服务的jar文件   java双时间模拟时钟不打印两个不同的时间   java Jackson反序列化处理不带字段的生成值   多线程在java同步中读锁的目的是什么   为什么java中有这么多获取日期时间的方法?   java从listview中的TextView获取数据   java是否可以定义如何对枚举进行(反)序列化以在枚举内持久化?   Java:异常处理我的catch()有问题   VMWare java SDK:可用的PerfMetricID何时不报告数据?   exec在Java中执行命令而不重定向输出   java使用SpringXML配置实现观察者模式?   java在竹笔平板电脑中使用JPen