- edited description
TimeSeries.retrieve() interpolation
Hello,
-
according to the docs, in FEniCS 2016.2.0,
TimeSeries.retrieve()
can be called with an optional argument,interpolate=True/False
. This does not work:ts.retrieve(p.vector(), t, interpolate=False)
TypeError: TimeSeries_retrieve() takes no keyword arguments
edit : this works if the keyword is ommited,
ts.retrieve(p.vector(), t, False)
. -
If i read all stored timestamps from a TimeSeries with
vector_times()
, and then retrieve the vectors at the corresponding timestamps, no interpolation should be necessary, the values should be read directly. This is not the case in the following example:
from dolfin import *
import numpy as np
set_log_level(PROGRESS)
mesh = UnitSquareMesh(8, 8)
V = FunctionSpace(mesh, FiniteElement('P', mesh.ufl_cell(), 1))
ex = Expression("t", degree=1, t=0.)
u = Function(V)
# store data
ts = TimeSeries('test_series')
times = np.arange(0, 1, 0.1)
for t in times:
ex.t = t
u = interpolate(ex, V)
ts.store(u.vector(), t)
# retrieve data
ts = TimeSeries('test_series')
times = ts.vector_times()
print(times)
for t in times:
ts.retrieve(u.vector(), t)
The times should probably be rounded when they are compared.
Regards, David
Comments (10)
-
reporter -
reporter - edited description
-
reporter - edited description
-
reporter - changed component to io
-
this works if the keyword is ommited, ts.retrieve(p.vector(), t, False)
Yes. Should be just a simple fix in a SWIG interface file.
The times should probably be rounded when they are compared.
I don't agree.
-
- changed milestone to 2017.2
-
assigned issue to
- marked as trivial
- changed version to dev
- marked as enhancement
-
reporter The times should probably be rounded when they are compared.
I don't agree.
Don't you agree that in the example,
times = ts.vector_times() for t in times: ts.retrieve(u.vector(), t)
no interpolation should be necessary? With rounding I meant something à la
np.allclose()
, standard floats comparison. -
Don't you agree
No, I don't. There's an explicit control by the argument.
-
- changed milestone to 2018.1
Is fixed in new Python interface generated by pybind11 which will be released experimentally with 2017.2.0 and as a default with 2018.1.0.
-
- changed status to wontfix
The problem in accepting kwarg fixed in pybind11 DOLFIN.
The feature request for avoiding interpolation is already present:
>>> ts.retrieve(u.vector(), 0.84, interpolate=False) Reading vector at t = 0.8 (close to t = 0.84).
- Log in to comment