Skip to content
Snippets Groups Projects
Commit 63de1fb9 authored by Edward Fauchon-Jones's avatar Edward Fauchon-Jones
Browse files

Add error for out of range strain mode order

Add error to handle case when absolute value of the mode's order
exceeds its degree.
parent 41e31138
No related branches found
No related tags found
2 merge requests!4WIP: Gitlab CI Experiments,!3Validate strain modes #2
......@@ -87,3 +87,12 @@ class Missing(Error):
"""No value is defined for the field"""
name = "MISSING"
msg = None
class InvalidModeName(Error):
"""Mode's absolute order value exceeds degree"""
name = "INVALID MODE"
msg = "(Order {0:} of mode is not allowed for degree {1:})"
def __init__(self, spec):
self.msg = self.msg.format(spec.m, spec.l)
......@@ -594,6 +594,13 @@ class Phaselm(ROMSplineSpec):
return SubPhaselm
@classmethod
def valid(self, sim):
if abs(self.m) > self.l:
return err.InvalidModeName(self)
else:
return super(Phaselm, self).valid(sim)
@classmethod
def getlm(self, sim):
"""Get a list of phase modes available in an LVC NR simulation
......@@ -677,6 +684,13 @@ class Amplm(ROMSplineSpec):
return SubAmplm
@classmethod
def valid(self, sim):
if abs(self.m) > self.l:
return err.InvalidModeName(self)
else:
return super(Amplm, self).valid(sim)
@classmethod
def getlm(self, sim):
"""Get a list of amp modes available in an LVC NR simulation
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment