This is a Julia implementation of a delayed corrected probabilistic flux variation gradient. Advantages over the PVFG include:
- It can deal with the presence of delays in the light curves.
- It can deal with irregularly sampled light curves.
After installing the package, see here, you can proceed to the example below.
Apart from cloning, an easy way of using the package is the following:
1 - Add the registry AINJuliaRegistry
2 - Switch into "package mode" with ]
and add the package with
add DelayCorrectedPFVG
The present code relies in the background on the Gaussian Process cross-correlation model in order to obtain the most likely delays. As it is a computationally intensive method, we recommend running it using multiple threads. We provide information here on how to do this.
Method simulatetwolightcurves
can be used to simulate data in 2 arbitrary (non-physical) bands:
using DelayCorrectedPFVG
tobs, yobs, σobs, truedelays = simulatetwolightcurves() # output omitted
For more details, please refer to the following section in package GPCC for the simulation of data.
The following script provides a complete receipe on how to infer the posterior of the scaling and shifting parameters and the density of the intersection point.
Start Julia with multiple threads, e.g. julia -t8
starts Julia with 8 threads.
Then use the following:
using DelayCorrectedPFVG
# Execute the following for better performance with multiple threads
using LinearAlgebra
BLAS.set_num_threads(1) # Set the number of BLAS threads to 1
using ThreadPinning # must be indepedently installed
pinthreads(:cores) # allows you to pin Julia threads to specific CPU-threads
warmup() # run this for Julia to precompile code
# Simulate some data
tobs, yobs, σobs, truedelays = simulatetwolightcurves()
# Define candidate delays
candidatedelays = collect(0.0:0.1:5.0)
# Get posterior of scaling and shifting parameters
# logl is the returned log-likelihood, i.e. the "quality of the posterior"
# q is the posterior of the scaling and shifting parameters
# delay is the most likely vector of delays
logl, q, delay = posteriors_a_b(tobs, yobs, σobs, candidatedelays, kernel=rbf, iterations = 10_000)
# We assume that the galaxy vector is given by `u`.
u = [6.0; 15.0] # this the shift vector that was used to shift the synthetic data.
# define candidate intersection points u/norm(u)⋅t
t = 0:0.1:60
# obtain probabilities for each candidate insersection point implied by u⋅t
pmf = intersectionprobabilities(q, u/norm(u), t); # note that the galaxy vector is normalised
using PyPlot # needs to be independently installed (or other plotting package)
figure("probability of intersection points implied by u⋅t")
plot(t, pmf)
# The peak of the plot above should be at around:
norm(u)