Skip to content

Commit

Permalink
Merge pull request #3 from ethansr/exceptions
Browse files Browse the repository at this point in the history
Raise exceptions for bad params
  • Loading branch information
omimo authored Aug 4, 2020
2 parents 252c3a8 + 935b0b5 commit a70dd13
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions pymo/preprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ def transform(self, X, y=None):
elif self.param_type == 'position':
return self._to_pos(X)
else:
raise 'param types: euler, quat, expmap, position'

raise UnsupportedParamError('Unsupported param: %s. Valid param types are: euler, quat, expmap, position' % self.param_type)
# return X

def inverse_transform(self, X, copy=None):
Expand All @@ -42,13 +41,12 @@ def inverse_transform(self, X, copy=None):
elif self.param_type == 'expmap':
return self._expmap_to_euler(X)
elif self.param_type == 'quat':
raise 'quat2euler is not supported'
raise UnsupportedParamError('quat2euler is not supported')
elif self.param_type == 'position':
# raise 'positions 2 eulers is not supported'
print('positions 2 eulers is not supported')
return X
else:
raise 'param types: euler, quat, expmap, position'
raise UnsupportedParamError('Unsupported param: %s. Valid param types are: euler, quat, expmap, position' % self.param_type)

def _to_pos(self, X):
'''Converts joints rotations in Euler angles to joint positions'''
Expand Down Expand Up @@ -731,3 +729,6 @@ def fit(self, X, y=None):
def transform(self, X, y=None):
return X

class UnsupportedParamError(Exception):
def __init__(self, message):
self.message = message

0 comments on commit a70dd13

Please sign in to comment.