Commit a5c4658d authored by Médéric Boquien's avatar Médéric Boquien

Various optimisations have been made regarding shared arrays to make their...

Various optimisations have been made regarding shared arrays to make their access faster. The overall effect is a speedup of 3-4% for the computation of the models.
parent 48cbaa6e
......@@ -35,6 +35,7 @@
- Thanks to a change in the layout of the models storage in RAM, the computation of the χ² is now massively faster when the run contains multiple redshifts. (Médéric Boquien)
- The computation of the weighted means and standard deviations has been made ~50% faster by normalising the likelihood. (Médéric Boquien)
- The the fritz2006 module should now run faster thanks to an optimisation of the computation of the luminosity of the various AGN components (Médéric Boquien & Guang Yang)
- Various optimisations have been made regarding shared arrays to make their access faster. The overall effect is a speedup of 3-4% for the computation of the models. (Médéric Boquien)
## 2018.0 (2018-11-06)
### Added
......
......@@ -55,25 +55,22 @@ class SharedArray(object):
self.array[:] = np.nan
def __setitem__(self, idx, data):
if isinstance(idx, slice):
self.array[idx] = data
else:
self._raw[idx] = data
self._raw[idx] = data
def __getitem__(self, idx):
if isinstance(idx, slice):
return self.array[idx]
return self._raw[idx]
if isinstance(idx, int):
return self._raw[idx]
return self.array[idx]
def __len__(self):
return self.size
def __rmul__(self, other):
return other * self.array
return other * self._array
@property
def array(self):
return np.ctypeslib.as_array(self._raw)
return self._array
@property
def raw(self):
......@@ -83,5 +80,6 @@ class SharedArray(object):
def raw(self, raw):
if isinstance(raw, ctypes.Array):
self._raw = raw
self._array = np.ctypeslib.as_array(self._raw)
else:
raise TypeError("Type must be RawArray.")
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