sunpy / sunkit-image

A image processing toolbox for Solar Physics
https://docs.sunpy.org/projects/sunkit-image/en/stable/
BSD 2-Clause "Simplified" License
36 stars 46 forks source link

Usage of non-AIA images in radial.rhef is broken #233

Closed GillySpace27 closed 15 hours ago

GillySpace27 commented 1 month ago

Describe the bug

When using different data sources, radial.rhef doesn't always know how to find the center of the image and do the units correctly. I've opened a draft PR #231 that I think might fix the problem but I'm open to some testing and iteration by others. In general I need to generalize the algorithm to be as agnostic to data source as possible. Thanks for your help!

To Reproduce

from sunpy.map import Map
from sunkit_image.radial import rhef
import matplotlib.pyplot as plt
import os

for file in os.listdir("example_data/"):
    if "fits" in file:
        target = os.path.join("example_data", file)
        pmap = Map(target)[0]
        pmap_filt = rhef(pmap)
        plt.figure()
        pmap_filt.plot()
        plt.savefig(target.replace(".fits", ".png"))

Screenshots

Output is nonsense: image

System Details

>>> import sunpy; sunpy.util.system_info()
==============================
sunpy Installation Information
==============================

General
#######
OS: Mac OS 14.5
Arch: 64bit, (arm)
sunpy: 6.0.2
Installation path: /Users/cgilbert/vscode/punch-5-meeting/.venv/lib/python3.12/site-packages/sunpy-6.0.2.dist-info

Required Dependencies
#####################
astropy: 6.1.3
numpy: 1.26.4
packaging: 24.1
parfive: 2.1.0
pyerfa: 2.0.1.4
requests: 2.32.3

Optional Dependencies
#####################
sunpy: 6.0.2

Installation method

git checkout

nabobalis commented 1 month ago

What was the data you used in that example? We need to consider adding more test data from not-AIA.

Abinash-bit commented 19 hours ago

Describe the bug

When using different data sources, radial.rhef doesn't always know how to find the center of the image and do the units correctly. I've opened a draft PR #231 that I think might fix the problem but I'm open to some testing and iteration by others. In general I need to generalize the algorithm to be as agnostic to data source as possible. Thanks for your help!

To Reproduce

from sunpy.map import Map
from sunkit_image.radial import rhef
import matplotlib.pyplot as plt
import os

for file in os.listdir("example_data/"):
    if "fits" in file:
        target = os.path.join("example_data", file)
        pmap = Map(target)[0]
        pmap_filt = rhef(pmap)
        plt.figure()
        pmap_filt.plot()
        plt.savefig(target.replace(".fits", ".png"))

Screenshots

Output is nonsense: image

System Details

>>> import sunpy; sunpy.util.system_info()
==============================
sunpy Installation Information
==============================

General
#######
OS: Mac OS 14.5
Arch: 64bit, (arm)
sunpy: 6.0.2
Installation path: /Users/cgilbert/vscode/punch-5-meeting/.venv/lib/python3.12/site-packages/sunpy-6.0.2.dist-info

Required Dependencies
#####################
astropy: 6.1.3
numpy: 1.26.4
packaging: 24.1
parfive: 2.1.0
pyerfa: 2.0.1.4
requests: 2.32.3

Optional Dependencies
#####################
sunpy: 6.0.2

Installation method

git checkout

Seems like i can not reproduce the issue ....

can anyone help me with this?

this is what i get when i try to reproduce!!

Screenshot 2024-11-11 173015

nabobalis commented 15 hours ago

This issue was fixed by https://github.com/sunpy/sunkit-image/pull/231 and I forgot to close this PR.

In your case, the code example, uses data on the original authors laptop.