-
-
Notifications
You must be signed in to change notification settings - Fork 221
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
Streamline the coordinates
module
#650
Comments
Hey! I'd like to be assigned to this issue. |
@GaganaMD Sure. Please go ahead. |
Do you need any assistance on this issue, I would be happy to help @GaganaMD |
Hi there! I've decided to start working on
Edit: I just looked through the code and it looks like this was already done |
Oh okay. Then does this Issue need to be closed? or is this part of the issue still open?:
|
Weirdly, I was not notified of this comment, even though I am subscribed to this thread. Anyway, this refactor is yet to be done. The idea is to remove (or move into separate functions) rewritten code. For example, check these sets of lines from two functions in einsteinpy/src/einsteinpy/coordinates/utils.py Lines 162 to 166 in e56fd9e
einsteinpy/src/einsteinpy/coordinates/utils.py Lines 189 to 193 in e56fd9e
You can find similar code duplication for other coordinate system pairs, too. The reason it is currently written this way is that we are branching based on einsteinpy/src/einsteinpy/coordinates/utils.py Lines 147 to 152 in e56fd9e
@TONYOG12 @dana-gill The goal of this refactor is to remove code duplication and instead do something like #644 (comment) (With one correction: |
Also, feel free to work on the issue. All subparts are open. |
thank you for the additional context @JeS24. I have already began work on point 1. I'll create a pr for that and take a look at point 2. with @dana-gill |
This commit addresses the first point on issue einsteinpy#650 by replacing named variables for each coordinate type with generic variable names
🐞 Problem
Currently, there are many redundancies in
einsteinpy.coordinates
. There's a ton of code rewrite instead of reuse between the various modules. This was done for various reasons, but the primary reason was to enablenumba.jit
acceleration. Today, it should be possible to keepnumba.jit
functionality while reducing the size of the module codebase, making it more robust and maintainable. For instance, see #644. Some key things to note are as follows:t x y z
in Cartesian,t r theta phi
in Polar, etc.). Use generic names such ase0, ..., e3
for position components andu0, ..., u3
for velocity components.bodies.py
. Also if aBaseDifferential
/ base class is added.coordinates/utils.py
to separate out the position and velocity conversion parts and to reassemble them, based on whether the velocity components are provided. This ensures that individual conversion operations are still accelerated usingjit
.Note that this is a simple refactor of the module, which does not necessarily add any new functionality. However, it might pave the way for adding newer coordinate systems more easily.
💡 Possible solutions
See the discussion in #644.
📋 Contribution steps
Please consult the developer docs to set up your dev environment and get started. Also, feel free to communicate, if you hit a snag. You can do so in our Gitter or Matrix/Element chat rooms (recommended), or you can also reply here.
Addresses #650
if you are partially fixing the issue.Fixes #650
if you are completely fixing the issue.The text was updated successfully, but these errors were encountered: