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

ResolutionRenderer only works for square observations #278

Open
pmelchior opened this issue Feb 15, 2023 · 0 comments
Open

ResolutionRenderer only works for square observations #278

pmelchior opened this issue Feb 15, 2023 · 0 comments

Comments

@pmelchior
Copy link
Owner

Follow up from #276

The immediately offending line is

scarlet/scarlet/renderer.py

Lines 274 to 275 in 5b0b5e0

pixels = np.stack((np.arange(lr_shape[0]), np.arange(lr_shape[1])), axis=1)
coord_hr = data_frame.convert_pixel_to(model_frame, pixel=pixels)

What's going on here is the Y and X coordinates of the observation are stacked together and then transformed to model coordinates. This should probably be better done with two different arrays, one with the 2D coordinates of the Y-axis and one the X-axis, instead of using the diagonal, which is what triggers the error.

But doing that doesn't solve the problem when the frames are rotated. To go from the rotated to the unrotated coordinates is done here:

scarlet/scarlet/renderer.py

Lines 322 to 329 in 5b0b5e0

Y_unrot = (
(coord_hr[:, 0] - center_y) * self.angle[0]
- (coord_hr[:, 1] - center_x) * self.angle[1]
).reshape(lr_shape[0])
X_unrot = (
(coord_hr[:, 1] - center_x) * self.angle[0]
+ (coord_hr[:, 0] - center_y) * self.angle[1]
).reshape(lr_shape[1])

This requires that both coordinates in coord_hr have the same length, i.e. that their frames are square. That's consistent with eq 20 in Remy's paper, where X and Y coordinates also have to be of same length.

This issue is here to document to problem. We could allow for non-square frame in the non-rotated case, but we must assert that the observations are square in the rotated case.

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

No branches or pull requests

1 participant