31 #include <gsl/gsl_rng.h>
32 #include <gsl/gsl_randist.h>
33 #include <lal/LALConstants.h>
34 #include <lal/LALDatatypes.h>
35 #include <lal/LALError.h>
36 #include <lal/LALSimBurst.h>
37 #include <lal/FrequencySeries.h>
38 #include <lal/Sequence.h>
39 #include <lal/TimeFreqFFT.h>
40 #include <lal/TimeSeries.h>
41 #include <lal/RealFFT.h>
42 #include <lal/Units.h>
66 series->
data->
data[
i] = gsl_ran_gaussian(rng, rms);
81 *
a = 1.0 / sqrt(2.0 - e2);
82 *b = *
a * sqrt(1.0 - e2);
115 double complex hpeak;
132 abs_hpeak = cabs(hpeak);
134 if(cabs(hplus->
data->
data[
i] + I * (hcross ? hcross->
data->
data[
i] : 0.)) > abs_hpeak) {
136 abs_hpeak = cabs(hpeak);
269 double x = pow(fseries->
f0 +
i * fseries->
deltaF, 2) * pow(cabs(fseries->
data->
data[
i]), 2) +
e;
344 double e_over_rsquared;
356 if(!plan || !tilde_hplus || !tilde_hcross) {
380 return e_over_rsquared;
441 if(!*hplus || !*hcross) {
444 *hplus = *hcross = NULL;
450 memset((*hplus)->data->data, 0, length *
sizeof(*(*hplus)->data->data));
451 memset((*hcross)->data->data, 0, length *
sizeof(*(*hcross)->data->data));
455 (*hplus)->data->data[(length - 1) / 2] = hpeak;
753 REAL8 int_hdot_squared,
774 if(
duration < 0 || frequency < 0 || bandwidth < 0 || eccentricity < 0 || eccentricity > 1 || sigma_t_squared < 0 || int_hdot_squared < 0 || delta_t <= 0) {
776 *hplus = *hcross = NULL;
785 length = (int) floor(21.0 *
duration / delta_t / 2.0);
786 length = 2 * length + 1;
797 if(!*hplus || !*hcross) {
800 *hplus = *hcross = NULL;
815 window =
XLALCreateGaussREAL8Window((*hplus)->data->length, (((*hplus)->data->length - 1) / 2) / (sqrt(sigma_t_squared) / delta_t));
819 *hplus = *hcross = NULL;
823 (*hplus)->data->data[
i] *= window->
data->
data[
i];
824 (*hcross)->data->data[
i] *= window->
data->
data[
i];
833 if(!plan || !tilde_hplus || !tilde_hcross) {
839 *hplus = *hcross = NULL;
850 *hplus = *hcross = NULL;
865 double beta = -0.5 / (bandwidth * bandwidth / 4.);
867 double f = (tilde_hplus->
f0 +
i * tilde_hplus->
deltaF) - frequency;
868 double w = f == 0. ? 1. : exp(f * f *
beta);
873 tilde_hplus->
data->
data[
i] *= cexp(-I * phase);
874 tilde_hcross->
data->
data[
i] *= I * cexp(-I * phase);
883 if(int_hdot_squared == 0 || norm_factor == 0) {
888 *hplus = *hcross = NULL;
892 tilde_hplus->
data->
data[
i] /= norm_factor;
893 tilde_hcross->
data->
data[
i] /= norm_factor;
904 *hplus = *hcross = NULL;
915 *hplus = *hcross = NULL;
921 (*hplus)->deltaT = (*hcross)->deltaT = delta_t;
930 *hplus = *hcross = NULL;
934 (*hplus)->data->data[
i] *= window->
data->
data[
i];
935 (*hcross)->data->data[
i] *= window->
data->
data[
i];
977 double centre_frequency
1009 double centre_frequency
1084 REAL8 centre_frequency,
1097 const double cgsq =
Q / (4.0 * centre_frequency * sqrt(
LAL_PI)) * (1.0 + exp(-
Q *
Q));
1098 const double sgsq =
Q / (4.0 * centre_frequency * sqrt(
LAL_PI)) * (1.0 - exp(-
Q *
Q));
1103 double cosphase = cos(phase);
1104 double sinphase = sin(phase);
1105 const double h0plus =
hrss *
a / sqrt(cgsq * cosphase * cosphase + sgsq * sinphase * sinphase);
1106 const double h0cross =
hrss * b / sqrt(cgsq * sinphase * sinphase + sgsq * cosphase * cosphase);
1111 const double negative2Qsquared = -2. *
Q *
Q;
1112 const double twopif0 =
LAL_TWOPI * centre_frequency;
1114 double *hp, *hc, *
w;
1118 if(
Q < 0 || centre_frequency < 0 ||
hrss < 0 || eccentricity < 0 || eccentricity > 1 || delta_t <= 0) {
1120 *hplus = *hcross = NULL;
1130 length = (int) floor(21.0 *
Q / centre_frequency /
LAL_TWOPI / delta_t / 2.0);
1131 length = 2 * length + 1;
1143 if(!*hplus || !*hcross || !window) {
1147 *hplus = *hcross = NULL;
1153 hp = (*hplus)->data->data;
1154 hc = (*hcross)->data->data;
1156 for(
i = 0;
i < (*hplus)->data->length;
i++) {
1157 const double t = ((int)
i - (length - 1) / 2) * delta_t;
1158 const double phi = twopif0 * t;
1159 const complex
double fac = cexp(phi * phi / negative2Qsquared + I * (phi - phase)) *
w[
i];
1160 hp[
i] = h0plus * creal(fac);
1161 hc[
i] = h0cross * cimag(fac);
1230 if(
duration < 0 ||
hrss < 0 || !isfinite(h0plus) || delta_t <= 0) {
1232 *hplus = *hcross = NULL;
1240 length = (int) floor(21.0 *
duration / delta_t / 2.0);
1241 length = 2 * length + 1;
1253 if(!*hplus || !*hcross || !window) {
1257 *hplus = *hcross = NULL;
1263 for(
i = 0;
i < (length - 1) / 2;
i++) {
1264 const double t = ((int)
i - (length - 1) / 2) * delta_t;
1265 (*hplus)->data->data[
i] = (*hplus)->data->data[length - 1 -
i] = h0plus * exp(-0.5 * t * t / (
duration *
duration)) * window->
data->
data[
i];
1267 (*hplus)->data->data[
i] = h0plus;
1268 memset((*hcross)->data->data, 0, (*hcross)->data->length *
sizeof(*(*hcross)->data->data));
1343 const char *waveform,
1356 const double f_low = 1.0;
1360 if(amplitude < 0 || f_high < f_low || delta_t <= 0) {
1362 *hplus = *hcross = NULL;
1371 length = (int) (9.0 / f_low / delta_t / 2.0);
1372 length = 2 * length + 1;
1385 if(!*hplus || !*hcross || !tilde_h || !plan) {
1390 *hplus = *hcross = NULL;
1397 memset((*hcross)->data->data, 0, (*hcross)->data->length *
sizeof(*(*hcross)->data->data));
1401 if(strcmp( waveform,
"cusp" ) == 0) {
1402 for(
i = 0; (unsigned) i < tilde_h->
data->length;
i++) {
1403 double f = tilde_h->
f0 +
i * tilde_h->
deltaF;
1409 double amp = amplitude * pow(1. + f_low * f_low / (f * f), -4.) * pow(f, -4. / 3.) * (f > f_high ? exp(1. - f / f_high) : 1.);
1411 tilde_h->
data->
data[
i] = amp * cexp(-I *
LAL_PI *
i * (length - 1) / length);
1413 }
else if(strcmp( waveform,
"kink" ) == 0) {
1414 for(
i = 0; (unsigned) i < tilde_h->
data->length;
i++) {
1415 double f = tilde_h->
f0 +
i * tilde_h->
deltaF;
1421 double amp = amplitude * pow(1. + f_low * f_low / (f * f), -4.) * pow(f, -5. / 3.) * (f > f_high ? exp(1. - f / f_high) : 1.);
1423 tilde_h->
data->
data[
i] = amp * cexp(-I *
LAL_PI *
i * (length - 1) / length);
1425 }
else if(strcmp( waveform,
"kinkkink" ) == 0) {
1426 for(
i = 0; (unsigned) i < tilde_h->
data->length;
i++) {
1427 double f = tilde_h->
f0 +
i * tilde_h->
deltaF;
1433 double amp = amplitude * pow(1. + f_low * f_low / (f * f), -4.) * pow(f, -2.0);
1435 tilde_h->
data->
data[
i] = amp * cexp(-I *
LAL_PI *
i * (length - 1) / length);
1438 XLALPrintError(
"%s(): invalid waveform. must be cusp, kink, or kinkkink\n", __func__);
1439 *hplus = *hcross = NULL;
1455 *hplus = *hcross = NULL;
1461 (*hplus)->deltaT = (*hcross)->deltaT = delta_t;
1471 *hplus = *hcross = NULL;
1475 (*hplus)->data->data[
i] *= window->
data->
data[
i];
1686 double source_length,
1697 const double f_low = 10;
1705 length = (int) floor(8.0 / f_low /
deltaT / 2.0);
1706 length = length * 2 + 1;
1716 if(f_high < f_low || source_length <= 0. ||
deltaT <= 0. || dE_over_dA <= 0.){
1717 *hplus = *hcross = NULL;
1729 memset((*hcross)->data->data, 0, (*hcross)->data->length *
sizeof(*(*hcross)->data->data));
1736 norm_factor *= sqrt(2.);
1738 double f = tilde_h->
f0 + tilde_h->
deltaF *
i;
1739 if(f_low <= f && f <= f_high)
1740 tilde_h->
data->
data[
i] = norm_factor * cexp(I *
LAL_PI *
i * (length - 1) / length) / sqrt(f);
1754 *hplus = *hcross = NULL;
1760 (*hplus)->deltaT =
deltaT;
1767 *hplus = *hcross = NULL;
1782 for(
i = 0;
i < (*hplus)->data->length;
i++)
1783 (*hplus)->data->data[
i] *= window->
data->
data[
i];
static int XLALGenerateString(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, const char *waveform, REAL8 amplitude, REAL8 f_high, REAL8 delta_t)
Function for generating cosmic string waveforms.
static void semi_major_minor_from_e(double e, double *a, double *b)
static void gaussian_noise(REAL8TimeSeries *series, double rms, gsl_rng *rng)
static double beta(const double a, const double b, const sysq *system)
Internal function that computes the spin-orbit couplings.
static REAL8 sum(REAL8 *arr1, REAL8 *arr2, int k)
#define LAL_CHECK_CONSISTENT_TIME_SERIES(s1, s2, val)
COMPLEX16FrequencySeries * XLALCreateCOMPLEX16FrequencySeries(const CHAR *name, const LIGOTimeGPS *epoch, REAL8 f0, REAL8 deltaF, const LALUnit *sampleUnits, size_t length)
void XLALDestroyCOMPLEX16FrequencySeries(COMPLEX16FrequencySeries *series)
int XLALSimBurstSineGaussian(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, REAL8 Q, REAL8 centre_frequency, REAL8 hrss, REAL8 eccentricity, REAL8 phase, REAL8 delta_t)
Generate sine- and cosine-Gaussian waveforms with various polarizations and phases.
double XLALSimBurstCherenkov_dE_dA(double power, double beta, double r)
energy calculating function for Cherenkov burst.
REAL8 XLALMeasureIntHDotSquaredDT(const COMPLEX16FrequencySeries *fseries)
Computes the integral of the square of a real-valued time series' first derivative from its Fourier t...
int XLALGenerateStringKinkKink(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, REAL8 amplitude, REAL8 delta_t)
Generates cosmic string kink waveforms.
double XLALSimBurstSineGaussianQ(double duration, double centre_frequency)
Compute the Q of a sine-Gaussian waveform from the duration and centre frequency.
REAL8 XLALMeasureHrss(const REAL8TimeSeries *hplus, const REAL8TimeSeries *hcross)
Computes "root-sum-square strain", or .
int XLALGenerateBandAndTimeLimitedWhiteNoiseBurst(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, REAL8 duration, REAL8 frequency, REAL8 bandwidth, REAL8 eccentricity, REAL8 phase, REAL8 int_hdot_squared, REAL8 delta_t, gsl_rng *rng)
Generate a band- and time-limited white-noise burst waveform with Gaussian envelopes in the time and ...
double XLALSimBurstSineGaussianDuration(double Q, double centre_frequency)
Compute the duration of a sine-Gaussian waveform from the Q and centre frequency.
int XLALSimBurstGaussian(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, REAL8 duration, REAL8 hrss, REAL8 delta_t)
Generate Gaussian waveforms.
REAL8 XLALMeasureEoverRsquared(REAL8TimeSeries *hplus, REAL8TimeSeries *hcross)
Computes the areal energy density carried by a gravitational wave.
int XLALGenerateImpulseBurst(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, REAL8 hpeak, REAL8 delta_t)
Genereates a single-sample impulse waveform.
int XLALGenerateStringKink(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, REAL8 amplitude, REAL8 f_high, REAL8 delta_t)
Generates cosmic string kink waveforms.
COMPLEX16 XLALMeasureHPeak(const REAL8TimeSeries *hplus, const REAL8TimeSeries *hcross, unsigned *index)
Return the strain of the sample with the largest magnitude.
REAL8 XLALMeasureIntS1S2DT(const REAL8TimeSeries *s1, const REAL8TimeSeries *s2)
Computes the integral of the product of two time series.
int XLALGenerateStringCusp(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, REAL8 amplitude, REAL8 f_high, REAL8 delta_t)
Generates cosmic string cusp waveforms.
int XLALSimBurstCherenkovRadiation(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, double source_length, double dE_over_dA, double deltaT)
Generates Cherenkov like waveforms.
void XLALDestroyREAL8FFTPlan(REAL8FFTPlan *plan)
REAL8FFTPlan * XLALCreateReverseREAL8FFTPlan(UINT4 size, int measurelvl)
REAL8FFTPlan * XLALCreateForwardREAL8FFTPlan(UINT4 size, int measurelvl)
int XLALREAL8TimeFreqFFT(COMPLEX16FrequencySeries *freq, const REAL8TimeSeries *tser, const REAL8FFTPlan *plan)
int XLALREAL8FreqTimeFFT(REAL8TimeSeries *tser, const COMPLEX16FrequencySeries *freq, const REAL8FFTPlan *plan)
REAL8TimeSeries * XLALCreateREAL8TimeSeries(const CHAR *name, const LIGOTimeGPS *epoch, REAL8 f0, REAL8 deltaT, const LALUnit *sampleUnits, size_t length)
void XLALDestroyREAL8TimeSeries(REAL8TimeSeries *series)
const LALUnit lalStrainUnit
const LALUnit lalSecondUnit
const LALUnit lalDimensionlessUnit
LALUnit * XLALUnitMultiply(LALUnit *output, const LALUnit *unit1, const LALUnit *unit2)
void XLALDestroyREAL8Window(REAL8Window *window)
REAL8Window * XLALCreateGaussREAL8Window(UINT4 length, REAL8 beta)
REAL8Window * XLALCreateTukeyREAL8Window(UINT4 length, REAL8 beta)
#define XLAL_ERROR_REAL8(...)
#define XLAL_CHECK(assertion,...)
#define XLAL_REAL8_FAIL_NAN
int XLALPrintError(const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(1
LIGOTimeGPS * XLALGPSSetREAL8(LIGOTimeGPS *epoch, REAL8 t)