From dd519455709bde19871379ba5c6a42d19ad21c2e Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 28 Mar 2019 07:25:20 +0100 Subject: [PATCH] checking for input errors --- python/damask/orientation.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/python/damask/orientation.py b/python/damask/orientation.py index ad9877835..7cb05af40 100644 --- a/python/damask/orientation.py +++ b/python/damask/orientation.py @@ -992,9 +992,14 @@ class Lattice: models={'KS':self.KS, 'GT':self.GT, "GT'":self.GTdash, 'NW':self.NW, 'Pitsch': self.Pitsch, 'Bain':self.Bain} + try: + relationship = models[model] + except: + raise KeyError('Orientation relationship "{}" is unknown'.format(model)) - relationship = models[model] - + if self.lattice not in relationship['mapping']: + raise ValueError('Relationship "{}" not supported for lattice "{}"'.format(model,self.lattice)) + r = {'lattice':Lattice((set(relationship['mapping'])-{self.lattice}).pop()), # target lattice 'rotations':[] }