Commit 4fb35c8c authored by Domanski, Marian M.'s avatar Domanski, Marian M.
Browse files

Merge branch '68-convert-float-results-to-single-precision' into 'master'

Resolve "Convert float results to single precision"

Closes #68

See merge request !58
parents 35e0e0eb d3dd1692
......@@ -21,6 +21,15 @@ class Results(ABC):
self._domain_length = results.domain_length()
self._time = results.time(slice(None))
def _convert_to_single(self):
for k in self.__class__.__dict__['_members']:
data = self.__dict__[k]
if isinstance(data, np.ndarray):
data = data.astype('f4') # convert to single precision
elif isinstance(data, np.float64):
data = np.float32(data)
def configuration(self):
"""Returns the configuration dictionary
......@@ -267,6 +276,8 @@ class FullResults(Results):
self._depth = results.depth()
self._width = results.width()
def _normalize_axis(self, position_axis):
"""Returns one position axis, normalized
......@@ -545,6 +556,8 @@ class QuantileResults(Results):
positions = results.positions((0, 1, 2))
self._positions = np.quantile(positions, self._quantiles, axis=1)
def position_cfrac(self, time, position_axis=0):
"""Cumulative fraction of particles past positions at a
given time
Supports Markdown
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