Firefly.jl
A tool for characterizing directly-imaged exoplanets in a Bayesian framework
Installation
From Julia (v"1.3"
)
julia>]
(1.3) pkg> add Firefly
API/Reference
Firefly.PoissonInvariant
— TypePoissonInvariant(a, b) <: ContinuousUnivariateDistribution
A Poisson invariant distributions truncated from a
to b
.
This distribution is derived from the determinant of the Fisher information matrix
$p(x) \propto \sqrt{E\left[\left(\frac{d\ln{L}}{dx} \right)^2 \right]}$
which gives $p(x)\propto 1/\sqrt{x}$
Form
$p(x) = \frac{1}{2(\sqrt{b} - \sqrt{a})\sqrt{x}}\quad\forall{x\in (a,b)}$
Supported Functions
These functions have been explicitly written for RadialUniform
from Distributions.jl. There may be more functionality available from fallback methods, but the following are guaranteed to work.
Examples
julia> using Distributions
julia> dist = PoissonInvariant(0, 1)
PoissonInvariant{Float64}(a=0.0, b=1.0)
julia> pdf(dist, -1)
0.0
julia> pdf(dist, 3)
0.0
julia> cdf(dist, quantile(dist, 0.5))
0.5
Firefly.RadialUniform
— TypeRadialUniform(r_in, r_out) <: ContinuousUnivariateDistribution
A radially uniform distribution from r_in
to r_out
.
This distribution is derived from the change of variables evaluation of
$p(r, \theta) = p(x, y)\left|\nabla_{r,\theta}(x, y) \right|$
which given $p(x, y)\propto 1$, leads to $p(r, \theta)\propto r$
Form
$p(r) = \frac{2r}{r_\text{out}^2 - r_\text{in}^2}\quad\forall{r\in (r_\text{in}, r_\text{out})}$
Supported Functions
These functions have been explicitly written for RadialUniform
from Distributions.jl. There may be more functionality available from fallback methods, but the following are guaranteed to work.
Examples
julia> using Distributions
julia> dist = RadialUniform(0, 10)
RadialUniform{Float64}(r_in=0.0, r_out=10.0)
julia> pdf(dist, -1)
0.0
julia> pdf(dist, 3)
0.06
julia> cdf(dist, quantile(dist, 0.5))
0.5000000000000001
Firefly.findpeak
— Methodfindpeak(::AbstractVector)
findpeak(::Chains, [::Symbol])
Return a naïve maximum a posteriori (MAP) estimate from a chain.
This uses kernel density estimation (KDE) to estimate the continuous posterior distribution from the input chain and simply returns its max argument. This is naïve because we should not consider KDE peaks to be true "modes" or MAP estimates. Estimating accurate modes of a posterior sample is still an active area of statistical research.
Examples
julia> samples = randn(2000);
julia> findpeak(samples) # should be close to 0
-0.24696046398697033
Firefly.findpeaks
— Methodfindpeaks(::AbstractVector, [n])
findpeaks(::Chains, [::Symbol], [n])
Return the first n
naïve maximum a posteriori (MAP) estimates from a chain.
This uses kernel density estimation (KDE) to estimate the continuous posterior distribution from the input sample and finds maxima via the finite-difference estimation of the derivative. This is naïve because we should not consider KDE peaks to be true "modes" or MAP estimates. Estimating accurate modes of a posterior sample is still an active area of statistical research.
Examples
julia> samples = append!(randn(1000), randn(800) .+ 10);
julia> findpeaks(samples, 2) # should be close to [0, 10]
2-element Array{Float64,1}:
-0.059655173778625246
9.987428704498656
License
This package is licensed under the MIT Expat license. See LICENSE for more information.