dD = []

for coinc in coincs:
    inj_pt = (coinc.latitude_inj, coinc.longitude_inj)

    if len(coinc.ifo_list) < 3:
        continue
    else:
        if opts.snr_threshold:
            rhosquared = 0.0
            for ifo in coinc.ifo_list:
                rhosquared += coinc.snr[ifo] * coinc.snr[ifo]
            dtrss_inj = sqrt(rhosquared) * skylocutils.get_delta_t_rss(inj_pt, coinc, opts.reference_frequency) / 10.0
        else:
            dtrss_inj = skylocutils.get_delta_t_rss(inj_pt, coinc, opts.reference_frequency)
        dDrss_inj = skylocutils.get_delta_D_rss(inj_pt, coinc)
        dt.append(dtrss_inj)
        dD.append(dDrss_inj)

# for the kdes
npts = opts.Npts

dtbw = compute_bw(dt, npts)
dtdat = np.array(dt, "float").reshape(len(dt), 1)
pdtx = np.linspace(0.0, max(dt), npts)
pdty = [skylocutils.gaussian_kde(dtdat, xn, dtbw) for xn in pdtx]
pdtnorm = np.trapz(pdty, pdtx)
Ptx = pdtx
Pty = np.array([np.trapz(pdty[:i], Ptx[:i]) / pdtnorm for i in np.arange(1, len(Ptx) + 1)])

dDbw = compute_bw(dD, npts)
Esempio n. 2
0
for coinc in coincs:
    inj_pt = (coinc.latitude_inj, coinc.longitude_inj)

    if len(coinc.ifo_list) < 3:
        continue
    else:
        if opts.snr_threshold:
            rhosquared = 0.0
            for ifo in coinc.ifo_list:
                rhosquared += coinc.snr[ifo] * coinc.snr[ifo]
            dtrss_inj = sqrt(rhosquared) * skylocutils.get_delta_t_rss(
                inj_pt, coinc, opts.reference_frequency) / 10.0
        else:
            dtrss_inj = skylocutils.get_delta_t_rss(inj_pt, coinc,
                                                    opts.reference_frequency)
        dDrss_inj = skylocutils.get_delta_D_rss(inj_pt, coinc)
        dt.append(dtrss_inj)
        dD.append(dDrss_inj)

#for the kdes
npts = opts.Npts

dtbw = compute_bw(dt, npts)
dtdat = np.array(dt, 'float').reshape(len(dt), 1)
pdtx = np.linspace(0.0, max(dt), npts)
pdty = [skylocutils.gaussian_kde(dtdat, xn, dtbw) for xn in pdtx]
pdtnorm = np.trapz(pdty, pdtx)
Ptx = pdtx
Pty = np.array([
    np.trapz(pdty[:i], Ptx[:i]) / pdtnorm for i in np.arange(1,
                                                             len(Ptx) + 1)
Esempio n. 3
0
    gal_prior = cPickle.load(f)
    f.close()

  print >>sys.stdout, 'Processing trigger at '+str(coinc.time)
  #main loop over the coarse grid
  for coarse_pt in grid.keys():

    #use timing alone to determine if we should move to the fine grid
    dtrss_coarse = dtsnrfac*skylocutils.get_delta_t_rss(coarse_pt,coinc,ref_freq)
    Pdt_coarse = 1 - Pdt.get_rank(dtrss_coarse)
    if Pdt_coarse >= opts.coarse_cut:
      #loop over points on the fine grid 
      for fine_pt in grid[coarse_pt]:
        dtrss_fine = dtsnrfac*skylocutils.get_delta_t_rss(fine_pt,coinc,ref_freq)
        dtrank = dtr.get_rank(dtrss_fine)
        dDrss_fine = skylocutils.get_delta_D_rss(fine_pt,coinc)
        dDrank = dDr.get_rank(dDrss_fine)
        L = dtrank*dDrank
        pval = 0.0
        if opts.galaxy_priors_dir:
          try:
            pval = gal_prior[fine_pt]
          except KeyError:
            pass
        sp.append([fine_pt,L,Pdt.get_rank(dtrank),dtrank,pval*L])

  fnames = {}
  if opts.input_type == 'coinctable':
    fnames['posterior'] = 'skymap_no_galaxies.txt'
    if opts.galaxy_priors_dir:
      fnames['galaxy'] = 'skymap.txt'