Skip to main content

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": ["Drift", {"length": 0.55}],
    "Q1": ["Quadrupole", {"length": 0.2, "k1": 1.2}],
    "Q2": ["Quadrupole", {"length": 0.4, "k1": -1.2}],
    "B1": ["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

Python Version PyPI CI

This repository also contains a Python based command-line tool which is able validate and convert LatticeJSON files into other common lattice file formats and vice versa.

You can install and update it using pip or pipenv:

pip install -U latticejson

Validate a LatticeJSON file:

latticejson validate /path/to/lattice.json

Convert an elegant lattice file to the LatticeJSON format:

latticejson convert --to json /path/to/lattice.lte

Autoformat one or more LatticeJSON files:

latticejson autoformat /path/to/lattice.json ...

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

GNU General Public License v3.0

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

LatticeJSON-0.1.0.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

LatticeJSON-0.1.0-py3-none-any.whl (26.7 kB view details)

Uploaded Python 3

File details

Details for the file LatticeJSON-0.1.0.tar.gz.

File metadata

  • Download URL: LatticeJSON-0.1.0.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.6

File hashes

Hashes for LatticeJSON-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a9325f6c54bfabf828aab865c0e2c8e05d77c696e009bf7a15155d052bea641f
MD5 0e779f9e5bb2da966f51fcf047e56d2b
BLAKE2b-256 5ddeb23b27913f4488e5d82fd96d06f0dcfcadb5acf64e3cf9f7c95ba299c201

See more details on using hashes here.

File details

Details for the file LatticeJSON-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: LatticeJSON-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 26.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.6

File hashes

Hashes for LatticeJSON-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9106cf73bce7ca68bfa5915e4a54846d148e45e6604d9d47419b89cacdf9afd4
MD5 7d2fc7babe39561fd56251d95f8f7c7f
BLAKE2b-256 d47929292ca0fb7acc62a1fa1ca4ad5c6030eb02bcf42a5b08fbdab50472d7af

See more details on using hashes here.

Supported by

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