-
-
Notifications
You must be signed in to change notification settings - Fork 49
Implemented the Fourier Normalizing Radial Gradient Filter #17
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
Merged
Merged
Changes from 8 commits
Commits
Show all changes
55 commits
Select commit
Hold shift + click to select a range
0755f43
Implemented the Fourier Normailizing Radial Gradient Filter
vatch123 9268712
Updated the variable name
vatch123 fd5eb43
Added the attenuation coefficients
vatch123 f4da119
Merge pull request #1 from sunpy/master
vatch123 51db695
Updated the docstrings
vatch123 b7d7903
Updated docs, Added tests
vatch123 13775b5
added the changelog file
vatch123 a9e7d11
Fixed PEP8 issues
vatch123 eddd3bd
Update sunkit_image/offlimb_enhance.py
nabobalis 19eaca6
Update sunkit_image/offlimb_enhance.py
nabobalis 73075e0
Update sunkit_image/offlimb_enhance.py
nabobalis aa87701
Update sunkit_image/offlimb_enhance.py
nabobalis c75dde9
Apply suggestions from code review
nabobalis 616e4ab
Updated the tests
vatch123 8c16423
Merge pull request #2 from sunpy/master
vatch123 1810bfd
Changed the test images to ones with radial profiles
vatch123 f97340f
Added one more test to NRGF
vatch123 23dbeb3
Spelling Corrected
vatch123 abff13b
Minor fixes
vatch123 80d6737
Tests added to FNRGF
vatch123 2f11ddd
Apply suggestions from code review
vatch123 f63d7f0
Resolved merge conflicts
vatch123 adbd9f8
Merge pull request #3 from sunpy/master
vatch123 5ea0601
Changed the way test maps are created
vatch123 32e0fae
Fixed the confest.py
vatch123 fd99563
Modules and functions renamed
vatch123 319967e
FIxed a corner case
vatch123 f5e4e0f
Added examples
vatch123 e2680ff
FIxed the docs file of offlimb
vatch123 e09fd95
Fixed the doc file again
vatch123 cb40301
Minor fixes
vatch123 bc7a7e4
Applied the suggestion
vatch123 0acfc51
Fixed the examples
vatch123 9817ba5
Merge conflicts resolution
vatch123 9555beb
Removed offlimb_enhance
vatch123 2b1b82d
fixed indentation and tests
vatch123 eb2c77c
Added figure tests
vatch123 3c41f99
marker for future tests
vatch123 bb6d2ab
Minor changes
vatch123 1e3c22f
Capitalized "Fourier"
vatch123 c2dc74a
Removed merge conflicts
vatch123 40af095
Apply suggestions from code review
vatch123 ec93937
Made changes to the offlimb file
vatch123 7e095c4
CHanged to radial
vatch123 a2308d1
Renamed test file
vatch123 1fcabf8
Added test for helpers
vatch123 236786b
Fixed the examples and figure hashes
vatch123 a7e7b22
fixed hash value
vatch123 71426aa
Docs fixed
vatch123 e67eb0f
Apply suggestions from code review
vatch123 c8fed34
added tests
vatch123 0adcdc1
Apply suggestions from code review
vatch123 d82fc41
Added the coefficient function and doc changes
vatch123 72b9566
Docs formatting done
vatch123 897a9f0
Added tests for warning
vatch123 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Added a new feature ```fourier_normalizing_radial_gradient_filter``` to normalize the radial brightness gradient using a fourier approximation. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,55 @@ | ||
| import os | ||
|
|
||
| import numpy as np | ||
| import pytest | ||
| import astropy.units as u | ||
| from numpy.testing import assert_allclose | ||
|
|
||
| import sunpy | ||
| import sunpy.map | ||
| import sunpy.data.test | ||
| import sunkit_image.utils.utils as utils | ||
vatch123 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| import sunkit_image.offlimb_enhance as off | ||
|
|
||
|
|
||
| test_map_data = np.ones((5, 5)) | ||
| header = {} | ||
| test_map = sunpy.map.Map((test_map_data, header)) | ||
| radial_bin_edges = utils.equally_spaced_bins() | ||
| radial_bin_edges = radial_bin_edges*u.R_sun | ||
nabobalis marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
| def set_attenuation_coefficients(order): | ||
| attenuation_coefficients = np.zeros((2, order + 1)) | ||
| attenuation_coefficients[0][:] = np.linspace(1, 0, order + 1) | ||
| attenuation_coefficients[1][:] = np.linspace(1, 0, order + 1) | ||
| return attenuation_coefficients | ||
|
|
||
|
|
||
| def test_normalizing_radial_gradient_filter(): | ||
|
|
||
| with pytest.warns(Warning, match="Missing metadata for solar radius: assuming photospheric limb as seen from Earth"): | ||
|
|
||
| result = np.zeros_like(test_map_data) | ||
| expect = off.normalizing_radial_gradient_filter(test_map, radial_bin_edges) | ||
|
|
||
| assert np.allclose(expect.data.shape, test_map.data.shape) | ||
| assert np.allclose(expect.data, result) | ||
|
|
||
|
|
||
| def test_fourier_normalizing_radial_gradient_filter(): | ||
|
|
||
| with pytest.warns(Warning, match="Missing metadata for solar radius: assuming photospheric limb as seen from Earth"): | ||
|
|
||
| result = np.zeros_like(test_map_data) | ||
|
|
||
| order = 20 | ||
| attenuation_coefficients = set_attenuation_coefficients(order) | ||
| expect = off.fourier_normalizing_radial_gradient_filter(test_map, radial_bin_edges, order, | ||
| attenuation_coefficients) | ||
| assert np.allclose(expect.data.shape, test_map.data.shape) | ||
| assert np.allclose(expect.data, result) | ||
|
|
||
| # TODO: Write this | ||
| order = 33 | ||
| attenuation_coefficients = set_attenuation_coefficients(order) | ||
| expect = off.fourier_normalizing_radial_gradient_filter(test_map, radial_bin_edges, order, | ||
| attenuation_coefficients) | ||
| assert np.allclose(expect.data.shape, test_map.data.shape) | ||
| assert np.allclose(expect.data, result) | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.