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

Implementing the RHE Filter #205

Merged
merged 76 commits into from
Jul 19, 2024
Merged

Implementing the RHE Filter #205

merged 76 commits into from
Jul 19, 2024

Conversation

GillySpace27
Copy link
Contributor

@GillySpace27 GillySpace27 commented Jun 3, 2024

PR Description

The Radial package has been updated to include the Radial Histogram Equalizing Filter as well as a double-sided gamma function that we call an Upsilon function that is utility that could be useful elsewhere.

Implementation follows chapter 3 of my thesis: https://www.proquest.com/docview/2759080511, as well as a journal article in prep (Gilly 2024).
This PR addresses the following issue: #204

@GillySpace27
Copy link
Contributor Author

I added an example and it runs! I don't know what to do about the pre-commit tests though.

@nabobalis
Copy link
Contributor

I added an example and it runs! I don't know what to do about the pre-commit tests though.

You can run the pre-commit locally using tox, tox -e codestyle and it will autofix what it can.
The ones left over need to fixed manually.

It seems to be complaining about the commented out test code which we can remove or uncomment out if its useful?

@GillySpace27
Copy link
Contributor Author

GillySpace27 commented Jul 2, 2024

Is there anything else that needs to be done for this pull request? The changelog maybe?

@nabobalis
Copy link
Contributor

Is there anything else that needs to be done for this pull request? The changelog maybe?

I'll review it again but for now I think a changelog entry is still missing.

@GillySpace27
Copy link
Contributor Author

Should I address the failing tests, or do you do that?

@nabobalis
Copy link
Contributor

The build_docs is failing to download the data from the VSO in a different example. There isn't anything we can do.

@GillySpace27
Copy link
Contributor Author

GillySpace27 commented Jul 5, 2024

I made another version of the example using functions and I wanted to see if it was better or not. I also added logging. Do y'all like either of those choices? It seems something might need to be changed to allow the images to appear in-line like before. I placed the functionalized version in a separate file for now.

@nabobalis
Copy link
Contributor

I made another version of the example using functions and I wanted to see if it was better or not. I also added logging. Do y'all like either of those choices? It seems something might need to be changed to allow the images to appear in-line like before. I placed the functionalized version in a separate file for now.

I am personally not a fan. I don't see the objective of using functions like that.

changelog/205.bugfix.rst Outdated Show resolved Hide resolved
changelog/205.feature.rst Outdated Show resolved Hide resolved
changelog/205.doc.rst Outdated Show resolved Hide resolved
examples/radial_gradient_filters.py Outdated Show resolved Hide resolved
examples/radial_gradient_filters.py Outdated Show resolved Hide resolved
sunkit_image/radial.py Show resolved Hide resolved
sunkit_image/radial.py Outdated Show resolved Hide resolved
sunkit_image/radial.py Outdated Show resolved Hide resolved
sunkit_image/radial.py Show resolved Hide resolved
sunkit_image/utils/utils.py Outdated Show resolved Hide resolved
@nabobalis
Copy link
Contributor

nabobalis commented Jul 19, 2024

Sorry for the lack of response.

Thanks for the PR @GillySpace27 and thanks for putting up with the long review.

@nabobalis
Copy link
Contributor

Can you check once more that the figure test output looks correct @GillySpace27?

The output image

@GillySpace27
Copy link
Contributor Author

GillySpace27 commented Jul 19, 2024 via email

@nabobalis nabobalis merged commit 83057d1 into sunpy:main Jul 19, 2024
24 checks passed
@GillySpace27
Copy link
Contributor Author

When will this show up in new versions of the package? I thought it would be there today but it doesn't seem to be.

`(base) cgilbert@GillyMacbook ~ % conda_create_ARM sunkit python=3.9
Collecting package metadata (current_repodata.json): done
Solving environment: done

==> WARNING: A newer version of conda exists. <==
current version: 22.9.0
latest version: 24.7.1

Please update conda by running

$ conda update -n base -c defaults conda

Package Plan

environment location: /opt/homebrew/anaconda3/envs/sunkit

added / updated specs:
- python=3.9

The following packages will be downloaded:

package                    |            build
---------------------------|-----------------
python-3.9.19              |       hb885b13_1        11.7 MB
setuptools-69.5.1          |   py39hca03da5_0        1004 KB
wheel-0.43.0               |   py39hca03da5_0         107 KB
------------------------------------------------------------
                                       Total:        12.8 MB

The following NEW packages will be INSTALLED:

ca-certificates pkgs/main/osx-arm64::ca-certificates-2024.7.2-hca03da5_0 None
libcxx pkgs/main/osx-arm64::libcxx-14.0.6-h848a8c0_0 None
libffi pkgs/main/osx-arm64::libffi-3.4.4-hca03da5_1 None
ncurses pkgs/main/osx-arm64::ncurses-6.4-h313beb8_0 None
openssl pkgs/main/osx-arm64::openssl-3.0.14-h80987f9_0 None
pip pkgs/main/osx-arm64::pip-24.0-py39hca03da5_0 None
python pkgs/main/osx-arm64::python-3.9.19-hb885b13_1 None
readline pkgs/main/osx-arm64::readline-8.2-h1a28f6b_0 None
setuptools pkgs/main/osx-arm64::setuptools-69.5.1-py39hca03da5_0 None
sqlite pkgs/main/osx-arm64::sqlite-3.45.3-h80987f9_0 None
tk pkgs/main/osx-arm64::tk-8.6.14-h6ba3021_0 None
tzdata pkgs/main/noarch::tzdata-2024a-h04d1e81_0 None
wheel pkgs/main/osx-arm64::wheel-0.43.0-py39hca03da5_0 None
xz pkgs/main/osx-arm64::xz-5.4.6-h80987f9_1 None
zlib pkgs/main/osx-arm64::zlib-1.2.13-h18a0788_1 None

Proceed ([y]/n)?

Downloading and Extracting Packages
setuptools-69.5.1 | 1004 KB | ########################################################################################################################################################################### | 100%
wheel-0.43.0 | 107 KB | ########################################################################################################################################################################### | 100%
python-3.9.19 | 11.7 MB | ########################################################################################################################################################################### | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done

To activate this environment, use

$ conda activate sunkit

To deactivate an active environment, use

$ conda deactivate

Retrieving notices: ...working... done
(sunkit) cgilbert@GillyMacbook ~ % pip install sunpy sunkit-image
Collecting sunpy
Using cached sunpy-5.1.5-cp39-abi3-macosx_11_0_arm64.whl.metadata (16 kB)
Collecting sunkit-image
Using cached sunkit_image-0.5.1-py3-none-any.whl.metadata (3.9 kB)
Collecting astropy!=5.1.0,>=5.0.6 (from sunpy)
Downloading astropy-6.0.1-cp39-cp39-macosx_11_0_arm64.whl.metadata (9.8 kB)
Collecting numpy>=1.21.0 (from sunpy)
Downloading numpy-2.0.1-cp39-cp39-macosx_14_0_arm64.whl.metadata (60 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 60.9/60.9 kB 1.2 MB/s eta 0:00:00
Collecting packaging>=19.0 (from sunpy)
Using cached packaging-24.1-py3-none-any.whl.metadata (3.2 kB)
Collecting parfive>=2.0.0 (from parfive[ftp]>=2.0.0->sunpy)
Using cached parfive-2.1.0-py3-none-any.whl.metadata (4.3 kB)
Collecting pyerfa (from sunpy)
Using cached pyerfa-2.0.1.4-cp39-abi3-macosx_11_0_arm64.whl.metadata (5.7 kB)
Collecting matplotlib>=3.5.0 (from sunkit-image)
Downloading matplotlib-3.9.1-cp39-cp39-macosx_11_0_arm64.whl.metadata (11 kB)
Collecting scipy>=1.6.0 (from sunkit-image)
Downloading scipy-1.13.1-cp39-cp39-macosx_12_0_arm64.whl.metadata (60 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 60.6/60.6 kB 4.3 MB/s eta 0:00:00
Collecting scikit-image>=0.19.0 (from sunkit-image)
Downloading scikit_image-0.24.0-cp39-cp39-macosx_12_0_arm64.whl.metadata (14 kB)
Collecting numpy>=1.21.0 (from sunpy)
Using cached numpy-1.26.4-cp39-cp39-macosx_11_0_arm64.whl.metadata (61 kB)
Collecting astropy-iers-data>=0.2024.2.26.0.28.55 (from astropy!=5.1.0,>=5.0.6->sunpy)
Downloading astropy_iers_data-0.2024.7.29.0.32.7-py3-none-any.whl.metadata (5.1 kB)
Collecting PyYAML>=3.13 (from astropy!=5.1.0,>=5.0.6->sunpy)
Downloading PyYAML-6.0.1-cp39-cp39-macosx_11_0_arm64.whl.metadata (2.1 kB)
Collecting contourpy>=1.0.1 (from matplotlib>=3.5.0->sunkit-image)
Downloading contourpy-1.2.1-cp39-cp39-macosx_11_0_arm64.whl.metadata (5.8 kB)
Collecting cycler>=0.10 (from matplotlib>=3.5.0->sunkit-image)
Using cached cycler-0.12.1-py3-none-any.whl.metadata (3.8 kB)
Collecting fonttools>=4.22.0 (from matplotlib>=3.5.0->sunkit-image)
Downloading fonttools-4.53.1-cp39-cp39-macosx_11_0_arm64.whl.metadata (162 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 162.6/162.6 kB 2.4 MB/s eta 0:00:00
Collecting kiwisolver>=1.3.1 (from matplotlib>=3.5.0->sunkit-image)
Downloading kiwisolver-1.4.5-cp39-cp39-macosx_11_0_arm64.whl.metadata (6.4 kB)
Collecting pillow>=8 (from matplotlib>=3.5.0->sunkit-image)
Downloading pillow-10.4.0-cp39-cp39-macosx_11_0_arm64.whl.metadata (9.2 kB)
Collecting pyparsing>=2.3.1 (from matplotlib>=3.5.0->sunkit-image)
Using cached pyparsing-3.1.2-py3-none-any.whl.metadata (5.1 kB)
Collecting python-dateutil>=2.7 (from matplotlib>=3.5.0->sunkit-image)
Using cached python_dateutil-2.9.0.post0-py2.py3-none-any.whl.metadata (8.4 kB)
Collecting importlib-resources>=3.2.0 (from matplotlib>=3.5.0->sunkit-image)
Using cached importlib_resources-6.4.0-py3-none-any.whl.metadata (3.9 kB)
Collecting tqdm>=4.27.0 (from parfive>=2.0.0->parfive[ftp]>=2.0.0->sunpy)
Using cached tqdm-4.66.4-py3-none-any.whl.metadata (57 kB)
Collecting aiohttp (from parfive>=2.0.0->parfive[ftp]>=2.0.0->sunpy)
Downloading aiohttp-3.10.0-cp39-cp39-macosx_11_0_arm64.whl.metadata (7.5 kB)
Collecting aioftp>=0.17.1 (from parfive[ftp]>=2.0.0->sunpy)
Using cached aioftp-0.22.3-py3-none-any.whl.metadata (20 kB)
Collecting networkx>=2.8 (from scikit-image>=0.19.0->sunkit-image)
Using cached networkx-3.2.1-py3-none-any.whl.metadata (5.2 kB)
Collecting imageio>=2.33 (from scikit-image>=0.19.0->sunkit-image)
Using cached imageio-2.34.2-py3-none-any.whl.metadata (4.9 kB)
Collecting tifffile>=2022.8.12 (from scikit-image>=0.19.0->sunkit-image)
Using cached tifffile-2024.7.24-py3-none-any.whl.metadata (31 kB)
Collecting lazy-loader>=0.4 (from scikit-image>=0.19.0->sunkit-image)
Using cached lazy_loader-0.4-py3-none-any.whl.metadata (7.6 kB)
Collecting zipp>=3.1.0 (from importlib-resources>=3.2.0->matplotlib>=3.5.0->sunkit-image)
Using cached zipp-3.19.2-py3-none-any.whl.metadata (3.6 kB)
Collecting six>=1.5 (from python-dateutil>=2.7->matplotlib>=3.5.0->sunkit-image)
Using cached six-1.16.0-py2.py3-none-any.whl.metadata (1.8 kB)
Collecting aiohappyeyeballs>=2.3.0 (from aiohttp->parfive>=2.0.0->parfive[ftp]>=2.0.0->sunpy)
Downloading aiohappyeyeballs-2.3.4-py3-none-any.whl.metadata (5.6 kB)
Collecting aiosignal>=1.1.2 (from aiohttp->parfive>=2.0.0->parfive[ftp]>=2.0.0->sunpy)
Using cached aiosignal-1.3.1-py3-none-any.whl.metadata (4.0 kB)
Collecting attrs>=17.3.0 (from aiohttp->parfive>=2.0.0->parfive[ftp]>=2.0.0->sunpy)
Using cached attrs-23.2.0-py3-none-any.whl.metadata (9.5 kB)
Collecting frozenlist>=1.1.1 (from aiohttp->parfive>=2.0.0->parfive[ftp]>=2.0.0->sunpy)
Downloading frozenlist-1.4.1-cp39-cp39-macosx_11_0_arm64.whl.metadata (12 kB)
Collecting multidict<7.0,>=4.5 (from aiohttp->parfive>=2.0.0->parfive[ftp]>=2.0.0->sunpy)
Downloading multidict-6.0.5-cp39-cp39-macosx_11_0_arm64.whl.metadata (4.2 kB)
Collecting yarl<2.0,>=1.0 (from aiohttp->parfive>=2.0.0->parfive[ftp]>=2.0.0->sunpy)
Downloading yarl-1.9.4-cp39-cp39-macosx_11_0_arm64.whl.metadata (31 kB)
Collecting async-timeout<5.0,>=4.0 (from aiohttp->parfive>=2.0.0->parfive[ftp]>=2.0.0->sunpy)
Downloading async_timeout-4.0.3-py3-none-any.whl.metadata (4.2 kB)
Collecting idna>=2.0 (from yarl<2.0,>=1.0->aiohttp->parfive>=2.0.0->parfive[ftp]>=2.0.0->sunpy)
Using cached idna-3.7-py3-none-any.whl.metadata (9.9 kB)
Using cached sunpy-5.1.5-cp39-abi3-macosx_11_0_arm64.whl (3.3 MB)
Using cached sunkit_image-0.5.1-py3-none-any.whl (6.0 MB)
Downloading astropy-6.0.1-cp39-cp39-macosx_11_0_arm64.whl (6.4 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.4/6.4 MB 5.7 MB/s eta 0:00:00
Downloading matplotlib-3.9.1-cp39-cp39-macosx_11_0_arm64.whl (7.8 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 7.8/7.8 MB 7.6 MB/s eta 0:00:00
Using cached numpy-1.26.4-cp39-cp39-macosx_11_0_arm64.whl (14.0 MB)
Using cached packaging-24.1-py3-none-any.whl (53 kB)
Using cached parfive-2.1.0-py3-none-any.whl (27 kB)
Using cached pyerfa-2.0.1.4-cp39-abi3-macosx_11_0_arm64.whl (329 kB)
Downloading scikit_image-0.24.0-cp39-cp39-macosx_12_0_arm64.whl (13.4 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 13.4/13.4 MB 7.5 MB/s eta 0:00:00
Downloading scipy-1.13.1-cp39-cp39-macosx_12_0_arm64.whl (30.3 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 30.3/30.3 MB 7.8 MB/s eta 0:00:00
Using cached aioftp-0.22.3-py3-none-any.whl (37 kB)
Downloading astropy_iers_data-0.2024.7.29.0.32.7-py3-none-any.whl (1.9 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.9/1.9 MB 8.7 MB/s eta 0:00:00
Downloading contourpy-1.2.1-cp39-cp39-macosx_11_0_arm64.whl (244 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 245.0/245.0 kB 8.4 MB/s eta 0:00:00
Using cached cycler-0.12.1-py3-none-any.whl (8.3 kB)
Downloading fonttools-4.53.1-cp39-cp39-macosx_11_0_arm64.whl (2.2 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.2/2.2 MB 7.5 MB/s eta 0:00:00
Using cached imageio-2.34.2-py3-none-any.whl (313 kB)
Using cached importlib_resources-6.4.0-py3-none-any.whl (38 kB)
Downloading kiwisolver-1.4.5-cp39-cp39-macosx_11_0_arm64.whl (66 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 66.2/66.2 kB 4.0 MB/s eta 0:00:00
Using cached lazy_loader-0.4-py3-none-any.whl (12 kB)
Using cached networkx-3.2.1-py3-none-any.whl (1.6 MB)
Downloading pillow-10.4.0-cp39-cp39-macosx_11_0_arm64.whl (3.4 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.4/3.4 MB 8.7 MB/s eta 0:00:00
Using cached pyparsing-3.1.2-py3-none-any.whl (103 kB)
Using cached python_dateutil-2.9.0.post0-py2.py3-none-any.whl (229 kB)
Downloading PyYAML-6.0.1-cp39-cp39-macosx_11_0_arm64.whl (174 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 174.4/174.4 kB 5.8 MB/s eta 0:00:00
Using cached tifffile-2024.7.24-py3-none-any.whl (226 kB)
Using cached tqdm-4.66.4-py3-none-any.whl (78 kB)
Downloading aiohttp-3.10.0-cp39-cp39-macosx_11_0_arm64.whl (385 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 385.9/385.9 kB 5.3 MB/s eta 0:00:00
Downloading aiohappyeyeballs-2.3.4-py3-none-any.whl (12 kB)
Using cached aiosignal-1.3.1-py3-none-any.whl (7.6 kB)
Downloading async_timeout-4.0.3-py3-none-any.whl (5.7 kB)
Using cached attrs-23.2.0-py3-none-any.whl (60 kB)
Downloading frozenlist-1.4.1-cp39-cp39-macosx_11_0_arm64.whl (53 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 53.7/53.7 kB 2.6 MB/s eta 0:00:00
Downloading multidict-6.0.5-cp39-cp39-macosx_11_0_arm64.whl (30 kB)
Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Downloading yarl-1.9.4-cp39-cp39-macosx_11_0_arm64.whl (81 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 81.8/81.8 kB 6.0 MB/s eta 0:00:00
Using cached zipp-3.19.2-py3-none-any.whl (9.0 kB)
Using cached idna-3.7-py3-none-any.whl (66 kB)
Installing collected packages: zipp, tqdm, six, PyYAML, pyparsing, pillow, packaging, numpy, networkx, multidict, kiwisolver, idna, frozenlist, fonttools, cycler, attrs, async-timeout, astropy-iers-data, aiohappyeyeballs, aioftp, yarl, tifffile, scipy, python-dateutil, pyerfa, lazy-loader, importlib-resources, imageio, contourpy, aiosignal, scikit-image, matplotlib, astropy, aiohttp, parfive, sunpy, sunkit-image
Successfully installed PyYAML-6.0.1 aioftp-0.22.3 aiohappyeyeballs-2.3.4 aiohttp-3.10.0 aiosignal-1.3.1 astropy-6.0.1 astropy-iers-data-0.2024.7.29.0.32.7 async-timeout-4.0.3 attrs-23.2.0 contourpy-1.2.1 cycler-0.12.1 fonttools-4.53.1 frozenlist-1.4.1 idna-3.7 imageio-2.34.2 importlib-resources-6.4.0 kiwisolver-1.4.5 lazy-loader-0.4 matplotlib-3.9.1 multidict-6.0.5 networkx-3.2.1 numpy-1.26.4 packaging-24.1 parfive-2.1.0 pillow-10.4.0 pyerfa-2.0.1.4 pyparsing-3.1.2 python-dateutil-2.9.0.post0 scikit-image-0.24.0 scipy-1.13.1 six-1.16.0 sunkit-image-0.5.1 sunpy-5.1.5 tifffile-2024.7.24 tqdm-4.66.4 yarl-1.9.4 zipp-3.19.2
(sunkit) cgilbert@GillyMacbook ~ % which python
/opt/homebrew/anaconda3/envs/sunkit/bin/python
(sunkit) cgilbert@GillyMacbook ~ % python
Python 3.9.19 (main, May 6 2024, 14:39:30)
[Clang 14.0.6 ] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.

import sunkit_image.radial as rad
dir(rad)
['all', 'builtins', 'cached', 'doc', 'file', 'loader', 'name', 'package', 'spec', '_calculate_fit_radial_intensity', '_fit_polynomial_to_log_radial_intensity', '_normalize_fit_radial_intensity', 'bin_edge_summary', 'equally_spaced_bins', 'find_pixel_radii', 'fnrgf', 'frames', 'get_radial_intensity_summary', 'intensity_enhance', 'np', 'nrgf', 'set_attenuation_coefficients', 'sunpy', 'u']
rad.all
['fnrgf', 'intensity_enhance', 'set_attenuation_coefficients', 'nrgf']
`

@nabobalis
Copy link
Contributor

My current plan is to wait for more pull requests to be reviewed and merged and then release v0.6 in a month or so.

@GillySpace27
Copy link
Contributor Author

Ok, cool! Thanks!

@nabobalis
Copy link
Contributor

Sorry for the delay but they're a bunch of open PRs that I would like to get in before a new release as well as I hope the new coalignment API.

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

Successfully merging this pull request may close these issues.

2 participants