Point functions
Gradus.AbstractPointFunction
— Typeabstract type AbstractPointFunction
Abstract super type for point functions. Must have f::Function
field.
Gradus.PointFunction
— Typestruct PointFunction <: AbstractPointFunction
PointFunction(func)
Point functions are functions that are used to calculate physical parameters from geodesic integrations, and to compose more complex models. A number of default and utility PointFunction
are defined in Gradus.ConstPointFunctions
.
Principally, point functions return a single value per geodesic, and are used to fill rendered images with values, e.g. colouring redshift.
Point functions may be instantiated by wrapping a function with the following signature
function func(m::AbstractMetric{T}, gp::AbstractGeodesicPoint, max_time::T; kwargs...)::T where {T}
# ...
end
pf = PointFunction(func)
- The
AbstractMetric
argument may be used to dispatch for different metrics. gp
is anAbstractGeodesicPoint
corresponding to a given geodesic.- The
max_time
parameter is the maximum integration time used to integrate the geodesics. This may be useful when trying to determine whether a geodesic terminated early or not.
They may be invoked by invoking the instance
result = pf(m, gp, max_time)
As of version 0.1.0, the kwargs
parameter is reserved only for passing optional results when chaining multiple point functions (see below). This is subject to revision and breaking changes in future versions.
Multiple AbstractPointFunction
may be chained together using the ∘
operator, and are evaluated from right to left
pf3 = pf2 ∘ pf1
This may be useful for constructing filters using FilterPointFunction
. When used with two PointFunction
objects, the output of the previous PointFunction
is passed to the next via the value
keyword argument.
Gradus.FilterPointFunction
— Typestruct FilterPointFunction <: AbstractPointFunction
FilterPointFunction(func, default_value)
Point functions used to filter geodesics. They may be constructed with
function func(m::AbstractMetric{T}, gp::AbstractGeodesicPoint, max_time::T; kwargs...)::Bool where {T}
# ... return Bool
end
fpf = FilterPointFunction(func, NaN64)
The second argument to the constructor is the default value, given to the pixel if the boolean condition of func
is false
.
Example
A filter for geodesics within a certain radius, used to only calculate redshift within 10 $\r_\text{g}$
func(m, gp, max_time) = gp.u[2] < 10.0
pf = ConstPointFunctions.redshift(m, u) ∘ FilterPointFunction(func, NaN64)
Pre-defined point functions
Gradus.ConstPointFunctions
— Modulemodule ConstPointFunctions
Module defining a number of const
Gradus.AbstractPointFunction
, serving different utility or common purposes for analysis.
Gradus.ConstPointFunctions.filter_early_term
— Functionfilter_early_term(m::AbstractMetric, gp::AbstractGeodesicPoint, max_time)
A FilterPointFunction
that filters geodesics that termined early (i.e., did not reach maximum integration time or effective infinity). Default: NaN
.
Gradus.ConstPointFunctions.filter_intersected
— Functionfilter_intersected(m::AbstractMetric, gp::AbstractGeodesicPoint, max_time)
A FilterPointFunction
that filters geodesics which intersected with the accretion disc. Default: NaN
.
Gradus.ConstPointFunctions.affine_time
— Functionaffine_time(m::AbstractMetric, gp::AbstractGeodesicPoint, max_time)
A PointFunction
returning the affine integration time at the endpoint of the geodesic.
Gradus.ConstPointFunctions.shadow
— Functionshadow(m::AbstractMetric, gp::AbstractGeodesicPoint, max_time)
A PointFunction
which colours the shadow of the black hole for any disc-less render. Equivalent to ConstPointFunctions.affine_time ∘ ConstPointFunctions.filter_early_term
.
Gradus.ConstPointFunctions.redshift
— Functionredshift(m::AbstractMetric)
Returns a PointFunction
.
Calculate the analytic redshift at a given geodesic point, assuming equatorial, geometrically thin accretion disc. Implementation depends on the metric type. Currently implemented for
Notes
Wraps calls to Gradus._redshift_guard
to dispatch different implementations.