Exemplo n.º 1
0
    def setUp(self):
        self.d = [det.Detector(ifo)
                  for ifo, name in det.get_available_detectors()]

        # not distributed sanely, but should provide some good coverage
        N = 1000
        self.ra = uniform(0, numpy.pi * 2, size=N)
        self.dec = uniform(-numpy.pi, numpy.pi, size=N)
        self.pol = uniform(0, numpy.pi * 2, size=N)
        self.time = uniform(1126000000.0, 1336096017.0, size=N)
Exemplo n.º 2
0
    def __init__(self,
                 num_templates,
                 analysis_block,
                 background_statistic,
                 stat_files,
                 ifos,
                 ifar_limit=100,
                 timeslide_interval=.035,
                 ifar_remove_threshold=100,
                 coinc_threshold=0.002,
                 return_background=False,
                 save_background_on_interrupt=False):
        """
        Parameters
        ----------
        num_templates: int
            The size of the template bank
        analysis_block: int
            The number of seconds in each analysis segment
        background_statistic: str
            The name of the statistic to rank coincident events.
        stat_files: list of strs
            List of filenames that contain information used to construct
            various coincident statistics.
        ifos: list of strs
            List of ifo names that are being analyzed. At the moment this must
            be two items such as ['H1', 'L1'].
        ifar_limit: float
            The largest inverse false alarm rate in years that we would like to
            calculate.
        timeslide_interval: float
            The time in seconds between consecutive timeslide offsets.
        ifar_remove_threshold: float
            The inverse false alarm rate to assume a detection is made and remove
            from the background estimate. !NOT IMPLEMENTED!
        coinc_threshold: float
            Amount of time allowed to form a coincidence in addition to the
            time of flight in seconds.
        return_background: boolean
            If true, background triggers will also be included in the file
            output.
        save_background_on_interrupt: boolean
            If true, an interrupt can be given to save a pickled version of
            the background instance for later restoration. !NOT IMPLEMENTED!
        """
        from pycbc import detector
        from . import stat
        self.num_templates = num_templates
        self.analysis_block = analysis_block
        self.stat_calculator = stat.get_statistic(background_statistic)(
            stat_files)
        self.timeslide_interval = timeslide_interval
        self.return_background = return_background
        self.ifar_remove_threshold = ifar_remove_threshold

        self.ifos = ifos
        if len(self.ifos) != 2:
            raise ValueError(
                "Only a two ifo analysis is supported at this time")

        self.lookback_time = (ifar_limit * lal.YRJUL_SI *
                              timeslide_interval)**0.5
        self.buffer_size = int(numpy.ceil(self.lookback_time / analysis_block))

        det0, det1 = detector.Detector(ifos[0]), detector.Detector(ifos[1])
        self.time_window = det0.light_travel_time_to_detector(
            det1) + coinc_threshold
        self.coincs = CoincExpireBuffer(self.buffer_size, self.ifos)

        self.singles = {}