Geodesic

The main object in PyGRO is the geodesic object which is used to describe the spacetime metric.

class pygro.geodesic.Geodesic(type: Literal['time-like', 'null'], engine: GeodesicEngine | None = None, verbose: bool = True)[source]View on GitHub

The pygro representation of a geodesic. It is used to define the geodesic type (either time-like or null), initial data and stores the results of the numerical integration, perfromed by the GeodesicEngine.

See Integrate a geodesic in PyGRO for more details on the actual integration procedure.

Variables:
  • initial_x (np.ndarray) – The starting position of the geodesic. It is a 4-dimensional numpy.ndarray that can be set using the helper function set_starting_position().

  • initial_u (np.ndarray) – The starting 4-velocity of the geodesic. It is a 4-dimensional numpy.ndarray that can be set using the helper function set_starting_4velocity() which enforces the appropriate normalization condition depending on the geodesic type.

__init__(type: Literal['time-like', 'null'], engine: GeodesicEngine | None = None, verbose: bool = True)[source]View on GitHub

The Geodesic constructor accepts the following arguments:

Parameters:
  • type (Literal['time-like', 'null']) – The geodesic normalization. It accepts strings with either "time-like" (\(g_{\mu\nu}\dot{x}^\mu\dot{x}^\nu = -1\)) or "null" (\(g_{\mu\nu}\dot{x}^\mu\dot{x}^\nu = 0\)).

  • engine (Optional[GeodesicEngine]) – The GeodesicEngine object to link to the Geodesic. If not provided, the Geodesic will be linked to the last initialized GeodesicEngine.

  • verbose (bool) – Specifies whether to log information on the geodesic status to the standard output.

set_starting_4velocity(u0: float | None = None, u1: float | None = None, u2: float | None = None, u3: float | None = None)[source]View on GitHub

Sets the initial values of the components of the 4-velocity, enforcing the normalization conditions. For this reason, only three out of the four components u[i] of the 4-velocity must be specified, and the remaining one will be automatically computed to satistfy the normalization condition.

To override this behaviour, you can directly set the .initial_u property of the Geodesic.

set_starting_point(x0: float | int, x1: float | int, x2: float | int, x3: float | int)[source]View on GitHub

Sets the initial values of the space-time coordinates from which to start the integration.