# Lattice definitions in the form of a dict: lattice_id -> TaoStartup (ie the arguments to Tao(...))
lattices:
  lat_a:
    lattice_file: lat_a.lat.bmad
  lat_b:
    lattice_file: lat_b.lat.bmad
  lat_c:
    lattice_file: lat_c.lat.bmad

# Grouped constraints: a dict of group_name -> list[Constraint]. Each constraint defined by its `constraint_type`. The
# constraints each have two observables, the type of which is set by `obs_type` and can be derived from the lattice
# or a literal. The constraints may include short descriptions and longer comments for documentation.
constraints:
  Lattice-Consistency:
    - constraint_type: ele_eq
      description: Short description, lat_a, lat_b treaty point
      comment: Longer comment included on error and in reports. eg Please rerun `tune_matcher.tao` in event of failure.
      obs_a:
        obs_type: ele
        lattice_id: lat_a
        ele_id: END
      obs_b:
        obs_type: ele
        lattice_id: lat_b
        ele_id: BEGINNING

    - constraint_type: ele_eq
      description: Trivial test
      obs_a:
        obs_type: ele
        lattice_id: lat_a
        ele_id: END
      obs_b:
        obs_type: ele
        lattice_id: lat_a
        ele_id: END

  Sanity-Checks:
    - constraint_type: ele_lt
      description: lat_a beta sanity check
      obs_a:
        obs_type: ele_max
        lattice_id: lat_a
      obs_b:
        obs_type: ele_literal
        beta_a: 200
        beta_b: 200
      comparison:
        beta_a: true
        beta_b: true

    - constraint_type: ele_lt
      description: lat_b beta sanity check
      obs_a:
        obs_type: ele_max
        lattice_id: lat_b
      obs_b:
        obs_type: ele_literal
        beta_a: 200
        beta_b: 200
      comparison:
        beta_a: true
        beta_b: true
  
    - constraint_type: ele_lt
      description: lat_c beta sanity check
      comment: This constraint is expected to fail
      obs_a:
        obs_type: ele_max
        lattice_id: lat_c
      obs_b:
        obs_type: ele_literal
        beta_a: 0
        beta_b: 200
      comparison:
        beta_a: true
        beta_b: true
  
  # Define some regression tests. Note: we split them out in their own group here, but they are constraints in their own
  # right and may be placed anywhere in the file. IsCloseConstraint's also implicitly define regression checks. 
  Regression:
    - constraint_type: ele_reg
      description: Middle of lat_a
      comment: lat_a should not be changing, check middle Twiss
      obs:
        obs_type: ele
        lattice_id: lat_a
        ele_id: MAR_MID
