greopy package

Submodules

greopy.common module

This module contains functions used in multiple places throughout the package.

class greopy.common.ODESolution(t: ndarray[Any, dtype[float64]], y: ndarray[Any, dtype[float64]])

Bases: object

Contain domain t and codomain y of differential equation solution.

exception greopy.common.SpacelikeGeodesicFail

Bases: Exception

Exception raised when spacelike geodesic calculation failed.

greopy.common.cartesian_coordinates(r: ndarray[Any, dtype[float64]], theta: ndarray[Any, dtype[float64]], phi: ndarray[Any, dtype[float64]]) ndarray[Any, dtype[float64]]
greopy.common.cartesian_coordinates(r: float64, theta: ndarray[Any, dtype[float64]], phi: ndarray[Any, dtype[float64]]) ndarray[Any, dtype[float64]]
greopy.common.cartesian_coordinates(r: float64, theta: float64, phi: float64) ndarray[Any, dtype[float64]]

Transform spherical-like coordinates into cartesian coordinates.

Parameters

r

Radial coordinate value.

theta

Angular (polar) coordinate value.

phi

Angular (azimuthal) coordinate value.

Returns

Cartesian coordinates corresponding to given input coordinates.

greopy.common.curve_dataframe(dataset: tuple[ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]]]) DataFrame

Write curve data into a DataFrame.

Parameters

dataset

Affine parameter array and ndarray of coordinates and tangent vectors.

Returns

DataFrame containing affine parameter, coordinates and tangent vectors.

greopy.common.data_interpolation(curve_data: DataFrame) interp1d

Interpolate spatial coordinates and tangent vectors with x0.

Since x0 is a measure of coordinate time, interpolating w.r.t. x0 is convenient when comparing spatial coordinate differences (at the same coordinate time / on the timelike hypersurface).

Parameters

curve_data

Dataset containing either observer or light coordinates and tangent vectors.

Returns

Set of spatial coordinate and tangent vector interpolations.

greopy.common.gram_schmidt_process(initial_vectors: tuple[ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]]], metric_evaluated: ndarray[Any, dtype[float64]]) tuple[ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]]]

Calculate a tetrad at a given event using the [Gram-Schmidt] process.

Parameters

initial_vectors

Set of four linearly independent vectors; four-velocity at event convenient as first initial vector.

event

Event’s spacetime coordinates.

metric

Metric line element as a function of spacetime coordinates.

Returns

Set of perpendicular tetrad vectors at given event coordinates.

References

[Gram-Schmidt]

Schmidt, Erhard. “Zur Theorie der linearen und nichtlinearen Integralgleichungen: I. Teil: Entwicklung willkürlicher Funktionen nach Systemen vorgeschriebener.” Mathematische Annalen 63, no. 4 (1907): 433-476.

greopy.common.load_dataset(filename: str, first_row: int | None = None, last_row: int | None = None, step_size: int = 1) Generator[DataFrame, None, None]

Load DataFrames from h5 file.

Parameters

filename

Name of file containing the desired DataFrames.

first_row

Starting row of the loaded DataFrame.

last_row

Last row of the loaded DataFrame.

step_size

Interval size from which only first row will be loaded.

Returns

DataFrames containing coordinates and tangent vectors.

greopy.common.scalar_product(metric_evaluated: ndarray[Any, dtype[float64]], vector_1: ndarray[Any, dtype[float64]], vector_2: ndarray[Any, dtype[float64]]) float

Calculate scalar product between two vectors at given event.

Parameters

metric_evaluated

Metric line element evaluated at event’s spacetime coordinates.

vector_1

First vector.

vector_2

Second vector.

Returns

scalar product between given vectors at the given event coorindates.

greopy.config module

This module contains class definitions for static typing.

class greopy.config.Config

Bases: TypedDict

Curve_1: Curve
Curve_2: Curve
Metric: MetricDict
class greopy.config.Curve

Bases: TypedDict

initial_event: InitialEvent
initial_velocity: InitialVelocity
proper_times: ProperTimes
class greopy.config.InitialEvent

Bases: TypedDict

phi_factor: int
radius: int
theta_factor: int
x0: int
class greopy.config.InitialVelocity

Bases: TypedDict

velocity_azimuthal: int
velocity_polar: int
velocity_radial: int
class greopy.config.MetricDict

Bases: TypedDict

name: str
params: MetricParams
class greopy.config.MetricParams

Bases: TypedDict

gravity_constant: int
multipole_moments: list[float]
period_rotation: int
radius_reference: int
class greopy.config.ProperTimes

Bases: TypedDict

time_final: int
time_initial: int

greopy.emitter_observer_problem module

Solve the emitter-observer problem for two given timelike curves.

class greopy.emitter_observer_problem.MinimumEvent(orbit_receiver_interpolation: interp1d, euclidean_approximation: bool, terminal: bool)

Bases: object

Class to find a minimum between solve_ivp solution and reference curve.

Attributes

orbit_receiver_interpolation: interp1d

Receiver curve interpolated w.r.t. coordinate time x0.

euclidean_approximation: bool

If true, euclidean approximation is used for distance measurements; recommended only for weakly curved regions of spacetime.

terminal: bool

If true, functions calling this event stop once minimum is found.

greopy.emitter_observer_problem.eop_solver(config: Config, curve_emitter: DataFrame, curve_receiver: DataFrame, multiprocessing: bool = False, hypersurface_approximation: bool = True, hypersurface_angle_range: float = 0.0001, de_relative_tolerance: float = 0, de_absolute_tolerance: float = 0.0001, de_popsize: float = 50, de_max_iterations: float = 15, de_seed: int | None = None, solve_ivp_absolute_tolerance: float = 1e-20, solve_ivp_relative_tolerance: float = 3e-14, root_tolerance: float = 1e-12, max_distance_measure: float = 0.01, euclidean_approximation: bool = False, affine_parameter_mesh_length: int = 10, verbose: int = 0) list[tuple[int, DataFrame]]

Calculate light ray solutions for given emitter and receiver orbit data.

Parameters

config

Configuration dictionary containing metric information.

curve_emitter

Emitter curve’s coordinates and tangent vector at each event.

curve_receiver

Receiver curve’s coordinates and tangent vector at each event.

multiprocessing

Switch multiprocessing on to calculate multiple light rays in parallel. Note that when running the code on Windows or macOS, switch the default start method for multiprocessing from ‘spawn’ to ‘fork’ manually before calling the function.

hypersurface_approximation

Switch on celestial angle approximation via geodesics between events in the hypersurface x0=const.

hypersurface_angle_range

For the case of the hypersurface approximation, defines the expected angular deviation in which the correct angles are expected to lie. Possible values lie in the range (0, pi).

de_relative_tolerance

Relative tolerance of scipy.optimize.differential_evolution.

de_absolute_tolerance

Absolute tolerance of scipy.optimize.differential_evolution.

de_popsize

Population size of scipy.optimize.differential_evolution.

de_max_iterations

Maximum number of iterations of scipy.optimize.differential_evolution.

de_seed

Seed for scipy.optimize.differential_evolution. If None, a random integer will be picked. The seed is vital for debugging.

solve_ivp_absolute_tolerance

Absolute tolerance of the scipy.integrate.solve_ivp function.

solve_ivp_relative_tolerance

Relative tolerance of the scipy.integrate.solve_ivp function.

root_tolerance

Tolerance of the scipy.optimize.root function.

max_distance_measure

Maximum allowed distance between light ray and receiver curve (distance in terms of euclidean distance or proper length depending on settings).

euclidean_approximation

Switch between defining length in terms of integrals over geodesics in spacetime (more robust, more computationally expensive) or in the euclidean sense (not suited for all coordinate systems, computationally cheaper).

affine_parameter_mesh_length

Number of mesh nodes for the solution of the geodesic equation boundary-value problem.

verbose

Decide the logging level. If 0, no information will be logged. If 1, info about the result curves will be logged. If 2, the minimal distance of each light ray candidate in differential evolution will additionally be logged (recommended for debugging if euclidean_approximation and multiprocessing are False). Logs will be output in the file ‘greopy.log’.

Returns

Coordinates and tangent vectors of light rays between emitter/receiver.

greopy.emitter_observer_problem.euclidean_distance(event_1_coordinates: list[float] | ndarray[Any, dtype[float64]], event_2_coordinates: list[float] | ndarray[Any, dtype[float64]]) float64

Approximate spacelike (hypersurface) distance between two events.

By omitting the metric in the calculation (assuming flat spacetime), the resulting coordinate difference is just an approximation and for large coordinate differences not a real “physical” distance. Only for small coordinate differences does it become a distance in the euclidean sense.

Parameters

event_1_coordinates

First event’s spacetime coordinates.

event_2_coordinates

Second event’s spacetime coordinates.

Returns

hypersurface distance between events in the euclidean sense.

greopy.emitter_observer_problem.initial_angle_approximation(tangent_vector, tetrad_vectors, metric_evaluated) tuple[float, float]

Calculate celestial angles of a given tangent vector.

Parameters

tangent_vector

Tangent vector to a curve.

tetrad_vectors

Tetrad of linearly-independent vectors.

metric_evaluated

Spacetime metric evaluated at some event.

Returns

Celestial angles pointing in the direction of the given tangent vector.

greopy.emitter_observer_problem.light_ray_calculation(dataframe_emitter_row: DataFrame, curve_receiver_interpolation: interp1d, metric_function: Callable[[float, float, float, float], ndarray[Any, dtype[float64]]], metric_derivatives: Callable[[float, float, float, float], tuple[ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]]]], metric_inverse: Callable[[float, float, float, float], ndarray[Any, dtype[float64]]], solver_setup_config: _SolverSetupConfig, multiprocessing: bool) tuple[ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]]]

Calculate and save light ray connecting emission and reception event.

For simpler tracking of which light ray corresponds to which emission event after multiprocessing, the solutions are first indexed and then queued instead of just returned.

Parameters

dataframe_emitter_row

DataFrame row containing one emission event and tangent vector.

curve_receiver_interpolation

Timelike receiver curve’s coordinates and tangent vector interpolation.

metric_function

Metric line element as a function of spacetime coordinates.

metric_derivatives

List of metric line element derivatives w.r.t. spacetime coordinates.

metric_inverse

Inverted metric line element.

solver_setup_config

Class instance containing parameters for approximations and solvers.

multiprocessing

Boolean signifying whether multiprocessing is used.

Returns

None

greopy.emitter_observer_problem.light_ray_calculation_multiprocessing(dataframe_emitter_row: DataFrame, curve_receiver_interpolation: interp1d, metric_function: Callable[[float, float, float, float], ndarray[Any, dtype[float64]]], metric_derivatives: Callable[[float, float, float, float], tuple[ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]]]], metric_inverse: Callable[[float, float, float, float], ndarray[Any, dtype[float64]]], solver_setup_config: _SolverSetupConfig, semaphore_calculations, multiprocessing_queue: Queue) None

Wrap light_ray_calculation function when multiprocessing is used.

Parameters

dataframe_emitter_row

DataFrame row containing one emission event and tangent vector.

curve_receiver_interpolation

Timelike receiver curve’s coordinates and tangent vector interpolation.

metric_function

Metric line element as a function of spacetime coordinates.

metric_derivatives

List of metric line element derivatives w.r.t. spacetime coordinates.

metric_inverse

Inverted metric line element.

solver_setup_config

Class instance containing parameters for approximations and solvers.

semaphore_calculations

Semaphore for multiprocessing of light ray calculations.

multiprocessing_queue

Queue for storing indexed light ray solutions.

Returns

None

greopy.emitter_observer_problem.light_ray_calculation_no_multiprocessing(dataframe_emitter_row: DataFrame, curve_receiver_interpolation: interp1d, metric_function: Callable[[float, float, float, float], ndarray[Any, dtype[float64]]], metric_derivatives: Callable[[float, float, float, float], tuple[ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]]]], metric_inverse: Callable[[float, float, float, float], ndarray[Any, dtype[float64]]], solver_setup_config: _SolverSetupConfig, solutions_list: list[tuple[int, DataFrame]]) None

Wrap light_ray_calculation function when multiprocessing is not used.

Parameters

dataframe_emitter_row

DataFrame row containing one emission event and tangent vector.

curve_receiver_interpolation

Timelike receiver curve’s coordinates and tangent vector interpolation.

metric_function

Metric line element as a function of spacetime coordinates.

metric_derivatives

List of metric line element derivatives w.r.t. spacetime coordinates.

metric_inverse

Inverted metric line element.

solver_setup_config

Class instance containing parameters for approximations and solvers.

solutions_list

List for storing indexed light ray solutions.

Returns

None

greopy.emitter_observer_problem.light_ray_differential_evolution(tetrad_vectors: tuple[ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]]], emission_event: ndarray[Any, dtype[float64]], curve_receiver_interpolation: interp1d, metric_function: Callable[[float, float, float, float], ndarray[Any, dtype[float64]]], metric_derivatives: Callable[[float, float, float, float], tuple[ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]]]], metric_inverse: Callable[[float, float, float, float], ndarray[Any, dtype[float64]]], solver_setup_config: _SolverSetupConfig, dataframe_row_index: int, affine_parameter_interval: tuple[float64, float64] | None = None) tuple[ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]]]

Find light ray curve connecting emission event and receiver curve.

It is convenient to transform this boundary value problem, namely connecting two events, into multipole initial value problems, since the reception boundary event changes during the propagation of the solution light ray; this is also known as ‘shooting method’. Solving the geodesic equation for the light ray requires its initial tangent vector; this can be expressed in terms of celestial coordinates pointing to a spot on the emitter’s celestial sphere.

Parameters

tetrad_vectors

Tetrad of linearly-independent vectors.

emission_event

Emission event’s spacetime coordinates.

curve_receiver_interpolation

Timelike receiver curve’s coordinates and tangent vector interpolation.

metric_function

Metric line element as a function of spacetime coordinates.

metric_derivatives

List of metric line element derivatives w.r.t. spacetime coordinates.

metric_inverse

Inverted metric line element.

solver_setup_config

Class instance containing parameters for approximations and solvers.

dataframe_row_index

Row index, only used for logging the number of the emission event.

affine_parameter_interval

Initial and final affine parameter value elapsing along solution curve.

Returns

Affine parameter array and coordinate and tangent vector arrays

greopy.emitter_observer_problem.light_ray_ivp(initial_angles: tuple[float, float], tetrad_vectors: tuple[ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]]], emission_event: ndarray[Any, dtype[float64]], curve_receiver_interpolation: interp1d, metric_function: Callable[[float, float, float, float], ndarray[Any, dtype[float64]]], metric_derivatives: Callable[[float, float, float, float], tuple[ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]]]], metric_inverse: Callable[[float, float, float, float], ndarray[Any, dtype[float64]]], solver_setup_config: _SolverSetupConfig, affine_parameter_interval: tuple[float64, float64] | None = None) ODESolution

Solve initial value problem for given initial angles and emission event.

The length of the curve is determined via an ‘event’ passed to the scipy.integrate.solve_ivp solver: For each step of the solver, check whether the coordinate difference between light ray and receiver decreases or increases. In weakly curved (!) spacetimes, the coordinate difference will be a function (of affine parameter s) with at most one minimum. When this minimum is passed, the coordinate difference increases, triggering the event. In case the light ray starts in the ‘wrong’ direction, the difference will increase immediately, also triggering the event.

Parameters

initial_angles

Reference frame dependent celestial coordinates covering the emitter’s celestial sphere; usually defined on the intervals [0, Pi], [0, 2*Pi].

tetrad_vectors

Tetrad of linearly-independent vectors.

emission_event

Emission event’s spacetime coordinates.

curve_receiver_interpolation

Timelike receiver curve’s coordinates and tangent vector interpolation.

metric_function

Metric line element as a function of spacetime coordinates.

metric_derivatives

List of metric line element derivatives w.r.t. spacetime coordinates.

metric_inverse

Inverted metric line element.

solver_setup_config

Class instance containing parameters for approximations and solvers.

affine_parameter_interval

Initial and final affine parameter value elapsing along solution curve.

Returns

Curve solving the initial value problem for given celestial angles.

greopy.emitter_observer_problem.spacelike_distance_minimisation(initial_angles: tuple[float, float], tetrad_vectors: tuple[ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]]], emission_event: ndarray[Any, dtype[float64]], curve_receiver_interpolation: interp1d, metric_function: Callable[[float, float, float, float], ndarray[Any, dtype[float64]]], metric_derivatives: Callable[[float, float, float, float], tuple[ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]]]], metric_inverse: Callable[[float, float, float, float], ndarray[Any, dtype[float64]]], solver_setup_config: _SolverSetupConfig, affine_parameter_interval: tuple[float64, float64] | None = None, affine_parameter_output: bool = False) float64

Find minimal spacelike coordinate difference between two curves.

For given initial angles and emission event, solve initial value problem for light ray curve and find minimal spacelike coordinate difference between light ray and some receiver curve.

Parameters

initial_angles

Reference frame dependent celestial coordinates covering the emitter’s celestial sphere; usually defined on the intervals [0, Pi], [0, 2*Pi].

tetrad_vectors

Tetrad of linearly-independent vectors.

emission_event

Emission event’s spacetime coordinates.

curve_receiver_interpolation

Timelike receiver curve’s coordinates and tangent vector interpolation.

metric_function

Metric line element as a function of spacetime coordinates.

metric_derivatives

List of metric line element derivatives w.r.t. spacetime coordinates.

metric_inverse

Inverted metric line element.

affine_parameter_interval

Initial and final affine parameter value elapsing along solution curve.

solve_ivp_absolute_tolerance

Absolute tolerance of the scipy.integrate.solve_ivp function.

solve_ivp_relative_tolerance

Relative tolerance of the scipy.integrate.solve_ivp function.

max_euclidean_distance

Maximum euclidean distance between light ray and receiver curves.

affine_parameter_output

Function returns affine parameter at minimal distance if True, minimal distance if False.

Returns

Minimal distance between curves or respective affine parameter value.

greopy.emitter_observer_problem.spacelike_geodesic_proper_length(emission_event: list[float] | ndarray[Any, dtype[float64]], reception_event: list[float] | ndarray[Any, dtype[float64]], metric_function: Callable[[float, float, float, float], ndarray[Any, dtype[float64]]], metric_derivatives: Callable[[float, float, float, float], tuple[ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]]]], metric_inverse: Callable[[float, float, float, float], ndarray[Any, dtype[float64]]], affine_parameter_mesh_length: int) float64

Calculate the geodesic’s proper length between two events.

The proper length along a curve in General Relativity is given by a line integral. The proper length between two events is calculated by first calculating a geodesic between the given events and then integrating along the resulting curve. The integral is calculated here using the [Chebyshev-Gauss] quadrature.

Parameters

emission_event

Emission event’s spacetime coordinates.

reception_event

Reception event’s spacetime coordinates.

metric_function

Metric line element as a function of spacetime coordinates.

metric_derivatives

List of metric line element derivatives w.r.t. spacetime coordinates.

metric_inverse

Inverted metric line element.

affine_parameter_mesh_length

Number of mesh nodes for the solution of the geodesic equation boundary-value problem.

Returns

Proper length of geodesic between events.

References

[Chebyshev-Gauss]

M. Abramowitz, IA Stegun, eds. “Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables” Dover (1972): 889.

greopy.emitter_observer_problem.spacelike_geodesic_solver(emission_event: ndarray[Any, dtype[float64]] | list[float], reception_event: ndarray[Any, dtype[float64]] | list[float], metric_derivatives: Callable[[float, float, float, float], tuple[ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]]]], metric_inverse: Callable[[float, float, float, float], ndarray[Any, dtype[float64]]], initial_mesh: ndarray[Any, dtype[float64]]) ODESolution

Instantiate and call the _SpacelikeGeodesicSolver class.

Parameters

emission_event

Emission event’s spacetime coordinates.

reception_event

Reception event’s spacetime coordinates.

metric_derivatives

List of metric line element derivatives w.r.t. spacetime coordinates.

metric_inverse

Inverted metric line element.

initial_mesh

Initial array containing affine parameter values at which geodesic should be calculated.

Returns

Solution to the boundary-value problem.

greopy.emitter_observer_problem.tangent_vector_lightlike(normalisation_factor: float, tetrad_vectors: tuple[ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]]], initial_angles: tuple[float, float], signal_frequency: float = 3600000000.0) ndarray[Any, dtype[float64]]

Calculate tangent vector for given celestial coordinates.

Since normalisation_factor can be chosen freely, vector is not necessarily normalised.

Parameters

normalisation_factor

Needs to be chosen correctly for correct normalisation.

tetrad_vectors

Tetrad of linearly-independent vectors.

initial_angles

Reference frame dependent celestial coordinates covering the emitter’s celestial sphere; usually defined on the intervals [0, Pi], [0, 2*Pi].

signal_frequency

Initial signal frequency measured in the emitter frame.

Returns

Tangent vector components defined via the celestial coordinates.

greopy.emitter_observer_solution_plot module

This module visualises the results of the emitter-observer problem.

greopy.emitter_observer_solution_plot.eop_plot(curve_1: DataFrame, curve_2: DataFrame, light_rays: list | Generator) None

Plot the emitter-observer problem setup with light ray solutions.

Parameters

curve_1

Curve 1 coordinates and tangent vector at each event.

curve_2

Curve 2 coordinates and tangent vector at each event.

light_rays

Indexed light ray curves’ coordinates and tangent vectors.

Returns

None

greopy.emitter_observer_solution_plot.plot_curve_arrays(spatial_coordinates: tuple[ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]]], axis: Axes3D) None

Plot curve given by spherical coordinate arrays.

Parameters

spatial_coordinates

Spherical coordinate arrays describing the curve.

axis

Determines the figure to be plotted in.

Returns

None

greopy.emitter_observer_solution_plot.plot_curve_dataframe(curve: DataFrame, axis: Axes3D) None

Plot curve from a DataFrame.

Parameters

curve

Curve coordinates and tangent vector at each event.

axis

Determines the figure to be plotted in.

Returns

None

greopy.emitter_observer_solution_plot.plot_sphere(radius_sphere: float64, axis: Axes3D) None

Plot a sphere of radius_sphere.

Here, the step length of mgrid is the complex number 30j, meaning the final point b of mgrid[a:b:step] is part of the grid. See the [mgrid] documentation for more info.

Parameters

radius_sphere

Spherical coordinate radius of the sphere to be plotted.

axis

Determines the figure to be plotted in.

Returns

None

References

greopy.initial_conditions module

This module calculates the curves’ initial temporal four-velocity component from a given set of spatial velocity components.

Code by Jan Patrick Hackstein

greopy.initial_conditions.initial_conditions_calc(config: Config) tuple[ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]]]

Return initial conditions for timelike curves.

Parameters

config

Configuration dictionary with event and spatial velocity information.

Returns

initial conditions

Initial events and four-velocities of given curves.

greopy.initial_conditions.x0_velocity_calc(metric_evaluated: ndarray[Any, dtype[float64]], spatial_velocity: ndarray[Any, dtype[float64]]) float

Calculate x0-component of four-velocity given a timelike normalisation.

x0 = c * t, where t is the coordinate time and c the speed of light.

Parameters

metric_function

Metric line element as a function of spacetime coordinates.

spatial_velocity

Spatial velocity tangent vector at given event.

Returns

x0-component of desired four-velocity tangent vector.

greopy.metric_config_numpy module

This module calculates symbolic expressions for the metric, its inverse and its derivatives w.r.t. coordinates and translates expressions into NumPy functions.

greopy.metric_config_numpy.metric_lambdified(metric_parametrised: MutableDenseMatrix) tuple[Callable[[float, float, float, float], ndarray[Any, dtype[float64]]], Callable[[float, float, float, float], tuple[ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]]]], Callable[[float, float, float, float], ndarray[Any, dtype[float64]]]]

Translate SymPy expressions into NumPy functions.

Parameters

metric_at_event

Metric line element as a function of spacetime coordinates.

Returns

Metric, its derivates w.r.t. given coordinates and its inverse as functions of event coordinates.

greopy.metric_config_numpy.metric_sympy_differentiate(metric_parametrised: MutableDenseMatrix) tuple[Expr, Expr, Expr, Expr]

Differentiate metric line element w.r.t. given coordinates.

Parameters

metric_at_event

Metric line element as a function of spacetime coordinates.

Returns

List of metric line element derivatives w.r.t. spacetime coordinates.

greopy.metric_config_sympy module

This module contains symbolic definitions of available metric line elements.

Line elements can be imported via the dictionary metric_line_elements with the corresponding key.

greopy.metric_config_sympy.centrifugal_potential(period_rotation: float) Expr

Calculate centrifugal potential symbolically in spherical-like coords.

Parameters

period_rotation

Gravitating mass’ period of rotation.

Returns

expression

Centrifugal potential at the given coordinates.

greopy.metric_config_sympy.gravitational_potential(multipole_moments: list[float], radius_reference: float, gravity_constant: float) Expr

Calculate gravitational potential symbolically in spherical-like coords.

Parameters

multipole_moments

Multipole moments of the gravitational potential. When interested in higher-order moments, add the required terms.

radius_reference

Radius coordinate for gravitating mass’ reference/average height.

gravity_constant

Gravitating mass’ measured gravity constant.

Returns

expression

Gravitational potential at the given coordinates.

greopy.metric_config_sympy.post_newton(multipole_moments: list[float], radius_reference: float, gravity_constant: float, period_rotation: float) Expr

Calculate line element symbolically in spherical-like coordinates.

The components metric_00 and metric_ij are given in harmonic coordinates, which need to be transformed into spherical coordinates via the standard coordinate transformation (see metric).

Parameters

multipole_moments

Multipole moments of the gravitational potential. When interested in higher-order moments, add the required terms to the gravitational_potential function.

radius_reference

Radius coordinate for gravitating mass’ reference/average height.

gravity_constant

Gravitating mass’ measured gravity constant.

period_rotation

Gravitating mass’ period of rotation.

Returns

expression

post-Newtonian metric line element at the given coordinates.

greopy.metric_config_sympy.schwarzschild(multipole_moments: list[float]) Expr

Calculate line element symbolically in spherical-like coordinates.

Parameters

multipole_moments

Monopole moment of the Schwarzschild metric, given by the product of the gravitational constant G and the gravitating object’s mass m.

Returns

Schwarzschild metric line element at the given coordinates.

greopy.orbit_calc module

Orbit calculation based on parameters defined in setup_params and params.

Code by Jan Patrick Hackstein

greopy.orbit_calc.gamma(metric_derivatives: Callable[[float, float, float, float], tuple[ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]]]], metric_inverse: Callable[[float, float, float, float], ndarray[Any, dtype[float64]]], event_coordinates: ndarray[Any, dtype[float64]]) ndarray[Any, dtype[float64]]

Calculate Christoffel symbols.

Parameters

metric_derivatives

List of metric line element derivatives w.r.t. spacetime coordinates.

metric_inverse

Inverted metric line element.

event_coordinates

Event’s spacetime coordinates.

Returns

Christoffel symbols

List of Christoffel symbols for a given event.

greopy.orbit_calc.geodesic_calc(config: Config, initial_conditions: tuple, step_numbers: tuple[int, int] | None = None) tuple[DataFrame, DataFrame]

Calculate timelike geodesics (curves) defined via initial conditions.

Parameters

config

Configuration dictionary containing metric information.

initial_conditions

Initial spacetime coordinates and four-velocity tangent vector.

step_numbers

Number of steps along the curve.

Returns

curve solutions

DataFrames with curve solutions.

greopy.orbit_calc.geodesic_equation(_affine_parameter: float, event_velocity_array: ndarray[Any, dtype[float64]], metric_derivatives: Callable[[float, float, float, float], tuple[ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]], ndarray[Any, dtype[float64]]]], metric_inverse: Callable[[float, float, float, float], ndarray[Any, dtype[float64]]]) ndarray[Any, dtype[float64]]

Calculate left-hand side of geodesic equation.

Parameters

_affine_parameter

Parameter elapsing along solution curve.

event_velocity_array

Event’s spacetime coordinates and given four-velocity tangent vector.

metric_derivatives

List of metric line element derivatives w.r.t. spacetime coordinates.

metric_inverse

Inverted metric line element.

Returns

geodesic equation

Components of geodesic equation’s left-hand side.

Module contents