Commit d545ca56 authored by Maria Haney's avatar Maria Haney

Merge branch 'TEOBResumS-review' into 'master'

Waveform review complete. Add TEOBResumS to master.

Closes #7

See merge request lscsoft/lalsuite!1257
parents d0260545 3d6521a1
Pipeline #160342 passed with stages
in 120 minutes and 27 seconds
......@@ -52,6 +52,7 @@ extern "C" {
* @defgroup LALSimIMRTidal_c LALSimIMRLackeyTidal2013.c
* @defgroup LALSimPrecessingNRSur_c LALSimIMRPrecessingNRSur.c
* @defgroup LALSimIMRNRWaveforms_c LALSimIMRNRWaveforms.c
* @defgroup LALSimIMRTEOBResumS_c LALSimIMRTEOBResumS.c
* @}
*
* @addtogroup LALSimIMR_h
......@@ -638,7 +639,7 @@ int XLALSimIMRPhenomXHMPhase(
LALDict *lalParams /**< Extra params */
);
int XLALSimIMRPhenomXPHM(
int XLALSimIMRPhenomXPHM(
COMPLEX16FrequencySeries **hptilde, /**< [out] Frequency-domain waveform h+ */
COMPLEX16FrequencySeries **hctilde, /**< [out] Frequency-domain waveform hx */
REAL8 m1_SI, /**< mass of companion 1 (kg) */
......@@ -764,6 +765,32 @@ int XLALSimIMRPhenomXPCalculateModelParametersFromSourceFrame(
LALDict *lalParams /**< LAL Dictionary */
);
/* in module LALSimIMRTEOBResumS.c */
int XLALSimIMRTEOBResumS(
REAL8TimeSeries **hplus,
REAL8TimeSeries **hcross,
const REAL8 phiRef,
const REAL8 deltaT,
const REAL8 m1,
const REAL8 m2,
const REAL8 S1x,
const REAL8 S1y,
const REAL8 S1z,
const REAL8 S2x,
const REAL8 S2y,
const REAL8 S2z,
const REAL8 lambda1,
const REAL8 lambda2,
const REAL8 distance,
const REAL8 inclination,
const REAL8 longAscNodes,
LALDict *LALparams,
const REAL8 eccentricity,
const REAL8 meanPerAno,
const REAL8 f_min,
const REAL8 f_ref
);
/* in module LALSimInspiralNRWaveforms.c */
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -361,7 +361,7 @@ typedef enum tagApproximant {
* @remarks Implemented in lalsimulation (frequency domain). */
SEOBNRv4_ROM, /**< Low-mass double-spin frequency domain reduced order model of spin-aligned EOBNR model SEOBNRv4
* @remarks Implemented in lalsimulation (frequency domain). */
SEOBNRv4HM_ROM, /**< Low-mass double-spin frequency domain reduced order model of spin-aligned EOBNR model SEOBNRv4hm
SEOBNRv4HM_ROM, /**< Low-mass double-spin frequency domain reduced order model of spin-aligned EOBNR model SEOBNRv4hm
* @remarks Implemented in lalsimulation (frequency domain). */
SEOBNRv4_ROM_NRTidal, /**< Low-mass double-spin frequency domain reduced order model of spin-aligned EOBNR model SEOBNRv4 [Bohe et al, arXiv:1611.03703] with tidal phase corrections [Dietrich et al, arXiv:1706.02969
* @remarks Implemented in lalsimulation (frequency domain). */
......@@ -431,6 +431,8 @@ typedef enum tagApproximant {
* @remarks Implemented in lalsimulation (frequency domain). */
IMRPhenomXP, /**< Frequency domain, precessing phenomenological IMR waveform model. */
IMRPhenomXPHM, /**< Frequency domain, precessing with subdominant modes phenomenological IMR waveform model. */
TEOBResumS, /**< Resummed Spin-aligned Tidal EOB
* @remarks Implemented in lalsimulation (time domain). */
NumApproximants, /**< Number of elements in enum, useful for checking bounds */
} Approximant;
......@@ -449,6 +451,7 @@ typedef enum tagFrequencyFunction {
fSEOBNRv2RD, /**< Dominant ringdown frequency in SEOBNRv2 */
fSEOBNRv4Peak, /**< Frequency of the peak amplitude in SEOBNRv4 */
fSEOBNRv4RD, /**< Dominant ringdown frequency in SEOBNRv4 */
fTEOBResumSFinal, /**< Dominant ringdown frequency in TEOBResumS */
NumFreqFunctions /**< Number of elements in the enum */
} FrequencyFunction;
......
......@@ -322,11 +322,12 @@ int XLALSimInspiralChooseTDWaveformFromCache(
return XLAL_SUCCESS;
}
// case 3: Non-precessing, ampO > 0
// FIXME: EOBNRv2HM actually ignores ampO. If it's given with ampO==0,
// FIXME: EOBNRv2HM and TEOBResumS actually ignores ampO. If it's given with ampO==0,
// it will fall to the catch-all and not be cached.
else if( (ampO==-1 || ampO>0) && (approximant==TaylorT1
|| approximant==TaylorT2 || approximant==TaylorT3
|| approximant==TaylorT4 || approximant==EOBNRv2HM) ) {
|| approximant==TaylorT4 || approximant==EOBNRv2HM
|| approximant==TEOBResumS) ) {
// If polarizations are not cached we must generate a fresh waveform
// FIXME: Add in check that hlms non-NULL
if( cache->hplus == NULL || cache->hcross == NULL) {
......@@ -681,6 +682,13 @@ static CacheVariableDiffersBitmask CacheArgsDifferenceBitmask(
if ( f_max != cache->f_max) return INTRINSIC;
if ( XLALSimInspiralWaveformParamsLookupTidalLambda1(LALpars) != XLALSimInspiralWaveformParamsLookupTidalLambda1(cache->LALpars)) return INTRINSIC;
if ( XLALSimInspiralWaveformParamsLookupTidalLambda2(LALpars) != XLALSimInspiralWaveformParamsLookupTidalLambda2(cache->LALpars)) return INTRINSIC;
if ( XLALSimInspiralWaveformParamsLookupTidalOctupolarLambda1(LALpars) != XLALSimInspiralWaveformParamsLookupTidalOctupolarLambda1(cache->LALpars)) return INTRINSIC;
if ( XLALSimInspiralWaveformParamsLookupTidalOctupolarLambda2(LALpars) != XLALSimInspiralWaveformParamsLookupTidalOctupolarLambda2(cache->LALpars)) return INTRINSIC;
if ( XLALSimInspiralWaveformParamsLookupTidalHexadecapolarLambda1(LALpars) != XLALSimInspiralWaveformParamsLookupTidalHexadecapolarLambda1(cache->LALpars)) return INTRINSIC;
if ( XLALSimInspiralWaveformParamsLookupTidalHexadecapolarLambda2(LALpars) != XLALSimInspiralWaveformParamsLookupTidalHexadecapolarLambda1(cache->LALpars)) return INTRINSIC;
if ( XLALSimInspiralWaveformParamsLookupdQuadMon1(LALpars) != XLALSimInspiralWaveformParamsLookupdQuadMon1(cache->LALpars)) return INTRINSIC;
if ( XLALSimInspiralWaveformParamsLookupdQuadMon2(LALpars) != XLALSimInspiralWaveformParamsLookupdQuadMon2(cache->LALpars)) return INTRINSIC;
if ( XLALSimInspiralWaveformParamsLookupPNAmplitudeOrder(LALpars) != XLALSimInspiralWaveformParamsLookupPNAmplitudeOrder(cache->LALpars)) return INTRINSIC;
if ( XLALSimInspiralWaveformParamsLookupPNAmplitudeOrder(LALpars) != XLALSimInspiralWaveformParamsLookupPNAmplitudeOrder(cache->LALpars)) return INTRINSIC;
......
......@@ -38,6 +38,7 @@ extern "C" {
/** Default values for all enumerated flags */
#define LAL_SIM_INSPIRAL_SPIN_ORDER_DEFAULT LAL_SIM_INSPIRAL_SPIN_ORDER_ALL
#define LAL_SIM_INSPIRAL_TIDAL_ORDER_DEFAULT LAL_SIM_INSPIRAL_TIDAL_ORDER_ALL
#define LAL_SIM_INSPIRAL_GMTIDES_DEFAULT LAL_SIM_INSPIRAL_GMTIDES_OFF
#define LAL_SIM_INSPIRAL_FRAME_AXIS_DEFAULT LAL_SIM_INSPIRAL_FRAME_AXIS_ORBITAL_L
#define LAL_SIM_INSPIRAL_MODES_CHOICE_DEFAULT LAL_SIM_INSPIRAL_MODES_CHOICE_RESTRICTED
......@@ -82,9 +83,25 @@ typedef enum tagLALSimInspiralTidalOrder {
LAL_SIM_INSPIRAL_TIDAL_ORDER_65PN = 13,
LAL_SIM_INSPIRAL_TIDAL_ORDER_7PN = 14,
LAL_SIM_INSPIRAL_TIDAL_ORDER_75PN = 15,
LAL_SIM_INSPIRAL_TIDAL_ORDER_ALL = -1
LAL_SIM_INSPIRAL_TIDAL_ORDER_ALL = -1,
} LALSimInspiralTidalOrder;
typedef enum tagLALSimInspiralGETides {
LAL_SIM_INSPIRAL_GETIDES_OFF,
LAL_SIM_INSPIRAL_GETIDES_NNLO,
LAL_SIM_INSPIRAL_GETIDES_GSF2,
LAL_SIM_INSPIRAL_GETIDES_GSF23,
LAL_SIM_INSPIRAL_GETIDES_NOPT
} LALSimInspiralGETides;
typedef enum tagLALSimInspiralGMTides {
LAL_SIM_INSPIRAL_GMTIDES_OFF,
LAL_SIM_INSPIRAL_GMTIDES_PN,
LAL_SIM_INSPIRAL_GMTIDES_GSF,
LAL_SIM_INSPIRAL_GMTIDES_NOPT
} LALSimInspiralGMTides;
/**
* Enumerator for choosing the reference frame associated with
* PSpinInspiralRD waveforms.
......
......@@ -67,12 +67,15 @@ DEFINE_INSERT_FUNC(PNAmplitudeOrder, INT4, "ampO", -1)
DEFINE_INSERT_FUNC(PNEccentricityOrder, INT4, "eccO", -1)
DEFINE_INSERT_FUNC(PNSpinOrder, INT4, "spinO", -1)
DEFINE_INSERT_FUNC(PNTidalOrder, INT4, "tideO", -1)
DEFINE_INSERT_FUNC(GETides, INT4, "GEtideO", 0)
DEFINE_INSERT_FUNC(GMTides, INT4, "GMtideO", 0)
DEFINE_INSERT_FUNC(TidalLambda1, REAL8, "lambda1", 0)
DEFINE_INSERT_FUNC(TidalLambda2, REAL8, "lambda2", 0)
DEFINE_INSERT_FUNC(TidalOctupolarLambda1, REAL8, "TidalOctupolarLambda1", 0)
DEFINE_INSERT_FUNC(TidalOctupolarLambda2, REAL8, "TidalOctupolarLambda2", 0)
DEFINE_INSERT_FUNC(TidalHexadecapolarLambda1, REAL8, "TidalHexadecapolarLambda1", 0)
DEFINE_INSERT_FUNC(TidalHexadecapolarLambda2, REAL8, "TidalHexadecapolarLambda2", 0)
DEFINE_INSERT_FUNC(TidalQuadrupolarFMode1, REAL8, "TidalQuadrupolarFMode1", 0)
DEFINE_INSERT_FUNC(TidalQuadrupolarFMode2, REAL8, "TidalQuadrupolarFMode2", 0)
DEFINE_INSERT_FUNC(TidalOctupolarFMode1, REAL8, "TidalOctupolarFMode1", 0)
......@@ -210,11 +213,15 @@ DEFINE_LOOKUP_FUNC(PNAmplitudeOrder, INT4, "ampO", -1)
DEFINE_LOOKUP_FUNC(PNEccentricityOrder, INT4, "eccO", -1)
DEFINE_LOOKUP_FUNC(PNSpinOrder, INT4, "spinO", -1)
DEFINE_LOOKUP_FUNC(PNTidalOrder, INT4, "tideO", -1)
DEFINE_LOOKUP_FUNC(GETides, INT4, "GEtideO", 0)
DEFINE_LOOKUP_FUNC(GMTides, INT4, "GMtideO", 0)
DEFINE_LOOKUP_FUNC(TidalLambda1, REAL8, "lambda1", 0)
DEFINE_LOOKUP_FUNC(TidalLambda2, REAL8, "lambda2", 0)
DEFINE_LOOKUP_FUNC(TidalOctupolarLambda1, REAL8, "TidalOctupolarLambda1", 0)
DEFINE_LOOKUP_FUNC(TidalOctupolarLambda2, REAL8, "TidalOctupolarLambda2", 0)
DEFINE_LOOKUP_FUNC(TidalHexadecapolarLambda1, REAL8, "TidalHexadecapolarLambda1", 0)
DEFINE_LOOKUP_FUNC(TidalHexadecapolarLambda2, REAL8, "TidalHexadecapolarLambda2", 0)
DEFINE_LOOKUP_FUNC(TidalQuadrupolarFMode1, REAL8, "TidalQuadrupolarFMode1", 0)
DEFINE_LOOKUP_FUNC(TidalQuadrupolarFMode2, REAL8, "TidalQuadrupolarFMode2", 0)
DEFINE_LOOKUP_FUNC(TidalOctupolarFMode1, REAL8, "TidalOctupolarFMode1", 0)
......@@ -344,11 +351,15 @@ DEFINE_ISDEFAULT_FUNC(PNAmplitudeOrder, INT4, "ampO", -1)
DEFINE_ISDEFAULT_FUNC(PNEccentricityOrder, INT4, "eccO", -1)
DEFINE_ISDEFAULT_FUNC(PNSpinOrder, INT4, "spinO", -1)
DEFINE_ISDEFAULT_FUNC(PNTidalOrder, INT4, "tideO", -1)
DEFINE_ISDEFAULT_FUNC(GETides, INT4, "GEtideO", LAL_SIM_INSPIRAL_GETIDES_GSF23)
DEFINE_ISDEFAULT_FUNC(GMTides, INT4, "GMtideO", LAL_SIM_INSPIRAL_GMTIDES_PN)
DEFINE_ISDEFAULT_FUNC(TidalLambda1, REAL8, "lambda1", 0)
DEFINE_ISDEFAULT_FUNC(TidalLambda2, REAL8, "lambda2", 0)
DEFINE_ISDEFAULT_FUNC(TidalOctupolarLambda1, REAL8, "TidalOctupolarLambda1", 0)
DEFINE_ISDEFAULT_FUNC(TidalOctupolarLambda2, REAL8, "TidalOctupolarLambda2", 0)
DEFINE_ISDEFAULT_FUNC(TidalHexadecapolarLambda1, REAL8, "TidalHexadecapolarLambda1", 0)
DEFINE_ISDEFAULT_FUNC(TidalHexadecapolarLambda2, REAL8, "TidalHexadecapolarLambda2", 0)
DEFINE_ISDEFAULT_FUNC(TidalQuadrupolarFMode1, REAL8, "TidalQuadrupolarFMode1", 0)
DEFINE_ISDEFAULT_FUNC(TidalQuadrupolarFMode2, REAL8, "TidalQuadrupolarFMode2", 0)
DEFINE_ISDEFAULT_FUNC(TidalOctupolarFMode1, REAL8, "TidalOctupolarFMode1", 0)
......
......@@ -23,11 +23,15 @@ int XLALSimInspiralWaveformParamsInsertPNAmplitudeOrder(LALDict *params, INT4 va
int XLALSimInspiralWaveformParamsInsertPNEccentricityOrder(LALDict *params, INT4 value);
int XLALSimInspiralWaveformParamsInsertPNSpinOrder(LALDict *params, INT4 value);
int XLALSimInspiralWaveformParamsInsertPNTidalOrder(LALDict *params, INT4 value);
int XLALSimInspiralWaveformParamsInsertGETides(LALDict *params, INT4 value);
int XLALSimInspiralWaveformParamsInsertGMTides(LALDict *params, INT4 value);
int XLALSimInspiralWaveformParamsInsertTidalLambda1(LALDict *params, REAL8 value);
int XLALSimInspiralWaveformParamsInsertTidalLambda2(LALDict *params, REAL8 value);
int XLALSimInspiralWaveformParamsInsertTidalOctupolarLambda1(LALDict *params, REAL8 value);
int XLALSimInspiralWaveformParamsInsertTidalOctupolarLambda2(LALDict *params, REAL8 value);
int XLALSimInspiralWaveformParamsInsertTidalHexadecapolarLambda1(LALDict *params, REAL8 value);
int XLALSimInspiralWaveformParamsInsertTidalHexadecapolarLambda2(LALDict *params, REAL8 value);
int XLALSimInspiralWaveformParamsInsertTidalQuadrupolarFMode1(LALDict *params, REAL8 value);
int XLALSimInspiralWaveformParamsInsertTidalQuadrupolarFMode2(LALDict *params, REAL8 value);
int XLALSimInspiralWaveformParamsInsertTidalOctupolarFMode1(LALDict *params, REAL8 value);
......@@ -151,11 +155,15 @@ INT4 XLALSimInspiralWaveformParamsLookupPNAmplitudeOrder(LALDict *params);
INT4 XLALSimInspiralWaveformParamsLookupPNEccentricityOrder(LALDict *params);
INT4 XLALSimInspiralWaveformParamsLookupPNSpinOrder(LALDict *params);
INT4 XLALSimInspiralWaveformParamsLookupPNTidalOrder(LALDict *params);
INT4 XLALSimInspiralWaveformParamsLookupGETides(LALDict *params);
INT4 XLALSimInspiralWaveformParamsLookupGMTides(LALDict *params);
REAL8 XLALSimInspiralWaveformParamsLookupTidalLambda1(LALDict *params);
REAL8 XLALSimInspiralWaveformParamsLookupTidalLambda2(LALDict *params);
REAL8 XLALSimInspiralWaveformParamsLookupTidalOctupolarLambda1(LALDict *params);
REAL8 XLALSimInspiralWaveformParamsLookupTidalOctupolarLambda2(LALDict *params);
REAL8 XLALSimInspiralWaveformParamsLookupTidalHexadecapolarLambda1(LALDict *params);
REAL8 XLALSimInspiralWaveformParamsLookupTidalHexadecapolarLambda2(LALDict *params);
REAL8 XLALSimInspiralWaveformParamsLookupTidalQuadrupolarFMode1(LALDict *params);
REAL8 XLALSimInspiralWaveformParamsLookupTidalQuadrupolarFMode2(LALDict *params);;
REAL8 XLALSimInspiralWaveformParamsLookupTidalOctupolarFMode1(LALDict *params);
......@@ -279,11 +287,15 @@ int XLALSimInspiralWaveformParamsPNAmplitudeOrderIsDefault(LALDict *params);
int XLALSimInspiralWaveformParamsPNEccentricityOrderIsDefault(LALDict *params);
int XLALSimInspiralWaveformParamsPNSpinOrderIsDefault(LALDict *params);
int XLALSimInspiralWaveformParamsPNTidalOrderIsDefault(LALDict *params);
int XLALSimInspiralWaveformParamsGETidesIsDefault(LALDict *params);
int XLALSimInspiralWaveformParamsGMTidesIsDefault(LALDict *params);
int XLALSimInspiralWaveformParamsTidalLambda1IsDefault(LALDict *params);
int XLALSimInspiralWaveformParamsTidalLambda2IsDefault(LALDict *params);
int XLALSimInspiralWaveformParamsTidalOctupolarLambda1IsDefault(LALDict *params);
int XLALSimInspiralWaveformParamsTidalOctupolarLambda2IsDefault(LALDict *params);
int XLALSimInspiralWaveformParamsTidalHexadecapolarLambda1IsDefault(LALDict *params);
int XLALSimInspiralWaveformParamsTidalHexadecapolarLambda2IsDefault(LALDict *params);
int XLALSimInspiralWaveformParamsTidalQuadrupolarFMode1IsDefault(LALDict *params);
int XLALSimInspiralWaveformParamsTidalQuadrupolarFMode2IsDefault(LALDict *params);
int XLALSimInspiralWaveformParamsTidalOctupolarFMode1IsDefault(LALDict *params);
......
......@@ -212,7 +212,7 @@ SphHarmTimeSeries *XLALResizeSphHarmTimeSeries(
}
SphHarmTimeSeries *XLALSphHarmTimeSeriesFromSphHarmFrequencySeriesDataAndPSD(
SphHarmFrequencySeries *hlms,
SphHarmFrequencySeries *hlms,
COMPLEX16FrequencySeries* data,
COMPLEX16FrequencySeries* psd
)
......@@ -259,8 +259,272 @@ SphHarmTimeSeries *XLALSphHarmTimeSeriesFromSphHarmFrequencySeriesDataAndPSD(
return rhoTlm;
}
/** @} */
/**
* @name SphHarmPolarTimeSeries Routines
* @{
*/
/**
* Prepend a node to a linked list of SphHarmPolarTimeSeries, or create a new head
*/
SphHarmPolarTimeSeries* XLALSphHarmPolarTimeSeriesAddMode(
SphHarmPolarTimeSeries *appended, /**< Linked list to be prepended */
const REAL8TimeSeries* inAmpl, /**< Time series of |h_lm| mode amplitude being prepended */
const REAL8TimeSeries* inphase, /**< Time series of phi_lm mode phase being prepended */
UINT4 l, /**< l index of h_lm mode being prepended */
INT4 m /**< m index of h_lm mode being prepended */
)
{
SphHarmPolarTimeSeries* ts;
// Check if the node with this l, m already exists
ts = appended;
while( ts ){
if( l == ts->l && m == ts->m ){
break;
}
ts = ts->next;
}
if( ts ){
XLALDestroyREAL8TimeSeries( ts->ampl );
XLALDestroyREAL8TimeSeries( ts->phase );
ts->ampl = XLALCutREAL8TimeSeries( inAmpl, 0, inAmpl->data->length);
ts->phase = XLALCutREAL8TimeSeries( inphase, 0, inphase->data->length);
return appended;
} else {
ts = XLALMalloc( sizeof(SphHarmPolarTimeSeries) );
}
ts->l = l;
ts->m = m;
// Cut returns a new series using a slice of the original. I ask it to
// return a new one for the full data length --- essentially a duplication
if( inAmpl ){
ts->ampl = XLALCutREAL8TimeSeries( inAmpl, 0, inAmpl->data->length);
} else {
ts->ampl = NULL;
}
if( inphase ){
ts->phase = XLALCutREAL8TimeSeries( inphase, 0, inphase->data->length);
XLAL_CHECK_NULL( (inAmpl) && (inphase->data->length == inAmpl->data->length), XLAL_EBADLEN, "Both mode amplitude and phase need to be defined with the same length or NULL.\n");
} else {
ts->phase = NULL;
XLAL_CHECK_NULL(!inAmpl, XLAL_EFUNC, "Both mode amplitude and phase need to be defined with the same length or NULL.\n");
}
if( appended ){
ts->next = appended;
ts->tdata = appended->tdata;
} else {
ts->next = NULL;
ts->tdata = NULL;
}
return ts;
}
/**
* Set the tdata member for *all* nodes in the list.
*/
void XLALSphHarmPolarTimeSeriesSetTData(
SphHarmPolarTimeSeries *ts, /**< Linked list to be prepended */
REAL8Sequence* tdata /**< series of time data*/
)
{
while( ts ){
ts->tdata = tdata;
ts = ts->next;
}
}
/**
* Get the tdata member for nodes in the list.
*/
REAL8Sequence* XLALSphHarmPolarTimeSeriesGetTData(
SphHarmPolarTimeSeries *ts /**< Get tdata from this list */
)
{
if( ts ){
return ts->tdata;
}
return NULL;
}
/** Delete list from current pointer to the end of the list */
void XLALDestroySphHarmPolarTimeSeries(
SphHarmPolarTimeSeries* ts /**< Head of linked list to destroy */
)
{
SphHarmPolarTimeSeries* pop;
while( (pop = ts) ){
if( pop->ampl ){
XLALDestroyREAL8TimeSeries( pop->ampl );
}
if( pop->phase ){
XLALDestroyREAL8TimeSeries( pop->phase );
}
// The tdata pointer is shared so we delete on the last node
if( pop->next == NULL && pop->tdata ){
XLALDestroyREAL8Sequence( pop->tdata );
}
ts = pop->next;
XLALFree( pop );
}
}
/**
* Get the time series of a waveform's (l,m) spherical harmonic mode amplitude from a
* SphHarmPolarTimeSeries linked list. Returns a pointer to its REAL8TimeSeries
*/
REAL8TimeSeries* XLALSphHarmPolarTimeSeriesGetModeAmplitude(
SphHarmPolarTimeSeries *ts, /**< linked list to extract mode from */
UINT4 l, /**< l index of h_lm mode to get */
INT4 m /**< m index of h_lm mode to get */
)
{
if( !ts ) return NULL;
SphHarmPolarTimeSeries *itr = ts;
while( itr->l != l || itr->m != m ){
itr = itr->next;
if( !itr ) return NULL;
}
return itr->ampl;
}
/**
* Get the time series of a waveform's (l,m) spherical harmonic mode phase from a
* SphHarmPolarTimeSeries linked list. Returns a pointer to its REAL8TimeSeries
*/
REAL8TimeSeries* XLALSphHarmPolarTimeSeriesGetModePhase(
SphHarmPolarTimeSeries *ts, /**< linked list to extract mode from */
UINT4 l, /**< l index of h_lm mode to get */
INT4 m /**< m index of h_lm mode to get */
)
{
if( !ts ) return NULL;
SphHarmPolarTimeSeries *itr = ts;
while( itr->l != l || itr->m != m ){
itr = itr->next;
if( !itr ) return NULL;
}
return itr->phase;
}
/**
* Get the largest l index of any mode in the SphHarmTimeSeries linked list
*/
UINT4 XLALSphHarmPolarTimeSeriesGetMaxL( SphHarmPolarTimeSeries* ts ){
SphHarmPolarTimeSeries *itr = ts;
UINT4 maxl=0;
while( itr ){
maxl = itr->l > maxl ? itr->l : maxl;
itr = itr ->next;
}
return maxl;
}
/**
* For every (l,m) node in the SphHarmPolarTimeSeries linked list,
* call XLALResizeREAL8TimeSeries(ts->ampl, first, length)
* and XLALResizeREAL8TimeSeries(ts->phase, first, length)
*
* The TimeSeries of each (l,m) mode will have the given length,
* and its contents will consist of that part of the original time series
* that started at sample first. If first is negative, then the new time
* series is padded at the start by that many samples. The time series' epoch
* is adjusted appropriately.
*/
SphHarmPolarTimeSeries *XLALResizeSphHarmPolarTimeSeries(
SphHarmPolarTimeSeries *ts, /**< SphHarmTimeSeries to be resized */
int first, /**< index of first time sample to be copied over */
size_t length /**< length to resize all COMPLEX16TimeSeries to */
)
{
SphHarmPolarTimeSeries *this = ts;
while( this ) {
this->ampl = XLALResizeREAL8TimeSeries(this->ampl, first, length);
this->phase = XLALResizeREAL8TimeSeries(this->phase, first, length);
this = this->next;
}
return ts;
}
/**
* Create a new SphHarmPolarTimeSeries linked listby extracting a
* section of an existing SphHarmPolarTimeSeries linked list.
* For every (l,m) node in the SphHarmPolarTimeSeries linked list,
* call XLALCutREAL8TimeSeries(ts->ampl, first, length)
* and XLALCutREAL8TimeSeries(ts->phase, first, length)
*
* The TimeSeries of each (l,m) mode will have the given length,
* and its contents will consist of that part of the original time series
* that started at sample first. If first is negative, then the new time
* series is padded at the start by that many samples. The time series' epoch
* is adjusted appropriately.
*/
SphHarmPolarTimeSeries *XLALCutSphHarmPolarTimeSeries(
SphHarmPolarTimeSeries *ts, /**< new SphHarmTimeSeries to be filled in */
int first, /**< index of first time sample to be copied over */
size_t length /**< length to cut all COMPLEX16TimeSeries to */
)
{
SphHarmPolarTimeSeries *this = ts;
SphHarmPolarTimeSeries *head=NULL, *tail=NULL, *new=NULL;
REAL8Sequence *tcut;
while( this ) {
new = XLALSphHarmPolarTimeSeriesAddMode(NULL, NULL, NULL, this->l, this->m);
if (head) {
head->next = new;
} else {
tail = new;
}
head = new;
head->ampl = XLALCutREAL8TimeSeries(this->ampl, first, length);
head->phase = XLALCutREAL8TimeSeries(this->phase, first, length);
this = this->next;
}
if (ts->tdata) {
tcut = XLALCutREAL8Sequence(ts->tdata, first, length);
XLALSphHarmPolarTimeSeriesSetTData(tail, tcut);
}
else {
tail->tdata=NULL;
}
head = NULL;
new = NULL;
tcut = NULL;
LALFree(head);
LALFree(new);
LALFree(tcut);
LALFree(this);
return tail;
}
/** @} */
/**
* @name SphHarmFrequencySeries Routines
* @{
......
......@@ -42,7 +42,7 @@ extern "C" {
*/
/**
* Structure to carry a collection of spherical harmonic modes in COMPLEX16
* Structure to carry a collection of spherical harmonic modes in COMPLEX16
* time series. Contains convenience getter and setter functions, as well as
* a convienence "maximum l mode" function. Implemented as a singly forward
* linked list.
......@@ -55,6 +55,14 @@ typedef struct tagSphHarmTimeSeries {
struct tagSphHarmTimeSeries* next; /**< next pointer */
} SphHarmTimeSeries;
typedef struct tagSphHarmPolarTimeSeries {
REAL8TimeSeries* ampl; /**< The sequences of mode amplitude. */
REAL8TimeSeries* phase; /**< The sequences of mode phase (not modulo 2Pi). */
UINT4 l; /**< Node mode l */
INT4 m; /**< Node submode m */
REAL8Sequence* tdata; /**< Timestamp values */
struct tagSphHarmPolarTimeSeries* next; /**< next pointer */
} SphHarmPolarTimeSeries;
typedef struct tagSphHarmFrequencySeries {
COMPLEX16FrequencySeries* mode; /**< The sequences of sampled data. */
......@@ -67,7 +75,7 @@ typedef struct tagSphHarmFrequencySeries {
/** @} */
SphHarmTimeSeries* XLALSphHarmTimeSeriesAddMode(SphHarmTimeSeries *appended, const COMPLEX16TimeSeries* inmode, UINT4 l, INT4 m);
void XLALSphHarmTimeSeriesSetTData(SphHarmTimeSeries *ts, REAL8Sequence* fdata);
void XLALSphHarmTimeSeriesSetTData(SphHarmTimeSeries *ts, REAL8Sequence* tdata);
REAL8Sequence* XLALSphHarmTimeSeriesGetTData(SphHarmTimeSeries *ts);
void XLALDestroySphHarmTimeSeries(SphHarmTimeSeries* ts);
UINT4 XLALSphHarmTimeSeriesGetMaxL(SphHarmTimeSeries* ts);
......@@ -80,10 +88,29 @@ SWIGLAL(RETURN_OWNED_BY_1ST_ARG(COMPLEX16TimeSeries*, XLALSphHarmTimeSeriesGetMo
COMPLEX16TimeSeries* XLALSphHarmTimeSeriesGetMode(SphHarmTimeSeries *ts, UINT4 l, INT4 m);
SphHarmTimeSeries *XLALResizeSphHarmTimeSeries(SphHarmTimeSeries *ts, int first, size_t length);
SphHarmPolarTimeSeries* XLALSphHarmPolarTimeSeriesAddMode(SphHarmPolarTimeSeries *appended, const REAL8TimeSeries* inampl, const REAL8TimeSeries* inphase, UINT4 l, INT4 m);
void XLALSphHarmPolarTimeSeriesSetTData(SphHarmPolarTimeSeries *ts, REAL8Sequence* tdata);
REAL8Sequence* XLALSphHarmPolarTimeSeriesGetTData(SphHarmPolarTimeSeries *ts);
void XLALDestroySphHarmPolarTimeSeries(SphHarmPolarTimeSeries* ts);
UINT4 XLALSphHarmPolarTimeSeriesGetMaxL(SphHarmPolarTimeSeries* ts);
#ifdef SWIG
SWIGLAL(OWNED_BY_1ST_ARG(REAL8TimeSeries*, XLALSphHarmPolarTimeSeriesGetModeAmplitude));
SWIGLAL(OWNED_BY_1ST_ARG(REAL8TimeSeries*, XLALSphHarmPolarTimeSeriesGetModePhase));
#endif
REAL8TimeSeries* XLALSphHarmPolarTimeSeriesGetModeAmplitude(SphHarmPolarTimeSeries *ts, UINT4 l, INT4 m);
REAL8TimeSeries* XLALSphHarmPolarTimeSeriesGetModePhase(SphHarmPolarTimeSeries *ts, UINT4 l, INT4 m);
SphHarmPolarTimeSeries *XLALResizeSphHarmPolarTimeSeries(SphHarmPolarTimeSeries *ts, int first, size_t length);
SphHarmPolarTimeSeries *XLALCutSphHarmPolarTimeSeries(SphHarmPolarTimeSeries *ts, int first, size_t length);
SphHarmFrequencySeries *XLALSphHarmFrequencySeriesFromSphHarmTimeSeries(SphHarmTimeSeries *hlms_TD);
SphHarmFrequencySeries* XLALSphHarmFrequencySeriesAddMode(SphHarmFrequencySeries *appended, const COMPLEX16FrequencySeries* inmode, UINT4 l, INT4 m);
SphHarmTimeSeries *XLALSphHarmTimeSeriesFromSphHarmFrequencySeriesDataAndPSD(SphHarmFrequencySeries *hlms, COMPLEX16FrequencySeries* data, COMPLEX16FrequencySeries* psd);
void XLALSphHarmFrequencySeriesSetFData(SphHarmFrequencySeries *ts, REAL8Sequence* tdata);
void XLALSphHarmFrequencySeriesSetFData(SphHarmFrequencySeries *ts, REAL8Sequence* fdata);
REAL8Sequence* XLALSphHarmFrequencySeriesGetFData(SphHarmFrequencySeries *ts);
void XLALDestroySphHarmFrequencySeries(SphHarmFrequencySeries* ts);
UINT4 XLALSphHarmFrequencySeriesGetMaxL(SphHarmFrequencySeries* ts);
......
This diff is collapsed.
......@@ -237,6 +237,7 @@ noinst_HEADERS = \
LALSimIMRSpinEOBHcapNumericalDerivativePrec.c \
LALSimIMRSpinEOBInitialConditions.c \
LALSimIMRSpinEOBInitialConditionsPrec.c \
LALSimTEOBResumS.h \
LALSimInspiralPNCoefficients.c \
LALSimInspiralTaylorF2Ecc.c \
LALSimInspiraldEnergyFlux.c \
......@@ -298,6 +299,9 @@ liblalsimulation_la_SOURCES = \
LALSimIMRPhenomXUtilities.c \
LALSimIMRPhenomXHM.c \
LALSimIMRPSpinInspiralRD.c \
LALSimIMRTEOBResumSUtils.c \
LALSimIMRTEOBResumS_Internals.c \
LALSimIMRTEOBResumS.c \
LALSimPhenSpinRingDown.c \
LALSimInspiralWaveformFlags.c \
LALSimInspiralTestGRParams.c \
......
......@@ -97,6 +97,7 @@ const char * usage =
" SEOBNRv4P\n"
" SEOBNRv2T\n"
" SEOBNRv4T\n"
" TEOBResumS\n"