Repository navigation
Convolution consistency - #5782
Conversation
|
This test is wrong: https://github.com/astropy/astropy/blob/master/astropy/convolution/tests/test_convolve.py#L120 (it's wrong because this is a 1D test and the output is 3D - that can not happen.) EDIT: it was wrong because it was broadcasting the comparison operation! |
|
@astrofrog - I think the behavior of convolve simply doesn't make sense in some cases. We need to chat offline about this. For example, this convolution:
which... I can't reconcile with any interpretation of convolution. Just as problematic, that is not the value being tested for in the tests, but the test is not failing. (please tell me if you get a different local result) |
|
I believe, after re-reading #926, that the In the example above, the middle NaN is assigned a temporary value of So, my plan is to replace this weighted average with a simple zeroing of the NaN value... which I think will have the desired effect, but it will take some guess and check or a deeper investigation of the code to get it right. |
|
I recently wrote a bunch of (numba-based) convolution functions because I disliked the interpolation before convolution (I remarked on that on astropy-dev a long time ago). However there are only three options when you have invalid values (
I'd rather think that ignoring and re-normalizing the header is the best approach but that depends on the size of the kernel (accuracy) and the applied convolution method (sum/average/median). I don't know what would be the "least astonishment" option here but there will always be differences in opinion. But changing how these are handled is definetly breaking backwards-compatibility so should not be taken lightly. Or am I totally wrong and there is a consensus on the "right way"? Note: I haven't looked at the actual changes, that's just picking up your last comment. |
|
@MSeifert04 I don't think there is a 'consensus right way' - both "ignore and renormalize" and "replace with fill" are valid options. I'm not convinced there's ever a case where 'interpolate-then-convolve' is a reasonable behavior for a convolution function. I also agree that this will break backward compatibility and is not a small change. It is probably necessary to preserve all three behaviors in some way, though I would like to deprecate the interpolate-first option. I don't want to provide the interpolate-first option as part of Is it possible for us to include numba functions in astropy? Or should we stick with cython? And looking at that astropy-dev conversation.... well, you and I were right, and the current I think part of the issue is that prior to that discussion, we had been using the term 'interpolate' to mean two different things - in |
|
I think |
|
In case anyone is following along, I'm completely changing the behavior of One question has come up that warrants some feedback: is |
|
@keflavich - I need to catch up with all this, but was wondering whether it wouldn't make more sense to change the default convolve_fft behavior - specifically I find the 'classic' result here to be the most sensible default: #926 (comment) - what do you think? |
|
@astrofrog - Yes, probably the default behavior of However, I now firmly believe that the default behavior of |
|
@keflavich - I'd like to discuss this more - I'm traveling for the next couple of weeks but maybe we can plan to talk during the week of March 13th? (if so I can send you a doodle) Side note: some users clearly do expect and like the NaN behavior in convolve: astropy/astropy.github.com#117 (comment) :) |
|
Just to put this out there, one thing we could do to not break backward compatibility in any bad way is to actually rename the functions and keep the old ones as wrappers of the new ones with the correct defaults. Since the main benefit of these convolution functions is to deal with NaNs in some way (compared to the convolve functions in scipy) we could always make the functions e.g. |
|
I'm traveling a lot over the next few weeks as well, but let's find a time to talk. We could split out the nan-fixing interpolation, but I think we need to always provide a way to access it via keywords from the default convolve functions. And, regarding users' liking the code: astropy's convolve (both variants) is the only version I know of that can handle missing data at all, so it's no surprise users like it, but we should be delivering correct results! |
bad53c7 to
833ad89
Compare
833ad89 to
78a84a1
Compare
|
I've completed the code fixes. There are some new open questions, and some more tests need to be written. Tests - checking Question: Do we change the default parameters to |
bb3c96d to
0e10f7f
Compare
|
circleci tests behave different from my own machine; they seem to reset the context between script calls within EDIT: travis does this too. I'm very sad now, this was a good solution that worked nicely, now I have to ditch everything. |
|
@astrofrog how did you make the docs in wcsaxes not try to access remote data on appveyor? My additions are causing this error: https://ci.appveyor.com/project/Astropy/astropy/build/1.0.7154/job/c8bwnq9v73aufi2p problem line in question says |
|
There are no failed tests on travis-ci, only timeout errors. These seem to be unrelated to this PR. Appveyor is failing because the documentation tests (i.e., the tests of the documentation, not the embedded docs test) are failing as noted above |
|
This PR is ready for final review if someone can help figure out the doc failures on travis and the illegal remote access on appveyor. |
|
For the Appveyor error, it looks like your doc example tries to grab remote data when it is not marked to do so. |
|
@pllim - Either both @keflavich and I were both very tired last week or something is fundamentally not right. The docs seems to use the same logic and thus remote data as the |
|
Are you sure the WCS docs actually run through doctest? A lot of FITS and WCS stuff get a "docskip all" treatment, right? |
|
I meant |
|
|
||
| kernel_internal /= kernel_sum | ||
|
|
||
|
|
There was a problem hiding this comment.
really nitpick: remove blank line
[ci skip]
9890071 to
b9eda18
Compare
b9eda18 to
c0b1fce
Compare
|
Looks like this is now ready to go as soon as the tests pass. It's probably good already but so many rebases... ®️⚾️ |
|
All green, so merging. Thanks a lot @keflavich for finishing off this marathon PR. |
|
Thanks @keflavich! |
The test in question, ``test_unity_1_none()`` exists in ``test_convolve_fft.py`` so test coverage is not reduced by this change. This entire construct was introduced in astropy#5782 by [this commit](astropy@3438f87) Signed-off-by: James Noss <[email protected]>
The test in question, ``test_unity_1_none()`` exists in ``test_convolve_fft.py`` so test coverage is not reduced by this change. This entire construct was introduced in astropy#5782 by [this commit](astropy@3438f87) Signed-off-by: James Noss <[email protected]>
The test in question, ``test_unity_1_none()`` exists in ``test_convolve_fft.py`` so test coverage is not reduced by this change. This entire construct was introduced in astropy#5782 by [this commit](astropy@3438f87) Signed-off-by: James Noss <[email protected]>
The test in question, ``test_unity_1_none()`` exists in ``test_convolve_fft.py`` so test coverage is not reduced by this change. This entire construct was introduced in astropy#5782 by [this commit](astropy@3438f87). Signed-off-by: James Noss <[email protected]>
The test in question, ``test_unity_1_none()`` exists in ``test_convolve_fft.py`` so test coverage is not reduced by this change. This entire construct was introduced in astropy#5782 by [this commit](astropy@3438f87). Signed-off-by: James Noss <[email protected]>
Closes #926.
Goals:
convolve_fftandconvolveaccept all of the same arguments where applicableconvolve_fftandconvolvehave the same behavior with respect to:@astrofrog please add to this if I missed anything