Skip to content
Snippets Groups Projects

Resolve #2021 "04 16 branched from master ini file device"

Merged Taya Snijder requested to merge 2021-04-16-Branched_from_master-INI_file_device into master
10 files
+ 16
225
Compare changes
  • Side-by-side
  • Inline
Files
10
@@ -122,12 +122,10 @@ class ini_client(CommClient):
@@ -122,12 +122,10 @@ class ini_client(CommClient):
print("pre conversion: ", value, type(value)) # pre conversion
print("pre conversion: ", value, type(value)) # pre conversion
value = array(value, dtype)
value = array(value, dtype)
# convert values from buildin type to numpy type
value = dtype(value)
print("post conversion: ", value, type(value)) # pre conversion
print("post conversion: ", value, type(value)) # pre conversion
if dim_y > 1:
if dim_y > 1:
# if data is an image, slice it according to the y dimensions
# if data is an image, slice it according to the y dimensions
value = numpy.array(numpy.split(numpy.array(value), indices_or_sections=dim_y))
value = numpy.array(numpy.split(value, indices_or_sections=dim_y))
return value
return value
@@ -182,10 +180,16 @@ def array(string, dtype):
@@ -182,10 +180,16 @@ def array(string, dtype):
array.append(False)
array.append(False)
else:
else:
raise ValueError("String to bool failed. String is not True/False, but is: '{}'".format(i))
raise ValueError("String to bool failed. String is not True/False, but is: '{}'".format(i))
 
 
array = dtype(array)
 
elif dtype is numpy.str_:
elif dtype is numpy.str_:
for i in string.split(","):
for i in string.split(","):
value = i
value = numpy.str_(i)
array.append(value)
array.append(value)
 
 
array = numpy.array(array)
 
else:
else:
# regular case, go through the separator
# regular case, go through the separator
for i in string.split(","):
for i in string.split(","):
@@ -193,6 +197,9 @@ def array(string, dtype):
@@ -193,6 +197,9 @@ def array(string, dtype):
value = dtype(i)
value = dtype(i)
array.append(value)
array.append(value)
 
# convert values from buildin type to numpy type
 
array = dtype(array)
 
return array
return array
def write_config(filename):
def write_config(filename):
Loading