Maxtem not enabled by default when user adds curved optic
Maxtem is not enabled by default when a user adds a curved optic. This can be quite misleading. I suggest adding a pre flight checks option to Model.run
which is enabled by default and checks for these common user faux pas. This can be disabled by advanced users who are sure they know what they are doing.
Suggested meta-code includes adding the following to the Model
class.
def pre_flight_checks(self):
print('Running pre-flight-checks. This can be disabled by setting pre_flight_checks=False.')
if self.__spatial_type == SpatialType.PLANE:
for _comp in self.__components:
if isinstance(_comp, Surface):
if _comp.Rcx != np.inf or _comp.Rcx != np.inf:
warn('maxtem is not set, but a radius of curvature is specified in at least one componant. Offending component {_comp.name}. Enable with model.select_modes(maxtem=2) to correctly model gaussian modes.')
break
print('Done')
And then adjusting the run method:
def run(self,pre_flight_checks=True):
if pre_flight_checks: self.pre_flight_checks()
s = self.analysis.run(self)
Such code should probably also check for the existance of lens, gauss and cavity commands.
I think it is important that the user is alerted of the existance of this code, so that they know they can disable it for a speed boost.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information