Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 29 additions & 25 deletions examples/fodo.pals.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,36 @@
# - definition of a FODO channel that:
# - repeats a line (fodo_cell) three times
#
- drift1:
kind: Drift
length: 0.25
PALS:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed today: Start with PALS: or - PALS:?

Claude:
image

I personally also find the extra nesting to get a bit excessive if we start with a list. When we import into each other, we would anyway do it in the lattice: ... list.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image image

Copy link
Member Author

@ax3l ax3l Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed with @DavidSagan : We would combine files and use immediate evaluation / sets like this later on:

PALS:
  version: null  # later, we will put the version of the PALS standard here

  imports:
    - "first.pals.yaml"  # adds elements to the beginning of "lattice: ..."
    - "second.pals.yaml"  # adds more elements (to the end of) "lattice: ..."

  elements:
    # elements from first.pals.yaml
    # elements from second.pals.yaml

    - another_drift:
        kind: Drift
        length: 0.25   

    - set: "..."  # can manipulate all elements

first.pals.yaml and second.pals.yaml would use the same schema (PALS: version: elements: ...).
We can later on allow to sub-select a beamline in imports:, e.g., first.pals.yaml:FODO for a named BeamLine only.

Copy link
Member Author

@ax3l ax3l Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rolled somehow back today, now includes use a "magic element name" like the set command:

Discussed with @DavidSagan : We would combine files and use immediate evaluation / sets like this later on:

PALS:
  version: null  # later, we will put the version of the PALS standard here

  lattices:
    - include: "first.pals.yaml"  # adds elements & commands
    - include: "second.pals.yaml"  # adds more elements & commands

    - another_drift:
        kind: Drift
        length: 0.25   

    - set: "..."  # can manipulate all elements

first.pals.yaml and second.pals.yaml would use the same schema (PALS: version: lattices: ...).
We can later on allow to sub-select a beamline in imports:, e.g., first.pals.yaml:FODO for a named BeamLine only.

Copy link
Member Author

@ax3l ax3l Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My personal preference is to call this group elements:.

I do not think it is confusing if elements includes a list of elements and commands like include/set, and it is quite descriptive (vs. writing "nodes" or "objects" or "list").

PALS:
  version: null  # later, we will put the version of the PALS standard here

  elements:
    - include: "first.pals.yaml"  # adds elements & commands

    - another_drift:
        kind: Drift
        length: 0.25   

    - set: "..."  # can manipulate all elements

    - include: "second.pals.yaml"  # adds more elements & commands

    - my_lattice:
        kind: Lattice
        branches:
          - ...

version: null # later, we will put the version of the PALS standard here

- quad1:
kind: Quadrupole
MagneticMultipoleP:
Bn1: 1.0
length: 1.0

- fodo_cell:
kind: BeamLine
line:
- drift1
- quad1
- drift2:
lattices:
- drift1:
kind: Drift
length: 0.5
- quad2:
inherit: quad1
length: 0.25

- quad1:
kind: Quadrupole
MagneticMultipoleP:
Bn1: -1.0
- drift1

- fodo_channel:
kind: BeamLine
line:
Bn1: 1.0
length: 1.0

- fodo_cell:
repeat: 3
kind: BeamLine
line:
- drift1
- quad1
- drift2:
kind: Drift
length: 0.5
- quad2:
inherit: quad1
MagneticMultipoleP:
Bn1: -1.0
- drift1

- fodo_channel:
kind: BeamLine
line:
- fodo_cell:
repeat: 3
45 changes: 39 additions & 6 deletions source/conventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,26 @@ associated standards, there are packages that implement translation between latt
representational internal format defined by the package.

While the standard itself is language agnostic, this document that describes the standard
needs to use some syntax and this syntax is based upon YAML. Non-YAML syntax used here is:
needs to use some syntax and this syntax is based upon YAML.

%---------------------------------------------------------------------------------------------------
(s:palsroot)=
## PALS Root Object

The root of the PALS schema is given by this dictionary:
```{code} YAML
PALS:
version: null # version schema: defined later

lattices:
- ... # a list of lattice elements and commands
```

%---------------------------------------------------------------------------------------------------
(s:matching)=
## Matching Syntax

Non-YAML syntax used here is:

1. The {math}`N^{th}` item in a list is referred to using square brackets enclosing the index: `[N]`.
For example:
Expand Down Expand Up @@ -142,13 +161,27 @@ Optional string parameters have a default value of blank unless otherwise stated

%---------------------------------------------------------------------------------------------------
(s:includefiles)=
## Include Files
## Include Lattice Files

A lattice file can include other lattice files using an include statement.
```{code} yaml
include: <file-name>
A lattice file can include other lattices (elements and commands) using an include statement.

Example:
```{code} YAML
PALS:
# ...

lattices:
# the elements and commands of base-lattice.pals.yaml
- include: "./base-lattice.pals.yaml"

# the elements and commands of extra-lattice.pals.yaml
- include: "./base-lattice.pals.yaml"

# a list of additional lattice elements and commands
- ...
```
where `<file-name>` is the name of the file to be included.
where the include file names above are examples.
Includes simply insert the `lattices` block of the `include` file(s).

%---------------------------------------------------------------------------------------------------
(s:names)=
Expand Down