File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change 16
16
from spatialmath .base import symbolic as sym
17
17
18
18
# valid scalar types
19
- _scalartypes = (int , np .int64 , float , np .float64 ) + sym .symtype
19
+ _scalartypes = (int , np .integer , float , np .floating ) + sym .symtype
20
20
21
21
def isscalar (x ):
22
22
"""
@@ -38,6 +38,24 @@ def isscalar(x):
38
38
"""
39
39
return isinstance (x , _scalartypes )
40
40
41
+ def isinteger (x ):
42
+ """
43
+ Test if argument is a scalar integer
44
+
45
+ :param x: value to test
46
+ :return: whether value is a scalar
47
+ :rtype: bool
48
+
49
+ ``isinteger(x)`` is ``True`` if ``x`` is a Python or numPy int or real float.
50
+
51
+ .. runblock:: pycon
52
+
53
+ >>> from spatialmath.base import isscalar
54
+ >>> isinteger(1)
55
+ >>> isinteger(1.2)
56
+
57
+ """
58
+ return isinstance (x , (int , np .integer ))
41
59
42
60
def assertmatrix (m , shape = None ):
43
61
"""
You can’t perform that action at this time.
0 commit comments