A JSON based lattice file format
Project description
LatticeJSON
LatticeJSON is a JSON based lattice file format. JSON is able to describe complex data structures, has a human readable syntax and is available in all common programming language. It is therefore an appropriate choice to characterize the magnetic lattice of a particle accelerator.
Specification
This repository contains the Specification of LatticeJSON in form of a JSON Schema.
Example
A LatticeJSON file for a FODO lattice:
{
"name": "FODO_RING",
"description": "This is the simplest possible strong focusing lattice.",
"elements": {
"D1": {"type": "Drift", "length": 0.55},
"Q1": {"type": "Quadrupole", "length": 0.2, "k1": 1.2},
"Q2": {"type": "Quadrupole", "length": 0.4, "k1": -1.2},
"B1": {"type": "Dipole", "length": 1.5, "angle": 0.392701, "e1": 0.1963505, "e2": 0.1963505}
},
"sub_lattices": {
"FODO": ["Q1", "D1", "B1", "D1", "Q2", "D1", "B1", "D1", "Q1"]
},
"lattice": ["FODO", "FODO", "FODO", "FODO", "FODO", "FODO", "FODO", "FODO"]
}
LatticeJSON CLI
This repository also contains a Python based commandline tool which is able validate and convert LatticeJSON files into other common lattice file formats.
You can install and update it using pip or pipenv:
pip install -U latticejson
Validate a LatticeJSON file:
latticejson validate /path/to/lattice
Convert a LatticeJSON file into the elegant lattice format:
latticejson convert json elegant /path/to/lattice
To activate Bash completion add
eval "$(_LATTICEJSON_COMPLETE=source latticejson)"
to your .bashrc
. Or, create an activation script with:
_LATTICEJSON_COMPLETE=source latticejson > latticejson-complete.sh
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for latticeJSON-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c715bb8f04a71595c8a9cdbbbfd9468f9b7b20b1e482d4c0de05aa79bc7e285c |
|
MD5 | 617c7e3aab10d6876588d4a8d72806de |
|
BLAKE2b-256 | e5630d06edf994a718e1e84048be6d6bb2ebdd3daa0ef5f16e4b490223cfb41f |