Skip to main content

Parser/transformator for MAD-X sequences

Project description

Build Status Coverage Latest Version Downloads 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.

Changelog

0.4.0

  • add ‘use_at’ slicing option that enables to use AT values

0.3.2

  • internal: remove attribute access for Element properties

  • fix bugged Element.copy and .__contains__ regarding to base elements

  • fix JSON/YAML serialization errors

  • fix bugged implementation for predefined elements

  • fix bugged LOOP style

  • fix bugged makethin

  • fix bugged use_optics

  • rename ‘use_optics’ => ‘template’. technically, this is a change in the public interface, but we are still in 0.X and furthermore the feature was not working before anyway.

0.3.1

  • use semantic versioning <http://semver.org/>

  • fix deep attribute lookup for elements

0.3

  • redesigned command line

  • fix erroneous parsing of MAD-X arrays, like KNL={…}

  • remove inline attributes for slicing

  • extended slicing via slicing configuration file

  • fix usability of template (predefined) elements

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

madseq-0.4.0.tar.gz (13.7 kB view details)

Uploaded Source

File details

Details for the file madseq-0.4.0.tar.gz.

File metadata

  • Download URL: madseq-0.4.0.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for madseq-0.4.0.tar.gz
Algorithm Hash digest
SHA256 42809761a04798a2087df660da3069fc6309981170374fca91b45680bc33b569
MD5 a8c0e65102bf151a45f59d8dc2d84baf
BLAKE2b-256 492c0df8fba801a3b220dba318b817a78413b2e69f889f3eae722a27a677aa43

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page