Skip to content
This repository has been archived by the owner on Aug 29, 2020. It is now read-only.
/ madseq Public archive

[OBSOLETE] MAD-X sequence file parser/transformer

License

Notifications You must be signed in to change notification settings

hibtc/madseq

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

97 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

madseq

Build Status Coverage Latest Version License

Description

Script to parse MAD-X sequences from a source file and perform simple transformations on the elements.

Dependencies

  • docopt to parse command line options
  • pydicti to store and access element attributes
  • pyyaml to parse slicing definition and use YAML output format

Installation

The setup is to be performed as follows

python setup.py install

Usage

The command should be called as follows:

Usage:
    madseq.py [-j|-y] [-s <slice>] [<input>] [<output>]
    madseq.py (--help | --version)

Options:
    -j, --json                      Use JSON as output format
    -y, --yaml                      Use YAML as output format
    -s <slice>, --slice=<slice>     Set slicing definition file
    -h, --help                      Show this help
    -v, --version                   Show version information

If <input> is not specified the standard input stream will be used to read the input file. Respectively, the standard output stream will be used if <output> is not specified.

The slicing definition defines a list of slicing instructions where each entry is a dictionary with the following groups of mutually exclusive keys:

str type: match only elements with the specified type
str name: match only elements with the specified name

bool use_at: use manually entered AT values, default is True

float density: slice element with the specified number of slices per meter
int slice: slice element using a fixed count, default=1

bool makethin: whether to convert the slices to MULTIPOLE

bool template: whether to put a template for the element in front

str style: slicing style, either 'uniform' or 'loop', defaults to 'uniform'

Example file:

- type: drift
  density: 10
- name: B1DK1
  slice: 10
  makethin: true
  style: uniform

Note, that even if an element is matched by multiple rules, only the first one will be used.

Caution

  • Do not use multi line commands in the input sequences. At the moment these are not parsed correctly!
  • Do not add any at= position arguments in the input sequences. The madseq script takes care of this responsibility.

About

[OBSOLETE] MAD-X sequence file parser/transformer

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages