Skip to content

Adjust the numerical_inverse API #566

@WilliamJamieson

Description

@WilliamJamieson

Currently, numerical_inverse assumes that one is inverting the entire GWCS pipeline. We should look into refactoring it so that we can use it on any transform rather than the full forward transform. This way something like WCS.transform(...) can make use of the numerical_inverse if necessary for transforming between any two frames.

If this ends up being possible, it should also allow us to "approximate" the inverse transform via using the analytic inverses for all steps whose transform has a defined analytic inverse. Currently, numerical_inverse approximates the entire inverse (typically automatically used when running WCS.inverse(...) where at least one step's transform lacks a analytic inverse). Essentially, this would let us "write" the "backward_transform" as if we had analytic inverses for all the steps via inserting the numerical_inverse only where one cannot be found.

Obviously, this step-wise numerical_inverse should be an option controllable by the user, something like numerical_inverse = "partial" vs numerical_inverse = "full" (default?). In order to maintain the current behavior.

The main motivation for this in #561 is so that WCS.transform can behave exactly like WCS.inverse currently does when the from_frame=WCS.output_frame and to_frame=WCS.input_frame. This way a fully uniform API can be used. As it stands now, WCS.inverse will still need some custom implementation steps in order to handle the numerical_inverse case as opposed to it being a "convenience" method.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions