def criteria(gamma0, gamma1, gamma2, gamma3):
    vars = lalinf.Variables()
    no_vary = lalinf.lalinference.LALINFERENCE_PARAM_FIXED
    lalinf.lalinference.AddREAL8Variable(vars, "SDgamma0", gamma0, no_vary )
    lalinf.lalinference.AddREAL8Variable(vars, "SDgamma1", gamma1, no_vary)
    lalinf.lalinference.AddREAL8Variable(vars, "SDgamma2",  gamma2, no_vary)
    lalinf.lalinference.AddREAL8Variable(vars, "SDgamma3",  gamma3, no_vary)
    lalinf.lalinference.AddREAL8Variable(vars, "mass1",  1.4 , no_vary)
    lalinf.lalinference.AddREAL8Variable(vars, "mass2",  1.4 , no_vary)
    
    a = lal.CreateStringVector("Hi")
    process_ptable = lalinf.ParseCommandLineStringVector(a)
    success_param = lalinf.EOSPhysicalCheck(vars, process_ptable)
    if success_param == 0:
        return True
    else :
        return False
Exemplo n.º 2
0
    def __init__(self, argv):
        """
        Parameters
        ----------
        argv : list
            List of command line arguments that will be used to
            set up the lalinference state. (similar to argv)
        """
        strvec = lal.CreateStringVector(argv[0])
        for a in argv[1:]:
            strvec=lal.AppendString2Vector(strvec, a)
        procParams=li.ParseStringVector(strvec)
        self.state = li.InitRunState(procParams)
        self.state.commandLine=procParams
        li.InitCBCThreads(self.state,1)

        # This is what Nest does
        li.InjectInspiralSignal(self.state.data, self.state.commandLine)
        li.ApplyCalibrationErrors(self.state.data, procParams)
        if li.GetProcParamVal(procParams,'--roqtime_steps'):
            li.SetupROQdata(self.state.data, procParams)
        li.InitCBCPrior(self.state)
        li.InitLikelihood(self.state)
        li.InitCBCThreads(self.state,1)
Exemplo n.º 3
0
assert ((b == [1.1, 2.2, 3.3]).all())
ts = lal.CreateREAL8TimeSeries("test", lal.LIGOTimeGPS(0), 0, 0.1,
                               lal.DimensionlessUnit, 10)
ts.data.data = list(range(0, 10))
for i in range(0, 7):
    v = ts.data
assert ((v.data == list(range(0, 10))).all())
del ts
assert ((v.data == list(range(0, 10))).all())
del v
lal.CheckMemoryLeaks()
print("PASSED object parent tracking")

# check equal return/first argument type handling
print("checking equal return/first argument type handling")
sv = lal.CreateStringVector("1")
assert (sv.length == 1)
lal.AppendString2Vector(sv, "2")
assert (sv.length == 2)
sv = lal.AppendString2Vector(sv, "3")
assert (sv.length == 3)
sv2 = lal.AppendString2Vector(sv, "4")
assert (sv.length == 4)
assert (sv2.length == 4)
assert (sv == sv2)
del sv
del sv2
lal.CheckMemoryLeaks()
ts = lal.CreateREAL8TimeSeries("ts", 800000000, 100, 0.1, lal.HertzUnit, 10)
assert (ts.data.length == 10)
lal.ResizeREAL8TimeSeries(ts, 0, 20)
Exemplo n.º 4
0
def get_Nstar_estimate(nsegs, tref, minStartTime, maxStartTime, prior, detector_names):
    """Returns N* estimated from the super-sky metric

    Parameters
    ----------
    nsegs : int
        Number of semi-coherent segments
    tref : int
        Reference time in GPS seconds
    minStartTime, maxStartTime : int
        Minimum and maximum SFT timestamps
    prior : dict
        The prior dictionary
    detector_names : array
        Array of detectors to average over

    Returns
    -------
    Nstar: int
        The estimated approximate number of templates to cover the prior
        parameter space at a mismatch of unity, assuming the normalised
        thickness is unity.

    """
    earth_ephem, sun_ephem = helper_functions.get_ephemeris_files()
    in_phys, spindowns, sky, fiducial_freq = _extract_data_from_prior(prior)
    out_rssky = np.zeros(in_phys.shape)

    in_phys = helper_functions.convert_array_to_gsl_matrix(in_phys)
    out_rssky = helper_functions.convert_array_to_gsl_matrix(out_rssky)

    tboundaries = np.linspace(minStartTime, maxStartTime, nsegs + 1)

    ref_time = lal.LIGOTimeGPS(tref)
    segments = lal.SegListCreate()
    for j in range(len(tboundaries) - 1):
        seg = lal.SegCreate(
            lal.LIGOTimeGPS(tboundaries[j]), lal.LIGOTimeGPS(tboundaries[j + 1]), j
        )
        lal.SegListAppend(segments, seg)
    detNames = lal.CreateStringVector(*detector_names)
    detectors = lalpulsar.MultiLALDetector()
    lalpulsar.ParseMultiLALDetector(detectors, detNames)
    detector_weights = None
    detector_motion = lalpulsar.DETMOTION_SPIN + lalpulsar.DETMOTION_ORBIT
    ephemeris = lalpulsar.InitBarycenter(earth_ephem, sun_ephem)
    try:
        SSkyMetric = lalpulsar.ComputeSuperskyMetrics(
            lalpulsar.SUPERSKY_METRIC_TYPE,
            spindowns,
            ref_time,
            segments,
            fiducial_freq,
            detectors,
            detector_weights,
            detector_motion,
            ephemeris,
        )
    except RuntimeError as e:
        logging.warning("Encountered run-time error {}".format(e))
        raise RuntimeError("Calculation of the SSkyMetric failed")

    if sky:
        i = 0
    else:
        i = 2

    lalpulsar.ConvertPhysicalToSuperskyPoints(
        out_rssky, in_phys, SSkyMetric.semi_rssky_transf
    )

    d = out_rssky.data

    g = SSkyMetric.semi_rssky_metric.data

    g = g[i:, i:]  # Remove sky if required
    parallelepiped = (d[i:, 1:].T - d[i:, 0]).T

    Nstars = []
    for j in range(1, len(g) + 1):
        dV = np.abs(np.linalg.det(parallelepiped[:j, :j]))
        sqrtdetG = np.sqrt(np.abs(np.linalg.det(g[:j, :j])))
        Nstars.append(sqrtdetG * dV)
    logging.debug(
        "Nstar for each dimension = {}".format(
            ", ".join(["{:1.1e}".format(n) for n in Nstars])
        )
    )
    return np.max(Nstars)