File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22from pals import Drift
33from pals import Quadrupole
44from pals import BeamLine
5+ from pals import Lattice
56
67
78def main ():
@@ -42,26 +43,31 @@ def main():
4243 drift3 ,
4344 ],
4445 )
46+ # Create lattice with the line as a branch
47+ lattice = Lattice (
48+ name = "fodo_lattice" ,
49+ branches = [line ],
50+ )
4551
4652 # Serialize to YAML
4753 yaml_file = "examples_fodo.pals.yaml"
48- line .to_file (yaml_file )
54+ lattice .to_file (yaml_file )
4955
5056 # Read YAML data from file
51- loaded_line = BeamLine .from_file (yaml_file )
57+ loaded_lattice = Lattice .from_file (yaml_file )
5258
5359 # Validate loaded data
54- assert line == loaded_line
60+ assert lattice == loaded_lattice
5561
5662 # Serialize to JSON
5763 json_file = "examples_fodo.pals.json"
58- line .to_file (json_file )
64+ lattice .to_file (json_file )
5965
6066 # Read JSON data from file
61- loaded_line = BeamLine .from_file (json_file )
67+ loaded_lattice = Lattice .from_file (json_file )
6268
6369 # Validate loaded data
64- assert line == loaded_line
70+ assert lattice == loaded_lattice
6571
6672
6773if __name__ == "__main__" :
You can’t perform that action at this time.
0 commit comments