Esempio n. 1
0
def _check_lal_pars(p):
    """ Create a laldict object from the dictionary of waveform parameters

    Parameters
    ----------
    p: dictionary
        The dictionary of lalsimulation paramaters

    Returns
    -------
    laldict: LalDict
        The lal type dictionary to pass to the lalsimulation waveform functions.
    """
    lal_pars = lal.CreateDict()
    #nonGRparams can be straightforwardly added if needed, however they have to
    # be invoked one by one
    if p['phase_order']!=-1:
        lalsimulation.SimInspiralWaveformParamsInsertPNPhaseOrder(lal_pars,int(p['phase_order']))
    if p['amplitude_order']!=-1:
        lalsimulation.SimInspiralWaveformParamsInsertPNAmplitudeOrder(lal_pars,int(p['amplitude_order']))
    if p['spin_order']!=-1:
        lalsimulation.SimInspiralWaveformParamsInsertPNSpinOrder(lal_pars,int(p['spin_order']))
    if p['tidal_order']!=-1:
        lalsimulation.SimInspiralWaveformParamsInsertPNTidalOrder(lal_pars, p['tidal_order'])
    if p['eccentricity_order']!=-1:
        lalsimulation.SimInspiralWaveformParamsInsertPNEccentricityOrder(lal_pars, p['eccentricity_order'])
    if p['lambda1'] is not None:
        lalsimulation.SimInspiralWaveformParamsInsertTidalLambda1(lal_pars, p['lambda1'])
    if p['lambda2'] is not None:
        lalsimulation.SimInspiralWaveformParamsInsertTidalLambda2(lal_pars, p['lambda2'])
    if p['lambda_octu1'] is not None:
        lalsimulation.SimInspiralWaveformParamsInsertTidalOctupolarLambda1(lal_pars, p['lambda_octu1'])
    if p['lambda_octu2'] is not None:
        lalsimulation.SimInspiralWaveformParamsInsertTidalOctupolarLambda2(lal_pars, p['lambda_octu2'])
    if p['quadfmode1'] is not None:
        lalsimulation.SimInspiralWaveformParamsInsertTidalQuadrupolarFMode1(lal_pars, p['quadfmode1'])
    if p['quadfmode2'] is not None:
        lalsimulation.SimInspiralWaveformParamsInsertTidalQuadrupolarFMode2(lal_pars, p['quadfmode2'])
    if p['octufmode1'] is not None:
        lalsimulation.SimInspiralWaveformParamsInsertTidalOctupolarFMode1(lal_pars, p['octufmode1'])
    if p['octufmode2'] is not None:
        lalsimulation.SimInspiralWaveformParamsInsertTidalOctupolarFMode2(lal_pars, p['octufmode2'])
    if p['dquad_mon1'] is not None:
        lalsimulation.SimInspiralWaveformParamsInsertdQuadMon1(lal_pars, p['dquad_mon1'])
    if p['dquad_mon2'] is not None:
        lalsimulation.SimInspiralWaveformParamsInsertdQuadMon2(lal_pars, p['dquad_mon2'])
    if p['numrel_data']:
        lalsimulation.SimInspiralWaveformParamsInsertNumRelData(lal_pars, str(p['numrel_data']))
    if p['modes_choice']:
        lalsimulation.SimInspiralWaveformParamsInsertModesChoice(lal_pars, p['modes_choice'])
    if p['frame_axis']:
        lalsimulation.SimInspiralWaveformParamsInsertFrameAxis(lal_pars, p['frame_axis'])
    if p['side_bands']:
        lalsimulation.SimInspiralWaveformParamsInsertSideband(lal_pars, p['side_bands'])
    if p['mode_array'] is not None:
        ma = lalsimulation.SimInspiralCreateModeArray()
        for l,m in p['mode_array']:
            lalsimulation.SimInspiralModeArrayActivateMode(ma, l, m)
        lalsimulation.SimInspiralWaveformParamsInsertModeArray(lal_pars, ma)
    #TestingGR parameters:
    if p['dchi0'] is not None:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRDChi0(lal_pars,p['dchi0'])
    if p['dchi1'] is not None:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRDChi1(lal_pars,p['dchi1'])
    if p['dchi2'] is not None:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRDChi2(lal_pars,p['dchi2'])
    if p['dchi3'] is not None:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRDChi3(lal_pars,p['dchi3'])
    if p['dchi4'] is not None:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRDChi4(lal_pars,p['dchi4'])
    if p['dchi5'] is not None:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRDChi5(lal_pars,p['dchi5'])
    if p['dchi5l'] is not None:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRDChi5L(lal_pars,p['dchi5l'])
    if p['dchi6'] is not None:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRDChi6(lal_pars,p['dchi6'])
    if p['dchi6l'] is not None:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRDChi6L(lal_pars,p['dchi6l'])
    if p['dchi7'] is not None:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRDChi7(lal_pars,p['dchi7'])
    if p['dalpha1'] is not None:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRDAlpha1(lal_pars,p['dalpha1'])
    if p['dalpha2'] is not None:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRDAlpha2(lal_pars,p['dalpha2'])
    if p['dalpha3'] is not None:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRDAlpha3(lal_pars,p['dalpha3'])
    if p['dalpha4'] is not None:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRDAlpha4(lal_pars,p['dalpha4'])
    if p['dalpha5'] is not None:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRDAlpha5(lal_pars,p['dalpha5'])
    if p['dbeta1'] is not None:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRDBeta1(lal_pars,p['dbeta1'])
    if p['dbeta2'] is not None:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRDBeta2(lal_pars,p['dbeta2'])
    if p['dbeta3'] is not None:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRDBeta3(lal_pars,p['dbeta3'])
    return lal_pars
Esempio n. 2
0
def _check_lal_pars(p):
    """ Create a laldict object from the dictionary of waveform parameters

    Parameters
    ----------
    p: dictionary
        The dictionary of lalsimulation paramaters

    Returns
    -------
    laldict: LalDict
        The lal type dictionary to pass to the lalsimulation waveform functions.
    """
    lal_pars = lal.CreateDict()
    #nonGRparams can be straightforwardly added if needed, however they have to
    # be invoked one by one
    if p['phase_order'] != -1:
        lalsimulation.SimInspiralWaveformParamsInsertPNPhaseOrder(
            lal_pars, int(p['phase_order']))
    if p['amplitude_order'] != -1:
        lalsimulation.SimInspiralWaveformParamsInsertPNAmplitudeOrder(
            lal_pars, int(p['amplitude_order']))
    if p['spin_order'] != -1:
        lalsimulation.SimInspiralWaveformParamsInsertPNSpinOrder(
            lal_pars, int(p['spin_order']))
    if p['tidal_order'] != -1:
        lalsimulation.SimInspiralWaveformParamsInsertPNTidalOrder(
            lal_pars, p['tidal_order'])
    if p['eccentricity_order'] != -1:
        lalsimulation.SimInspiralWaveformParamsInsertPNEccentricityOrder(
            lal_pars, p['eccentricity_order'])
    if p['lambda1']:
        lalsimulation.SimInspiralWaveformParamsInsertTidalLambda1(
            lal_pars, p['lambda1'])
    if p['lambda2']:
        lalsimulation.SimInspiralWaveformParamsInsertTidalLambda2(
            lal_pars, p['lambda2'])
    if p['dquad_mon1']:
        lalsimulation.SimInspiralWaveformParamsInsertdQuadMon1(
            lal_pars, p['dquad_mon1'])
    if p['dquad_mon2']:
        lalsimulation.SimInspiralWaveformParamsInsertdQuadMon2(
            lal_pars, p['dquad_mon2'])
    if p['numrel_data']:
        lalsimulation.SimInspiralWaveformParamsInsertNumRelData(
            lal_pars, str(p['numrel_data']))
    if p['modes_choice']:
        lalsimulation.SimInspiralWaveformParamsInsertModesChoice(
            lal_pars, p['modes_choice'])
    if p['frame_axis']:
        lalsimulation.SimInspiralWaveformParamsInsertFrameAxis(
            lal_pars, p['frame_axis'])
    if p['side_bands']:
        lalsimulation.SimInspiralWaveformParamsInsertSideband(
            lal_pars, p['side_bands'])
################################################################################################
#####-------------------------------------Non-GR params-----------------------------------######
################################################################################################
# Phi:
    if 'phi1' in p:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRPhi1(
            lal_pars, float(p['phi1']))
    if 'phi2' in p:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRPhi2(
            lal_pars, float(p['phi2']))
    if 'phi3' in p:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRPhi3(
            lal_pars, float(p['phi3']))
    if 'phi4' in p:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRPhi4(
            lal_pars, float(p['phi4']))
# dChi:
    if 'dchi0' in p:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRDChi0(
            lal_pars, float(p['dchi0']))
    if 'dchi1' in p:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRDChi1(
            lal_pars, float(p['dchi1']))
    if 'dchi2' in p:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRDChi2(
            lal_pars, float(p['dchi2']))
    if 'dchi3' in p:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRDChi3(
            lal_pars, float(p['dchi3']))
    if 'dchi4' in p:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRDChi4(
            lal_pars, float(p['dchi4']))
    if 'dchi5' in p:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRDChi5(
            lal_pars, float(p['dchi5']))
    if 'dchi5L' in p:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRDChi5L(
            lal_pars, float(p['dchi5L']))
    if 'dchi6' in p:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRDChi6(
            lal_pars, float(p['dchi7']))
    if 'dchi6L' in p:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRDChi6L(
            lal_pars, float(p['dchi6L']))
    if 'dchi7' in p:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRDChi7(
            lal_pars, float(p['dchi7']))
# dXi:
    if 'dxi1' in p:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRDXi1(
            lal_pars, float(p['dxi1']))
    if 'dxi2' in p:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRDXi2(
            lal_pars, float(p['dxi2']))
    if 'dxi3' in p:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRDXi3(
            lal_pars, float(p['dxi3']))
    if 'dxi4' in p:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRDXi4(
            lal_pars, float(p['dxi4']))
    if 'dxi5' in p:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRDXi5(
            lal_pars, float(p['dxi5']))
    if 'dxi6' in p:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRDXi6(
            lal_pars, float(p['dxi6']))
# Sigma:
    if 'dsigma1' in p:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRDSigma1(
            lal_pars, float(p['dsigma1']))
    if 'dsigma2' in p:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRDSigma2(
            lal_pars, float(p['dsigma2']))
    if 'dsigma3' in p:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRDSigma3(
            lal_pars, float(p['dsigma3']))
    if 'dsigma4' in p:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRDSigma4(
            lal_pars, float(p['dsigma4']))
# Alpha:
    if 'dalpha1' in p:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRDAlpha1(
            lal_pars, float(p['dalpha1']))
    if 'dalpha2' in p:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRDAlpha2(
            lal_pars, float(p['dalpha2']))
    if 'dalpha3' in p:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRDAlpha3(
            lal_pars, float(p['dalpha3']))
    if 'dalpha4' in p:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRDAlpha4(
            lal_pars, float(p['dalpha4']))
    if 'dalpha5' in p:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRDAlpha5(
            lal_pars, float(p['dalpha5']))
# Beta:
    if 'dbeta1' in p:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRDBeta1(
            lal_pars, float(p['dbeta1']))
    if 'dbeta2' in p:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRDBeta2(
            lal_pars, float(p['dbeta2']))
    if 'dbeta3' in p:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRDBeta3(
            lal_pars, float(p['dbeta3']))
# Alpha PPE:
    if 'alphaPPE' in p:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRAlphaPPE(
            lal_pars, float(p['alphaPPE']))
    if 'alphaPPE0' in p:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRAlphaPPE0(
            lal_pars, float(p['alphaPPE0']))
    if 'alphaPPE1' in p:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRAlphaPPE1(
            lal_pars, float(p['alphaPPE1']))
    if 'alphaPPE2' in p:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRAlphaPPE2(
            lal_pars, float(p['alphaPPE2']))
    if 'alphaPPE3' in p:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRAlphaPPE3(
            lal_pars, float(p['alphaPPE3']))
    if 'alphaPPE4' in p:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRAlphaPPE4(
            lal_pars, float(p['alphaPPE4']))
    if 'alphaPPE5' in p:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRAlphaPPE5(
            lal_pars, float(p['alphaPPE5']))


# Beta PPE:
    if 'betaPPE' in p:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRBetaPPE(
            lal_pars, float(p['betaPPE']))
    if 'betaPPE0' in p:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRBetaPPE0(
            lal_pars, float(p['betaPPE0']))
    if 'betaPPE1' in p:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRBetaPPE1(
            lal_pars, float(p['betaPPE1']))
    if 'betaPPE2' in p:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRBetaPPE2(
            lal_pars, float(p['betaPPE2']))
    if 'betaPPE3' in p:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRBetaPPE3(
            lal_pars, float(p['betaPPE3']))
    if 'betaPPE4' in p:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRBetaPPE4(
            lal_pars, float(p['betaPPE4']))
    if 'betaPPE5' in p:
        lalsimulation.SimInspiralWaveformParamsInsertNonGRBetaPPE5(
            lal_pars, float(p['betaPPE5']))

    return lal_pars