|
| 1 | +# LatticeJSON |
| 2 | + |
| 3 | +LatticeJSON is a JSON based lattice file format. JSON is able to describe complex data structures, |
| 4 | +has a human readable syntax and is available in all common programming language. It is therefore an |
| 5 | +appropriate choice to characterize the magnetic lattice of a particle accelerator. |
| 6 | + |
| 7 | +## Specification |
| 8 | +This repository contains the |
| 9 | +[Specification of LatticeJSON](https://github.com/andreasfelix/latticejson/blob/master/latticejson/schema.json) |
| 10 | +in form of a [JSON Schema](https://json-schema.org). |
| 11 | + |
| 12 | +## Example |
| 13 | + |
| 14 | +A LatticeJSON file for a FODO lattice: |
| 15 | +```json |
| 16 | +{ |
| 17 | + "name": "FODO lattice", |
| 18 | + "description": "This is the simplest possible strong focusing lattice.", |
| 19 | + "elements": { |
| 20 | + "D1": {"type": "Drift", "length": 0.55}, |
| 21 | + "Q1": {"type": "Quad", "length": 0.2, "k1": 1.2}, |
| 22 | + "Q2": {"type": "Quad", "length": 0.4, "k1": -1.2}, |
| 23 | + "B1": {"type": "Bend", "length": 1.5, "angle": 0.392701, "e1": 0.1963505, "e2": 0.1963505} |
| 24 | + }, |
| 25 | + "cells": { |
| 26 | + "fodo": ["Q1", "D1", "B1", "D1", "Q2", "D1", "B1", "D1", "Q1"] |
| 27 | + }, |
| 28 | + |
| 29 | + "main_cell": ["fodo", "fodo", "fodo", "fodo", "fodo", "fodo", "fodo", "fodo"] |
| 30 | +} |
| 31 | +``` |
| 32 | + |
| 33 | + |
| 34 | +# LatticeJSON CLI |
| 35 | +[](https://pypi.org/project/latticejson/) |
| 36 | +[](https://pypi.org/project/latticejson/) |
| 37 | +[](https://github.com/andreasfelix/latticejson/actions?query=workflow%3ACI) |
| 38 | + |
| 39 | +This repository also contains a Python based commandline tool which is able validate and convert LatticeJSON |
| 40 | +files into other common lattice file formats. |
| 41 | + |
| 42 | +You can install and update it using pip or pipenv: |
| 43 | + |
| 44 | +```sh |
| 45 | +pip install -U latticejson |
| 46 | +``` |
| 47 | + |
| 48 | +Validate a LatticeJSON file: |
| 49 | +```sh |
| 50 | +latticejson validate /path/to/lattice |
| 51 | +``` |
| 52 | + |
| 53 | +Convert a LatticeJSON file into the elegant lattice format: |
| 54 | +```sh |
| 55 | +latticejson convert json elegant /path/to/lattice |
| 56 | +``` |
| 57 | + |
| 58 | +## License |
| 59 | +[GNU General Public License v3.0](https://github.com/andreasfelix/latticejson/blob/master/LICENSE) |
| 60 | + |
| 61 | + |
0 commit comments