uvex_transients.phase_space.analysis.compare.difference_map#

uvex_transients.phase_space.analysis.compare.difference_map(baseline: Table, comparison: Table, *, floor: float | None = None, check_meta: bool = True) → Table[source]#

Difference two recovery maps, in dex of the recovered yield.

At every point of the plane the difference is \(\Delta = \log_{10}(R_\mathrm{c} / R_\mathrm{b})\), with \(R = f\,w\) the recovered yield of the comparison and the baseline map: the success fraction times the weight \(w\) that the sampler of the maps declares (yield_weight, the volume-time \(\mathcal V T\) for a survey sampler, so that \(R\) is the recovered volume-time; a sampler with none compares the fractions). It is positive where the comparison recovers more. The maps are fitted independently, so the uncertainties of the two combine in quadrature, each taken from the half-width of the 1 sigma interval of the map.

A point of a map cannot tell a recovery fraction much below one recovery in its n_max events from none at all, so a map resolves \(f\) only down to about \(1/n_\mathrm{max}\). That is a limit of the measurement, not of what matters: a rare event can still be recovered often, where the volume-time is large, which is why the floor is on \(f\) and the rest of the difference is not cut. Wherever a map has \(f\) below floor, its \(f\) is replaced by floor: if only one map is below it, \(\Delta\) is then a bound (limit), and if both are, it is undefined (NaN).

Parameters:
  • baseline (astropy.table.Table) – The two maps, as made by grid_table(), or read from map.ecsv. They need the columns f, f_lo and f_hi and the column their weight metadata names (the same for both), and must be on the same grid of the same axes. A map that records no weight is weighted by its volume_time column if it has one.

  • comparison (astropy.table.Table) – The two maps, as made by grid_table(), or read from map.ecsv. They need the columns f, f_lo and f_hi and the column their weight metadata names (the same for both), and must be on the same grid of the same axes. A map that records no weight is weighted by its volume_time column if it has one.

  • floor (float, optional) – The recovery fraction below which a map is taken not to have recovered anything. If None (the default), the coarser of the resolutions of the two maps, \(1/n_\mathrm{max}\) from the n_max that each records. A map that does not (those made before it was recorded) is taken to resolve 1e-4.

  • check_meta (bool, optional) – Whether to require that the two maps agree on the quantities of COMPARED_META that they both record. A luminosity in one band is not one in another, so a comparison across them is only meaningful when it is deliberate. The default is True. The depth, the schedule and the definition of a detection are not checked, as they are what maps are most often compared for, and a map does not record them.

Returns:

One row per grid point, in the order of the maps, with their two coordinates and

delta_dex

\(\Delta\), in dex.

sigma_dex

Its 1 sigma uncertainty, in dex.

delta_dex_lo, delta_dex_hi

\(\Delta \mp \sigma\).

significance

\(\Delta / \sigma\).

limit

0 where \(\Delta\) is a measurement, +1 where the baseline is below floor so that \(\Delta\) is a lower bound, and -1 where the comparison is, so that it is an upper bound.

Its meta holds the space, the band, the unit of the luminosity and the zero point of the absolute magnitude (from the baseline), floor, and the metadata of each map as baseline_* and comparison_*.

Return type:

astropy.table.Table

Raises:

ValueError – If a map lacks a column, the maps are not on the same grid, or (with check_meta) they measure different axes.