API

Spacetime

Geometric functions

Allocating methods

Skylight.metricMethod
metric(position::AbstractVector, spacetime::AbstractSpacetime)

Evaluate the spacetime metric at the given position and return the result.

source
Skylight.metric_inverseMethod
metric_inverse(position::AbstractVector, spacetime::AbstractSpacetime)

Evaluate the inverse of the metric at the given position and return the result.

source
Skylight.volume_elementMethod
volume_element(position::AbstractVector, spacetime::AbstractSpacetime)

Compute $\sqrt{-\text{det}(g)}$ at the given position

source
Skylight.christoffelMethod
christoffel(position::AbstractVector, spacetime::AbstractSpacetime)

Evaluate the Christoffel symbols of the second kind at the given position and return the result as a 4x4x4 array Γ, where Γ[α,μ,ν] corresponds to

$\Gamma^\alpha_{\mu \nu} = \frac{1}{2} g^{\alpha \rho}(\partial_\mu g_{\rho \nu} + \partial_\nu g_{\rho \mu} - \partial_\rho g_{\mu \nu}).$

source

Non-allocating methods

For computing these quantities within tight loops, we suggest to use the following non-allocating methods that write the output on preallocated arrays, and use caches to store intermediate results.

Skylight.metric!Method
metric!(g::AbstractMatrix, position::AbstractVector, spacetime::AbstractSpacetime, cache::Union{Nothing, AbstractSpacetimeCache})

Evaluate the spacetime metric at the given position and store the result in g using cache for temporary storage.

The cache should be preallocated as cache = allocate_cache(spacetime).

See also allocate_cache.

source
Skylight.metric_inverse!Method
metric_inverse!(ginv::AbstractMatrix, position::AbstractVector, spacetime::AbstractSpacetime, g::AbstractMatrix, cache::Union{Nothing, AbstractSpacetimeCache})

Evaluate the inverse of the metric at the given position and store the result in the given array, using g and cache for temporary storage, which must be preallocated as g = zeros(4,4) and cache = allocate_cache(spacetime).

See also allocate_cache.

source
Skylight.volume_elementMethod
volume_element(position::AbstractVector, spacetime::AbstractSpacetime, g::AbstractMatrix, cache::Union{Nothing, AbstractSpacetimeCache})

Compute $\sqrt{-\text{det}(g)}$ at the given position, using g and cache for temporary storage, which must be preallocated as g = zeros(4,4) and cache = allocate_cache(spacetime).

See also allocate_cache.

source
Skylight.christoffel!Method
christoffel!(Γ::AbstractArray, position::AbstractVector, spacetime::AbstractSpacetime, cache::Union{Nothing,AbstractChristoffelCache})

Evaluate the Christoffel symbols of the second kind at the given position and store the result in Γ, where Γ[α,μ,ν] corresponds to

$\Gamma^\alpha_{\mu \nu} = \frac{1}{2} g^{\alpha \rho}(\partial_\mu g_{\rho \nu} + \partial_\nu g_{\rho \mu} - \partial_\rho g_{\mu \nu}).$

The cache must be preallocated as cache = allocate_christoffel_cache(spacetime).

See also allocate_christoffel_cache.

source

Other functions

Skylight.radiusMethod
radius(position, spacetime)

Radius of the given position in the given spacetime.

source
Skylight.isco_radiusMethod
isco_radius(spacetime, rotation_sense::AbstractRotationSense)

Radius of the innermost stable circular orbit in the given spacetime and rotation sense (either Prograde() or Retrograde()).

source
Skylight.mbco_radiusMethod
mbco_radius(spacetime, rotation_sense::AbstractRotationSense)

Radius of the marginally bound circular orbit in the given spacetime and rotation sense (either Prograde() or Retrograde()).

source
Skylight.circular_geodesic_angular_speedMethod
circular_geodesic_angular_speed(position, spacetime, rotation_sense::AbstractRotationSense)

Angular speed of a circular geodesic at the given positioninspacetime`for a particle rotating in the givenrotation_sense`.

source

Cache allocation

Skylight.allocate_cacheMethod
allocate_cache(spacetime::AbstractSpacetime)

Allocate a cache object for the given spacetime. The cache object is used to store temporary data in spacetime-related calculations.

See also metric!.

source

Radiative model

Skylight.rest_frame_four_velocity!Method
rest_frame_four_velocity!(vector::AbstractVector, position::AbstractVector, metric::AbstractMatrix, spacetime::AbstractSpacetime, model::AbstractRadiativeModel, coords_top::AbstractCoordinatesTopology, spacetime_cache::AbstractSpacetimeCache, model_cache::AbstractModelCache)

Rest frame four velocity of the model at given `position`. This is the frame where the model radiative functions are defined.

Arguments

  • vector: Output vector.
  • position: Position where the four-velocity is evaluated.
  • metric: Metric tensor at position.
  • spacetime: Spacetime.
  • model: Radiative model.
  • coords_top: Coordinates topology.
  • spacetime_cache: Spacetime cache.
  • model_cache: Model cache.

See also

source
Skylight.rest_frame_bolometric_intensityMethod
rest_frame_bolometric_intensity(position::AbstractVector, momentum::AbstractVector, rest_frame_four_velocity::AbstractVector, metric::AbstractMatrix, spacetime::AbstractSpacetime, model::AbstractRadiativeModel, coords_top::AbstractCoordinatesTopology, cache::AbstractModelCache)

Bolometric intensity of the model at given `position`.

Arguments

  • position: Position where the intensity is evaluated.
  • momentum: Momentum of the emission (frequency and direction).
  • rest_frame_four_velocity: Rest frame four velocity of the model at position. Must but be normalized.
  • metric: Metric tensor at position.
  • spacetime: Spacetime.
  • model: Radiative model.
  • coords_top: Coordinates topology.
  • cache: Model cache.

See also

source
Skylight.rest_frame_specific_intensityMethod
rest_frame_specific_intensity(position::AbstractVector, momentum::AbstractVector, energy::Real, rest_frame_four_velocity::AbstractVector, metric::AbstractMatrix, spacetime::AbstractSpacetime, model::AbstractRadiativeModel, coords_top::AbstractCoordinatesTopology, cache::AbstractModelCache)

Specific intensity of the model at given `position`.

Arguments

  • position: Position where the intensity is evaluated.
  • momentum: Momentum of the emission (frequency and direction).
  • energy: Energy of the emission. This should be assumed to be in CGS units.
  • rest_frame_four_velocity: Rest frame four velocity of the model at position. Must but be normalized.
  • metric: Metric tensor at position.
  • spacetime: Spacetime.
  • model: Radiative model.
  • coords_top: Coordinates topology.
  • cache: Model cache.

See also

source
Skylight.is_final_position_at_sourceMethod
is_final_position_at_source(position::AbstractVector, spacetime::AbstractSpacetime, model::AbstractRadiativeModel)

Check if the final position of the photon is at the source of the model. This function is used in the observer-to-emitter method
in vacuum to discard rays that do not intersect the source.

Arguments

  • position: Final position of the geodesic.
  • spacetime: Spacetime.
  • model: Radiative model.
source
Skylight.lorentz_factorsMethod
lorentz_factors(positions, spacetime::AbstractSpacetime, model::AbstractRadiativeModel)

Lorentz factors of the rest frame four velocities of `model` at given list of positions. Positions should be an iterable
object with the positions as elements.

# Returns

An array with the Lorentz factors of the rest frame four velocities of the model at the given positions.

# Example

```
positions = [[0.0, 5.0, 0.0, 0.0], [1.0, 0.0, 5.0, 0.0]]
spacetime = SchwarzschildSpacetimeSphericalCoordinates(M=1.0)
model = DummyModel()
γ = lorentz_factors(positions, spacetime, model)
```
source
Skylight.allocate_cacheMethod
allocate_cache(model::AbstractRadiativeModel)

Allocate a cache object for the given model. The cache object is used to store temporary data in radiative-model-related calculations.

source

Surface emission models

Skylight.surface_differential!Method
surface_differential!(differential::AbstractVector, position::AbstractVector, model::AbstractSurfaceEmissionModel, coords_top::AbstractCoordinatesTopology)

Differential of the function defining the emitting surface in the model. For example, for an emitting sphere in Cartesian coordinates, the output would be `[0,2x,2y,2z]`.
The normalization of the differential is not important, as it is only used to calculate the surface (unit) normal in terms of the metric.

Arguments

  • differential: Output vector.
  • position: Position where the differential is evaluated.
  • model: Radiative model.
  • coords_top: Coordinates topology.
source

Thermal emission models

Skylight.temperatureMethod
temperature(position::AbstractVector, spacetime::AbstractSpacetime, model::AbstractRadiativeModel)

Temperature of the model at given `position`.
source

Line emission models

Skylight.line_emission_profileMethod
line_emission_profile(position::AbstractVector, momentum::AbstractVector, rest_frame_four_velocity::AbstractVector, metric::AbstractMatrix, spacetime::AbstractSpacetime, model::AbstractRadiativeModel, coords_top::AbstractCoordinatesTopology, cache::AbstractModelCache)

Emissivity profile for line emission radiative models.

Arguments

  • position: Position of the emission.
  • momentum: Momentum of the emission (frequency and direction). Must be null.
  • rest_frame_four_velocity: Rest frame four velocity of the model at position. Must but be normalized.
  • metric: Metric tensor at position.
  • spacetime: Spacetime.
  • model: Radiative model.
  • coords_top: Coordinates topology.
  • cache: Model cache.

See also

source