Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Scientific Software
Takin
mag-core
Commits
94be8a47
Verified
Commit
94be8a47
authored
Sep 29, 2020
by
Tobias WEBER
Browse files
tascalc: bounds check
parent
0d3dafa5
Changes
1
Hide whitespace changes
Inline
Side-by-side
tools/tascalc/tas.py
View file @
94be8a47
...
...
@@ -12,7 +12,7 @@ try:
import
numpy
as
np
import
numpy.linalg
as
la
except
ImportError
:
print
(
"Numpy could not be imported!"
)
print
n
(
"Numpy could not be imported!"
)
exit
(
-
1
)
use_scipy
=
False
...
...
@@ -60,6 +60,15 @@ def angle(a, b, metric):
len_b
=
np
.
sqrt
(
dot
(
b
,
b
,
metric
))
c
=
dot
(
a
,
b
,
metric
)
/
(
len_a
*
len_b
)
# check for rounding errors
if
c
>
1.
:
#print("arccos precision overflow: " + str(c) + ".")
c
=
1.
if
c
<
-
1.
:
#print("arccos precision underflow: " + str(c) + ".")
c
=
-
1.
return
np
.
arccos
(
c
)
# -----------------------------------------------------------------------------
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment