Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Nov 15 07:17

    JeS24 on main

    Add ability to pass custom metr… Merge pull request #625 from a3… (compare)

  • Nov 15 07:17
    JeS24 closed #625
  • Nov 15 07:17
    JeS24 commented #625
  • Nov 15 07:17
    JeS24 milestoned #626
  • Nov 15 07:17
    JeS24 opened #626
  • Nov 15 07:17
    JeS24 labeled #626
  • Nov 15 07:17
    JeS24 labeled #626
  • Nov 14 20:13
    a3ahmad commented #625
  • Nov 14 20:05
    codecov[bot] commented #625
  • Nov 14 20:05
    codecov[bot] commented #625
  • Nov 14 20:04
    a3ahmad synchronize #625
  • Nov 14 19:53
    JeS24 labeled #625
  • Nov 14 19:53
    JeS24 unlabeled #625
  • Nov 14 19:52
    JeS24 commented #625
  • Nov 14 17:04
    a3ahmad commented #625
  • Nov 14 17:04
    codecov[bot] commented #625
  • Nov 14 17:04
    codecov[bot] commented #625
  • Nov 14 17:03
    a3ahmad synchronize #625
  • Nov 14 16:54
    codecov[bot] commented #625
  • Nov 14 16:47
    codecov[bot] commented #625
JeS24
@jes0:matrix.org
[m]
@zabopThe latest version from GitHub should help: pip install git+https://github.com/einsteinpy/einsteinpy.git.
Pal Szabo
@zabop
Ohh maybe I am doing something wrong then. I am using this guide: https://docs.einsteinpy.org/en/stable/user_guide.html
and the result of my attempt is:
image.png
maybe the guide I am following is not the one I am supposed to be using with the latest einsteinpy version? :)
jes0
@jes0:matrix.org
[m]
Sorry, I should have explained. "stable" in this link (https://docs.einsteinpy.org/en/stable/user_guide.html) refers to the EinsteinPy version, you'd install using pip install einsteinpy. This would install einsteinpy-0.3.1 (AKA "stable"). What you want is einsteinpy-0.4.dev0 (AKA "latest"), that you can install via pip install git+https://github.com/einsteinpy/einsteinpy.git. This pulls the most recent code from our GitHub repo. The documentation for this version can be found at https://docs.einsteinpy.org/en/latest .
2 replies
I also recommend uninstalling the previous version using pip uninstall einsteinpy before you install the latest version.
@zabop
jezza1251
@jezza1251:matrix.org
[m]
Hi everyone! Currently using the latest version of einsteinpy (0.4dev0), and I'm trying to do this project - https://docs.einsteinpy.org/en/latest/examples/Using%20Geodesics%20%28Back-ends%20%26%20Plotting%29.html, however my plot seems very wrong compared to what's expected! Attached is my code and the plot, if anyone could help that'll be so great!
shreyasbapat
@shreyasbapat:matrix.org
[m]
Okay, finally I am back
The release should happen this weekend
And all these issues will get sprtef
Sorted*
smondal
@smondal:matrix.org
[m]
Hello guys, I have a naive question. It is fine to write the metric as for desitter or schwarzschild. I want to write a metric where the metric components are diag(F(t,r),G(t,r),E(t,r),D(t,r)). Where F,G,D,E are arbitrary function and not sin, cos or any other predefined function. How do I write that. Please help....
shreyasbapat
@shreyasbapat:matrix.org
[m]
EinsteinPy 0.4.0 is out 😁
1 reply
I am really sorry for not staying up to date here
This covid wave has hurt all of us here pretty badly
2 replies
Sourodip Ghoshdastidar
@geekyboy:matrix.org
[m]
how can i use the cartesian to spherical coordinates conversion module?
1 reply
i am new to python sorry
rh99
@rh99:matrix.org
[m]
Hi, can I contribute to this project without knowledge of general relativity? I will be taking a class on it next year...
1 reply
Thomas Andersen
@tomandersen:matrix.org
[m]
m1 Mac install - I have tried quite a bit, and pip methods all fail, usually on llvmlite. When I use conda it 'works' but in Jupyter I can't import or use it. Also trying to use it in python3 in a small python file or interactive fails, it can't see the installed by conda version. All the other python modules i need install. It's installing or trying to using native arm64 code. Thanks for any tips! Was trying out EinsteinPy and it was great getting the Einstein tensor from a metric. I tried on a different computer from mine.
shreyasbapat
@shreyasbapat:matrix.org
[m]
Yeah. I don't know what to do about it. I am sorry for that. Will have to get a M1 to try it out.
I am sure it is because either Numba does not support M1
Thomas Andersen
@tomandersen:matrix.org
[m]
I figured it out. Install everything with conda. (which all worked for me). Then only problem is macs use zsh shell, needed to cd into the conda bin directory and type ./conda init zsh

tandersen@tomm1 bin % ./conda init zsh
no change /opt/homebrew/Caskroom/miniforge/base/condabin/conda
no change /opt/homebrew/Caskroom/miniforge/base/bin/conda
no change /opt/homebrew/Caskroom/miniforge/base/bin/conda-env
no change /opt/homebrew/Caskroom/miniforge/base/bin/activate
no change /opt/homebrew/Caskroom/miniforge/base/bin/deactivate
no change /opt/homebrew/Caskroom/miniforge/base/etc/profile.d/conda.sh
no change /opt/homebrew/Caskroom/miniforge/base/etc/fish/conf.d/conda.fish
no change /opt/homebrew/Caskroom/miniforge/base/shell/condabin/Conda.psm1
no change /opt/homebrew/Caskroom/miniforge/base/shell/condabin/conda-hook.ps1
no change /opt/homebrew/Caskroom/miniforge/base/lib/python3.9/site-packages/xontrib/conda.xsh
no change /opt/homebrew/Caskroom/miniforge/base/etc/profile.d/conda.csh
modified /Users/tandersen/.zshrc

==> For changes to take effect, close and re-open your current shell. <==

tandersen@tomm1 bin % pwd
/opt/homebrew/Caskroom/miniforge/base/bin

Then it worked. I needed to get conda to set up my zsh shell so typing jupyter-lab would run the correct one.
@penuss:matrix.org
@pimmlel:matrix.org
[m]
Hi guys, I was reading through the docs to see if I could improve some things. One thing that I noticed is that you write "space-time" instead of "spacetime". Is this a stylistic choice of yours? Usually, it's written as "spacetime" in books and papers. The rationale behind that is that space and time are intrinsically linked. This isn't reflected when using a dash to separate both.
Disclaimer: I am coming more from a physics background rather than coding background.
Bernhard Umlauf
@bernie67:matrix.org
[m]
Hi all, first try to use einsteinpy. Can someone tell, how to declare user defined metrics? I want to use modified Schwarzschild metric, i.e. multiply g_rr with 1/r.
I get also an error message, if i use "from einsteinpy.symbolic import SchwarzschildMetric"
DottMichela Lai
@michelalai:matrix.org
[m]
Hi everyone! I am Michela, Post-Doc at University of Cagliari, Italy. I am just starting with einsteinpy. Thank you for what have you done so far, and hope I will be able to contribute to this project soon!
DottMichela Lai
@michelalai:matrix.org
[m]

Hi! Sorry for bothering for the very first day, but I noticed that the pip installing is complaining that
einsteinpy requires Python '>=3.7' but the running Python is 2.7.17

while I just installed python 3.8, and also the alias "python" points to that one, so why does it search for the oldest python? How can I force it to choose the 3.8 version I installed?

DottMichela Lai
@michelalai:matrix.org
[m]
Hi! hope This time will be easier

Processing /project/6004969/mlai92/einsteinpy
Installing collected packages: UNKNOWN
Running setup.py install for UNKNOWN ... error
Complete output from command /usr/bin/python2 -u -c "import setuptools, tokenize;file='/tmp/pip-Ycu7Ai-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-oH81vU-record/install-record.txt --single-version-externally-managed --compile:
/usr/lib64/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'setup_cfg'
warnings.warn(msg)
running install
running build
running install_egg_info
running egg_info
creating UNKNOWN.egg-info
writing UNKNOWN.egg-info/PKG-INFO
writing top-level names to UNKNOWN.egg-info/top_level.txt
writing dependency_links to UNKNOWN.egg-info/dependency_links.txt
writing manifest file 'UNKNOWN.egg-info/SOURCES.txt'
warning: manifest_maker: standard file '-c' not found

reading manifest file 'UNKNOWN.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*.py' under directory 'src/einsteinpy/tests'
warning: no files found matching '*.html' under directory 'src/einsteinpy/tests'
no previously-included directories found matching 'docs/source/examples/.ipynb_checkpoints'
warning: no previously-included files matching '*.py[cod]' found anywhere in distribution
warning: no previously-included files matching '__pycache__' found anywhere in distribution
warning: no previously-included files matching '*.so' found anywhere in distribution
warning: no previously-included files matching '*.dylib' found anywhere in distribution
writing manifest file 'UNKNOWN.egg-info/SOURCES.txt'
Copying UNKNOWN.egg-info to /usr/lib/python2.7/site-packages/UNKNOWN-0.0.0-py2.7.egg-info
error: /usr/lib/python2.7/site-packages/UNKNOWN-0.0.0-py2.7.egg-info: Permission denied

----------------------------------------

Command "/usr/bin/python2 -u -c "import setuptools, tokenize;file='/tmp/pip-Ycu7Ai-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-oH81vU-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-Ycu7Ai-build/

This is the output when I try to install it from the git repository. The python version is 3.7.7
Any idea of how can I solve this?
DottMichela Lai
@michelalai:matrix.org
[m]
oky, I solved the issue. Let me know if anyone want to work together
Yashvardhan Prasad
@yasphy:matrix.org
[m]
Hello everyone. I am an undergrad student from India and I wish to contribute in this community and I wish to know if some project we can make for GSOC 22 on behalf of sympy library. Kindly guide me in my path
James Chryssanthacopoulos
@jamesc112186:matrix.org
[m]
Hi, I am new to einsteinpy. Does anyone know if it's able to compute an Einstein tensor for a metric that has unknown functions of the coordinates in it? For example, if you're interested in a particular metric ansatz, and want to reduce the Einstein equation to a corresponding equation for the ansatz. Thanks!
1 reply
lgraham20
@lgraham20
Hi, I'm a bit confused by the indices of the Riemann tensors calculated by EinsteinPy. I have a 3D metric, so the Riemann tensor is a 3x3 matrix (I'll call it the outer matrix) where each element is another 3x3 matrix (the inner matrices). I assumed the indexing would be RbcdaR^{a}_{bcd} with a being the row of the outer matrix, b being columns, and then c&d being the respective indices for the inner matrices. This doesn't appear to be the case when I compare my Riemann tensor generated by EinsteinPy to hand calculations.
1 reply
What I'm noticing is a & d are the indices for the outer matrix, and then cb the row/column for the inner matrix. Is this correct?
JeS24
@jes0:matrix.org
[m]

I believe, it is better to use the term "array" instead of "matrix" (rank-2 tensor).

RbcdaR^{a}_{bcd}Rbcda

Could you clarify this term? This does not look right (wrt indices repeating more than twice & their ordering).

a being the row of the outer matrix, b being columns, and then c&d being the respective indices for the inner matrices.

Right. This is how it should work in EinsteinPy, as long as the index labels are ordered first-to-last for a Riemann (or a general rank-4) tensor denoted as R_{abcd}. Two things to note here:

  • R (here) should not be understood to be covariant. abcd could just as well denote upper / lower indices - this does not affect array-indexing.
  • a, b, c, d are just labels, that might change their ordering based on tensor operations (such as transpose), when mathematically represented in the Einstein notation. But these operations do not change the order in which the array elements are accessed / indexed, which remains first-to-last. The elements within the array are obviously altered.

    For example, if you have a rank-4 tensor, T_{abcd}, here a & b would denote the rows & columns of the outer array respectively, and c & d would denote the rows & columns for the inner arrays. However, if you transpose the last two indices to get T_{abdc} in Einstein notation, this would swap elements along those axes, but the array-indexing order remains the same afterwards, which in turn means, c no longer denotes the rows of the inner arrays & d no longer denotes the columns of the inner arrays. Their roles are now reversed with c denoting the columns and d denoting the rows. Meanings of a & b of course do not change in this case.

What I'm noticing is a & d are the indices for the outer matrix, and then cb the row/column for the inner matrix. Is this correct?

If the order of indices in your array-indexing is a, b, c, d, then this doesn't seem right. Could you please share the metric you used to generate the Riemann tensor and also how you are accessing the elements of the Riemann tensor in code? As stated above, tensor operations (transposition, contractions etc) change the meaning of the indices, but not the order in which the array elements are accessed / indexed. The symmetries of the Riemann tensor might also be playing in role in your confusion.

14 replies
Anis Ahmad
@a3ahmad:matrix.org
[m]
I have a change that allows the user to provide arbitrary metrics to the Geodesic derived classes. Would this be of interest? Should I submit my PR?
1 reply
Emanuil Hristov
@moni42077

I am new to einsteinpy and have been reading a lot of documentation but there seems to be a lot of outdated stuff. I wanted to ask how to make use of the body module to get geodesics equivalent to the old geodesic = Geodesic(body = Particle,.... For example, I have the following system :

cord = CartesianDifferential(t=0*u.s,x=20*u.km,y=100*u.km,z=0*u.km,v_x=10*u.km/u.s,v_y=0*u.km/u.s,v_z=0*u.km/u.s)
b1 = Body(name='Attractor',mass = 1e10*u.kg,R = 1e06*u.km)
part = Body(name='Particle',mass=16e-28*u.kg,R = 8e-18*u.km,parent=b1,differential=cord)

How do I calculate the geodesic here? And what if I have more bodies?

1 reply
jes0
@jes0:matrix.org
[m]

How do I calculate the geodesic here?

This API is from v0.3.1 and lower. Ensure that you are using 0.3.1 (pip install einsteinpy==0.3.1 should work), and try this code:

import astropy.units as u
from einsteinpy.coordinates import CartesianDifferential
from einsteinpy.geodesic import Geodesic
from einsteinpy.bodies import Body
from einsteinpy.plotting import GeodesicPlotter, StaticGeodesicPlotter
from einsteinpy.metric import Schwarzschild

# In EPy v0.3.1 and lower, CartesianDifferential does not take a `t` argument.
cord = CartesianDifferential(x=20*u.km,y=100*u.km,z=0*u.km,v_x=10*u.km/u.s,v_y=0*u.km/u.s,v_z=0*u.km/u.s)
b1 = Body(name='Attractor', mass=1e10*u.kg, R = 1e06*u.km)
part = Body(name='Particle', mass=16e-28*u.kg, R = 8e-18*u.km, parent=b1, differential=cord)

# Given the large distance between the test particle and the black hole, you will need a large step size to get results 
# in a reasonable amount of time. Note that this means that the results will be less accurate, especially near the black hole.
geod = Geodesic(body=part, end_lambda=3000, step_size=5, metric=Schwarzschild) # metric=Schwarzschild by default

plotter = StaticGeodesicPlotter()
plotter.plot(geod)
plotter.show()
1 reply

And what if I have more bodies?

If you want to have more test particles (vis-à-vis Particle in your code), the only thing you need to ensure is that particle masses << the mass of the black hole (Attractor in your code). So, the code should look something like this:

# imports and definitions as above
cord1 = CartesianDifferential(x=..., y=..., z=..., v_x=..., v_y=..., v_z=...)
cord2 = CartesianDifferential(x=..., y=..., z=..., v_x=..., v_y=..., v_z=...)

part1 = Body(name='Particle',mass=...,R = ...,parent=b1, differential=cord1)
part2 = Body(name='Particle',mass=...,R = ...,parent=b1, differential=cord2)
# and so on

geod1 = Geodesic(body=part1, end_lambda=..., step_size=...)
geod2 = Geodesic(body=part2, end_lambda=..., step_size=...)
# and so on

# plotting code as above

Multiple "attractors" with comparable masses will alter the background metric (Schwarzschild in this case) and it will require solving the full Einstein field equations (or a perturbed / linearized form of them) to get the form of the metric that can define this new spacetime geometry with multiple gravitating masses.

Some other things to add here:
  1. To avoid the issue of large step_size and inaccurate results, we generally make use of Geometrized units in numerical relativity, which rescale SI quantities such that large distances and steps are not needed to explore interesting phenomena. This is also why we pivoted away from this API in later versions of EPy (which use M-units, G = c = M = 1).
  2. Be careful while changing the metric in Geodesic above, since not all metrics enjoy the generalizability given to Schwarzschild-like metrics by the Birkhoff theorem.
jes0
@jes0:matrix.org
[m]
@moni42077: Hopefully, this answered your questions. Feel free to ask if you have more.
Koustubh Bhattacharjee
@kbohuastt:matrix.org
[m]
hello there, sorry if this is rather abrupt. How do i contribute to this project?
1 reply