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

Warn about future changes to adaptive defaults #302

Merged
merged 1 commit into from
Sep 1, 2022

Conversation

svank
Copy link
Contributor

@svank svank commented Aug 24, 2022

(One new commit on top of the boundary-handling PR, will rebase later)

This warns the user if the default filter kernel or boundary handling mode is being used.

In [3]: reproject.reproject_adaptive((data, w), w, data.shape)
<ipython-input-3-6fbe9b99ba1d>:1: FutureWarning: The default kernel will change from 'Hann' to  'Gaussian' in a future release. To suppress this warning, explicitly select a kernel with the 'kernel' argument.
  reproject.reproject_adaptive((data, w), w, data.shape)
<ipython-input-3-6fbe9b99ba1d>:1: FutureWarning: The default boundary mode will change from 'ignore' to  'strict' in a future release. To suppress this warning, explicitly select a mode with the 'boundary_mode' argument.
  reproject.reproject_adaptive((data, w), w, data.shape)
Out[3]: 
...

In [4]: reproject.reproject_adaptive((data, w), w, data.shape, kernel='hann', boundary_mode='strict')
Out[4]: 
...

I set the default values for these two kwargs to 'default' so we can tell whether the user is relying on the default behavior or explicitly requesting the old behavior. I haven't mentioned the literal value of default in the docs and intend to stop recognizing it in the same commit that changes the defaults, and I hope this temporarily-valid value of default doesn't itself need a deprecation period. LMK if there's a better way.

@svank svank force-pushed the warn-about-changes branch 2 times, most recently from 151d8ad to 70434a8 Compare August 24, 2022 17:31
@codecov
Copy link

codecov bot commented Aug 24, 2022

Codecov Report

Merging #302 (95a95c0) into main (bc88deb) will increase coverage by 0.05%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #302      +/-   ##
==========================================
+ Coverage   94.30%   94.36%   +0.05%     
==========================================
  Files          23       23              
  Lines         720      727       +7     
==========================================
+ Hits          679      686       +7     
  Misses         41       41              
Impacted Files Coverage Δ
reproject/adaptive/high_level.py 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@astrofrog
Copy link
Member

@svank - could you rebase this again? Thanks!

@svank
Copy link
Contributor Author

svank commented Aug 25, 2022

@astrofrog Done

Copy link
Member

@astrofrog astrofrog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good but could you change 'default' to None as mentioned below?

@@ -12,8 +13,9 @@ def reproject_adaptive(input_data, output_projection, shape_out=None, hdu_in=0,
order=None,
return_footprint=True, center_jacobian=False,
roundtrip_coords=True, conserve_flux=False,
kernel='Hann', kernel_width=1.3, sample_region_width=4,
boundary_mode='ignore', boundary_fill_value=0,
kernel='default', kernel_width=1.3,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The usual way to deal with this is to actually have kernel=None rather than have 'default' as a special string

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooh, yes, I like that better. Done

Copy link
Member

@astrofrog astrofrog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me assuming CI passes. Thanks! Do you have any more PRs that should be considered before I go ahead and do a release? (after which we can finalize/merge the ones to actually change the defaults). I was thinking we could perhaps plan to wait a couple of months before the next release (which would change the defaults) just to make sure we give some time for users to see the warnings.

@astrofrog astrofrog merged commit b3b9442 into astropy:main Sep 1, 2022
@svank
Copy link
Contributor Author

svank commented Sep 1, 2022

Nope, I'm fresh out of PRs for this next release. Sounds like a plan!

@svank svank deleted the warn-about-changes branch June 23, 2023 21:41
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