-
Notifications
You must be signed in to change notification settings - Fork 109
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
Convert dir
to axis
#310
Convert dir
to axis
#310
Conversation
# Conflicts: # pylops/waveeqprocessing/oneway.py
Let me get back to this once we got v1.17.0 out :) |
I have not forgotten about this, just being thinking a little about it. Overall thought:
Here a some more specific thoughts:
|
Hi @mrava87 thanks for the comments. Let's go over your them:
|
# Conflicts: # pylops/basicoperators/Laplacian.py # pylops/basicoperators/SecondDerivative.py
# Conflicts: # examples/plot_causalintegration.py # examples/plot_derivative.py # examples/plot_flip.py # examples/plot_restriction.py # examples/plot_roll.py # examples/plot_stacking.py # examples/plot_symmetrize.py # examples/plot_tvreg.py # pylops/avo/poststack.py # pylops/avo/prestack.py # pylops/basicoperators/CausalIntegration.py # pylops/basicoperators/FirstDerivative.py # pylops/basicoperators/Flip.py # pylops/basicoperators/Gradient.py # pylops/basicoperators/Laplacian.py # pylops/basicoperators/Restriction.py # pylops/basicoperators/Roll.py # pylops/basicoperators/SecondDerivative.py # pylops/basicoperators/Smoothing1D.py # pylops/basicoperators/Smoothing2D.py # pylops/basicoperators/Symmetrize.py # pylops/signalprocessing/Convolve1D.py # pylops/signalprocessing/Convolve2D.py # pylops/signalprocessing/ConvolveND.py # pylops/signalprocessing/Interp.py # pylops/signalprocessing/Patch2D.py # pylops/signalprocessing/Sliding2D.py # pylops/signalprocessing/Sliding3D.py # pylops/waveeqprocessing/lsm.py # pylops/waveeqprocessing/marchenko.py # pylops/waveeqprocessing/seismicinterpolation.py # pytests/test_basicoperators.py # pytests/test_causalintegration.py # pytests/test_convolve.py # pytests/test_derivative.py # pytests/test_interpolation.py # pytests/test_kronecker.py # pytests/test_restriction.py # pytests/test_seismicinterpolation.py # tutorials/ctscan.py # tutorials/deblurring.py # tutorials/seismicinterpolation.py
Great! Let me take a look in details in coming days (I just want to be sure if there is any operator where we don't want to switch convention 0->1) then I can merge it :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First half, done up to Interp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Second part
@mrava87, could you have a final look? By the way, we should probably squash all this into one commit when we merge :) |
Let me take a final look and I let you know if I have anything more :) Then I am happy if you want to squash all in one commit as there is quite a lot here and it all fits within the same idea of removing |
Alright, apart from the small comment on the MIGRATION file, everything else looks good to me and ready to go :) |
Have a look here. If it's ok, feel free to merge! |
Wait, maybe my comment was confusing. In the MIGRATION file you say:
shouldn't that be:
Apart from that, you want to squash all in one commit before I merge or not? I don't really have strong feeling here ;) |
Motivation
As described in #123, the choice of
dir
for direction in many linear operators is not compatible with NumPy/Scipy notation. In addition, it encroaches on thedir
built-in function. As such, it is highly desirable to move from the use ofdir
toaxis
instead. In addition, some other related keywords such asdirs
andnodir
can both be substituted byaxes
. While there are other improvements that can be made in this respect, the scope of this PR is simply to move away fromdir
without altering the current functionality of these modified operators.Strategy
The main issue to keep in mind is to retain the old behavior as much as possible, so as to allow users to migrate to
axis
and not break any existing code. The approach taken to ensure this was as follows..., dir=0,...
→..., axis=-1, dir=None, ...
and similar fordirs
/axes
.dir
is supplied, it supersedes the use ofaxis
but also issues a deprecation warning:axis
and note thatdir
is deprecated like so:dir
always worked. After this check, tests were updated to also callaxis
.Considerations
I am creating this as a draft because there I'd like some feedback on this strategy. For example, I strongly favor setting the default as
axis=-1
for v2.0.0, but this is a breaking change. I am also open to amending warnings/documentation on this change.