Beispiel #1
0
	def __init__(self, instruments):
		self.densities = {}
		for instrument in instruments:
			self.densities["%s_snr2_chi2" % instrument] = rate.BinnedLnPDF(rate.NDBins((rate.ATanLogarithmicBins(10, 1e7, 801), rate.ATanLogarithmicBins(.1, 1e4, 801))))
		for pair in itertools.combinations(sorted(instruments), 2):
			dt = 0.005 + snglcoinc.light_travel_time(instrument1, instrument2)	# seconds
			self.densities["%s_%s_dt" % pair] = rate.BinnedLnPDF(rate.NDBins((rate.ATanBins(-dt, +dt, 801),)))
			self.densities["%s_%s_dA" % pair] = rate.BinnedLnPDF(rate.NDBins((rate.ATanBins(-0.5, +0.5, 801),)))
			self.densities["%s_%s_df" % pair] = rate.BinnedLnPDF(rate.NDBins((rate.ATanBins(-0.2, +0.2, 501),)))
		# only non-negative rss timing residual bins will be used
		# but we want a binning that's linear at the origin so
		# instead of inventing a new one we just use atan bins that
		# are symmetric about 0
		self.densities["instrumentgroup,rss_timing_residual"] = rate.BinnedLnPDF(rate.NDBins((snglcoinc.InstrumentBins(names = instruments), rate.ATanBins(-0.02, +0.02, 1001))))
Beispiel #2
0
def parse_thresholds(options):
    #
    # parse --thresholds options into a dictionary of instrument pairs
    # and components
    #

    try:
        thresholds = parse_thresholdstrings(options.thresholds)
    except Exception as e:
        raise ValueError("error parsing --thresholds: %s" % str(e))

    #
    # parse the components from --thresholds options
    #

    if options.coincidence_algorithm == "excesspower":
        #
        # excess power does not use adjustable thresholds, but for
        # speed it helps to pre-compute the light travel time
        # between the instruments involved in the analysis
        #

        for pair in thresholds.keys():
            thresholds[pair] = snglcoinc.light_travel_time(*pair)

    elif options.coincidence_algorithm == "stringcusp":
        #
        # parse thresholds into dt values
        #

        try:
            thresholds = dict(
                (instrumentpair, (float(dt), ))
                for instrumentpair, (dt, ) in thresholds.iteritems())
        except Exception as e:
            raise ValueError("error parsing --thresholds: %s" % str(e))

    else:
        #
        # unrecognized coincidence algorithm
        #

        raise ValueError(options.coincidence_algorithm)

    #
    # Done
    #

    return thresholds
Beispiel #3
0
def dt_binning(instrument1, instrument2):
    dt = 0.005 + snglcoinc.light_travel_time(instrument1,
                                             instrument2)  # seconds
    return rate.NDBins((rate.ATanBins(-dt, +dt, 801), ))
         injections_binnedarray, [10, 1e6], [.01, 1e4])
     zero_lag_xcoords, zero_lag_ycoords, zero_lag_data = clip_binned_array_2d(
         zero_lag_binnedarray, [10, 1e6], [.01, 1e4])
     fig = snr2_chi2_plot("%s" % name.replace("_", "-"), background_xcoords,
                          background_ycoords, background_data,
                          injections_xcoords, injections_ycoords,
                          injections_data)
     for extension in options.format:
         outname = "%s.%s" % (name, extension)
         if options.verbose:
             print >> sys.stderr, "\twriting %s ..." % outname
         fig.savefig(outname)
 elif name.endswith("_dt"):
     if options.verbose:
         print >> sys.stderr, "generating plots for %s ..." % name
     dt = .010 + snglcoinc.light_travel_time(*instruments)
     background_coords, background_data = clip_binned_array_1d(
         background_binnedarray, (-dt, +dt))
     injections_coords, injections_data = clip_binned_array_1d(
         injections_binnedarray, (-dt, +dt))
     zero_lag_coords, zero_lag_data = clip_binned_array_1d(
         zero_lag_binnedarray, (-dt, +dt))
     fig = dt_plot("%s" % name.replace("_", "-"), background_coords,
                   background_data, injections_coords, injections_data)
     for extension in options.format:
         outname = "%s.%s" % (name, extension)
         if options.verbose:
             print >> sys.stderr, "\twriting %s ..." % outname
         fig.savefig(outname)
 elif name.endswith("_dA"):
     if options.verbose:
Beispiel #5
0
def dt_binning(instrument1, instrument2):
	dt = 0.005 + snglcoinc.light_travel_time(instrument1, instrument2)	# seconds
	return rate.NDBins((rate.ATanBins(-dt, +dt, 801),))