otaf.exceptions package
Module contents
Custom exception classes for the OTAF project.
- exception otaf.exceptions.ConflictingSurfaceDirectionsException(part_id1, surface_id1, part_id2, surface_id2)[source]
Bases:
ExceptionException raised for conflicting surface directions in cylinder interactions.
- exception otaf.exceptions.CylindricalInterferenceGeometricException(part_id1, surface_id1, part_id2, surface_id2, radius1, radius2)[source]
Bases:
ExceptionException raised for geometric inconsistencies in cylindrical interactions.
- exception otaf.exceptions.DuplicatePointError(point_name, surf_id, part_id, existing_point=None, origin=False, new_point_value=None, existing_point_value=None, exact_match=True)[source]
Bases:
ValueErrorRaised when a point name or its coordinates duplicate an existing point of the surface.
- Parameters:
point_name (str) – Name of the new point.
surf_id (str) – ID of the surface.
part_id (str) – ID of the part.
existing_point (str, optional) – Name of the existing point with similar coordinates (
exact_match=False).origin (bool, optional) – Whether the point is the surface origin.
new_point_value (array_like, optional) – Coordinates of the new point, shown in the message.
existing_point_value (array_like, optional) – Coordinates of the existing point, shown in the message.
exact_match (bool, optional) – True when the name itself is duplicated, False when only the coordinates are.
- exception otaf.exceptions.GeometricConditionError(condition_name)[source]
Bases:
ExceptionRaised when a geometric condition required by the modelling is not met.
- Parameters:
condition_name (str) – Name of the condition.
- exception otaf.exceptions.InconsistentContactConstraintsError(part_id1, surf_id1, constraints1, part_id2, surf_id2, constraints2)[source]
Bases:
ValueErrorRaised when the two surfaces of a contact carry different
CONSTRAINTS_G.The contact type is looked up from both entries, so they must be equal. A surface without the key counts as
["FLOATING"].- Parameters:
part_id1 (str) – First surface of the contact.
surf_id1 (str) – First surface of the contact.
constraints1 (list of str) – Its
CONSTRAINTS_G(default included).part_id2 (str) – Second surface of the contact.
surf_id2 (str) – Second surface of the contact.
constraints2 (list of str) – Its
CONSTRAINTS_G(default included).
- exception otaf.exceptions.InvalidAffineTransformException(matrix, message='Matrix is not a valid affine transformation matrix.')[source]
Bases:
ExceptionException raised when a matrix is not a valid affine transformation matrix.
- matrix
The matrix that caused the exception.
- Type:
np.ndarray
- message
Explanation of the error.
- Type:
str
- exception otaf.exceptions.InvalidGlobalConstraintError(valid_constraints)[source]
Bases:
ValueErrorRaised when
GLOBAL_CONSTRAINTSis not one of the available presets.- Parameters:
valid_constraints (iterable of str) – The accepted preset names.
- exception otaf.exceptions.InvalidInteractionFormatError(interaction)[source]
Bases:
ValueErrorRaised when an
INTERACTIONSentry does not matchP<part><surface>(e.g.P2a).- Parameters:
interaction (str) – The offending interaction string.
- exception otaf.exceptions.InvalidPartLabelError[source]
Bases:
ValueErrorRaised when a part label is not the string form of an integer.
- exception otaf.exceptions.InvalidSurfaceDirectionError(surf_dir)[source]
Bases:
ValueErrorRaised when
SURFACE_DIRECTIONis not one ofotaf.constants.SURFACE_DIRECTIONS.- Parameters:
surf_dir (str) – The offending direction.
- exception otaf.exceptions.InvalidSurfaceLabelError[source]
Bases:
ValueErrorRaised when a surface label is not a lowercase alphabetical string.
- exception otaf.exceptions.LabelPatternError[source]
Bases:
ValueErrorRaised when point labels do not match the expected pattern (capital letters followed by an integer).
- exception otaf.exceptions.LabelPrefixError[source]
Bases:
ValueErrorRaised when the point labels of a surface do not share the same letter prefix.
- exception otaf.exceptions.MissingKeyError(key, dictionary_name)[source]
Bases:
KeyErrorRaised when a required key is missing from an input dictionary.
- Parameters:
key (str) – Name of the missing key.
dictionary_name (str) – Name of the dictionary that should contain it.
- exception otaf.exceptions.MissingOriginPointError(part_id, surf_id)[source]
Bases:
PointDictionaryErrorRaised when the
POINTSdictionary of a surface has no point for the surface origin.- Parameters:
part_id (str) – ID of the part.
surf_id (str) – ID of the surface.
- exception otaf.exceptions.MissingSurfaceTypeKeyError(part_id, surf_id)[source]
Bases:
KeyErrorRaised when a surface has no
TYPEkey.- Parameters:
part_id (str) – ID of the part.
surf_id (str) – ID of the surface.
- exception otaf.exceptions.NoAxialOverlapException(part_id1, surface_id1, part_id2, surface_id2)[source]
Bases:
ExceptionException raised when two interacting cylinders have no physical overlap along their axis.
- exception otaf.exceptions.NoPlanarOverlapException(part_id1, surface_id1, part_id2, surface_id2)[source]
Bases:
ExceptionException raised when two interacting planes do not overlap once projected onto each other.
- exception otaf.exceptions.NonConcentricCylindersException(part_id1, surface_id1, part_id2, surface_id2)[source]
Bases:
ExceptionException raised for cylinders that are not concentric.
- exception otaf.exceptions.NonUniqueCoordinatesError(duplicates=None)[source]
Bases:
ValueErrorRaised when two points of a surface have the same coordinates.
- Parameters:
duplicates (dict, optional) – Mapping from coordinates to the labels sharing them, shown in the message.
- exception otaf.exceptions.NonUniqueLabelError(message)[source]
Bases:
PointDictionaryErrorRaised when point labels of a surface are not unique.
- Parameters:
message (str) – Description of the problem.
- exception otaf.exceptions.PartNotFoundError(part_id)[source]
Bases:
ValueErrorRaised when a part ID does not exist in the assembly data.
- Parameters:
part_id (str) – The unknown part ID.
- exception otaf.exceptions.PointDictionaryError(message)[source]
Bases:
ValueErrorBase class of the errors raised for an invalid
POINTSdictionary.- Parameters:
message (str) – Description of the problem.
- exception otaf.exceptions.PointsNotOnPlaneError(part_id, surf_id)[source]
Bases:
ExceptionRaised when the points given for a plane surface are not coplanar.
- Parameters:
part_id (str) – ID of the part.
surf_id (str) – ID of the surface.
- exception otaf.exceptions.SolverFailureWarning[source]
Bases:
RuntimeWarningWarns that the optimisation failed for some samples of a batch.
Their rows of the result are NaN; the
scipy.optimize.milpstatus of every sample is available withreturn_status=True.
- exception otaf.exceptions.SurfaceNotFoundError(surf_id, part_id)[source]
Bases:
ValueErrorRaised when a surface ID does not exist in a part.
- Parameters:
surf_id (str) – The unknown surface ID.
part_id (str) – ID of the part searched.
- exception otaf.exceptions.SystemDataValidationError(messages)[source]
Bases:
ValueErrorRaised when the assembly dictionary does not match the input schema.
Lists every problem found, each prefixed by its location in the dictionary (e.g.
PARTS -> 1 -> a -> RADIUS).- Parameters:
messages (list of str) – One message per problem.
- exception otaf.exceptions.UncoveredContactWarning[source]
Bases:
UserWarningWarns that a contact listed in
INTERACTIONSis crossed by no compatibility loop.Contact conditions are only written for the gaps that appear in the loops, so such a contact has no condition at all.
- exception otaf.exceptions.UniqueLabelSuffixError[source]
Bases:
ValueErrorRaised when integer suffixes of point labels coincide once leading zeros are removed (
A000andA0).
- exception otaf.exceptions.UnsupportedSurfaceTypeError(part_id, surf_id, surf_type)[source]
Bases:
ValueErrorRaised when a surface
TYPEis not one ofotaf.constants.SUPPORTED_SURFACE_TYPES."cone"and"sphere"are listed inotaf.constants.BASE_SURFACE_TYPESbut have no deviation or gap model yet, so they are rejected too.- Parameters:
part_id (str) – ID of the part.
surf_id (str) – ID of the surface.
surf_type (str) – The unsupported type.
- otaf.exceptions.timeout(seconds=10, error_message='Function call timed out')[source]
Limit the execution time of a function using a decorator.
- Parameters:
seconds (int) – The number of seconds before the function is terminated with a timeout error.
error_message (str) – The message to include in the TimeoutError raised when the timeout occurs.