Commit e0221f3e authored by Reinhard Prix's avatar Reinhard Prix Committed by Bernd Machenschalk
Browse files

fixed HS-GCT segment-list handling when dealing with frequency-split SFTs

   - consistency of read segment-list file with read-in SFTs needs to
     be checked on loaded SFTs, not on the SFT-catalog:
     in case of "frequency-split" SFTs, the catalog contains multiples
     of the actual number of SFTs loaded (for each split frequency-band).
   - fixes #66
Original: fdc57f3e1add2e15e523297c41c6d6bc67207d09
parent 9eb384a9
......@@ -661,13 +661,6 @@ int MAIN( int argc, char *argv[]) {
LAL_CALL( SetUpSFTs( &status, &stackMultiSFT, &stackMultiNoiseWeights, &stackMultiDetStates, &usefulParams), &status);
LogPrintfVerbatim ( LOG_NORMAL, " done.\n");
/* free segment list */
if ( usefulParams.segmentList )
if ( XLALSegListClear( usefulParams.segmentList ) != XLAL_SUCCESS )
XLAL_ERROR ( fn, XLAL_EFUNC );
XLALFree ( usefulParams.segmentList );
usefulParams.segmentList = NULL;
/* some useful params computed by SetUpSFTs */
tStack = usefulParams.tStack;
tObs = usefulParams.tObs;
......@@ -683,15 +676,38 @@ int MAIN( int argc, char *argv[]) {
firstSFT = &(stackMultiSFT.data[0]->data[0]->data[0]); /* use first SFT from first detector */
Tsft = 1.0 / firstSFT->deltaF; /* define the length of an SFT (assuming 1/Tsft resolution) */
/* count the total number of SFTs used */
/* count the total and per-segment number of SFTs used */
UINT4 iTS, nSFTs = 0;
for ( iTS = 0; iTS < nStacks; iTS ++ )
{
UINT4 X;
UINT4 nSFTsInSeg = 0;
for ( X=0; X < stackMultiSFT.data[iTS]->length; X ++ )
nSFTs += stackMultiSFT.data[iTS]->data[X]->length;
nSFTsInSeg += stackMultiSFT.data[iTS]->data[X]->length;
nSFTs += nSFTsInSeg;
/* if we have a segment-list: double-check number of SFTs */
if ( usefulParams.segmentList )
{
/* check the number of SFTs we found in this segment against the nominal value,
* stored in the segment list field 'id' */
UINT4 nSFTsExpected = usefulParams.segmentList->segs[iTS].id;
if ( nSFTsInSeg != nSFTsExpected ) {
XLALPrintError ("%s: Segment list seems inconsistent with data read: segment %d contains %d SFTs, should hold %d SFTs\n", fn, iTS, nSFTsInSeg, nSFTsExpected );
XLAL_ERROR ( fn, XLAL_EDOM );
}
} /* if have segmentList */
} /* for iTS < nStacks */
/* free segment list */
if ( usefulParams.segmentList )
if ( XLALSegListClear( usefulParams.segmentList ) != XLAL_SUCCESS )
XLAL_ERROR ( fn, XLAL_EFUNC );
XLALFree ( usefulParams.segmentList );
usefulParams.segmentList = NULL;
/* special treatment of SFTs if upsampling is used */
if ( uvar_sftUpsampling > 1 )
{
......@@ -2626,13 +2642,7 @@ XLALSetUpStacksFromSegmentList ( const SFTCatalog *catalog, /**< complete list o
} /* while true */
/* check the number of SFTs we found in this segment against the nominal value,
* stored in the segment list field 'id' */
INT4 numSFTsInSeg = iSFT1 - iSFT0 + 1;
if ( numSFTsInSeg != thisSeg->id ) {
XLALPrintError ("%s: Segment list seems inconsistent with data read: segment %d contains %d SFTs, should hold %d SFTs\n", fn, iSeg, numSFTsInSeg, thisSeg->id );
XLAL_ERROR_NULL ( fn, XLAL_EDOM );
}
/* ----- allocate and copy this range of SFTs into the segmented catalog */
stacks->data[iSeg].length = (UINT4)numSFTsInSeg;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment