Shifting domain
ego-thales opened this issue · comments
Hi,
Is there a simple way to shift the domain of a FData
instance? From what I understand, the shift
method is meant to shift the curve while looking at the same domain, whereas I would like to shift the curve while looking somewhere else.
I think this could be added in two ways:
- by implementing
shift_domain
:
def shift_domain(
self,
shift: Union[ArrayLike, float],
) -> FDataGrid:
"""Shifts grid points and domain range."""
shift = np.broadcast_to(shift, self.dim_domain)
shifted_gp = tuple(gp + s for gp, s in zip(self.grid_points, shift))
shifted_dr = np.array(self.domain_range) + shift[:, None]
return self.copy(
grid_points=shifted_gp,
domain_range=shifted_dr,
)
- by redesigning a bit the
shift
method, which may not help its clarity of use. By the way, I think thegrid_points
option is a bit misleading, since the argument is meant to be points inside the domain_range, that will be shifted withshifts
before evaluation.
Cheers!