Commit 539f990b authored by Médéric Boquien's avatar Médéric Boquien
Browse files

For some reason assigning an integer array to np.nan, which should never be...

For some reason assigning an integer array to np.nan, which should never be possible, only fails when it is of size 1. Work around this with a try/except.
parent 9b2ed603
...@@ -50,9 +50,14 @@ class SharedArray(object): ...@@ -50,9 +50,14 @@ class SharedArray(object):
self.raw = RawArray(dtype, size) self.raw = RawArray(dtype, size)
self.size = size self.size = size
# By default RawArray initialises all the elements to 0. Setting them to # By default RawArray initialises all the elements to 0. Setting them to
# np.nan is preferanble to in case for a reason some elements are never # np.nan is preferable in case for a reason some elements are never
# assigned a value during a run # assigned a value during a run. Note that in case the shared array is
self.array[:] = np.nan # not of a float type and is of size 1 it will fail, se we work around
# this with a try.
try:
self.array[:] = np.nan
except:
pass
def __setitem__(self, idx, data): def __setitem__(self, idx, data):
self._raw[idx] = data self._raw[idx] = data
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment