Skip to content

Commit

Permalink
#28 allowing numpy ndarray float32 dtype input in GmicImage constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
myselfhimself committed Aug 24, 2020
1 parent c049e0e commit d0d6bc4
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions gmicpy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -608,9 +608,8 @@ PyGmicImage_init(PyGmicImage *self, PyObject *args, PyObject *kwargs)
// We are doing string comparison here instead of introspecting the
// dtype.kind.num which is expected to be a unique identifier of type
// Slightly simpler to read.. slightly slower to run
if (strcmp(bytesObj_ndarray_dtype_name_str, "uint8") == 0) {
}
else {
if (!(strcmp(bytesObj_ndarray_dtype_name_str, "uint8") == 0 ||
strcmp(bytesObj_ndarray_dtype_name_str, "float32") == 0)) {
PyErr_Format(PyExc_TypeError,
"Parameter 'data' of type 'numpy.ndarray' has an "
"understandable shape for us, but its data type '%s' "
Expand Down

0 comments on commit d0d6bc4

Please sign in to comment.