Commit 7816eae9 authored by Domanski, Marian M.'s avatar Domanski, Marian M.

Merge branch '39-results-calculate-distribution' into 'master'

Resolve "Results calculate distribution at time"

Closes #39

See merge request mdomanski/fluegg!33
parents 6a9c2c84 cacd06e7
......@@ -320,7 +320,7 @@ class FullResults(Results):
return res
def positions(self, normalize=()):
def positions(self, normalize=(), time=None):
"""Returns particle position array
Parameters
......@@ -328,6 +328,10 @@ class FullResults(Results):
normalize : tuple of int, optional
Normalize position array axes (the default is an empty,
tuple, which doesn't normalize any axes).
time : float or None, optional
Simulation time, in seconds, for returned positions. If
time is None, positions at all simulation times are
returned.
Returns
-------
......@@ -349,6 +353,17 @@ class FullResults(Results):
for a in absolute:
positions[:, :, a] = self._positions[:, :, a]
if time is not None:
positions = np.apply_along_axis(
lambda p: np.interp(
time,
self._time,
p,
left=np.nan,
right=np.nan),
0,
positions)
return positions
def position_cfrac(self, time, position_axis=0):
......
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