Commit f8ecd1d7 authored by Maria Haney's avatar Maria Haney

Merge branch 'PN_modes_master_rebase' into 'master'

Precessing PN modes

See merge request lscsoft/lalsuite!1010
parents cac7e583 89440468
......@@ -50,6 +50,7 @@ extern "C" {
* @defgroup LALSimIMRPSpinInspiralRD_c LALSimIMRPSpinInspiralRD.c
* @defgroup LALSimIMRTidal_c LALSimIMRLackeyTidal2013.c
* @defgroup LALSimPrecessingNRSur_c LALSimIMRPrecessingNRSur.c
* @defgroup LALSimIMRNRWaveforms_c LALSimIMRNRWaveforms.c
* @}
*
* @addtogroup LALSimIMR_h
......@@ -106,7 +107,7 @@ int XLALSimIMRPhenomPCalculateModelParametersFromSourceFrame(REAL8 *chi1_l, REAL
int XLALSimIMREOBNRv2DominantMode(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, const REAL8 phiC, const REAL8 deltaT, const REAL8 m1SI, const REAL8 m2SI, const REAL8 fLower, const REAL8 distance, const REAL8 inclination);
int XLALSimIMREOBNRv2AllModes(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, const REAL8 phiC, const REAL8 deltaT, const REAL8 m1SI, const REAL8 m2SI, const REAL8 fLower, const REAL8 distance, const REAL8 inclination);
SphHarmTimeSeries *XLALSimIMREOBNRv2Modes(const REAL8 phiRef, const REAL8 deltaT, const REAL8 m1, const REAL8 m2, const REAL8 fLower, const REAL8 distance);
SphHarmTimeSeries *XLALSimIMREOBNRv2Modes(const REAL8 deltaT, const REAL8 m1, const REAL8 m2, const REAL8 fLower, const REAL8 distance);
/* in module LALSimIMRSpinAlignedEOB.c */
......@@ -342,6 +343,9 @@ int XLALSimInspiralNRWaveformGetSpinsFromHDF5File(
const char *NRDataFile /**< Location of NR HDF file */
);
/* The following XLALSimInspiralNRWaveformGetHplusHcross() generates polarizations
* reading directly the NR files and does not return l,m modes.
*/
int XLALSimInspiralNRWaveformGetHplusHcross(
REAL8TimeSeries **hplus, /**< OUTPUT h_+ vector */
REAL8TimeSeries **hcross, /**< OUTPUT h_x vector */
......@@ -363,6 +367,25 @@ int XLALSimInspiralNRWaveformGetHplusHcross(
LALValue* ModeArray /**< Container for the ell and m modes to generate. To generate all available modes pass NULL */
);
/* The following XLALSimInspiralNRWaveformGetHlms() reads NR file to output l,m modes.
*/
INT4 XLALSimInspiralNRWaveformGetHlms(SphHarmTimeSeries **hlms, /**< OUTPUT */
REAL8 deltaT, /**< sampling interval (s) */
REAL8 m1, /**< mass of companion 1 (kg) */
REAL8 m2, /**< mass of companion 2 (kg) */
REAL8 r, /**< distance of source (m) */
REAL8 fStart, /**< start GW frequency (Hz) */
REAL8 fRef, /**< reference GW frequency (Hz) */
REAL8 s1x, /**< initial value of S1x */
REAL8 s1y, /**< initial value of S1y */
REAL8 s1z, /**< initial value of S1z */
REAL8 s2x, /**< initial value of S2x */
REAL8 s2y, /**< initial value of S2y */
REAL8 s2z, /**< initial value of S2z */
const char *NRDataFile, /**< Location of NR HDF file */
LALValue* ModeArray /**< Container for the ell and m modes to generate. To generate all available modes pass NULL */
);
/* in module LALSimIMRPrecessingNRSur.c */
int XLALSimInspiralPrecessingNRSurPolarizations(
......@@ -399,7 +422,7 @@ SphHarmTimeSeries *XLALSimInspiralPrecessingNRSurModes(
REAL8 S2z, /**< z-component of the dimensionless spin of object 2 */
REAL8 fMin, /**< start GW frequency (Hz) */
REAL8 fRef, /**< reference GW frequency (Hz) */
REAL8 distnace, /**< distance of source (m) */
REAL8 distance, /**< distance of source (m) */
LALDict* LALparams, /**< Dict with extra parameters */
Approximant approximant /**< approximant (NRSur7dq2 or NRSur7dq4) */
);
......@@ -434,7 +457,6 @@ int XLALPrecessingNRSurDynamics(
Approximant approximant /**< approximant (NRSur7dq2 or NRSur7dq4). */
);
/* in module LALSimNRTunedTides.c */
double XLALSimNRTunedTidesComputeKappa2T(
REAL8 m1_SI, /**< Mass of companion 1 (kg) */
......
......@@ -1748,7 +1748,6 @@ XLALSimIMREOBNRv2AllModes(
* SWSH modes in a SphHarmTimeSeries struct.
*/
SphHarmTimeSeries *XLALSimIMREOBNRv2Modes(
const REAL8 phiRef, /**< Orbital phase at coalescence (radians) */
const REAL8 deltaT, /**< Sampling interval (s) */
const REAL8 m1, /**< First component mass (kg) */
const REAL8 m2, /**< Second component mass (kg) */
......@@ -1757,7 +1756,7 @@ SphHarmTimeSeries *XLALSimIMREOBNRv2Modes(
)
{
SphHarmTimeSeries *hlms = NULL;
if ( XLALSimIMREOBNRv2Generator(NULL, NULL, &hlms, phiRef, deltaT, m1, m2,
if ( XLALSimIMREOBNRv2Generator(NULL, NULL, &hlms, 0., deltaT, m1, m2,
fLower, distance, 0., 1) == XLAL_FAILURE )
{
XLAL_ERROR_NULL( XLAL_EFUNC );
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -338,4 +338,50 @@ int XLALSimInspiralOrientationMatrixDirection(
return XLAL_SUCCESS;
}
/**
* Takes in the h_lm spherical harmonic decomposed modes and rotates the modes
* by Euler angles alpha, beta, and gamma using the Wigner D matrices, analog to
* int XLALSimInspiralPrecessionRotateModes but with 2 crucial differences:
*
* * leaves unaltered the input SphericalHarmonicTimeSeries
* * The Wigner DMatrix rotation function XLALWignerDMatrix() is called
with arguments (alpha, -beta, gamma), instead of (alpha, beta, gamma),
* to ensure that
* (h+ + i hx)(alpha,beta,gamma)=Sum_{lmm'} Y_lm(0,0) D_mm'(alpha,beta,gamma) h_lm'(0,0,0)
*
*/
int XLALSimInspiralPrecessionRotateModesOut(SphHarmTimeSeries **hlm_out, /**< spherical harmonic decomposed modes, output */
SphHarmTimeSeries *hlm_in, /**< spherical harmonic decomposed modes, input */
const REAL8TimeSeries *alpha, /**< alpha Euler angle time series */
const REAL8TimeSeries *beta, /**< beta Euler angle time series */
const REAL8TimeSeries *gam /**< gamma Euler angle time series */
){
if (*hlm_out)
XLAL_ERROR(XLAL_EFAILED);
unsigned int i;
int l, m, mp;
int lmax = XLALSphHarmTimeSeriesGetMaxL( hlm_in );
int lmin = XLALSphHarmTimeSeriesGetMinL( hlm_in );
for( l=lmin; l <= lmax; l++ ) {
COMPLEX16TimeSeries **inmode= XLALCalloc( 2*lmax+1, sizeof(COMPLEX16TimeSeries) );
for( m=-l; m<=l; m++){
inmode[m+l] = XLALSphHarmTimeSeriesGetMode(hlm_in, l, m );
}
for( m=-l; m<=l; m++){
COMPLEX16TimeSeries *outmode = XLALCreateCOMPLEX16TimeSeries(inmode[m+l]->name,&inmode[m+l]->epoch,0.,inmode[m+l]->deltaT,&inmode[m+l]->sampleUnits,inmode[m+l]->data->length);
for(i=0; i<inmode[m+l]->data->length; i++)
outmode->data->data[i]=0.;
for(mp=-l; mp<=l; mp++){
for(i=0; i<inmode[m+l]->data->length; i++) {
outmode->data->data[i] += inmode[mp+l]->data->data[i] * XLALWignerDMatrix( l, mp, m, alpha->data->data[i], -beta->data->data[i], gam->data->data[i] );
}
}
*hlm_out=XLALSphHarmTimeSeriesAddMode(*hlm_out,outmode,l,m);
}
}
return XLAL_SUCCESS;
}
/** @} */
......@@ -41,6 +41,7 @@
#include <gsl/gsl_eigen.h>
int XLALSimInspiralPrecessionRotateModes(SphHarmTimeSeries* h_lm, REAL8TimeSeries* alpha, REAL8TimeSeries* beta, REAL8TimeSeries* gam);
int XLALSimInspiralPrecessionRotateModesOut(SphHarmTimeSeries **hlm_out, SphHarmTimeSeries *hlm_in, const REAL8TimeSeries *alpha, const REAL8TimeSeries *beta, const REAL8TimeSeries *gam);
int XLALSimInspiralConstantPrecessionConeWaveformModes(SphHarmTimeSeries** h_lm_tmp, double precess_freq, double a, double phi_precess, double alpha_0, double beta_0);
int XLALSimInspiralConstantPrecessionConeWaveform(REAL8TimeSeries** hp, REAL8TimeSeries** hx, SphHarmTimeSeries* h_lm, double precess_freq, double a, double phi_precess, double alpha_0, double beta_0);
int XLALSimInspiralOrientationMatrixForL2(REAL8 mtx[3][3], COMPLEX16 h22, COMPLEX16 h2m2, COMPLEX16 h21, COMPLEX16 h2m1, COMPLEX16 h20);
......
......@@ -470,8 +470,7 @@ int XLALSimInspiralTaylorT1PNGenerator(
}
SphHarmTimeSeries *XLALSimInspiralTaylorT1PNModes(
REAL8 phiRef, /**< reference orbital phase (rad) */
REAL8 v0, /**< tail-term gauge choice (default = 1) */
UNUSED REAL8 v0, /**< tail-term gauge choice (default = 1) */
REAL8 deltaT, /**< sampling interval (s) */
REAL8 m1, /**< mass of companion 1 (kg) */
REAL8 m2, /**< mass of companion 2 (kg) */
......@@ -513,7 +512,7 @@ SphHarmTimeSeries *XLALSimInspiralTaylorT1PNModes(
REAL8TimeSeries *V;
REAL8TimeSeries *phi;
int n;
n = XLALSimInspiralTaylorT1PNEvolveOrbit(&V, &phi, phiRef, deltaT,
n = XLALSimInspiralTaylorT1PNEvolveOrbit(&V, &phi, 0., deltaT,
m1, m2, f_min, fRef, lambda1, lambda2, tideO, phaseO);
if ( n < 0 )
XLAL_ERROR_NULL(XLAL_EFUNC);
......@@ -521,8 +520,8 @@ SphHarmTimeSeries *XLALSimInspiralTaylorT1PNModes(
COMPLEX16TimeSeries *hxx;
for(l=2; l<=lmax; l++){
for(m=-l; m<=l; m++){
hxx = XLALCreateSimInspiralPNModeCOMPLEX16TimeSeries(V, phi,
v0, m1, m2, r, amplitudeO, l, m);
hxx = XLALCreateSimInspiralPNModeCOMPLEX16TimeSeriesLALConvention(V, phi,
m1, m2, r, amplitudeO, l, m);
if ( !hxx ){
XLAL_ERROR_NULL(XLAL_EFUNC);
}
......@@ -540,8 +539,7 @@ SphHarmTimeSeries *XLALSimInspiralTaylorT1PNModes(
* using TaylorT1 phasing.
*/
COMPLEX16TimeSeries *XLALSimInspiralTaylorT1PNMode(
REAL8 phiRef, /**< reference orbital phase (rad) */
REAL8 v0, /**< tail-term gauge choice (default = 1) */
UNUSED REAL8 v0, /**< tail-term gauge choice (default = 1) */
REAL8 deltaT, /**< sampling interval (s) */
REAL8 m1, /**< mass of companion 1 (kg) */
REAL8 m2, /**< mass of companion 2 (kg) */
......@@ -584,12 +582,12 @@ COMPLEX16TimeSeries *XLALSimInspiralTaylorT1PNMode(
REAL8TimeSeries *V;
REAL8TimeSeries *phi;
int n;
n = XLALSimInspiralTaylorT1PNEvolveOrbit(&V, &phi, phiRef, deltaT,
n = XLALSimInspiralTaylorT1PNEvolveOrbit(&V, &phi, 0., deltaT,
m1, m2, f_min, fRef, lambda1, lambda2, tideO, phaseO);
if ( n < 0 )
XLAL_ERROR_NULL(XLAL_EFUNC);
hlm = XLALCreateSimInspiralPNModeCOMPLEX16TimeSeries(V, phi,
v0, m1, m2, r, amplitudeO, l, m);
hlm = XLALCreateSimInspiralPNModeCOMPLEX16TimeSeriesLALConvention(V, phi,
m1, m2, r, amplitudeO, l, m);
if ( !hlm )
XLAL_ERROR_NULL(XLAL_EFUNC);
XLALDestroyREAL8TimeSeries(phi);
......
......@@ -935,7 +935,7 @@ int XLALSimInspiralTaylorT2PNGenerator(
REAL8TimeSeries **hplus, /**< +-polarization waveform */
REAL8TimeSeries **hcross, /**< x-polarization waveform */
REAL8 phiRef, /**< reference orbital phase (rad) */
REAL8 v0, /**< tail-term gauge choice (default = 1) */
UNUSED REAL8 v0, /**< tail-term gauge choice (default = 1) */
REAL8 deltaT, /**< sampling interval (s) */
REAL8 m1, /**< mass of companion 1 (kg) */
REAL8 m2, /**< mass of companion 2 (kg) */
......@@ -996,8 +996,7 @@ int XLALSimInspiralTaylorT2PNGenerator(
* using TaylorT2 phasing.
*/
SphHarmTimeSeries *XLALSimInspiralTaylorT2PNModes(
REAL8 phiRef, /**< reference orbital phase (rad) */
REAL8 v0, /**< tail-term gauge choice (default = 1) */
UNUSED REAL8 v0, /**< tail-term gauge choice (default = 1) */
REAL8 deltaT, /**< sampling interval (s) */
REAL8 m1, /**< mass of companion 1 (kg) */
REAL8 m2, /**< mass of companion 2 (kg) */
......@@ -1039,7 +1038,7 @@ SphHarmTimeSeries *XLALSimInspiralTaylorT2PNModes(
REAL8TimeSeries *V;
REAL8TimeSeries *phi;
int n;
n = XLALSimInspiralTaylorT2PNEvolveOrbit(&V, &phi, phiRef, deltaT,
n = XLALSimInspiralTaylorT2PNEvolveOrbit(&V, &phi, 0., deltaT,
m1, m2, f_min, fRef, lambda1, lambda2, tideO, phaseO);
if ( n < 0 )
XLAL_ERROR_NULL(XLAL_EFUNC);
......@@ -1047,8 +1046,8 @@ SphHarmTimeSeries *XLALSimInspiralTaylorT2PNModes(
COMPLEX16TimeSeries *hxx;
for(l=2; l<=lmax; l++){
for(m=-l; m<=l; m++){
hxx = XLALCreateSimInspiralPNModeCOMPLEX16TimeSeries(V, phi,
v0, m1, m2, r, amplitudeO, l, m);
hxx = XLALCreateSimInspiralPNModeCOMPLEX16TimeSeriesLALConvention(V, phi,
m1, m2, r, amplitudeO, l, m);
if ( !hxx ){
XLAL_ERROR_NULL(XLAL_EFUNC);
}
......@@ -1066,8 +1065,7 @@ SphHarmTimeSeries *XLALSimInspiralTaylorT2PNModes(
* using TaylorT2 phasing.
*/
COMPLEX16TimeSeries *XLALSimInspiralTaylorT2PNMode(
REAL8 phiRef, /**< reference orbital phase (rad) */
REAL8 v0, /**< tail-term gauge choice (default = 1) */
UNUSED REAL8 v0, /**< tail-term gauge choice (default = 1) */
REAL8 deltaT, /**< sampling interval (s) */
REAL8 m1, /**< mass of companion 1 (kg) */
REAL8 m2, /**< mass of companion 2 (kg) */
......@@ -1110,12 +1108,12 @@ COMPLEX16TimeSeries *XLALSimInspiralTaylorT2PNMode(
REAL8TimeSeries *V;
REAL8TimeSeries *phi;
int n;
n = XLALSimInspiralTaylorT2PNEvolveOrbit(&V, &phi, phiRef, deltaT,
n = XLALSimInspiralTaylorT2PNEvolveOrbit(&V, &phi, 0., deltaT,
m1, m2, f_min, fRef, lambda1, lambda2, tideO, phaseO);
if ( n < 0 )
XLAL_ERROR_NULL(XLAL_EFUNC);
hlm = XLALCreateSimInspiralPNModeCOMPLEX16TimeSeries(V, phi,
v0, m1, m2, r, amplitudeO, l, m);
hlm = XLALCreateSimInspiralPNModeCOMPLEX16TimeSeriesLALConvention(V, phi,
m1, m2, r, amplitudeO, l, m);
XLALDestroyREAL8TimeSeries(phi);
XLALDestroyREAL8TimeSeries(V);
return hlm;
......
......@@ -1040,8 +1040,7 @@ int XLALSimInspiralTaylorT3PNGenerator(
* using TaylorT3 phasing.
*/
SphHarmTimeSeries *XLALSimInspiralTaylorT3PNModes(
REAL8 phiRef, /**< reference orbital phase (rad) */
REAL8 v0, /**< tail-term gauge choice (default = 1) */
UNUSED REAL8 v0, /**< tail-term gauge choice (default = 1) */
REAL8 deltaT, /**< sampling interval (s) */
REAL8 m1, /**< mass of companion 1 (kg) */
REAL8 m2, /**< mass of companion 2 (kg) */
......@@ -1083,7 +1082,7 @@ SphHarmTimeSeries *XLALSimInspiralTaylorT3PNModes(
REAL8TimeSeries *V;
REAL8TimeSeries *phi;
int n;
n = XLALSimInspiralTaylorT3PNEvolveOrbit(&V, &phi, phiRef, deltaT,
n = XLALSimInspiralTaylorT3PNEvolveOrbit(&V, &phi, 0., deltaT,
m1, m2, f_min, fRef, lambda1, lambda2, tideO, phaseO);
if ( n < 0 )
XLAL_ERROR_NULL(XLAL_EFUNC);
......@@ -1091,8 +1090,8 @@ SphHarmTimeSeries *XLALSimInspiralTaylorT3PNModes(
COMPLEX16TimeSeries *hxx;
for(l=2; l<=lmax; l++){
for(m=-l; m<=l; m++){
hxx = XLALCreateSimInspiralPNModeCOMPLEX16TimeSeries(V, phi,
v0, m1, m2, r, amplitudeO, l, m);
hxx = XLALCreateSimInspiralPNModeCOMPLEX16TimeSeriesLALConvention(V, phi,
m1, m2, r, amplitudeO, l, m);
if ( !hxx ){
XLAL_ERROR_NULL(XLAL_EFUNC);
}
......@@ -1110,8 +1109,7 @@ SphHarmTimeSeries *XLALSimInspiralTaylorT3PNModes(
* using TaylorT3 phasing.
*/
COMPLEX16TimeSeries *XLALSimInspiralTaylorT3PNMode(
REAL8 phiRef, /**< reference orbital phase (rad) */
REAL8 v0, /**< tail-term gauge choice (default = 1) */
UNUSED REAL8 v0, /**< tail-term gauge choice (default = 1) */
REAL8 deltaT, /**< sampling interval (s) */
REAL8 m1, /**< mass of companion 1 (kg) */
REAL8 m2, /**< mass of companion 2 (kg) */
......@@ -1154,12 +1152,12 @@ COMPLEX16TimeSeries *XLALSimInspiralTaylorT3PNMode(
REAL8TimeSeries *V;
REAL8TimeSeries *phi;
int n;
n = XLALSimInspiralTaylorT3PNEvolveOrbit(&V, &phi, phiRef, deltaT,
n = XLALSimInspiralTaylorT3PNEvolveOrbit(&V, &phi, 0., deltaT,
m1, m2, f_min, fRef, lambda1, lambda2, tideO, phaseO);
if ( n < 0 )
XLAL_ERROR_NULL(XLAL_EFUNC);
hlm = XLALCreateSimInspiralPNModeCOMPLEX16TimeSeries(V, phi,
v0, m1, m2, r, amplitudeO, l, m);
hlm = XLALCreateSimInspiralPNModeCOMPLEX16TimeSeriesLALConvention(V, phi,
m1, m2, r, amplitudeO, l, m);
XLALDestroyREAL8TimeSeries(phi);
XLALDestroyREAL8TimeSeries(V);
return hlm;
......
......@@ -572,7 +572,7 @@ int XLALSimInspiralTaylorT4PNGenerator(
REAL8TimeSeries **hplus, /**< +-polarization waveform */
REAL8TimeSeries **hcross, /**< x-polarization waveform */
REAL8 phiRef, /**< reference orbital phase (rad) */
REAL8 v0, /**< tail-term gauge choice (default = 1) */
UNUSED REAL8 v0, /**< tail-term gauge choice (default = 1) */
REAL8 deltaT, /**< sampling interval (s) */
REAL8 m1, /**< mass of companion 1 (kg) */
REAL8 m2, /**< mass of companion 2 (kg) */
......@@ -634,8 +634,7 @@ int XLALSimInspiralTaylorT4PNGenerator(
* using TaylorT4 phasing.
*/
SphHarmTimeSeries *XLALSimInspiralTaylorT4PNModes(
REAL8 phiRef, /**< reference orbital phase (rad) */
REAL8 v0, /**< tail-term gauge choice (default = 1) */
UNUSED REAL8 v0, /**< tail-term gauge choice (default = 1) */
REAL8 deltaT, /**< sampling interval (s) */
REAL8 m1, /**< mass of companion 1 (kg) */
REAL8 m2, /**< mass of companion 2 (kg) */
......@@ -677,7 +676,7 @@ SphHarmTimeSeries *XLALSimInspiralTaylorT4PNModes(
REAL8TimeSeries *V;
REAL8TimeSeries *phi;
int n;
n = XLALSimInspiralTaylorT4PNEvolveOrbit(&V, &phi, phiRef, deltaT,
n = XLALSimInspiralTaylorT4PNEvolveOrbit(&V, &phi, 0., deltaT,
m1, m2, f_min, fRef, lambda1, lambda2, tideO, phaseO);
if ( n < 0 )
XLAL_ERROR_NULL(XLAL_EFUNC);
......@@ -685,8 +684,8 @@ SphHarmTimeSeries *XLALSimInspiralTaylorT4PNModes(
COMPLEX16TimeSeries *hxx;
for(l=2; l<=lmax; l++){
for(m=-l; m<=l; m++){
hxx = XLALCreateSimInspiralPNModeCOMPLEX16TimeSeries(V, phi,
v0, m1, m2, r, amplitudeO, l, m);
hxx = XLALCreateSimInspiralPNModeCOMPLEX16TimeSeriesLALConvention(V, phi,
m1, m2, r, amplitudeO, l, m);
if ( !hxx ){
XLAL_ERROR_NULL(XLAL_EFUNC);
}
......@@ -704,8 +703,7 @@ SphHarmTimeSeries *XLALSimInspiralTaylorT4PNModes(
* using TaylorT4 phasing.
*/
COMPLEX16TimeSeries *XLALSimInspiralTaylorT4PNMode(
REAL8 phiRef, /**< reference orbital phase (rad) */
REAL8 v0, /**< tail-term gauge choice (default = 1) */
UNUSED REAL8 v0, /**< tail-term gauge choice (default = 1) */
REAL8 deltaT, /**< sampling interval (s) */
REAL8 m1, /**< mass of companion 1 (kg) */
REAL8 m2, /**< mass of companion 2 (kg) */
......@@ -748,12 +746,12 @@ COMPLEX16TimeSeries *XLALSimInspiralTaylorT4PNMode(
REAL8TimeSeries *V;
REAL8TimeSeries *phi;
int n;
n = XLALSimInspiralTaylorT4PNEvolveOrbit(&V, &phi, phiRef, deltaT,
n = XLALSimInspiralTaylorT4PNEvolveOrbit(&V, &phi, 0., deltaT,
m1, m2, f_min, fRef, lambda1, lambda2, tideO, phaseO);
if ( n < 0 )
XLAL_ERROR_NULL(XLAL_EFUNC);
hlm = XLALCreateSimInspiralPNModeCOMPLEX16TimeSeries(V, phi,
v0, m1, m2, r, amplitudeO, l, m);
hlm = XLALCreateSimInspiralPNModeCOMPLEX16TimeSeriesLALConvention(V, phi,
m1, m2, r, amplitudeO, l, m);
XLALDestroyREAL8TimeSeries(phi);
XLALDestroyREAL8TimeSeries(V);
return hlm;
......
......@@ -82,6 +82,62 @@ int XLALSimAddMode(
return 0;
}
/**
* Multiplies a mode h(l,m) by a spin-2 weighted spherical harmonic
* to obtain hplus - i hcross, which is added to the time series for
* TimeSeries of angles.
*
* Implements the sum of Eq. (11) of:
* Lawrence E. Kidder, \"Using Full Information When Computing Modes of
* Post-Newtonian Waveforms From Inspiralling Compact Binaries in Circular
* Orbit\", Physical Review D 77, 044016 (2008), arXiv:0710.0614v1 [gr-qc].
*/
int XLALSimAddModeAngleTimeSeries(
REAL8TimeSeries *hplus, /**< +-polarization waveform */
REAL8TimeSeries *hcross, /**< x-polarization waveform */
COMPLEX16TimeSeries *hmode, /**< complex mode h(l,m) */
REAL8TimeSeries *theta, /**< polar angle (rad) */
REAL8TimeSeries *phi, /**< azimuthal angle (rad) */
int l, /**< mode number l */
int m, /**< mode number m */
int sym /**< flag to add -m mode too */
)
{
COMPLEX16 Y;
UINT4 j;
LAL_CHECK_VALID_SERIES(hmode, XLAL_FAILURE);
LAL_CHECK_VALID_SERIES(hplus, XLAL_FAILURE);
LAL_CHECK_VALID_SERIES(hcross, XLAL_FAILURE);
LAL_CHECK_VALID_SERIES(theta, XLAL_FAILURE);
LAL_CHECK_VALID_SERIES(phi, XLAL_FAILURE);
LAL_CHECK_CONSISTENT_TIME_SERIES(hplus, hmode, XLAL_FAILURE);
LAL_CHECK_CONSISTENT_TIME_SERIES(hcross, hmode, XLAL_FAILURE);
LAL_CHECK_COMPATIBLE_BUT_UNIT_TIME_SERIES(hcross, theta, XLAL_FAILURE);
LAL_CHECK_COMPATIBLE_BUT_UNIT_TIME_SERIES(hcross, phi, XLAL_FAILURE);
for ( j = 0; j < hmode->data->length; ++j ) {
COMPLEX16 hpc;
Y = XLALSpinWeightedSphericalHarmonic(theta->data->data[j], phi->data->data[j], -2, l, m);
hpc = Y * hmode->data->data[j];
hplus->data->data[j] += creal(hpc);
hcross->data->data[j] += -cimag(hpc);
}
if ( sym ) { /* equatorial symmetry: add in -m mode */
if ( l % 2 ) /* l is odd */
Y = -Y;
for ( j = 0; j < hmode->data->length; ++j ) {
COMPLEX16 hpc;
Y = XLALSpinWeightedSphericalHarmonic(theta->data->data[j], phi->data->data[j], -2, l, -m);
hpc = Y * conj(hmode->data->data[j]);
hplus->data->data[j] += creal(hpc);
hcross->data->data[j] += -cimag(hpc);
}
}
return 0;
}
/**
* For all valid TimeSeries contained within hmode structure,
* multiplies a mode h(l,m) by a spin-2 weighted spherical harmonic
......@@ -93,11 +149,11 @@ int XLALSimAddMode(
* Orbit\", Physical Review D 77, 044016 (2008), arXiv:0710.0614v1 [gr-qc].
*/
int XLALSimAddModeFromModes(
REAL8TimeSeries *hplus, /**< +-polarization waveform */
REAL8TimeSeries *hcross, /**< x-polarization waveform */
SphHarmTimeSeries *hmode, /**< complex modes h(l,m) */
REAL8 theta, /**< polar angle (rad) */
REAL8 phi /**< azimuthal angle (rad) */
REAL8TimeSeries *hplus, /**< +-polarization waveform */
REAL8TimeSeries *hcross, /**< x-polarization waveform */
SphHarmTimeSeries *hmode, /**< complex modes h(l,m) */
REAL8 theta, /**< polar angle (rad) */
REAL8 phi /**< azimuthal angle (rad) */
)
{
SphHarmTimeSeries* this = hmode;
......@@ -114,6 +170,42 @@ int XLALSimAddModeFromModes(
return 0;
}
/**
* For all valid TimeSeries contained within hmode structure,
* multiplies a mode h(l,m) by a spin-2 weighted spherical harmonic
* to obtain hplus - i hcross, which is added to the time series.
* Angles are TimeSeries too.
*
* Implements the sum of Eq. (11) of:
* Lawrence E. Kidder, \"Using Full Information When Computing Modes of
* Post-Newtonian Waveforms From Inspiralling Compact Binaries in Circular
* Orbit\", Physical Review D 77, 044016 (2008), arXiv:0710.0614v1 [gr-qc].
*
* @sa XLALSimAddModeAngleTimeSeries()
*
*/
int XLALSimAddModeFromModesAngleTimeSeries(
REAL8TimeSeries *hplus, /**< +-polarization waveform */
REAL8TimeSeries *hcross, /**< x-polarization waveform */
SphHarmTimeSeries *hmode, /**< complex modes h(l,m) */
REAL8TimeSeries *theta, /**< polar angle (rad) */
REAL8TimeSeries *phi /**< azimuthal angle (rad) */
)
{
SphHarmTimeSeries* this = hmode;
while ( this ) {
if ( !this->tdata ) {
this = this->next;
continue;
}
XLALSimAddModeAngleTimeSeries(hplus, hcross, hmode->mode, theta, phi, this->l, this->m, 1);
this = this->next;
}
return 0;
}
/**
* Returns the h+, hx waveforms constructed from all valid TimeSeries
* contained within hmode structure.
......@@ -152,4 +244,42 @@ int XLALSimNewTimeSeriesFromModes(
return 0;
}
/**
* Returns the h+, hx waveforms constructed from all valid TimeSeries
* contained within hmode structure. Angles are TimeSeries too.
*
* @sa XLALSimAddModeFromModesAngleTimeSeries() and XLALSimAddModeAngleTimeSeries()
*/
int XLALSimNewTimeSeriesFromModesAngleTimeSeries(
REAL8TimeSeries **hplus, /**< +-polarization waveform */
REAL8TimeSeries **hcross, /**< x-polarization waveform */
SphHarmTimeSeries *hmode, /**< complex modes h(l,m) */
REAL8TimeSeries *theta, /**< polar angle (rad) */
REAL8TimeSeries *phi /**< azimuthal angle (rad) */
)
{
if (!hmode) {
XLALPrintError("NULL mode structure passed.\n");
XLAL_ERROR(XLAL_EINVAL);
}
if (*hplus || *hcross) {
XLALPrintError("hplus and hcross time series must be NULL.\n");
XLAL_ERROR(XLAL_EINVAL);
}
*hplus = XLALCreateREAL8TimeSeries("hplus", &(hmode->mode->epoch),
hmode->mode->f0, hmode->mode->deltaT, &lalStrainUnit,
hmode->mode->data->length);
*hcross = XLALCreateREAL8TimeSeries("hplus", &(hmode->mode->epoch),
hmode->mode->f0, hmode->mode->deltaT, &lalStrainUnit,
hmode->mode->data->length);
memset((*hplus)->data->data, 0, (*hplus)->data->length*sizeof(REAL8));
memset((*hcross)->data->data, 0, (*hcross)->data->length*sizeof(REAL8));
XLALSimAddModeFromModesAngleTimeSeries(*hplus, *hcross, hmode, theta, phi);
return 0;
}
/** @} */
......@@ -46,8 +46,11 @@ extern "C" {
*/
int XLALSimAddMode(REAL8TimeSeries *hplus, REAL8TimeSeries *hcross, COMPLEX16TimeSeries *hmode, REAL8 theta, REAL8 phi, int l, int m, int sym);
int XLALSimAddModeAngleTimeSeries(REAL8TimeSeries *hplus, REAL8TimeSeries *hcross, COMPLEX16TimeSeries *hmode, REAL8TimeSeries *theta, REAL8TimeSeries *phi, int l, int m, int sym);
int XLALSimAddModeFromModes(REAL8TimeSeries *hplus, REAL8TimeSeries *hcross, SphHarmTimeSeries *hmode, REAL8 theta, REAL8 phi);
int XLALSimAddModeFromModesAngleTimeSeries(REAL8TimeSeries *hplus, REAL8TimeSeries *hcross, SphHarmTimeSeries *hmode, REAL8TimeSeries *theta, REAL8TimeSeries *phi);
int XLALSimNewTimeSeriesFromModes(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, SphHarmTimeSeries *hmode, REAL8 theta, REAL8 phi);
int XLALSimNewTimeSeriesFromModesAngleTimeSeries(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, SphHarmTimeSeries *hmode, REAL8TimeSeries *theta, REAL8TimeSeries *phi);
#if 0
{ /* so that editors will match succeeding brace */
......
......@@ -172,6 +172,20 @@ UINT4 XLALSphHarmTimeSeriesGetMaxL( SphHarmTimeSeries* ts ){
return maxl;
}
/**
* Get the smallest l index of any mode in the SphHarmTimeSeries linked list
*/
UINT4 XLALSphHarmTimeSeriesGetMinL( SphHarmTimeSeries* ts ){
SphHarmTimeSeries *itr = ts;
UINT4 minl=INT_MAX;
while( itr ){
minl = itr->l < minl ? itr->l : minl;
itr = itr ->next;
}
return minl;
}
/**
* For every (l,m) node in the SphHarmTimeSeries linked list,
* call XLALResizeCOMPLEX16TimeSeries(ts->mode, first, length)
......
......@@ -20,6 +20,8 @@
#ifndef _LALSIMSPHHARMSERIES_H
#define _LALSIMSPHHARMSERIES_H
#include <limits.h>
#include <lal/LALDatatypes.h>
#include <lal/TimeSeries.h>
......@@ -69,6 +71,7 @@ void XLALSphHarmTimeSeriesSetTData(SphHarmTimeSeries *ts, REAL8Sequence* fdata);
REAL8Sequence* XLALSphHarmTimeSeriesGetTData(SphHarmTimeSeries *ts);
void XLALDestroySphHarmTimeSeries(SphHarmTimeSeries* ts);
UINT4 XLALSphHarmTimeSeriesGetMaxL(SphHarmTimeSeries* ts);
UINT4 XLALSphHarmTimeSeriesGetMinL(SphHarmTimeSeries* ts);
#ifdef SWIG
SWIGLAL(RETURN_OWNED_BY_1ST_ARG(COMPLEX16TimeSeries*, XLALSphHarmTimeSeriesGetMode));
......
......@@ -25,3 +25,11 @@
if ( fabs( (s1)->f0 - (s2)->f0 ) > LAL_REAL8_EPS ) XLAL_ERROR_VAL( val, XLAL_EFREQ ); \
if ( XLALUnitCompare( &(s1)->sampleUnits, &(s2)->sampleUnits ) ) XLAL_ERROR_VAL( val, XLAL_EUNIT ); \
} while (0)
#define LAL_CHECK_COMPATIBLE_BUT_UNIT_TIME_SERIES(s1,s2,val) \
do { \
if ( XLALGPSCmp( &(s1)->epoch, &(s2)->epoch ) != 0 ) XLAL_ERROR_VAL( val, XLAL_ETIME ); \
if ( fabs( (s1)->deltaT - (s2)->deltaT ) > LAL_REAL8_EPS ) XLAL_ERROR_VAL( val, XLAL_ETIME ); \
if ( fabs( (s1)->f0 - (s2)->f0 ) > LAL_REAL8_EPS ) XLAL_ERROR_VAL( val, XLAL_EFREQ ); \
if ( (s1)->data->length != (s1)->data->length ) XLAL_ERROR_VAL(val, XLAL_EBADLEN ); \
} while (0)
......@@ -101,6 +101,7 @@ const char * usage =
" SpinDominatedWf\n"
" HGimri\n"
" NRHybSur3dq8\n"
" NR_hdf5\n"
" Supported FD approximants:\n"
" IMRPhenomA\n"
" IMRPhenomB\n"
......@@ -172,6 +173,7 @@ const char * usage =
"--eccentricity ecc Eccentricity (default 0)\n"
"--mean-per-ano psi Mean periastron anomaly in radians (default 0)\n"
"--axis AXIS for PhenSpin: 'View' (default), 'TotalJ', 'OrbitalL'\n"
"--nr-file for NR_hdf5\n"
"--nonGRpar NAME VALUE add the nonGRparam with name 'NAME' and value 'VALUE'\n"
" Supported names:\n"
" NonGRPhi1\n"
......@@ -240,7 +242,6 @@ static GSParams *parse_args(ssize_t argc, char **argv) {
XLALSimInspiralWaveformParamsInsertTidalOctupolarFMode2(params->params, 0.);
snprintf(params->outname, sizeof(params->outname), "simulation.dat"); /* output to this file */
params->verbose = 0; /* No verbosity */
/* consume command line */
for (i = 1; i < argc; ++i) {
if ((strcmp(argv[i], "-h") == 0) || (strcmp(argv[i], "--help") == 0)) {
......@@ -362,6 +363,8 @@ static GSParams *parse_args(ssize_t argc, char **argv) {
}
} else if (strcmp(argv[i], "--outname") == 0) {
snprintf(params->outname, sizeof(params->outname), "%s", argv[++i]);
} else if (strcmp(argv[i], "--nr-file") == 0) {
XLALSimInspiralWaveformParamsInsertNumRelData(params->params, argv[++i]);
} else {
XLALPrintError("Error: invalid option: %s\n", argv[i]);
goto fail;
......