Example #1
0
def print_fd_approximants():
    """Only list the frequency-domain approximants in lalsimulation.
    """
    napprox = lalsimulation.NumApproximants
    for i in range(napprox):
        if lalsimulation.SimInspiralImplementedFDApproximants(i):
            print i, lalsimulation.GetStringFromApproximant(i)
Example #2
0
def legacy_approximant_name(apx):
    """Convert the old style xml approximant name to a name
    and phase_order. Alex: I hate this function. Please delet this when we
    use Collin's new tables.
    """
    apx = str(apx)
    try:
        order = sim.GetOrderFromString(apx)
    except:
        print("Warning: Could not read phase order from string, using default")
        order = -1
    name = sim.GetStringFromApproximant(sim.GetApproximantFromString(apx))
    return name, order
def regenerate_known_approximants():
    """
    Function here for convenience if you need to regenerate the list
    Not used in test
    """
    appx = {}
    for i in range(lalsim.NumApproximants):
        try:
            appx[lalsim.GetStringFromApproximant(i)] = i
        except RuntimeError:
            # Integer which is not used in enum?
            print('No approximant numbered {}'.format(i))
    print(appx)
    return appx
Example #4
0
def _lalsim_sgburst_waveform(**p):
    hp, hc = lalsimulation.SimBurstSineGaussian(float(p['q']),
               float(p['frequency']),
               float(p['hrss']),
               float(p['eccentricity']),
               float(p['polarization']),
               float(p['delta_t']))

    hp = TimeSeries(hp.data.data[:], delta_t=hp.deltaT, epoch=hp.epoch)
    hc = TimeSeries(hc.data.data[:], delta_t=hc.deltaT, epoch=hc.epoch)

    return hp, hc

for approx_enum in xrange(0, lalsimulation.NumApproximants):
    if lalsimulation.SimInspiralImplementedTDApproximants(approx_enum):
        approx_name = lalsimulation.GetStringFromApproximant(approx_enum)
        _lalsim_enum[approx_name] = approx_enum
        _lalsim_td_approximants[approx_name] = _lalsim_td_waveform

for approx_enum in xrange(0, lalsimulation.NumApproximants):
    if lalsimulation.SimInspiralImplementedFDApproximants(approx_enum):
        approx_name = lalsimulation.GetStringFromApproximant(approx_enum)
        _lalsim_enum[approx_name] = approx_enum
        _lalsim_fd_approximants[approx_name] = _lalsim_fd_waveform

# sine-Gaussian burst
for approx_enum in xrange(0, lalsimulation.NumApproximants):
    if lalsimulation.SimInspiralImplementedFDApproximants(approx_enum):
        approx_name = lalsimulation.GetStringFromApproximant(approx_enum)
        _lalsim_enum[approx_name] = approx_enum
        _lalsim_sgburst_approximants[approx_name] = _lalsim_sgburst_waveform
def spin_tidal_eob(m1,
                   m2,
                   s1z,
                   s2z,
                   lambda1,
                   lambda2,
                   f_min,
                   delta_t=1.0 / 16384.0,
                   distance=1.0,
                   inclination=0.0,
                   approximant='SEOBNRv4T',
                   verbose=True):
    """EOB waveform with aligned spin and tidal interactions. 
    l=3 tidal interaction and l=2,3 f-mode calculated with universal relations.
    
    Parameters
    ----------
    approximant : 'TEOBv2' or 'TEOBv4' or the new names 'SEOBNRv2T' or 'SEOBNRv4T'.
        Based on the inspiral model given by 'SEOBNRv2' or 'SEOBNRv4'.
    
    Returns
    -------
    Waveform object
    """
    # print m1, m2, s1z, s2z, lambda1, lambda2, f_min, delta_t, distance, inclination
    f_ref = 0.
    phiRef = 0.

    # Must have aligned spin
    s1x, s1y, s2x, s2y = 0., 0., 0., 0.

    # Eccentricity is not part of the model
    longAscNodes = 0.
    eccentricity = 0.
    meanPerAno = 0.

    # Set the EOB approximant
    if (approximant not in ['TEOBv2', 'TEOBv4', 'SEOBNRv2T', 'SEOBNRv4T']):
        raise Exception, "Approximant must be 'TEOBv2' or 'TEOBv4' or 'SEOBNRv2T' or 'SEOBNRv4T'."
    lal_approx = LS.GetApproximantFromString(approximant)

    # Insert matter parameters
    lal_params = lal.CreateDict()
    LS.SimInspiralWaveformParamsInsertTidalLambda1(lal_params, lambda1)
    LS.SimInspiralWaveformParamsInsertTidalLambda2(lal_params, lambda2)

    if verbose:
        ap = LS.GetStringFromApproximant(lal_approx)
        L2A = LS.SimInspiralWaveformParamsLookupTidalLambda1(lal_params)
        L2B = LS.SimInspiralWaveformParamsLookupTidalLambda2(lal_params)
        L3A = LS.SimInspiralWaveformParamsLookupTidalOctupolarLambda1(
            lal_params)
        L3B = LS.SimInspiralWaveformParamsLookupTidalOctupolarLambda2(
            lal_params)
        w2A = LS.SimInspiralWaveformParamsLookupTidalQuadrupolarFMode1(
            lal_params)
        w2B = LS.SimInspiralWaveformParamsLookupTidalQuadrupolarFMode2(
            lal_params)
        w3A = LS.SimInspiralWaveformParamsLookupTidalOctupolarFMode1(
            lal_params)
        w3B = LS.SimInspiralWaveformParamsLookupTidalOctupolarFMode2(
            lal_params)
        print 'Approximant: ' + str(ap)
        print 'm1={:.2f}, m2={:.2f}'.format(m1, m2)
        print 's1z={:.2f}, s2z={:.2f}'.format(s1z, s2z)
        print 'delta_t={:.6f}, 1/delta_t={:.5}, f_min={:.2f}'.format(
            delta_t, 1. / delta_t, f_min)
        print 'L2A, L2B, L3A, L3B, w2A, w2B, w3A, w3B:'
        print '{:.1f}, {:.1f}, {:.1f}, {:.1f}, {:.4f}, {:.4f}, {:.4f}, {:.4f}'.format(
            L2A, L2B, L3A, L3B, w2A, w2B, w3A, w3B)
        sys.stdout.flush()

    # Evaluate waveform
    hp, hc = LS.SimInspiralChooseTDWaveform(m1 * lal.MSUN_SI, m2 * lal.MSUN_SI,
                                            s1x, s1y, s1z, s2x, s2y, s2z,
                                            distance * lal.PC_SI, inclination,
                                            phiRef, longAscNodes, eccentricity,
                                            meanPerAno, delta_t, f_min, f_ref,
                                            lal_params, lal_approx)

    # Extract time array from lalsimulation's structures
    tstart = hp.epoch.gpsSeconds + hp.epoch.gpsNanoSeconds * 1.0e-9
    ts = tstart + hp.deltaT * np.arange(hp.data.length)

    return ts, hp.data.data, hc.data.data
Example #6
0
parser.add_argument("--condor-local-nonworker",action='store_true',help="Provide this option if job will run in non-NFS space. ")
parser.add_argument("--use-osg-simple-requirements",action='store_true',help="Provide this option if job should use a more aggressive setting for OSG matching ")
parser.add_argument("--archive-pesummary-label",default=None,help="If provided, creates a 'pesummary' directory and fills it with this run's final output at the end of the run")
parser.add_argument("--archive-pesummary-event-label",default="this_event",help="Label to use on the pesummary page itself")
opts=  parser.parse_args()


if opts.assume_highq:
    opts.internal_correlate_default=True
event_dict={}

if (opts.approx is None) and not (opts.use_ini is None):
    config = ConfigParser.ConfigParser()
    config.read(opts.use_ini)
    approx_name_ini = config.get('engine','approx')
    approx_name_cleaned = lalsim.GetStringFromApproximant(lalsim.GetApproximantFromString(approx_name_ini))
    opts.approx = approx_name_cleaned
    print( " Approximant provided in ini file: ",approx_name_cleaned)
elif opts.approx is None:
    print( " Approximant required! ")
    sys.exit(1)

if opts.use_osg:
    os.environ["LIGO_DATAFIND_SERVER"]="datafind.ligo.org:443"   #  enable lookup of data

if opts.make_bw_psds:
    if not(opts.choose_data_LI_seglen) and (opts.data_LI_seglen is None):
        print( " To use the BW PSD, you MUST provide a default analysis seglen ")
        sys.exit(1)

if opts.online:
parser.add_option("--verbose")
opts, args = parser.parse_args()

# Loop over arguments, joining
P_list = []
for fname in args:
    print(" File name : ", fname)
    P_list_here = lalsimutils.xml_to_ChooseWaveformParams_array(fname)
    print(" Read n= ", len(P_list_here))
    for P in P_list_here:
        P.tref = 0.0  # insure it is ok  -- there have been problems with malformed times. DANGEROUS if used for another purpose than mine!
    print(" Revised length before cutting: N = ", len(P_list_here))
    if opts.force_approximant:
        approx = lalsim.GetApproximantFromString(opts.force_approximant)
        print(" Forcing approx = ", approx, " AKA ",
              lalsim.GetStringFromApproximant(approx), " from ",
              opts.force_approximant)
        for P in P_list_here:
            P.approx = approx
    P_list = P_list + P_list_here

if opts.verbose:
    for P in P_list:
        P.print_params()
#        print P.approx

# Loop, removing duplicates sequentially
P_list_out = []
n = len(P_list)
indxList = np.arange(n - 1)
print(indxList)
Example #8
0
def print_all_approximants():
    """List all the approximants available in lalsimulation.
    """
    napprox = lalsimulation.NumApproximants
    for i in range(napprox):
        print i, lalsimulation.GetStringFromApproximant(i)