gstlal-inspiral  1.9.3
 All Classes Namespaces Files Functions
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
stats.inspiral_extrinsics.TimePhaseSNR Class Reference
Inheritance diagram for stats.inspiral_extrinsics.TimePhaseSNR:
[legend]
Collaboration diagram for stats.inspiral_extrinsics.TimePhaseSNR:
[legend]

Public Member Functions

def __init__
 
def to_hdf5
 
def from_hdf5
 
def combos
 
def pairs
 
def slices
 
def instrument_pair_slices
 
def instrument_combos
 
def instrument_pairs
 
def dtdphideffpoints
 
def tile
 
def __call__
 

Public Attributes

 instruments
 
 norm
 
 transtt
 
 transtp
 
 transpt
 
 transpp
 
 transdd
 
 tree_data
 
 margsky
 
 snr
 
 psd_fname
 
 KDTree
 

Static Public Attributes

dictionary responses = {"H1": lal.CachedDetectors[lal.LHO_4K_DETECTOR].response, "L1":lal.CachedDetectors[lal.LLO_4K_DETECTOR].response, "V1":lal.CachedDetectors[lal.VIRGO_DETECTOR].response, "K1":lal.CachedDetectors[lal.KAGRA_DETECTOR].response}
 
dictionary locations = {"H1":lal.CachedDetectors[lal.LHO_4K_DETECTOR].location, "L1":lal.CachedDetectors[lal.LLO_4K_DETECTOR].location, "V1":lal.CachedDetectors[lal.VIRGO_DETECTOR].location, "K1":lal.CachedDetectors[lal.KAGRA_DETECTOR].location}
 
int numchunks = 20
 

Detailed Description

The goal of this is to compute:

.. math::

    P(\\vec{\\rho}, \\vec{t}, \\vec{\phi} | \\vec{O}, \\vec{D_H}, s)

Instead of evaluating the above probability we will parameterize it by
pulling out an overall term that scales as the network SNR to the negative
fourth power.

.. math::

    P(\\vec{\\rho}, \\vec{t}, \\vec{\phi} | \\vec{O}, \\vec{D_H}, s)
    \\approx
    P(\\vec{\\rho_{\mathrm{1\,Mpc}}}, \\vec{t}, \\vec{\phi} | \\vec{O}, \\vec{D_H}, s) \\times |\\vec{\\rho}|^{-4}


We reduce the dimensionality by computing things relative to the first
instrument in alphabetical order and use effective distance instead of SNR,
e.g.,

.. math::
        P(\\vec{D_{\mathrm{eff}}} / D_{\mathrm{eff}\,0}, \\vec{t} - t_0, \\vec{\phi} - \phi_0 | \\vec{O}, s)
    \\times
        |\\vec{\\rho}|^{-4}
    \equiv
        P(\\vec\lambda|\\vec{O}, s)
    \\times
        |\\vec{\\rho}|^{-4}

where now the absolute geocenter end time or coalescence phase does not
matter since our new variables are relative to the first instrument in
alphabetical order (denoted with 0 subscript).  Since the first component of
each of the new vectors is one by construction we don't track it and have
reduced the dimensionality by three.

We won't necessarily evalute exactly this distribution, but something
that should be proportional to it.  In order to evaluate this distribution. We
assert that physical signals have a uniform distribution in earth based
coordinates, :math:`\mathrm{RA}, \cos(\mathrm{DEC}), \cos(\iota), \psi`.  We
lay down a uniform densly sampled grid in these coordinates and assert that any
signal should ``exactly" land on one of the grid points. We transform that
regularly spaced grid into a grid of (irregularly spaced) points in
:math:`\\vec{\lambda}`, which we denote as :math:`\\vec{\lambda_{\mathrm{m}i}}`
for the *i*\ th model lambda vector.  We consider that the **only** mechanism
to push a signal away from one of these exact *i*\ th grid points is Gaussian
noise.  Furthermore we assume the probability distribution is of the form:

.. math::

    P(\\vec{\lambda} | \\vec{O}, \\vec{\lambda_{mi}})
    =
        \\frac{1}{\sqrt{(2\pi)^k |\pmb{\Sigma}|}}
        \exp{ \left[ -\\frac{1}{2} \\vec{\Delta\lambda}^T \, \pmb{\Sigma}^{-1} \, \\vec{\Delta\lambda} \\right] }

where :math:`\\vec{\Delta\lambda_i} = \\vec{\lambda} -
\\vec{\lambda_{\mathrm{m}i}}` and :math:`\pmb{\Sigma}` is diagonal.
For simplicity here forward we will set :math:`\pmb{\Sigma} = 1` and will drop the normalization, i.e.,

.. math::

    P(\\vec{\lambda} | \\vec{O}, \\vec{\lambda_{mi}})
    \propto
        \exp{ \left[ -\\frac{1}{2} \\vec{\Delta\lambda_i}^2 \\right] }

Then we assert that:

.. math::

    P(\\vec\lambda|\\vec{O}, \\vec{D_H}, s) \propto \sum_i P(\\vec{\lambda} | \\vec{O}, \\vec{\lambda_{mi}}) \, p(\\vec{\lambda_{mi}})

Where by construction :math:`p(\\vec{\lambda_{mi}})` doesn't depend on
*i* since they were chosen uniform in prior signal probabality. Computing this
probability on the fly is tough since the grid might have millions of points.
Therefore we make another simplifying assumption that the noise only adds a
contribution which is orthogonal to the hypersurface defined by the signal.  In
other words, we assume that noise cannot push a signal from one grid point
towards another along the signal manifold.  In this case we can simplify the
marginalization step with a precomputation since

.. math::

    \sum_i P(\\vec{\lambda} |\\vec{O}, \\vec{\lambda_{mi}}) \\approx P(\\vec{\lambda} |\\vec{O}, \\vec{\lambda_{m0}}) \\times \sum_{i > 0} \exp{ \left[ -\\frac{1}{2} \\vec{\Delta x_i}^2 \\right] }


Where :math:`\\vec{\lambda_{m0}}` is the **nearest neighbor** to the
measured :math:`\\vec{\lambda}`.  The :math:`\\vec{\Delta x_i}^2` term is the
distance squared for the *i*\ th grid point and the nearest neighbor point 0.
This entire sum can be precomputed and stored.

The geometric interpretation is shown in the following figure:

.. image:: ../images/TimePhaseSNR01.png
   :width: 400px

In order for this endeavor to be successful, we still need a fast way
to find the nearest neighbor. We use scipy KDTree to accomplish this.

Definition at line 1082 of file inspiral_extrinsics.py.

Constructor & Destructor Documentation

def stats.inspiral_extrinsics.TimePhaseSNR.__init__ (   self,
  instruments = ("H1", "L1",
  V1,
  K1,
  transtt = None,
  transtp = None,
  transpt = None,
  transpp = None,
  transdd = None,
  norm = None,
  tree_data = None,
  margsky = None,
  verbose = False,
  margstart = 0,
  margstop = None,
  SNR = None,
  psd_fname = None 
)
Initialize a new class from scratch via explicit computation
of the tree data and marginalized probability distributions or by providing
these.  **NOTE** generally speaking a user will not initialize
one of these from scratch, but instead will read the data from disk using the
from_hdf() method below.

transtt, transtp, transpt, transpp, transdd are required.  They
can be produced by running gstlal_inspiral_compute_dtdphideff_cov_matrix.  An
example is here

gstlal_inspiral_compute_dtdphideff_cov_matrix --psd-xml share/O3/2019-05-09-H1L1V1psd_new.xml.gz --H-snr 5 --L-snr 7.0 --V-snr 2.25

transtt = {frozenset(['V1', 'H1']): 1721.2939671945821, frozenset(['H1', 'L1']): 4264.931381497161, frozenset(['V1', 'L1']): 1768.5971596859304}
transtp = {frozenset(['V1', 'H1']): -1.620591401760186, frozenset(['H1', 'L1']): -3.07346071253937, frozenset(['V1', 'L1']): -1.7020167980031902}
transpt = {frozenset(['V1', 'H1']): 0.0, frozenset(['H1', 'L1']): 0.0, frozenset(['V1', 'L1']): 0.0}
transpp = {frozenset(['V1', 'H1']): 1.2422379329336048, frozenset(['H1', 'L1']): 2.6540061786001834, frozenset(['V1', 'L1']): 1.2984050700516363}
transdd = {frozenset(['V1', 'H1']): 2.0518233866439894, frozenset(['H1', 'L1']): 4.068667356033675, frozenset(['V1', 'L1']): 2.1420642628918447}

norm is required. An example is:

norm = {('H1', 'V1'):332.96168414700816, ('H1', 'L1', 'V1'):7.729877009864116, ('L1', 'V1'):313.34679951193306, ('L1',):0.0358423687136922, ('H1', 'L1'):409.06489455239137, ('H1',):0.0358423687136922, ('V1',):0.0358423687136922}

typically a user would make a new inspiral_dt_dphi_pdf.h5 file
which contains all of these by running:

gstlal_inspiral_create_dt_dphi_snr_ratio_pdfs_dag

Definition at line 1188 of file inspiral_extrinsics.py.

Member Function Documentation

def stats.inspiral_extrinsics.TimePhaseSNR.__call__ (   self,
  time,
  phase,
  snr,
  horizon 
)
Compute the probability of obtaining time, phase and SNR values
for the instruments specified by the input dictionaries.  We also need the
horizon distance because we convert to effective distance internally.

>>> TimePhaseSNR({"H1":0, "L1":0.001, "V1":0.001}, {"H1":0., "L1":1., "V1":1.}, {"H1":5., "L1":7., "V1":7.}, {"H1":1., "L1":1., "V1":1.})
array([  9.51668418e-14], dtype=float32)

Definition at line 1545 of file inspiral_extrinsics.py.

def stats.inspiral_extrinsics.TimePhaseSNR.combos (   self)
return instrument combos for all the instruments internally stored in self.responses

>>> TimePhaseSNR.combos
(('H1', 'L1'), ('H1', 'L1', 'V1'), ('H1', 'V1'), ('L1', 'V1'))

Definition at line 1377 of file inspiral_extrinsics.py.

def stats.inspiral_extrinsics.TimePhaseSNR.dtdphideffpoints (   self,
  time,
  phase,
  deff,
  slices 
)
Given a dictionary of time, phase and deff, which could be
lists of values, pack the delta t delta phi and eff distance
ratios transformed by the covariance matrix according to
the rules provided by slices.

>>> TimePhaseSNR.dtdphideffpoints({"H1":0, "L1":-.001, "V1":.001}, {"H1":0, "L1":0, "V1":1}, {"H1":1, "L1":3, "V1":4}, TimePhaseSNR.slices)
array([[ 1.        ,  0.        , -5.        , -1.        , -2.54647899,
    -5.        , -2.        , -2.54647899, -5.        ]], dtype=float32)

**NOTE** You must have the same ifos in slices as in the time,
phase, deff dictionaries.  The result of self.slices gives slices for all the
instruments stored in self.responses

Definition at line 1461 of file inspiral_extrinsics.py.

def stats.inspiral_extrinsics.TimePhaseSNR.from_hdf5 (   cls,
  fname,
  other_fnames = [],
  instruments = ("H1", "K1",
  L1,
  V1,
  kwargs 
)
Initialize one of these from a file instead of computing it from scratch

Definition at line 1338 of file inspiral_extrinsics.py.

def stats.inspiral_extrinsics.TimePhaseSNR.instrument_combos (   cls,
  instruments,
  min_instruments = 2 
)
Given a list of instrument produce all the possible combinations of min_instruents or greater, e.g.,

>>> TimePhaseSNR.instrument_combos(("H1","V1","L1"), min_instruments = 3)
(('H1', 'L1', 'V1'),)
>>> TimePhaseSNR.instrument_combos(("H1","V1","L1"), min_instruments = 2)
(('H1', 'L1'), ('H1', 'L1', 'V1'), ('H1', 'V1'), ('L1', 'V1'))
>>> TimePhaseSNR.instrument_combos(("H1","V1","L1"), min_instruments = 1)
(('H1',), ('H1', 'L1'), ('H1', 'L1', 'V1'), ('H1', 'V1'), ('L1',), ('L1', 'V1'), ('V1',))

**NOTE**: these combos are always returned in alphabetical order

Definition at line 1421 of file inspiral_extrinsics.py.

def stats.inspiral_extrinsics.TimePhaseSNR.instrument_pair_slices (   self,
  pairs 
)
define slices into tree data for a given set of instrument
pairs (which is possibly a subset of the full availalbe pairs)

Definition at line 1412 of file inspiral_extrinsics.py.

def stats.inspiral_extrinsics.TimePhaseSNR.instrument_pairs (   self,
  instruments 
)
Given a list of instruments, construct all possible pairs

>>> TimePhaseSNR.instrument_pairs(("H1","K1","V1","L1"))
(('H1', 'K1'), ('H1', 'L1'), ('H1', 'V1'))

**NOTE**: These are always in alphabetical order

Definition at line 1446 of file inspiral_extrinsics.py.

def stats.inspiral_extrinsics.TimePhaseSNR.pairs (   self)
Return all possible pairs of instruments for the
instruments internally stored in self.responses
>>> TimePhaseSNR.pairs
(('H1', 'L1'), ('H1', 'V1'), ('L1', 'V1'))

Definition at line 1387 of file inspiral_extrinsics.py.

def stats.inspiral_extrinsics.TimePhaseSNR.slices (   self)
This provides a way to index into the internal tree data for
the delta T, delta phi, and deff ratios for each instrument pair.

>>> TimePhaseSNR.slices
{('H1', 'L1'): [0, 1, 2], ('H1', 'V1'): [3, 4, 5], ('L1', 'V1'): [6, 7, 8]}

Definition at line 1401 of file inspiral_extrinsics.py.

def stats.inspiral_extrinsics.TimePhaseSNR.tile (   cls,
  NSIDE = 16,
  NANGLE = 33,
  verbose = False 
)
Tile the sky with equal area tiles defined by the healpix NSIDE
and NANGLE parameters.  Also tile polarization uniformly and inclination
uniform in cosine.  Convert these sky coordinates to time, phase and deff for
each instrument in self.responses.  Return the sky tiles in the detector
coordinates as dictionaries.  The default values have millions
of points in the 4D grid

Definition at line 1498 of file inspiral_extrinsics.py.

def stats.inspiral_extrinsics.TimePhaseSNR.to_hdf5 (   self,
  fname 
)
If you have initialized one of these from scratch and want to
save it to disk, do so.

Definition at line 1308 of file inspiral_extrinsics.py.


The documentation for this class was generated from the following file: