Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dummy-PR: Fix CWMakeFakeData transient signals potentially time shifted #2

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions lal/lib/tools/TimeSeries_source.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,20 @@ SERIESTYPE *ASERIES (
XLALPrintError("%s(): incompatible sample periods\n", __func__);
XLAL_ERROR_NULL(XLAL_EDATA);
}
REAL8 i0 = fabs(Delta_epoch / arg1->deltaT);
REAL8 bin_mismatch = fabs(i0 - round(i0)) / (i0 >= 1 ? i0 : 1.0);
if ( bin_mismatch > 10 * LAL_REAL8_EPS ) {
XLALPrintError("%s(): incompatible start-times, bins misaligned by %.5g deltaT\n", __func__, i0 - round(i0) );
XLAL_ERROR_NULL(XLAL_EDATA);
}

/* set start indexes */
if(Delta_epoch >= 0) {
i = floor(Delta_epoch / arg1->deltaT + 0.5);
i = round(Delta_epoch / arg1->deltaT);
j = 0;
} else {
i = 0;
j = floor(-Delta_epoch / arg2->deltaT + 0.5);
j = round(-Delta_epoch / arg2->deltaT);
}

/* add arg2 to arg1, adjusting the units */
Expand Down
2 changes: 1 addition & 1 deletion lal/test/tools/DetResponseTest.c
Original file line number Diff line number Diff line change
Expand Up @@ -2628,7 +2628,7 @@ BOOLEAN passed_special_locations_tests_p(LALStatus UNUSED *status)

char *laldr_strlcpy(char *dst, const char *src, size_t len)
{
char *retval = strncpy(dst, src, len);
char *retval = strncpy(dst, src, len-1);
if (verbose_level & 8)
{
printf("sizeof(dst) = %zu\n", sizeof(dst));
Expand Down
2 changes: 1 addition & 1 deletion lalapps/src/pulsar/MakeSFTs/MakeSFTs.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ void mkSFTFilename(CHAR *sftFilename, CHAR *site, CHAR *numSFTs, CHAR *ifo, CHAR

/* 01/09/06 gam; move filename1 to filename2 */
void mvFilenames(CHAR *filename1, CHAR *filename2) {
CHAR mvFilenamesCommand[512];
CHAR mvFilenamesCommand[512+4];
sprintf(mvFilenamesCommand,"mv %s %s",filename1,filename2);
if ( system(mvFilenamesCommand) ) XLALPrintError ("system() returned non-zero status\n");
}
Expand Down
9 changes: 6 additions & 3 deletions lalpulsar/lib/CWMakeFakeData.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,12 @@ XLALCWMakeFakeData ( SFTVector **SFTvect,
signalStartGPS = firstGPS;
} else if ( t0 >= lastGPS_REAL8 ) {
signalStartGPS = lastGPS;
}
else {
signalStartGPS.gpsSeconds = t0;
} else { // firstGPS < t0 < lastGPS:
// make sure signal start-time is an integer multiple of deltaT from timeseries start
// to allow safe adding of resulting signal timeseries
REAL8 offs0_aligned = round ( (t0 - firstGPS_REAL8) * fSamp ) / fSamp;
signalStartGPS = firstGPS;
XLALGPSAdd( &signalStartGPS, offs0_aligned );
}

// use earliest possible end-time: min(t1,lastGPS), but not earlier than firstGPS
Expand Down