Skip to content

Commit bc14ef9

Browse files
committed
Merge branch 'develop-check' into develop-hiddenmarkovnormal
2 parents a46a031 + 4a863ac commit bc14ef9

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

bayesml/_check.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,24 @@ def nonneg_ints(val,val_name,exception_class):
4747
return val
4848
raise(exception_class(val_name + " must be int or a numpy.ndarray whose dtype is int. Its values must be non-negative (including 0)."))
4949

50+
def int_vec(val,val_name,exception_class):
51+
if type(val) is np.ndarray:
52+
if np.issubdtype(val.dtype,np.integer) and val.ndim == 1:
53+
return val
54+
raise(exception_class(val_name + " must be a 1-dimensional numpy.ndarray whose dtype is int."))
55+
5056
def nonneg_int_vec(val,val_name,exception_class):
5157
if type(val) is np.ndarray:
5258
if np.issubdtype(val.dtype,np.integer) and val.ndim == 1 and np.all(val>=0):
5359
return val
5460
raise(exception_class(val_name + " must be a 1-dimensional numpy.ndarray whose dtype is int. Its values must be non-negative (including 0)."))
5561

62+
def nonneg_int_vecs(val,val_name,exception_class):
63+
if type(val) is np.ndarray:
64+
if np.issubdtype(val.dtype,np.integer) and val.ndim >= 1 and np.all(val>=0):
65+
return val
66+
raise(exception_class(val_name + " must be a numpy.ndarray whose ndim >= 1 and dtype is int. Its values must be non-negative (including 0)."))
67+
5668
def nonneg_float_vec(val,val_name,exception_class):
5769
if type(val) is np.ndarray:
5870
if np.issubdtype(val.dtype,np.floating) and val.ndim == 1 and np.all(val>=0):

0 commit comments

Comments
 (0)