File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,14 @@ class SimParams:
2828
2929 def __post_init__ (self ):
3030 """Check that we have a valid combination of simulation parameters."""
31+ try :
32+ LinoptType (self .linopt )
33+ except ValueError as e :
34+ raise ValueError (
35+ f"{ self .linopt } is not a valid linopt function. Choose from: "
36+ f"{ [sp .value for sp in LinoptType ]} "
37+ ) from e
38+
3139 if self .linopt == LinoptType .LINOPT2 or self .linopt == LinoptType .LINOPT4 :
3240 if self .emittance or self .radiation :
3341 raise ValueError (
@@ -86,11 +94,6 @@ def calculate_optics(
8694 case LinoptType .LINOPT6 :
8795 orbit_func = at_lattice .find_orbit6
8896 linopt_func = at_lattice .linopt6
89- case _:
90- raise ValueError (
91- f"Error. Invalid linopt function selected: { sp .linopt } . Simulation "
92- "data not calculated."
93- )
9497
9598 # Perform pyAT orbit calculation
9699 orbit0 , _ = orbit_func ()
You can’t perform that action at this time.
0 commit comments