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

Request to add the feature to get the exact image array size back after applying register. #330

Open
dinesh-hegde opened this issue Feb 21, 2024 · 3 comments
Labels
Feature Request New feature wanted!

Comments

@dinesh-hegde
Copy link

Hi,

Please let me know if there is any straightforward way to get the full 4096 by 4096 array back after applying the register function. I checked that aia_prep.pro in SSWIDL is not doing this resizing. help needed.

@dinesh-hegde dinesh-hegde changed the title Request to add the feature get the exact image array size back after applying register. Request to add the feature to get the exact image array size back after applying register. Feb 21, 2024
@nabobalis
Copy link
Contributor

nabobalis commented Feb 21, 2024

Hello @dinesh-hegde,

This is known behavior with that function that we had to add a warning note to the function.
The affine transform has to cut off pixels to account for the de-rotation correctly.

If you do need to go back to the original size of 4096 by 4096, the current best method is to do something like (this is old code, you will have to adapt it):

if tempmap.data.shape == (4094, 4094):
	padded_array = np.pad(tempmap.data, 1, mode="constant")
	tempmap.meta["crpix1"] += 1
	tempmap.meta["crpix2"] += 1
	newmap = tempmap._new_instance(padded_array, tempmap.meta)

The other choice would be to look at https://github.com/sunpy/sunpy/pull/6707/files and see how that padded the array.

Can I ask a few questions:

What was the output array size?
Do you need it to be 4096 by 4096?
Are you planning to run the data through a DEM code?

@dinesh-hegde
Copy link
Author

Hi @nabobalis,

Thank you. Do you think the resized output size is always 4094 by 4094? After looking at the warning on the documentation page,I was just thinking whether this manual padding of some constant value is ok or not.

Output array was 4094 by 4094.
Yes, I need it to be 4096 by 4096.
No, working on some ML project.

@nabobalis nabobalis added enhancement Feature Request New feature wanted! and removed Feature Request New feature wanted! labels Feb 21, 2024
@nabobalis
Copy link
Contributor

nabobalis commented Feb 21, 2024

For everyone, I have spoken to about this issue, the array has always been 4094 by 4094 but I forget if it was wavelength dependent. I think a lot of the time the array was the same size? How has been in your case?

Padding the array by one each side, should be safe as you would be padding the edges and those are basically 0

@github-actions github-actions bot added Feature Request New feature wanted! and removed enhancement labels Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request New feature wanted!
Projects
None yet
Development

No branches or pull requests

2 participants