Skip to content

Commit

Permalink
Merge pull request #287 from jonwright/issue285
Browse files Browse the repository at this point in the history
Issue285
  • Loading branch information
jonwright authored Jun 18, 2024
2 parents 575c331 + 89f1651 commit 1b45fa1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ImageD11/lattice_reduction.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from numpy import dot, round_, array, allclose, asarray, fabs,\
argmin, argmax, sqrt, argsort, take, sum, where, ndarray, eye,\
zeros, cross, pi, arccos, floor
from numpy.linalg import inv, LinAlgError
from numpy.linalg import inv, LinAlgError, det

import logging

Expand Down Expand Up @@ -195,11 +195,15 @@ def __init__(self, v1, v2, v3, direction=None, min_vec2=MIN_VEC2):
if direction == 'col':
# print "Supplied col direction vectors"
self.r2c = array(vl)
if det( self.r2c ) < 0:
self.r2c = array( [vl[0], vl[2], vl[1] ] )
self.c2r = inv(self.r2c)
elif direction == 'row':
# Supplied with g-vectors
# print "Supplied row direction vectors"
self.c2r = array(vl).T
if det( self.c2r ) < 0:
self.c2r = array( [vl[0], vl[2], vl[1] ] ).T
self.r2c = inv(self.c2r)
else:
raise Exception("Direction must be row or col "+str(direction))
Expand Down
3 changes: 3 additions & 0 deletions test/test_index_unknown/test_index_unknown.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import unittest, os, sys
from ImageD11 import indexing
import ImageD11.grain
import numpy as np
"""
>>> from ImageD11.indexing import readubis, write_ubi_file
Expand Down Expand Up @@ -97,6 +98,8 @@ def test1(self):
e = SCRIPT +' -g "%s" '%(fname)+cmd
print ("\n",e)
assert os.system(e) == 0
grains = ImageD11.grain.read_grain_file(cmd.split()[3])


def tearDown(self):
""" explicitely leave the files here for debugging """
Expand Down

0 comments on commit 1b45fa1

Please sign in to comment.