/**
 * Wrapper similar to XLALSimInspiralChooseFDWaveform() for waveforms to be generated a specific freqencies.
 * Returns the waveform in the frequency domain at the frequencies of the REAL8Sequence frequencies.
 */
int XLALSimInspiralChooseFDWaveformSequence(
    COMPLEX16FrequencySeries **hptilde,     /**< FD plus polarization */
    COMPLEX16FrequencySeries **hctilde,     /**< FD cross polarization */
    REAL8 phiRef,                           /**< reference orbital phase (rad) */
    REAL8 m1,                               /**< mass of companion 1 (kg) */
    REAL8 m2,                               /**< mass of companion 2 (kg) */
    REAL8 S1x,                              /**< x-component of the dimensionless spin of object 1 */
    REAL8 S1y,                              /**< y-component of the dimensionless spin of object 1 */
    REAL8 S1z,                              /**< z-component of the dimensionless spin of object 1 */
    REAL8 S2x,                              /**< x-component of the dimensionless spin of object 2 */
    REAL8 S2y,                              /**< y-component of the dimensionless spin of object 2 */
    REAL8 S2z,                              /**< z-component of the dimensionless spin of object 2 */
    REAL8 f_ref,                            /**< Reference frequency (Hz) */
    REAL8 distance,                         /**< distance of source (m) */
    REAL8 inclination,                      /**< inclination of source (rad) */
    LALDict *LALpars,                       /**< LALDictionary containing non-mandatory variables/flags */
    Approximant approximant,                /**< post-Newtonian approximant to use for waveform production */
    REAL8Sequence *frequencies              /**< sequence of frequencies for which the waveform will be computed. Pass in NULL (or None in python) for standard f_min to f_max sequence. */
)
{
    int ret;
    unsigned int j;
    REAL8 pfac, cfac;
    REAL8 LNhatx, LNhaty, LNhatz;

    /* Support variables for precessing wfs*/
    REAL8 incl;
    REAL8 spin1x,spin1y,spin1z;
    REAL8 spin2x,spin2y,spin2z;

    /* Variables for IMRPhenomP and IMRPhenomPv2 */
    REAL8 chi1_l, chi2_l, chip, thetaJ, alpha0;

    /* General sanity checks that will abort
     *
     * If non-GR approximants are added, include them in
     * XLALSimInspiralApproximantAcceptTestGRParams()
     */
    if ( !XLALSimInspiralWaveformParamsNonGRAreDefault(LALpars) && XLALSimInspiralApproximantAcceptTestGRParams(approximant) != LAL_SIM_INSPIRAL_TESTGR_PARAMS ) {
        XLALPrintError("XLAL Error - %s: Passed in non-NULL testGRparams for an approximant that does not use them\n", __func__);
        XLAL_ERROR(XLAL_EINVAL);
    }
    if (!frequencies) XLAL_ERROR(XLAL_EFAULT);
    REAL8 f_min = frequencies->data[0];

    /* General sanity check the input parameters - only give warnings! */
    if( m1 < 0.09 * LAL_MSUN_SI )
    XLALPrintWarning("XLAL Warning - %s: Small value of m1 = %e (kg) = %e (Msun) requested...Perhaps you have a unit conversion error?\n", __func__, m1, m1/LAL_MSUN_SI);
    if( m2 < 0.09 * LAL_MSUN_SI )
    XLALPrintWarning("XLAL Warning - %s: Small value of m2 = %e (kg) = %e (Msun) requested...Perhaps you have a unit conversion error?\n", __func__, m2, m2/LAL_MSUN_SI);
    if( m1 + m2 > 1000. * LAL_MSUN_SI )
    XLALPrintWarning("XLAL Warning - %s: Large value of total mass m1+m2 = %e (kg) = %e (Msun) requested...Signal not likely to be in band of ground-based detectors.\n", __func__, m1+m2, (m1+m2)/LAL_MSUN_SI);
    if( S1x*S1x + S1y*S1y + S1z*S1z > 1.000001 )
    XLALPrintWarning("XLAL Warning - %s: S1 = (%e,%e,%e) with norm > 1 requested...Are you sure you want to violate the Kerr bound?\n", __func__, S1x, S1y, S1z);
    if( S2x*S2x + S2y*S2y + S2z*S2z > 1.000001 )
    XLALPrintWarning("XLAL Warning - %s: S2 = (%e,%e,%e) with norm > 1 requested...Are you sure you want to violate the Kerr bound?\n", __func__, S2x, S2y, S2z);
    if( f_min < 1. )
    XLALPrintWarning("XLAL Warning - %s: Small value of fmin = %e requested...Check for errors, this could create a very long waveform.\n", __func__, f_min);
    if( f_min > 40.000001 )
    XLALPrintWarning("XLAL Warning - %s: Large value of fmin = %e requested...Check for errors, the signal will start in band.\n", __func__, f_min);

    /* The non-precessing waveforms return h(f) for optimal orientation
     * (i=0, Fp=1, Fc=0; Lhat pointed toward the observer)
     * To get generic polarizations we multiply by inclination dependence
     * and note hc(f) \propto -I * hp(f)
     * Non-precessing waveforms multiply hp by pfac, hc by -I*cfac
     */
    cfac = cos(inclination);
    pfac = 0.5 * (1. + cfac*cfac);

    REAL8 lambda1=XLALSimInspiralWaveformParamsLookupTidalLambda1(LALpars);
    REAL8 lambda2=XLALSimInspiralWaveformParamsLookupTidalLambda2(LALpars);

    switch (approximant)
    {
        /* inspiral-only models */
        case TaylorF2:
            /* Waveform-specific sanity checks */
            if( !XLALSimInspiralWaveformParamsFrameAxisIsDefault(LALpars) )
                ABORT_NONDEFAULT_FRAME_AXIS(LALpars);
            if( !XLALSimInspiralWaveformParamsModesChoiceIsDefault(LALpars) )
                ABORT_NONDEFAULT_MODES_CHOICE(LALpars);
            if( !checkTransverseSpinsZero(S1x, S1y, S2x, S2y) )
                ABORT_NONZERO_TRANSVERSE_SPINS(LALpars);

            /* Call the waveform driver routine */
            ret = XLALSimInspiralTaylorF2Core(hptilde, frequencies, phiRef,
                    m1, m2, S1z, S2z, f_ref, 0., distance, LALpars);
            if (ret == XLAL_FAILURE) XLAL_ERROR(XLAL_EFUNC);
            /* Produce both polarizations */
            *hctilde = XLALCreateCOMPLEX16FrequencySeries("FD hcross",
                    &((*hptilde)->epoch), (*hptilde)->f0, 0.0,
                    &((*hptilde)->sampleUnits), (*hptilde)->data->length);
            for(j = 0; j < (*hptilde)->data->length; j++) {
                (*hctilde)->data->data[j] = -I*cfac * (*hptilde)->data->data[j];
                (*hptilde)->data->data[j] *= pfac;
            }
            break;
        /* inspiral-merger-ringdown models */
        case SEOBNRv1_ROM_EffectiveSpin:
            /* Waveform-specific sanity checks */
            if( !XLALSimInspiralWaveformParamsFlagsAreDefault(LALpars) )
                ABORT_NONDEFAULT_LALDICT_FLAGS(LALpars);
            if (!checkAlignedSpinsEqual(S1z, S2z))
                ABORT_NONZERO_TRANSVERSE_SPINS(LALpars);
            if( !checkTransverseSpinsZero(S1x, S1y, S2x, S2y) )
                ABORT_NONZERO_TRANSVERSE_SPINS(LALpars);
            if( !checkTidesZero(lambda1, lambda2) )
                ABORT_NONZERO_TIDES(LALpars);
            if( !checkTidesZero(lambda1, lambda2) )
                ABORT_NONZERO_TIDES(LALpars);

            ret = XLALSimIMRSEOBNRv1ROMEffectiveSpinFrequencySequence(hptilde, hctilde, frequencies,
                    phiRef, f_ref, distance, inclination, m1, m2, XLALSimIMRPhenomBComputeChi(m1, m2, S1z, S2z));
            break;

        case SEOBNRv1_ROM_DoubleSpin:
            /* Waveform-specific sanity checks */
            if( !XLALSimInspiralWaveformParamsFlagsAreDefault(LALpars) )
                ABORT_NONDEFAULT_LALDICT_FLAGS(LALpars);
            if( !checkTransverseSpinsZero(S1x, S1y, S2x, S2y) )
                ABORT_NONZERO_TRANSVERSE_SPINS(LALpars);
            if( !checkTidesZero(lambda1, lambda2) )
                ABORT_NONZERO_TIDES(LALpars);

            ret = XLALSimIMRSEOBNRv1ROMDoubleSpinFrequencySequence(hptilde, hctilde, frequencies,
                    phiRef, f_ref, distance, inclination, m1, m2, S1z, S2z);
            break;

        case SEOBNRv2_ROM_EffectiveSpin:
            /* Waveform-specific sanity checks */
            if( !XLALSimInspiralWaveformParamsFlagsAreDefault(LALpars) )
                ABORT_NONDEFAULT_LALDICT_FLAGS(LALpars);
            if( !checkTransverseSpinsZero(S1x, S1y, S2x, S2y) )
                ABORT_NONZERO_TRANSVERSE_SPINS(LALpars);
            if( !checkTidesZero(lambda1, lambda2) )
                ABORT_NONZERO_TIDES(LALpars);

            ret = XLALSimIMRSEOBNRv2ROMEffectiveSpinFrequencySequence(hptilde, hctilde, frequencies,
                    phiRef, f_ref, distance, inclination, m1, m2, XLALSimIMRPhenomBComputeChi(m1, m2, S1z, S2z));
            break;

        case SEOBNRv2_ROM_DoubleSpin:
            /* Waveform-specific sanity checks */
            if( !XLALSimInspiralWaveformParamsFlagsAreDefault(LALpars) )
                ABORT_NONDEFAULT_LALDICT_FLAGS(LALpars);
            if( !checkTransverseSpinsZero(S1x, S1y, S2x, S2y) )
                ABORT_NONZERO_TRANSVERSE_SPINS(LALpars);
            if( !checkTidesZero(lambda1, lambda2) )
                ABORT_NONZERO_TIDES(LALpars);

            ret = XLALSimIMRSEOBNRv2ROMDoubleSpinFrequencySequence(hptilde, hctilde, frequencies,
                    phiRef, f_ref, distance, inclination, m1, m2, S1z, S2z);
            break;

        case SEOBNRv2_ROM_DoubleSpin_HI:
            /* Waveform-specific sanity checks */
            if( !XLALSimInspiralWaveformParamsFlagsAreDefault(LALpars) )
                ABORT_NONDEFAULT_LALDICT_FLAGS(LALpars);
            if( !checkTransverseSpinsZero(S1x, S1y, S2x, S2y) )
                ABORT_NONZERO_TRANSVERSE_SPINS(LALpars);
            if( !checkTidesZero(lambda1, lambda2) )
                ABORT_NONZERO_TIDES(LALpars);

            ret = XLALSimIMRSEOBNRv2ROMDoubleSpinHIFrequencySequence(hptilde, hctilde, frequencies,
                    phiRef, f_ref, distance, inclination, m1, m2, S1z, S2z, -1);
            break;

        case Lackey_Tidal_2013_SEOBNRv2_ROM:
            /* Waveform-specific sanity checks */
            if( !XLALSimInspiralWaveformParamsFlagsAreDefault(LALpars) )
                ABORT_NONDEFAULT_LALDICT_FLAGS(LALpars);
            if( !checkTransverseSpinsZero(S1x, S1y, S2x, S2y) )
                ABORT_NONZERO_TRANSVERSE_SPINS(LALpars);

            ret = XLALSimIMRLackeyTidal2013FrequencySequence(hptilde, hctilde, frequencies,
                    phiRef, f_ref, distance, inclination, m1, m2, S1z, lambda2);
            break;

        case IMRPhenomP:
	    XLALSimInspiralInitialConditionsPrecessingApproxs(&incl,&spin1x,&spin1y,&spin1z,&spin2x,&spin2y,&spin2z,inclination,S1x,S1y,S1z,S2x,S2y,S2z,m1,m2,f_ref,phiRef,XLALSimInspiralWaveformParamsLookupFrameAxis(LALpars));
            /* Waveform-specific sanity checks */
            if( !XLALSimInspiralWaveformParamsFrameAxisIsDefault(LALpars) )
                ABORT_NONDEFAULT_FRAME_AXIS(LALpars);/* Default is LAL_SIM_INSPIRAL_FRAME_AXIS_VIEW : z-axis along direction of GW propagation (line of sight). */
            if( !XLALSimInspiralWaveformParamsModesChoiceIsDefault(LALpars) )
                ABORT_NONDEFAULT_MODES_CHOICE(LALpars);
          /* Default is (2,2) or l=2 modes. */
            if( !checkTidesZero(lambda1, lambda2) )
                ABORT_NONZERO_TIDES(LALpars);
            LNhatx = sin(incl);
            LNhaty = 0.;
            LNhatz = cos(incl);
            /* Tranform to model parameters */
            if(f_ref==0.0)
                f_ref = f_min; /* Default reference frequency is minimum frequency */
            XLALSimIMRPhenomPCalculateModelParameters(
                &chi1_l, &chi2_l, &chip, &thetaJ, &alpha0,
                m1, m2, f_ref,
                LNhatx, LNhaty, LNhatz,
                spin1x, spin1y, spin1z,
                spin2x, spin2y, spin2z, IMRPhenomPv1_V);
            /* Call the waveform driver routine */
            ret = XLALSimIMRPhenomPFrequencySequence(hptilde, hctilde, frequencies,
              chi1_l, chi2_l, chip, thetaJ,
              m1, m2, distance, alpha0, phiRef, f_ref, IMRPhenomPv1_V, NULL);
            if (ret == XLAL_FAILURE) XLAL_ERROR(XLAL_EFUNC);
            break;

        case IMRPhenomPv2:
	    XLALSimInspiralInitialConditionsPrecessingApproxs(&incl,&spin1x,&spin1y,&spin1z,&spin2x,&spin2y,&spin2z,inclination,S1x,S1y,S1z,S2x,S2y,S2z,m1,m2,f_ref,phiRef,XLALSimInspiralWaveformParamsLookupFrameAxis(LALpars));

            /* Waveform-specific sanity checks */
            if( !XLALSimInspiralWaveformParamsFrameAxisIsDefault(LALpars) )
                ABORT_NONDEFAULT_FRAME_AXIS(LALpars);/* Default is LAL_SIM_INSPIRAL_FRAME_AXIS_VIEW : z-axis along direction of GW propagation (line of sight). */
            if( !XLALSimInspiralWaveformParamsModesChoiceIsDefault(LALpars) )
                ABORT_NONDEFAULT_MODES_CHOICE(LALpars);
          /* Default is (2,2) or l=2 modes. */
            if( !checkTidesZero(lambda1, lambda2) )
	        ABORT_NONZERO_TIDES(LALpars);
            LNhatx = sin(incl);
            LNhaty = 0.;
            LNhatz = cos(incl);
            /* Tranform to model parameters */
            if(f_ref==0.0)
	      f_ref = f_min; /* Default reference frequency is minimum frequency */
            XLALSimIMRPhenomPCalculateModelParameters(
                &chi1_l, &chi2_l, &chip, &thetaJ, &alpha0,
                m1, m2, f_ref,
                LNhatx, LNhaty, LNhatz,
                spin1x, spin1y, spin1z,
                spin2x, spin2y, spin2z, IMRPhenomPv2_V);
            /* Call the waveform driver routine */
            ret = XLALSimIMRPhenomPFrequencySequence(hptilde, hctilde, frequencies,
              chi1_l, chi2_l, chip, thetaJ,
              m1, m2, distance, alpha0, phiRef, f_ref, IMRPhenomPv2_V, NULL);
            if (ret == XLAL_FAILURE) XLAL_ERROR(XLAL_EFUNC);
            break;

        default:
            XLALPrintError("FD version of approximant not implemented in lalsimulation\n");
            XLAL_ERROR(XLAL_EINVAL);
    }

    if (ret == XLAL_FAILURE) XLAL_ERROR(XLAL_EFUNC);

    return ret;
}
Example #2
0
static void Test_XLALSimIMRPhenomP(void) {
  printf("\n** Test_XLALSimIMRPhenomP: **\n");

  REAL8 eta, chi_eff, chip, thetaJ, phiJ, alpha0;

  REAL8 m1 = 10;
  REAL8 m2 = 40;
  REAL8 m1_SI = m1 * LAL_MSUN_SI;
  REAL8 m2_SI = m2 * LAL_MSUN_SI;
  REAL8 s1x = 0.3;
  REAL8 s1y = 0;
  REAL8 s1z = 0.45;
  REAL8 s2x = 0;
  REAL8 s2y = 0;
  REAL8 s2z = 0.45;
  REAL8 lnhatx = sin(0.4);
  REAL8 lnhaty = 0;
  REAL8 lnhatz = cos(0.4);
  REAL8 f_min = 20;

  XLALSimIMRPhenomPCalculateModelParameters(
      &chi_eff,           /**< Output: Effective aligned spin */
      &chip,              /**< Output: Effective spin in the orbital plane */
      &eta,               /**< Output: Symmetric mass-ratio */
      &thetaJ,            /**< Output: Angle between J0 and line of sight (z-direction) */
      &phiJ,              /**< Output: Angle of J0 in the plane of the sky */
      &alpha0,            /**< Output: Initial value of alpha angle */
      m1_SI,              /**< Mass of companion 1 (kg) */
      m2_SI,              /**< Mass of companion 2 (kg) */
      f_min,              /**< Starting GW frequency (Hz) */
      lnhatx,             /**< Initial value of LNhatx: orbital angular momentum unit vector */
      lnhaty,             /**< Initial value of LNhaty */
      lnhatz,             /**< Initial value of LNhatz */
      s1x,                /**< Initial value of s1x: dimensionless spin of larger BH */
      s1y,                /**< Initial value of s1y: dimensionless spin of larger BH */
      s1z,                /**< Initial value of s1z: dimensionless spin of larger BH */
      s2x,                /**< Initial value of s2x: dimensionless spin of larger BH */
      s2y,                /**< Initial value of s2y: dimensionless spin of larger BH */
      s2z);               /**< Initial value of s2z: dimensionless spin of larger BH */

  COMPLEX16FrequencySeries *hptilde = NULL;
  COMPLEX16FrequencySeries *hctilde = NULL;
  REAL8 phic = 0;
  REAL8 deltaF = 0.06;
  REAL8 f_max = 0; // 8000;
  REAL8 distance = 100 * 1e6 * LAL_PC_SI;

  int ret = XLALSimIMRPhenomP(
    &hptilde,                 /**< Frequency-domain waveform h+ */
    &hctilde,                 /**< Frequency-domain waveform hx */
    chi_eff,                  /**< Effective aligned spin */
    chip,                     /**< Effective spin in the orbital plane */
    eta,                      /**< Symmetric mass-ratio */
    thetaJ,                   /**< Angle between J0 and line of sight (z-direction) */
    phiJ,                     /**< Angle of J0 in the plane of the sky */
    m1_SI + m2_SI,            /**< Total mass of binary (kg) */
    distance,                 /**< Distance of source (m) */
    alpha0,                   /**< Initial value of alpha angle */
    phic,                     /**< Orbital coalescence phase (rad) */
    deltaF,                   /**< Sampling frequency (Hz) */
    f_min,                    /**< Starting GW frequency (Hz) */
    f_max);                   /**< End frequency; 0 defaults to ringdown cutoff freq */

  dump_file("PhenomP_Test1.dat", hptilde, hctilde, m1+m2);
  UNUSED(ret);
  COMPLEX16 hp = (hptilde->data->data)[1000];
  COMPLEX16 hc = (hctilde->data->data)[1000];
  prC("hp", hp);
  prC("hc", hc);

  COMPLEX16 hp_expected = 2.10915e-24 - I*5.50997e-23;
  COMPLEX16 hc_expected = -5.48992e-23 - I*2.12973e-24;
  const REAL8 eps = 1e-5;

  assert(
       approximatelyEqualC(hp, hp_expected, eps)
    && approximatelyEqualC(hc, hc_expected, eps)
    && "XLALSimIMRPhenomP()"
  );
}
Example #3
0
static void Test_PhenomC_PhenomP(void) {
  printf("\n** Test_PhenomC_PhenomP: **\n");
  REAL8 eta = 0.16;
  REAL8 chi = 0.45;
  REAL8 q = (1 + sqrt(1 - 4*eta) - 2*eta)/(2.*eta);
  REAL8 M = 50;

  // Parameters for XLALSimIMRPhenomPCalculateModelParameters
  COMPLEX16FrequencySeries *hptilde = NULL;
  COMPLEX16FrequencySeries *hctilde = NULL;
  REAL8 phic = 0;
  REAL8 deltaF = 0.06;
  REAL8 m1_SI = M *   q/(1+q) * LAL_MSUN_SI;
  REAL8 m2_SI = M * 1.0/(1+q) * LAL_MSUN_SI;
  REAL8 f_min = 10;
  REAL8 f_max = 0; // 8000;
  REAL8 distance = 100 * 1e6 * LAL_PC_SI;
  REAL8 s1x = 0;
  REAL8 s1y = 0;
  REAL8 s1z = chi;
  REAL8 s2x = 0;
  REAL8 s2y = 0;
  REAL8 s2z = chi;
  REAL8 lnhatx = 0;
  REAL8 lnhaty = 0;
  REAL8 lnhatz = 1;

  REAL8 chi_eff, chip, thetaJ, phiJ, alpha0;

  XLALSimIMRPhenomPCalculateModelParameters(
      &chi_eff,           /**< Output: Effective aligned spin */
      &chip,              /**< Output: Effective spin in the orbital plane */
      &eta,               /**< Output: Symmetric mass-ratio */
      &thetaJ,            /**< Output: Angle between J0 and line of sight (z-direction) */
      &phiJ,              /**< Output: Angle of J0 in the plane of the sky */
      &alpha0,            /**< Output: Initial value of alpha angle */
      m1_SI,              /**< Mass of companion 1 (kg) */
      m2_SI,              /**< Mass of companion 2 (kg) */
      f_min,              /**< Starting GW frequency (Hz) */
      lnhatx,             /**< Initial value of LNhatx: orbital angular momentum unit vector */
      lnhaty,             /**< Initial value of LNhaty */
      lnhatz,             /**< Initial value of LNhatz */
      s1x,                /**< Initial value of s1x: dimensionless spin of larger BH */
      s1y,                /**< Initial value of s1y: dimensionless spin of larger BH */
      s1z,                /**< Initial value of s1z: dimensionless spin of larger BH */
      s2x,                /**< Initial value of s2x: dimensionless spin of larger BH */
      s2y,                /**< Initial value of s2y: dimensionless spin of larger BH */
      s2z);               /**< Initial value of s2z: dimensionless spin of larger BH */

  printf("chi_eff = %g\n", chi_eff);
  printf("chip = %g\n", chip);
  printf("eta = %g\n", eta);
  printf("thetaJ = %g\n", thetaJ);
  printf("phiJ = %g\n", phiJ);

  int ret = XLALSimIMRPhenomP(
    &hptilde,                 /**< Frequency-domain waveform h+ */
    &hctilde,                 /**< Frequency-domain waveform hx */
    chi_eff,                  /**< Effective aligned spin */
    chip,                     /**< Effective spin in the orbital plane */
    eta,                      /**< Symmetric mass-ratio */
    thetaJ,                   /**< Angle between J0 and line of sight (z-direction) */
    phiJ,                     /**< Angle of J0 in the plane of the sky */
    m1_SI + m2_SI,            /**< Total mass of binary (kg) */
    distance,                 /**< Distance of source (m) */
    alpha0,                   /**< Initial value of alpha angle */
    phic,                     /**< Orbital coalescence phase (rad) */
    deltaF,                   /**< Sampling frequency (Hz) */
    f_min,                    /**< Starting GW frequency (Hz) */
    f_max);                   /**< End frequency; 0 defaults to ringdown cutoff freq */

  int wflen = hptilde->data->length;
  REAL8 f_max_prime = 0;
  FILE *out;
  out = fopen("XLALSimIMRPhenomP.dat", "w");
  for (int i=1;i<wflen;i++) {
    REAL8 f = i*deltaF;
    COMPLEX16 hp = (hptilde->data->data)[i];
    COMPLEX16 hc = (hctilde->data->data)[i];
    if (!(creal(hp) == 0 && cimag(hp) == 0 && creal(hc) == 0 && cimag(hc) == 0)) {
      f_max_prime = (f > f_max_prime) ? f : f_max_prime;
      fprintf(out, "%.15g\t%.15g\t%.15g\t%.15g\t%.15g\n", f*LAL_MTSUN_SI*M, creal(hp), cimag(hp), creal(hc), cimag(hc));
    }
  }
  fclose(out);
  printf("f_max_prime = %g\n", f_max_prime);


  COMPLEX16FrequencySeries *htildePC = NULL;
  ret = XLALSimIMRPhenomCGenerateFD(
      &htildePC, /**< FD waveform */
      phic,                  /**< orbital phase at peak (rad) */
      deltaF,                /**< sampling interval (Hz) */
      m1_SI,                 /**< mass of companion 1 (kg) */
      m2_SI,                 /**< mass of companion 2 (kg) */
      chi,                   /**< mass-weighted aligned-spin parameter */
      f_min,                 /**< starting GW frequency (Hz) */
      f_max,                 /**< end frequency; 0 defaults to ringdown cutoff freq */
      distance               /**< distance of source (m) */
  );

  out = fopen("XLALSimIMRPhenomC.dat", "w");
  wflen = hptilde->data->length;
  for (int i=1;i<wflen;i++) {
    REAL8 f = i*deltaF;
    COMPLEX16 hp = (htildePC->data->data)[i];
    if (!(creal(hp) == 0 && cimag(hp) == 0))
      fprintf(out, "%.15g\t%.15g\t%.15g\n", f*LAL_MTSUN_SI*M, creal(hp), cimag(hp));
  }
  fclose(out);

  // Now compute match between PhenomC and PhenomP for this aligned configuration
  REAL8 match = MatchSI(&hptilde, &htildePC, f_min, f_max_prime, deltaF);
  REAL8 match_expected = 0.999443;

  const REAL8 eps = 1e-5;

  assert(
       approximatelyEqualC(match, match_expected, eps)
    && "Test_PhenomC_PhenomP()"
  );

  printf("match(PhenomP_aligned, PhenomC) = %g\n", match);
  UNUSED(ret);
}
Example #4
0
static void Test_XLALSimIMRPhenomPCalculateModelParameters(void) {
  printf("\n** Test_XLALSimIMRPhenomPCalculateModelParameters: **\n");

  REAL8 eta, chi_eff, chip, thetaJ, phiJ, alpha0;

  REAL8 m1_SI = 10 * LAL_MSUN_SI;
  REAL8 m2_SI = 40 * LAL_MSUN_SI;
  REAL8 s1x = 0.3;
  REAL8 s1y = 0;
  REAL8 s1z = 0.45;
  REAL8 s2x = 0;
  REAL8 s2y = 0;
  REAL8 s2z = 0.45;
  REAL8 lnhatx = sin(0.4);
  REAL8 lnhaty = 0;
  REAL8 lnhatz = cos(0.4);
  REAL8 f_min = 20;

  XLALSimIMRPhenomPCalculateModelParameters(
      &chi_eff,           /**< Output: Effective aligned spin */
      &chip,              /**< Output: Effective spin in the orbital plane */
      &eta,               /**< Output: Symmetric mass-ratio */
      &thetaJ,            /**< Output: Angle between J0 and line of sight (z-direction) */
      &phiJ,              /**< Output: Angle of J0 in the plane of the sky */
      &alpha0,            /**< Output: Initial value of alpha angle */
      m1_SI,              /**< Mass of companion 1 (kg) */
      m2_SI,              /**< Mass of companion 2 (kg) */
      f_min,              /**< Starting GW frequency (Hz) */
      lnhatx,             /**< Initial value of LNhatx: orbital angular momentum unit vector */
      lnhaty,             /**< Initial value of LNhaty */
      lnhatz,             /**< Initial value of LNhatz */
      s1x,                /**< Initial value of s1x: dimensionless spin of larger BH */
      s1y,                /**< Initial value of s1y: dimensionless spin of larger BH */
      s1z,                /**< Initial value of s1z: dimensionless spin of larger BH */
      s2x,                /**< Initial value of s2x: dimensionless spin of larger BH */
      s2y,                /**< Initial value of s2y: dimensionless spin of larger BH */
      s2z);               /**< Initial value of s2z: dimensionless spin of larger BH */

  REAL8 eta_expected = 0.16;
  REAL8 chi_eff_expected = 0.437843;
  REAL8 chip_expected = 0.175238;
  REAL8 thetaJ_expected = 0.298553;
  REAL8 phiJ_expected = 0;
  REAL8 alpha0_expected = 0;

  print_difference("eta", eta, eta_expected);
  print_difference("chi_eff", chi_eff, chi_eff_expected);
  print_difference("chip", chip, chip_expected);
  print_difference("thetaJ", thetaJ, thetaJ_expected);
  print_difference("phiJ", phiJ, phiJ_expected);
  print_difference("alpha0", alpha0, alpha0_expected);

  //const REAL8 eps = DBL_EPSILON;
  const REAL8 eps = 1e-5;

  assert(
       approximatelyEqual(eta,      eta_expected, eps)
    && approximatelyEqual(chi_eff,  chi_eff_expected, eps)
    && approximatelyEqual(chip,     chip_expected, eps)
    && approximatelyEqual(thetaJ,   thetaJ_expected, eps)
    && approximatelyEqual(phiJ,     phiJ_expected, eps)
    && approximatelyEqual(alpha0,   alpha0_expected, eps)
    && "Test_XLALSimIMRPhenomPCalculateModelParameters()"
  );
}