Class Edsd

java.lang.Object
uk.ac.starlink.dpac.math.Edsd

public class Edsd extends Object
Calculates quantities related to the Exponentially Decreasing Space Density prior for estimating distances from parallaxes.
Since:
15 Mar 2018
Author:
Mark Taylor
  • Constructor Details

    • Edsd

      public Edsd(double plx, double eplx, double l)
      Constructor. The units are either max and kpc or arcsec and parsec.
      Parameters:
      plx - parallax
      eplx - error in parallax
      l - distance scale
  • Method Details

    • getBestEstimation

      public double getBestEstimation()
      Returns the position of the favoured mode of the PDF. This is considered to be the best estimator of the distance.
      Returns:
      distance PDF mode in kpc or parsec; the lower one if there are two
    • getUnnormalizedProbabilityAt

      public double getUnnormalizedProbabilityAt(double r)
      Returns the unnormalized PDF (posterior) for this prior evaluated at a given distance.

      Note this differs by a numerical factor (a function of plx, eplx and l) from the similarly named function in gaia.cu9.tools.parallax.PDF.ExpDecrVolumeDensityDEM. This nominally makes no difference, since the result of this function is declared unnormalised and will generally be scaled before further use. However, in practice this method will return a definite result for parameter ranges in which the CU9 code faces numerical overflow and returns Infinity.

      Parameters:
      r - distance (in kpc or parsec)
      Returns:
      unnormalised probability density
    • getPdf

      public Function getPdf()
      Returns the PDF corresponding to this prior. This is not normalised in the sense that the area under it is unity, but it is scaled so that the best estimate equals 1.
      Returns:
      sort-of normalised PDF
    • calculateCdf

      public NumericFunction calculateCdf(double tol)
      Integrates the PDF to provide a numerical approximation of the cumulative density function. The output range in distance is between r=0 and the radius above which the PDF is close to zero. The output is normalised, so its value is zero at r=0 and unity at the largest r.

      Careful when interpolating this. The spline interpolation for plx=40, eplx=0.75, l=1.35 gives some nasty results at high r. Linear and quadratic interpolations are OK.

      Parameters:
      tol - calculation tolerance
      Returns:
      normalised numerical CDF samples
    • getSampledPdf

      public NumericFunction getSampledPdf(NumericFunction cdf)
      Returns a numerical reconstruction of the PDF based on the samples used to perform the CDF integration. This can be used to assess the quality of the integration, at least by eye.
      Parameters:
      cdf - calculated cumulative density function; this is only used to supply the sample X values
      Returns:
      PDF evaluated at the CDF X values