Exemplo n.º 1
0
    def covers(self, proposal, min_match):
        """
        Return True if any template in the bank has match with proposal
        greater than min_match.
        """
        # find templates in the bank "near" this tmplt
        low, high = _find_neighborhood(self._mchirps, proposal._mchirp, self.flow)
        tmpbank = self._templates[low:high]
        if not tmpbank: return False

        # sort the bank by its nearness to tmplt in mchirp
        # NB: This sort comes up as a dominating cost if you profile,
        # but it cuts the number of match evaluations by 80%, so turns out
        # to be worth it even for metric match, where matches are cheap.
        pm = proposal._mchirp
        tmpbank.sort(key=lambda b: abs(b._mchirp - pm))

        # set parameters of match calculation that are optimized for this block
        df, PSD = get_neighborhood_PSD(tmpbank + [proposal], self.flow, self.noise_model)

        # find and test matches
        for tmplt in tmpbank:
            self._nmatch += 1
            match = self.compute_match(tmplt, proposal, df, PSD=PSD)
            if match > min_match:
                return True
        return False
Exemplo n.º 2
0
    def finalize_as_template(self):
        if not self.bank.use_metric: return

        df, PSD = get_neighborhood_PSD([self], self.bank.flow, self.bank.noise_model)

        if df not in self.bank._moments or len(PSD) - self.bank.flow // df > self.bank._moments[df][0].length:
            real8vector_psd = CreateREAL8Vector(len(PSD))
            real8vector_psd.data[:] = PSD
            self.bank._moments[df] = create_moments(df, self.bank.flow, len(PSD))
            SimInspiralTaylorF2RedSpinComputeNoiseMoments(*(self.bank._moments[df] + (real8vector_psd, self.bank.flow, df)))

        self._metric = SimInspiralTaylorF2RedSpinMetricChirpTimes(self._theta0, self._theta3, self._theta3s, self.bank.flow, df, *self.bank._moments[df])
        if isnan(self._metric[0]):
            raise ValueError("g00 is nan")
    def finalize_as_template(self):
        if not self.bank.use_metric: return

        df, PSD = get_neighborhood_PSD([self], self.flow, self.bank.noise_model)

        if df not in self.bank._moments or len(PSD) - self.flow // df > self.bank._moments[df][0].length:
            real8vector_psd = CreateREAL8Vector(len(PSD))
            real8vector_psd.data[:] = PSD
            self.bank._moments[df] = create_moments(df, self.flow, len(PSD))
            lalsim.SimInspiralTaylorF2RedSpinComputeNoiseMoments(*(self.bank._moments[df] + (real8vector_psd, self.flow, df)))

        self._metric = lalsim.SimInspiralTaylorF2RedSpinMetricChirpTimes(self._theta0, self._theta3, self._theta3s, self.flow, df, *self.bank._moments[df])
        if isnan(self._metric[0]):
            raise ValueError("g00 is nan")