Organize and reorder utils for Kerr, Kerr-Newman and Schwarzschild metrics
See original GitHub issue🐞 Problem
As of now, various useful functions used by metric/schwarzschild.py
are in utils/schwarzschild_utils.py
. Same goes for metric/kerr.py
and metric/kerrnewman.py
. We need to move these functions out of utils
and make them a core part of library as they are quite-useful even when used stand-alone.
🎯 Goal
- Migrate them somewhere, so as to make them look like a core part of library.
- Reorder the parameters inside the functions, so as parameters like
c
,G
etc are made to be optional with default values can be taken in SI units fromconstant.py
. - Many functions take
Rs
as parameters which is Schwarzschild Radius. However, there is no sense to keep parametersRs
as it can be calculated from more fundamental things like mass, speed of light(c
), gravitational constant(G
).Rs = 2*M*G/square(c)
. - These changes would break the API, and therefore requires updation of tests and example notebooks.
⏫ Progress
The tasks to be taken up in separate PRs
- Reorder parameters within functions
- Move the functions somewhere more suitable
💡 Possible solutions
-
Firstly, wherever the functions take
Rs
, i.e schwarzschild radius as an input, replace them withM
,G
, andc
and calculateRs = 2*G*M/(c**2)
inside the function itself. We can’t expect the user to supply schwarzschild radius. While implementing it, leave out functiondelta()
in bothkerr_utils.py
andkerrnewman_utils.py
. -
Currently functions are like
func(c, G, Cc, r, theta.....)
. Here the fundamental constants need to be optional arguments and therefore, should be last few parameters likefunc(r, theta, ..... , c=default_value, G=default_value, Cc=default_value)
. Leave outG
andCc
whenever not required.c
is Speed of light. Default value :einsteinpy.constant.c.value
G
is gravitational constant. Default value :einsteinpy.constant.G.value
Cc
is coulomb’s constant. Default value :einsteinpy.constant.coulombs_const.value
-
After the changes, the API would break, therefore, update the example notebooks.
-
Update the user guide
-
Update the tests
📋 Steps to solve the problem
- Comment below about what you’ve started working on.
- Add, commit, push your changes
- Submit a pull request and add this in comments -
Addresses #141
- Ask for a review in comments section of pull request
- Celebrate your contribution to this project 🎉
Issue Analytics
- State:
- Created 4 years ago
- Comments:13 (13 by maintainers)
Top GitHub Comments
@alpeshjamgade Reorganizations is also being undertaken in the core metric modules in PR #203 . We have to wait for a while to work on this. I’ll notify when the time is right 😃 . BTW thanks for taking this up.
Almost all of the utilities have been moved into
metric
itself, in #512.