Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shifting domain #587

Open
ego-thales opened this issue Oct 17, 2023 · 0 comments
Open

Shifting domain #587

ego-thales opened this issue Oct 17, 2023 · 0 comments

Comments

@ego-thales
Copy link
Contributor

ego-thales commented Oct 17, 2023

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 the grid_points option is a bit misleading, since the argument is meant to be points inside the domain_range, that will be shifted with shifts before evaluation.

Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant