20 #include <lal/LALSimInspiralPrecess.h>
21 #include <lal/LALAtomicDatatypes.h>
47 complex
double *x_lm =
XLALCalloc( 2*lmax+1,
sizeof(complex
double) );
50 for(
i=0;
i<
alpha->data->length;
i++){
51 for(
l=2;
l<=lmax;
l++){
52 for(
m=0;
m<2*
l+1;
m++){
62 for(
m=0;
m<2*
l+1;
m++){
63 for(mp=0; mp<2*
l+1; mp++){
64 if( !h_xx[
m] )
continue;
65 if(!(creal(h_xx[
m]->
data->data[
i])==0 && creal(x_lm[mp])==0)) {
113 if( !(h_22 && h_2_2) ){
114 XLALPrintError(
"XLAL Error - %s: Currently, ConstantPrecessionConeWaveformModes requires the l=2 m=+/-2 modes to exist to continue.", __func__);
123 XLALPrintError(
"XLAL Error - %s: Waveform length is too small to evolve accurately.", __func__);
127 XLALPrintError(
"XLAL Error - %s: Input (2,2) and (2,-2) modes have different length.", __func__);
132 double omg_p = 2*
LAL_PI*precess_freq;
165 for(
i=0;
i<
alpha->data->length;
i++){
167 alpha->data->data[
i] =
a*sin(omg_p * t + phi_precess) + alpha_0;
168 beta->data->data[
i] =
a*cos(omg_p * t + phi_precess) + beta_0;
174 double dalpha_0 =
alpha->data->data[1] -
alpha->data->data[0];
176 double dalpha_1 = 0.5*(
alpha->data->data[2] -
alpha->data->data[0]);
179 cos(
beta->data->data[0])*dalpha_0 +
180 cos(
beta->data->data[1])*dalpha_1;
184 dalpha_1 = 0.5*(
alpha->data->data[
i+1] -
alpha->data->data[
i-1]);
188 cos(
beta->data->data[
i-1])*dalpha_0 +
189 cos(
beta->data->data[
i])*dalpha_1;
193 dalpha_1 =
alpha->data->data[
i] -
alpha->data->data[
i-1];
195 cos(
beta->data->data[
i-1])*dalpha_0 +
196 cos(
beta->data->data[
i])*dalpha_1;
227 &h_lm, precess_freq,
a, phi_precess, alpha_0, beta_0 );
233 double view_th = 0.0, view_ph = 0.0;
264 I2 = sqrt(6.)*( conj(h20)*h2m2 + h20*conj(h22) ) + 3*conj(h21)*h2m1;
266 (2*(3) - 2*2)* conj(h22)*h22
267 + (2*(3) - 2*2) *conj(h2m2)*h2m2
268 + (2*(3) - 1*1)* conj(h21)*h21
269 + (2*(3) - 1*1) *conj(h2m1)*h2m1
270 + (2*(3) - 0 )* conj(h20)*h20
272 Izz = ( (2*2)* conj(h22)*h22
273 + ( 2*2) *conj(h2m2)*h2m2
274 + ( 1*1) *conj(h21)*h21
275 + ( 1*1) *conj(h2m1)*h2m1
276 + ( 0 ) *conj(h20)*h20
279 3*conj(h22)*h2m1 - 3 *conj(h2m1)*h2m2
280 + sqrt(3./2.)*(conj(h21)*h20 - conj(h20)*h2m1)
283 nm = conj(h22)*h22 + conj(h21)*h21 + conj(h20)*h20 + conj(h2m1)*h2m1 + conj(h2m2)*h2m2;
285 mtx[0][0] = creal( (I0 + creal(I2))/nm );
286 mtx[1][0] = mtx[0][1] = cimag(I2/nm);
287 mtx[2][0] = mtx[0][2] = creal(I1/nm);
288 mtx[1][1] = creal( (I0 - creal(I2))/nm );
289 mtx[2][1] = mtx[1][2] = cimag(I1/nm);
290 mtx[2][2] = creal(Izz/nm);
306 gsl_matrix *
m = gsl_matrix_alloc(3,3);
307 gsl_vector *eval = gsl_vector_alloc(3);
308 gsl_matrix *evec = gsl_matrix_alloc(3,3);
309 gsl_eigen_symmv_workspace *
w = gsl_eigen_symmv_alloc(3);
315 for (
i=0;
i<3;
i++) {
316 for (j=0; j<3; j++) {
317 gsl_matrix_set(
m,
i,j,mtx[
i][j]);
320 gsl_eigen_symmv(
m, eval, evec,
w);
321 gsl_eigen_symmv_free(
w);
323 gsl_eigen_symmv_sort (eval, evec, GSL_EIGEN_SORT_ABS_ASC);
325 for (
i=0;
i<3;
i++) {
326 vec[
i] = gsl_matrix_get(evec,2,
i);
329 if (vecLast[0]*vec[0] + vecLast[1]*vec[1] + vecLast[2]*vec[2] <0) {
330 for (
i=0;
i<3;
i++) {
335 gsl_vector_free(eval);
336 gsl_matrix_free(evec);
367 for(
l=lmin;
l <= lmax;
l++ ) {
369 for(
m=-
l;
m<=
l;
m++){
372 for(
m=-
l;
m<=
l;
m++){
376 for(mp=-
l; mp<=
l; mp++){
static double beta(const double a, const double b, const sysq *system)
Internal function that computes the spin-orbit couplings.
void * XLALCalloc(size_t m, size_t n)
int XLALSimInspiralPolarizationsFromSphHarmTimeSeries(REAL8TimeSeries **hp, REAL8TimeSeries **hc, SphHarmTimeSeries *hlms, REAL8 iota, REAL8 phiRef)
Compute the polarizations from all the -2 spin-weighted spherical harmonic modes stored in 'hlms'.
int XLALSimInspiralOrientationMatrixForL2(REAL8 mtx[3][3], COMPLEX16 h22, COMPLEX16 h2m2, COMPLEX16 h21, COMPLEX16 h2m1, COMPLEX16 h20)
Determine the `‘preferred direction’' matrix for the l=2 subspace from the relevant mode decomposed h...
int XLALSimInspiralOrientationMatrixDirection(REAL8 vec[3], REAL8 mtx[3][3])
Determine a direction vector from the orientation matrix.
int XLALSimInspiralPrecessionRotateModes(SphHarmTimeSeries *h_lm, REAL8TimeSeries *alpha, REAL8TimeSeries *beta, REAL8TimeSeries *gam)
Takes in the h_lm spherical harmonic decomposed modes and rotates the modes by Euler angles alpha,...
int XLALSimInspiralPrecessionRotateModesOut(SphHarmTimeSeries **hlm_out, SphHarmTimeSeries *hlm_in, const REAL8TimeSeries *alpha, const REAL8TimeSeries *beta, const REAL8TimeSeries *gam)
Takes in the h_lm spherical harmonic decomposed modes and rotates the modes by Euler angles alpha,...
int XLALSimInspiralConstantPrecessionConeWaveformModes(SphHarmTimeSeries **h_lm_tmp, double precess_freq, double a, double phi_precess, double alpha_0, double beta_0)
Takes in the l=2, abs(m)=2 decomposed modes as a strain time series and imposes the effect of a const...
int XLALSimInspiralConstantPrecessionConeWaveform(REAL8TimeSeries **hp, REAL8TimeSeries **hx, SphHarmTimeSeries *h_lm, double precess_freq, double a, double phi_precess, double alpha_0, double beta_0)
Takes in the spherical harmonic decomposed modes as a strain time series and imposes the effect of a ...
UINT4 XLALSphHarmTimeSeriesGetMinL(SphHarmTimeSeries *ts)
Get the smallest l index of any mode in the SphHarmTimeSeries linked list.
SphHarmTimeSeries * XLALSphHarmTimeSeriesAddMode(SphHarmTimeSeries *appended, const COMPLEX16TimeSeries *inmode, UINT4 l, INT4 m)
Prepend a node to a linked list of SphHarmTimeSeries, or create a new head.
COMPLEX16TimeSeries * XLALSphHarmTimeSeriesGetMode(SphHarmTimeSeries *ts, UINT4 l, INT4 m)
Get the time series of a waveform's (l,m) spherical harmonic mode from a SphHarmTimeSeries linked lis...
UINT4 XLALSphHarmTimeSeriesGetMaxL(SphHarmTimeSeries *ts)
Get the largest l index of any mode in the SphHarmTimeSeries linked list.
COMPLEX16 XLALWignerDMatrix(int l, int mp, int m, double alpha, double beta, double gam)
REAL8TimeSeries * XLALCreateREAL8TimeSeries(const CHAR *name, const LIGOTimeGPS *epoch, REAL8 f0, REAL8 deltaT, const LALUnit *sampleUnits, size_t length)
void XLALDestroyREAL8TimeSeries(REAL8TimeSeries *series)
COMPLEX16TimeSeries * XLALCreateCOMPLEX16TimeSeries(const CHAR *name, const LIGOTimeGPS *epoch, REAL8 f0, REAL8 deltaT, const LALUnit *sampleUnits, size_t length)
int XLALPrintError(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
Structure to carry a collection of spherical harmonic modes in COMPLEX16 time series.