10 REAL4FFTPlan *psdplan,
11 REAL4FFTPlan *revplan,
12 REAL4 **timeSlideVectorsP,
13 struct timeval startTime
16 REAL4 *timeSlideVectors;
19 memset(timeSlideVectors, 0,
26 for(ifoNumber = 0; ifoNumber <
LAL_NUM_IFO; ifoNumber++)
30 if (
params->haveTrig[ifoNumber])
34 params->dataCache[ifoNumber],
45 invspec[ifoNumber],fwdplan, ifoNumber,
50 if (segments[ifoNumber])
61 if ( (! segments[ifoNumber]) )
65 error(
"ERROR: Disagreement in number of segments in ifos.");
70 error(
"ERROR: Disagreement in number of segments in ifos.");
74 verbose(
"Created segments for one ifo %ld \n",
78 *timeSlideVectorsP = timeSlideVectors;
88 const char *ifoChannel,
89 const char *dataCache,
112 params->randomSeed+ 100*ifoNumber, spectrum );
115 else if (
params->zeroData )
126 params->highpassFrequency);
136 if (
params->writeRawData )
146 if (
params->writeRawData )
151 if (
params->writeProcessedData )
157 if (
params->writeProcessedData )
164 if (
params->writeProcessedData )
180 REAL4FFTPlan *fwdplan,
181 REAL4FFTPlan *revplan,
182 REAL4FFTPlan *psdplan,
183 REAL4 *timeSlideVectors,
184 struct timeval startTime
198 error(
"Null stream construction failure\n");
203 revplan, psdplan,
params);
205 if (
params->whiteSpectrum)
220 verbose(
"Created segments for null stream at %ld \n",
240 for( ifoNumber = 0; ifoNumber <
LAL_NUM_IFO; ifoNumber++)
242 if (
params->haveTrig[ifoNumber] )
247 fprintf(stderr,
"Currently Null stream can only be constructed for three ifo combinations \n");
255 fprintf(stderr,
"Null stream requires at least three detectors\n");
273 for (
i =0 ;
i < 3;
i++ )
275 t[
i] =
j + timeOffsetPoints[
n[
i]];
289 if (
params->writeProcessedData )
299 REAL4FFTPlan *fwdplan,
300 REAL4FFTPlan *revplan,
301 REAL4FFTPlan *psdplan,
306 if (
params->getSpectrum )
308 if ( !
params->whiteSpectrum)
310 UINT4 recordLength,psdSegmentLength,segmentStride,numDoublePsdSegs;
311 UINT4 neededDataLength;
316 psdSegmentLength = floor(
params->psdSegmentDuration * \
317 params->sampleRate + 0.5);
318 segmentStride = floor(
params->psdStrideDuration *
params->sampleRate \
321 numDoublePsdSegs = 1 + (recordLength - psdSegmentLength)/ \
323 numDoublePsdSegs /= 2;
326 neededDataLength = ((2*numDoublePsdSegs)-1) * segmentStride + psdSegmentLength;
327 verbose(
"Using %e of %e seconds for PSD estimation in %d segments.\n",\
331 channel->data->length = neededDataLength;
334 params->psdStrideDuration, psdplan, 0 );
336 channel->data->length = recordLength;
338 if (
params->psdSegmentDuration !=
params->segmentDuration)
340 if (
params->writeInvSpectrum )
348 invspec = invspecorig;
362 if((
int)
sizeof(invspec->
name) <= snprintf( invspec->
name,
sizeof( invspec->
name),
372 if (
params->writeInvSpectrum )
377 params->truncateDuration,
params->highpassFrequency, fwdplan,
380 if (
params->writeInvSpectrum )
393 channel->data->data[
k] *= rescaleFactor;
401 REAL4FFTPlan *fwdplan,
403 REAL4 *timeSlideVectors,
412 segments =
LALCalloc( 1,
sizeof( *segments ) );
414 if (
params->analyzeInjSegsOnly )
420 for (
i = 0 ;
i <
params->numOverlapSegments;
i++)
423 REAL8 deltaTime,segBoundDiff;
428 params->injectList = injectList;
432 injectList =
params->injectList;
439 deltaTime -=
params->startTime.gpsSeconds;
440 deltaTime -=
params->startTime.gpsNanoSeconds * 1E-9;
443 deltaTime -=
params->analStartTime;
446 segNumber = floor( deltaTime /
params->strideDuration);
447 if (segNumber >= (
INT4)
params->numOverlapSegments)
452 else if (segNumber < 0)
459 segListToDo[segNumber] = 1;
462 for (
j = 0 ;
j <
params->numOverlapSegments;
j++)
464 segBoundDiff = deltaTime -
j *
params->strideDuration/2;
465 if (segBoundDiff > 0 && segBoundDiff < params->injSearchWindow)
469 segListToDo[segNumber-1] = 1;
472 if (segBoundDiff < 0 && segBoundDiff > -
params->injSearchWindow)
474 if ((
j+1) !=
params->numOverlapSegments)
476 segListToDo[segNumber+1] = 1;
480 injectList = injectList->
next;
485 params->injectList = NULL;
492 if ( (!
params->segmentsToDoList || ! strlen(
params->segmentsToDoList )) && (!
params->analyzeInjSegsOnly) )
498 for ( sgmnt = 0; sgmnt <
params->numOverlapSegments; ++sgmnt )
500 slidSegNum = ( sgmnt + (
params->slideSegments[NumberIFO] ) ) % ( segments->
numSgmnt );
501 timeSlideVectors[NumberIFO*
params->numOverlapSegments + sgmnt] =
504 invspec, response,
params->segmentDuration,
params->strideDuration,
514 for ( sgmnt = 0; sgmnt <
params->numOverlapSegments; ++sgmnt )
516 if (
params->analyzeInjSegsOnly )
518 if ( segListToDo[sgmnt] == 1)
542 for ( sgmnt = 0; sgmnt <
params->numOverlapSegments; ++sgmnt )
544 if (
params->analyzeInjSegsOnly )
547 if ( segListToDo[sgmnt] == 1)
549 invspec, response,
params->segmentDuration,
params->strideDuration,
557 slidSegNum = ( sgmnt + (
params->slideSegments[NumberIFO] ) ) % (
params->numOverlapSegments );
558 timeSlideVectors[NumberIFO*
params->numOverlapSegments +
count] =
561 invspec, response,
params->segmentDuration,
params->strideDuration,
567 if (
params->writeSegment)
569 for ( sgmnt = 0; sgmnt < segments->
numSgmnt; ++sgmnt )
591 new->time_slide_id = -1;
592 new->segment_def_id = -1;
635 REAL4 *timeSlideVectors,
648 UINT4 longSlideCount = 0;
649 UINT4 shortSlideCount = 0;
651 UINT4 ui,uj,ifoNumber,ifoNum,lastStartPoint,wrapPoint,currId,ifoCount;
652 UINT4 slideSegmentCount, calculatedFlag;
654 LIGOTimeGPS slideStartTime,slideEndTime, tmpSlideStartTime, tmpSlideEndTime;
659 UINT4 slideDuplicate = 0;
662 for (uj = 0; uj < longSlideCount; uj++)
664 UINT4 slideChecking = 1;
667 for(ifoNumber = 0; ifoNumber <
LAL_NUM_IFO; ifoNumber++)
669 if (
params->haveTrig[ifoNumber])
671 if (timeSlideVectors[ifoNumber*
params->numOverlapSegments+
i] != \
685 if (! slideDuplicate)
687 for(ifoNumber = 0; ifoNumber <
LAL_NUM_IFO; ifoNumber++)
689 if (
params->haveTrig[ifoNumber])
692 timeSlideVectors[ifoNumber*
params->numOverlapSegments+
i];
695 longTimeSlideList[longSlideCount].
timeSlideID = longSlideCount;
696 slideIDList[
i] = longTimeSlideList[longSlideCount].
timeSlideID;
706 for(ifoNumber = 0; ifoNumber <
LAL_NUM_IFO; ifoNumber++)
708 if (
params->haveTrig[ifoNumber])
718 if (
params->doShortSlides)
720 currBaseOffset =
params->shortSlideOffset;
725 for(ifoNumber = 0; ifoNumber <
LAL_NUM_IFO; ifoNumber++)
727 currBaseIfoOffset[ifoNumber] = 0;
728 if (
params->haveTrig[ifoNumber])
730 currBaseIfoOffset[ifoNumber] = currBaseOffset * ifoNum;
735 if (currBaseIfoOffset[ifoNumber] > \
736 (
params->strideDuration) )
752 for (ui = 0; ui < ifoNum; ui++)
755 shortTimeSlideList[shortSlideCount].
timeSlideID = shortSlideCount;
764 params->analEndPoint;
769 shortTimeSlideList[shortSlideCount].
analEndPoint = lastStartPoint;
771 if (ui == ifoNum - 1)
775 params->analStartPoint;
781 wrapTime =
params->strideDuration - (ui + 1) * currBaseOffset;
782 wrapPoint = floor(wrapTime *
params->sampleRate + 0.5);
785 params->analStartPoint + wrapPoint;
787 lastStartPoint = shortTimeSlideList[shortSlideCount].
analStartPoint;
790 for(ifoNumber = 0; ifoNumber <
LAL_NUM_IFO; ifoNumber++)
793 if (
params->haveTrig[ifoNumber])
795 currIfoOffset = currBaseIfoOffset[ifoNumber];
798 currIfoOffset -=
params->strideDuration;
807 currBaseOffset +=
params->shortSlideOffset;
813 for (ui = 0 ; ui < longSlideCount; ui++)
815 for (uj = 0 ; uj < shortSlideCount; uj++)
818 currId = longTimeSlideList[ui].
timeSlideID*shortSlideCount;
821 if (! time_slide_map_head)
824 curr_time_slide_map = time_slide_map_head;
829 curr_time_slide_map = curr_time_slide_map->
next;
835 for(ifoNumber = 0; ifoNumber <
LAL_NUM_IFO; ifoNumber++)
837 if (
params->haveTrig[ifoNumber])
840 if (! time_slide_head)
843 curr_slide= time_slide_head;
848 curr_slide = curr_slide->
next;
858 longTimeSlideList[ui].timeSlideVectors[ifoNumber];
860 shortTimeSlideList[uj].timeSlideVectors[ifoNumber];
870 slideSegmentCount = 0;
873 for (uj = 0 ; uj < shortSlideCount; uj++)
876 currId = slideIDList[
i]*shortSlideCount;
880 for (ifoNumber = 0; ifoNumber <
LAL_NUM_IFO; ifoNumber++)
882 if (
params->haveTrig[ifoNumber])
884 tmpSlideStartTime = segments[ifoNumber]->
sgmnt[
i].
epoch;
885 tmpSlideEndTime = segments[ifoNumber]->
sgmnt[
i].
epoch;
887 -timeSlideVectors[ifoNumber*
params->numOverlapSegments+
i]);
889 -timeSlideVectors[ifoNumber*
params->numOverlapSegments+
i]);
892 if (
XLALGPSCmp(&tmpSlideStartTime, &slideStartTime))
896 error(
"Error long slide epochs not agreeing with the slid times. This suggests broken code, please contact a developer.\n");
899 if (
XLALGPSCmp(&tmpSlideEndTime, &slideEndTime))
903 error(
"Error long slide epochs not agreeing with the slid times. This suggests broken code, please contact a developer.");
917 ((
REAL8)shortTimeSlideList[uj].analStartPoint) /
params->sampleRate );
919 ((
REAL8)shortTimeSlideList[uj].analEndPoint) /
params->sampleRate );
921 if (! segment_table_head)
924 curr_slide_segment= segment_table_head;
929 curr_slide_segment = curr_slide_segment->
next;
931 curr_slide_segment->
segment_id = slideSegmentCount;
933 curr_slide_segment->
start_time = slideStartTime;
934 curr_slide_segment->
end_time = slideEndTime;
940 *time_slide_headP = time_slide_head;
941 *time_slide_map_headP = time_slide_map_head;
942 *segment_table_headP = segment_table_head;
943 *shortTimeSlideListP = shortTimeSlideList;
944 *longTimeSlideListP = longTimeSlideList;
958 REAL8 FplusTmp,FcrossTmp;
961 for(ifoNumber = 0; ifoNumber <
LAL_NUM_IFO; ifoNumber++)
969 for (ui = 0; ui < 3; ui++)
971 detLoc[ui] = (double)
detectors[ifoNumber]->location[ui];
974 timeOffsets[ifoNumber] = (
REAL4)
983 skyPoints->data[skyPointNum].latitude, 0.,
985 Fplustrig[ifoNumber] = (
REAL4) FplusTmp;
986 Fcrosstrig[ifoNumber] = (
REAL4) FcrossTmp;
997 REAL4FFTPlan *fwdplan
1010 fcTmplt =
LALCalloc(1,
sizeof(*fcTmplt));
1011 fcTmpltParams =
LALCalloc(1,
sizeof(*fcTmpltParams));
1037 const REAL4 xfacExponent = -1.0/3.0;
1045 xfac[ui] = pow((
REAL4) ui, xfacExponent);
1057 fcTmpltParams->
fwdPlan = fwdplan;
1059 if (
params->dynTempLength)
1066 fcTmpltParams->
fLow =
params->lowTemplateFrequency;
1074 for(ifoNumber = 0; ifoNumber <
LAL_NUM_IFO; ifoNumber++)
1076 if (
params->haveTrig[ifoNumber])
1083 (5,
params->numTimePoints);
1090 (1,
params->numTimePoints);
1095 if (
params->doNullStream)
1102 (5,
params->numTimePoints);
1109 (1,
params->numTimePoints);
1113 *fcTmpltP = fcTmplt;
1114 *fcTmpltParamsP = fcTmpltParams;
1134 UINT4 ifoNumber,vecLength,vecLengthTwo,ui;
1149 if (
params->doNullStream)
1161 for (ifoNumber = 0;ifoNumber <
LAL_NUM_IFO; ifoNumber++)
1163 if (
params->haveTrig[ifoNumber])
1166 snprintf(
name,
sizeof(
name ),
"%s_snr",ifoName);
1183 if (
params->doSnglChiSquared)
1185 for (ifoNumber = 0; ifoNumber <
LAL_NUM_IFO; ifoNumber++)
1187 if (
params->haveTrig[ifoNumber])
1190 snprintf(
name,
sizeof(
name ),
"%s_bank_veto",ifoName);
1210 if (
params->doSnglChiSquared)
1212 for (ifoNumber = 0; ifoNumber <
LAL_NUM_IFO; ifoNumber++)
1214 if (
params->haveTrig[ifoNumber])
1217 snprintf(
name,
sizeof(
name ),
"%s_auto_veto",ifoName);
1237 if (
params->doSnglChiSquared)
1239 for (ifoNumber = 0; ifoNumber <
LAL_NUM_IFO; ifoNumber++)
1241 if (
params->haveTrig[ifoNumber])
1244 snprintf(
name,
sizeof(
name ),
"%s_chi_square",ifoName);
1260 vecLengthTwo = vecLength;
1262 vecLengthTwo = 2* vecLength;
1264 for (ui = 0 ; ui < vecLengthTwo ; ui++)
1274 for (ui = 0 ; ui < 2 ; ui++)
1284 *nullSNRP = nullSNR;
1285 *traceSNRP = traceSNR;
1304 UINT4 ifoNumber,vecLength,vecLengthTwo,ui;
1312 for (ifoNumber = 0;ifoNumber <
LAL_NUM_IFO; ifoNumber++)
1314 if (
params->haveTrig[ifoNumber])
1318 segStartTime.gpsNanoSeconds;
1319 memset(snrComps[ifoNumber]->
data->data, 0,\
1325 if (
params->doNullStream)
1348 if (
params->doSnglChiSquared)
1350 for (ifoNumber = 0; ifoNumber <
LAL_NUM_IFO; ifoNumber++)
1352 if (
params->haveTrig[ifoNumber])
1356 segStartTime.gpsNanoSeconds;
1357 memset(bankVeto[ifoNumber]->
data->data, 0,\
1373 if (
params->doSnglChiSquared)
1375 for (ifoNumber = 0; ifoNumber <
LAL_NUM_IFO; ifoNumber++)
1377 if (
params->haveTrig[ifoNumber])
1381 segStartTime.gpsNanoSeconds;
1382 memset(autoVeto[ifoNumber]->
data->data, 0,\
1395 segStartTime.gpsNanoSeconds;
1399 if (
params->doSnglChiSquared)
1401 for (ifoNumber = 0; ifoNumber <
LAL_NUM_IFO; ifoNumber++)
1403 if (
params->haveTrig[ifoNumber])
1407 segStartTime.gpsNanoSeconds;
1408 memset(chiSquare[ifoNumber]->
data->data, 0,\
1421 vecLengthTwo = vecLength;
1423 vecLengthTwo = 2* vecLength;
1425 for (ui = 0 ; ui < vecLengthTwo ; ui++)
1429 memset(pValues[ui]->
data->data, 0,\
1435 for (ui = 0 ; ui < 2 ; ui++)
1439 memset(gammaBeta[ui]->
data->data,0 ,\
1485 for (
k = 0 ;
k < 10 ;
k++)
1502 for (
k = 0;
k < 2;
k++)
1507 gammaBeta[
k] = NULL;
1519 UINT4 **snglAcceptPoints,
1520 UINT4 *snglAcceptCount,
1522 COMPLEX8FFTPlan *invPlan,
1527 UINT4 ifoNumber,ui,uj,localCount;
1528 REAL4 reSNRcomp,imSNRcomp;
1529 REAL4 *localSNRData;
1530 UINT4 *localAcceptPoints;
1534 for(ifoNumber = 0; ifoNumber <
LAL_NUM_IFO; ifoNumber++)
1536 if (
params->haveTrig[ifoNumber])
1539 localSNRData = snrComps[ifoNumber]->
data->
data;
1540 localAcceptPoints = snglAcceptPoints[ifoNumber];
1544 memset(PTFM[ifoNumber]->
data, 0, 25 *
sizeof(
REAL8));
1545 memset(PTFqVec[ifoNumber]->
data, 0,
1550 memset(PTFM[ifoNumber]->
data, 0, 1 *
sizeof(
REAL8));
1551 memset(PTFqVec[ifoNumber]->
data, 0,
1557 PTFM[ifoNumber], NULL, PTFqVec[ifoNumber],
1558 &segments[ifoNumber]->sgmnt[segNum], invPlan,
1565 snrComps,ifoNumber,localAcceptPoints);
1569 for (ui =
params->analStartPointBuf; ui < params->analEndPointBuf; ++ui)
1571 uj = ui -
params->analStartPointBuf;
1572 reSNRcomp = crealf(PTFqVec[ifoNumber]->
data[ui]);
1573 imSNRcomp = cimagf(PTFqVec[ifoNumber]->
data[ui]);
1574 localSNRData[uj] = sqrt((reSNRcomp*reSNRcomp + imSNRcomp*imSNRcomp)/
1575 PTFM[ifoNumber]->
data[0]);
1576 if (localSNRData[uj] > acceptThresh)
1578 localAcceptPoints[localCount] = uj;
1583 snglAcceptCount[ifoNumber] = localCount;
1595 UINT4 *localAcceptPoints
1598 UINT4 ui,uj,uk,localCount;
1599 gsl_matrix *PTFmatrix;
1600 gsl_vector *eigenvalsSngl;
1601 gsl_matrix *eigenvecsSngl;
1602 gsl_eigen_symmv_workspace *matTemp = gsl_eigen_symmv_alloc(5);
1603 REAL4 v1_dot_u1, v1_dot_u2, v2_dot_u1, v2_dot_u2,max_eigen;
1604 REAL4 *snglv1p,*snglv2p;
1605 eigenvecsSngl = gsl_matrix_alloc(5,5);
1606 eigenvalsSngl = gsl_vector_alloc(5);
1612 PTFmatrix = gsl_matrix_alloc(5,5);
1613 for (ui = 0; ui < 5; ui++ )
1615 for (uj = 0; uj < 5; uj++ )
1617 gsl_matrix_set(PTFmatrix, ui, uj, PTFM[ifoNumber]->
data[ui*5+uj]);
1622 gsl_eigen_symmv(PTFmatrix, eigenvalsSngl, eigenvecsSngl,matTemp);
1623 gsl_eigen_symmv_free(matTemp);
1624 gsl_matrix_free(PTFmatrix);
1626 for (ui =
params->analStartPointBuf; ui < params->analEndPointBuf; ++ui)
1628 uk = ui -
params->analStartPointBuf;
1630 NULL,NULL,eigenvecsSngl,eigenvalsSngl,\
1631 params->numTimePoints,ui,5,5,ifoNumber);
1634 v1_dot_u1 = v1_dot_u2 = v2_dot_u1 = v2_dot_u2 = max_eigen = 0.0;
1635 for (uj = 0; uj < 5; uj++)
1637 v1_dot_u1 += snglv1p[uj] * snglv1p[uj];
1638 v1_dot_u2 += snglv1p[uj] * snglv2p[uj];
1639 v2_dot_u2 += snglv2p[uj] * snglv2p[uj];
1641 max_eigen =0.5 * (v1_dot_u1 + v2_dot_u2 + sqrt((v1_dot_u1 - v2_dot_u2) * \
1642 (v1_dot_u1 - v2_dot_u2) + 4 * v1_dot_u2 * v1_dot_u2));
1645 if (snrComps[ifoNumber]->
data->data[ui-
params->analStartPointBuf] >\
1648 localAcceptPoints[localCount] = uk;
1665 REAL4 v1_dot_u1,v1_dot_u2,v2_dot_u2,max_eigen;
1666 v1_dot_u1 = v1_dot_u2 = v2_dot_u2 = 0.0;
1667 for (ui =0; ui < vecLengthTwo; ui++)
1669 v1_dot_u1 += v1p[ui] * v1p[ui];
1670 v2_dot_u2 += v2p[ui] * v2p[ui];
1671 v1_dot_u2 += v1p[ui] * v2p[ui];
1673 max_eigen = 0.5 * (v1_dot_u1 + v2_dot_u2 + sqrt((v1_dot_u1 - v2_dot_u2)
1674 * (v1_dot_u1 - v2_dot_u2) + 4 * v1_dot_u2 * v1_dot_u2));
1675 return sqrt(max_eigen);
1775 INT4 *timeOffsetPoints,
1779 gsl_matrix *eigenvecs,
1780 gsl_vector *eigenvals,
1781 UINT4 segStartPoint,
1786 UINT4 **snglAcceptPoints,
1787 UINT4 *snglAcceptCount
1794 UINT4 i,
j,
k,ifoNumber,ifoNumber2,currPointLoc,ifoNum1,ifoNum2;
1795 UINT4 localCount,*localAcceptPoints,localOffset;
1796 INT4 tOffset1,tOffset2;
1797 REAL4 v1_dot_u1,v2_dot_u2,max_eigen,coincSNR;
1803 ifoNum1 = ifoNum2 = tOffset1 = tOffset2 = 0;
1804 if (
params->numIFO == 2 && (!
params->singlePolFlag) &&\
1805 (!
params->faceOnStatistic) )
1807 for (ifoNumber = 0; ifoNumber <
LAL_NUM_IFO; ifoNumber++)
1809 if (
params->haveTrig[ifoNumber])
1812 ifoNum1 = ifoNumber;
1813 else if (ifoNum2 == 0)
1814 ifoNum2 = ifoNumber;
1817 tOffset1 = timeOffsetPoints[ifoNum1] -
params->analStartPointBuf;
1818 tOffset2 = timeOffsetPoints[ifoNum2] -
params->analStartPointBuf;
1821 for (ifoNumber2 = 0; ifoNumber2 <
LAL_NUM_IFO; ifoNumber2++)
1823 if (!
params->haveTrig[ifoNumber2])
1827 localCount = snglAcceptCount[ifoNumber2];
1828 localAcceptPoints = snglAcceptPoints[ifoNumber2];
1829 localOffset =
params->analStartPointBuf-timeOffsetPoints[ifoNumber2];
1830 for (
k = 0;
k < localCount; ++
k)
1832 i = localAcceptPoints[
k] + localOffset;
1833 currPointLoc =
i-
params->analStartPoint;
1835 if ((
i < segStartPoint) || (
i > segEndPoint))
1842 for (ifoNumber = 0;ifoNumber <
LAL_NUM_IFO; ifoNumber++)
1844 if (
params->haveTrig[ifoNumber])
1846 if (snrComps[ifoNumber]->
data->
1847 data[
i-
params->analStartPointBuf+timeOffsetPoints[ifoNumber]]
1856 snrData[currPointLoc] = 0;
1857 fprintf(stderr,
"I shouldn't be here now!!\n");
1861 if (
params->numIFO == 2 && (!
params->singlePolFlag) &&\
1862 (!
params->faceOnStatistic) )
1864 max_eigen = snrComps[ifoNum1]->
data->
data[
i+tOffset1] *
1865 snrComps[ifoNum1]->
data->
data[
i+tOffset1] +
1866 snrComps[ifoNum2]->
data->
data[
i+tOffset2] *
1867 snrComps[ifoNum2]->
data->
data[
i+tOffset2];
1868 if (max_eigen < cohSNRThresholdSq)
1870 snrData[currPointLoc] = 0;
1873 snrData[currPointLoc] = sqrt(max_eigen);
1874 if (
params->storeAmpParams)
1877 timeOffsetPoints,eigenvecs,eigenvals,
1879 for (
j = 0 ;
j < vecLengthTwo ;
j++)
1881 pValues[
j]->
data->
data[currPointLoc] = \
1882 v1p[
j] / (pow(gsl_vector_get(eigenvals,
j),0.5));
1883 pValues[
j+vecLengthTwo]->
data->
data[currPointLoc] = \
1884 v2p[
j] / (pow(gsl_vector_get(eigenvals,
j),0.5));
1892 for (ifoNumber = 0;ifoNumber <
LAL_NUM_IFO; ifoNumber++)
1894 if (
params->haveTrig[ifoNumber])
1896 coincSNR += snrComps[ifoNumber]->
data->
data[\
1897 i -
params->analStartPointBuf + timeOffsetPoints[ifoNumber]]
1898 * snrComps[ifoNumber]->
data->
data[\
1899 i -
params->analStartPointBuf + timeOffsetPoints[ifoNumber]];
1904 if (coincSNR < cohSNRThresholdSq)
1906 snrData[currPointLoc] = 0;
1914 timeOffsetPoints,eigenvecs,eigenvals,
1926 if (spinTemplate == 0)
1928 v1_dot_u1 = v2_dot_u2 = 0.0;
1929 for (
j = 0;
j < vecLengthTwo;
j++)
1931 v1_dot_u1 += v1p[
j] * v1p[
j];
1932 v2_dot_u2 += v2p[
j] * v2p[
j];
1934 max_eigen = (v1_dot_u1 + v2_dot_u2);
1935 if (max_eigen < cohSNRThresholdSq)
1937 snrData[currPointLoc] = 0;
1942 snrData[currPointLoc] = sqrt(max_eigen);
1943 if (
params->storeAmpParams)
1945 for (
j = 0 ;
j < vecLengthTwo ;
j++)
1947 pValues[
j]->
data->
data[currPointLoc] = \
1948 v1p[
j] / (pow(gsl_vector_get(eigenvals,
j),0.5));
1949 pValues[
j+vecLengthTwo]->
data->
data[currPointLoc] = \
1950 v2p[
j] / (pow(gsl_vector_get(eigenvals,
j),0.5));
1957 snrData[
i-
params->analStartPoint] = \
1958 coh_PTF_get_spin_SNR(v1p,v2p,vecLengthTwo);
1959 if (
params->storeAmpParams)
1961 fprintf(stderr,
"Spinning amplitude stuff is currently disabled\n");
1973 UINT4 *acceptPoints,
1974 INT4 *timeOffsetPoints,
1978 UINT4 **snglAcceptPoints,
1979 UINT4 *snglAcceptCount
1985 INT4 tempPoint, tempPointStart, tempPointEnd;
1989 volatile INT4 localOffset;
1990 UINT4 localCount,*localAcceptPoints;
1992 INT4 startPointI = (
INT4) startPoint;
1997 for (ifoNumber2 = 0; ifoNumber2 <
LAL_NUM_IFO; ifoNumber2++)
1999 if (!
params->haveTrig[ifoNumber2])
2003 localCount = snglAcceptCount[ifoNumber2];
2004 localAcceptPoints = snglAcceptPoints[ifoNumber2];
2005 localOffset =
params->analStartPointBuf-timeOffsetPoints[ifoNumber2];
2006 for (
k = 0;
k < localCount; ++
k)
2008 i = localAcceptPoints[
k] + localOffset;
2009 ui =
i-
params->analStartPoint;
2011 if ((ui < startPoint) || (ui > endPoint))
2018 tempPointStart = ui - numPointCheck;
2019 if (tempPointStart < startPointI)
2021 tempPointStart = startPointI;
2023 tempPointEnd = ui + numPointCheck;
2024 if (tempPointEnd >= endPointI)
2026 tempPointEnd = endPointI;
2028 for (tempPoint = tempPointStart; tempPoint < tempPointEnd; tempPoint++)
2030 if (snrData[tempPoint] > snrData[ui])
2040 for (ifoNumber2 = 0; ifoNumber2 <
LAL_NUM_IFO; ifoNumber2++)
2042 if (!
params->haveTrig[ifoNumber2])
2046 localCount = snglAcceptCount[ifoNumber2];
2047 localAcceptPoints = snglAcceptPoints[ifoNumber2];
2048 localOffset =
params->analStartPointBuf-timeOffsetPoints[ifoNumber2];
2049 for (
k = 0;
k < localCount; ++
k)
2051 i = localAcceptPoints[
k] + localOffset;
2052 ui =
i-
params->analStartPoint;
2054 if ((ui < startPoint) || (ui > endPoint))
2059 if (! logicArray[ui])
2063 else if (logicArray[ui] == 1)
2067 acceptPoints[
count] = ui;
2093 REAL4 bestNR,currSNR;
2099 currSNR = cohSNR->
data->
data[currPointLoc];
2102 if (
params->doNullStream)
2104 if (nullSNR->
data->
data[currPointLoc] >
params->nullStatThreshold \
2105 && currSNR < params->nullStatGradOn)
2109 if (currSNR >
params->nullStatGradOn)
2111 if (nullSNR->
data->
data[currPointLoc] > (
params->nullStatThreshold \
2112 + (currSNR -
params->nullStatGradOn)*
params->nullStatGradient))
2123 params->BVsubBankSize*numDOF)
2125 bestNR = currSNR / pow( ( 1. + pow( \
2129 if (bestNR < params->chiSquareCalcThreshold)
2140 params->numAutoPoints*numDOF)
2142 bestNR = currSNR / pow( ( 1. + pow( \
2146 if (bestNR < params->chiSquareCalcThreshold)
2162 COMPLEX8FFTPlan *invPlan,
2187 gsl_matrix *eigenvecsNull,
2188 gsl_vector *eigenvalsNull,
2199 gsl_matrix_set(eigenvecsNull, 0 , 0, 1);
2206 gsl_eigen_symmv_workspace *matTempNull = gsl_eigen_symmv_alloc(vecLength);
2207 gsl_matrix *B2Null = gsl_matrix_alloc(vecLength, vecLength);
2208 for (
i = 0;
i < vecLength;
i++)
2210 for (
j = 0;
j < vecLength;
j++)
2215 gsl_eigen_symmv(B2Null, eigenvalsNull, eigenvecsNull, matTempNull);
2223 gsl_matrix *eigenvecsNull,
2224 gsl_vector *eigenvalsNull,
2232 REAL4 v1_dot_u1,v1_dot_u2,v2_dot_u2,max_eigen;
2233 REAL4 v1N[vecLength],v2N[vecLength],u1N[vecLength],u2N[vecLength];
2237 for (
j = 0;
j < vecLength;
j++)
2243 for (
j = 0 ;
j < vecLength ;
j++)
2247 for (
k = 0 ;
k < vecLength ;
k++)
2249 u1N[
j] += gsl_matrix_get(eigenvecsNull,
k,
j)*v1N[
k];
2250 u2N[
j] += gsl_matrix_get(eigenvecsNull,
k,
j)*v2N[
k];
2252 u1N[
j] = u1N[
j] / (pow(gsl_vector_get(eigenvalsNull,
j),0.5));
2253 u2N[
j] = u2N[
j] / (pow(gsl_vector_get(eigenvalsNull,
j),0.5));
2256 v1_dot_u1 = v1_dot_u2 = v2_dot_u2 = 0.0;
2257 for (
j = 0;
j < vecLength;
j++)
2259 v1_dot_u1 += u1N[
j] * u1N[
j];
2260 v1_dot_u2 += u1N[
j] * u2N[
j];
2261 v2_dot_u2 += u2N[
j] * u2N[
j];
2263 if (spinTemplate == 0)
2265 max_eigen = 0.5 * (v1_dot_u1 + v2_dot_u2);
2269 max_eigen = 0.5*(v1_dot_u1+v2_dot_u2+sqrt((v1_dot_u1-v2_dot_u2)
2270 * (v1_dot_u1 - v2_dot_u2) + 4 * v1_dot_u2 * v1_dot_u2));
2272 nullSNR->
data->
data[snrLoc] = sqrt(max_eigen);
2279 gsl_matrix *eigenvecs,
2280 gsl_vector *eigenvals,
2283 INT4 *timeOffsetPoints,
2292 REAL4 v1_dot_u1,v1_dot_u2,v2_dot_u2,max_eigen,traceSNRsq;
2293 REAL4 v1[vecLength],v2[vecLength],u1[vecLength],
u2[vecLength];
2301 for (
j = 0;
j < vecLengthTwo ;
j++)
2305 v1[
j] = Fplus[
k] * crealf(PTFqVec[
k]->
data[\
2306 j*
params->numTimePoints+vecLoc+timeOffsetPoints[
k]]);
2307 v2[
j] = Fplus[
k] * cimagf(PTFqVec[
k]->
data[\
2308 j*
params->numTimePoints+vecLoc+timeOffsetPoints[
k]]);
2312 v1[
j] = Fcross[
k] * crealf(PTFqVec[
k]->
data[ (
j-vecLength) * \
2313 params->numTimePoints+vecLoc+timeOffsetPoints[
k]]);
2314 v2[
j] = Fcross[
k] * cimagf(PTFqVec[
k]->
data[ (
j-vecLength) * \
2315 params->numTimePoints+vecLoc+timeOffsetPoints[
k]]);
2318 for (
j = 0 ;
j < vecLengthTwo ;
j++)
2322 for (
m = 0 ;
m < vecLengthTwo ;
m++)
2324 u1[
j] += gsl_matrix_get(eigenvecs,
m,
j)*v1[
m];
2325 u2[
j] += gsl_matrix_get(eigenvecs,
m,
j)*v2[
m];
2327 u1[
j] = u1[
j] / (pow(gsl_vector_get(eigenvals,
j),0.5));
2328 u2[
j] =
u2[
j] / (pow(gsl_vector_get(eigenvals,
j),0.5));
2331 v1_dot_u1 = v1_dot_u2 = v2_dot_u2 = max_eigen = 0.0;
2332 for (
j = 0;
j < vecLengthTwo;
j++)
2334 v1_dot_u1 += u1[
j] * u1[
j];
2335 v1_dot_u2 += u1[
j] *
u2[
j];
2336 v2_dot_u2 +=
u2[
j] *
u2[
j];
2338 if (spinTemplate == 0)
2340 max_eigen = (v1_dot_u1 + v2_dot_u2);
2344 max_eigen = 0.5 * (v1_dot_u1 + v2_dot_u2 + sqrt((v1_dot_u1 - v2_dot_u2)
2345 * (v1_dot_u1 - v2_dot_u2) + 4 * v1_dot_u2 * v1_dot_u2));
2347 traceSNRsq += max_eigen;
2350 traceSNR->
data->
data[snrLoc] = sqrt(traceSNRsq);
2356 INT4 *timeOffsetPoints
2363 timeOffsetPoints[
i] = (
int) floor(timeOffsets[
i]/
deltaT + 0.5);
2391 gsl_matrix *eigenvecs,
2392 gsl_vector *eigenvals,
2393 REAL4 Fplus[LAL_NUM_IFO],
2394 REAL4 Fcross[LAL_NUM_IFO],
2407 UINT4 vecLengthSquare = vecLength*vecLength;
2408 REAL4 zh[vecLengthSquare],sh[vecLengthSquare],yu[vecLengthSquare];
2409 gsl_matrix *B2 = gsl_matrix_alloc(vecLengthTwo,vecLengthTwo);
2410 gsl_eigen_symmv_workspace *matTemp = gsl_eigen_symmv_alloc (vecLengthTwo);
2415 for (
i = 0;
i < vecLength;
i++ )
2417 for (
j = 0;
j < vecLength;
j++ )
2419 zh[
i*vecLength+
j] = 0;
2420 sh[
i*vecLength+
j] = 0;
2421 yu[
i*vecLength+
j] = 0;
2426 if (
params->faceOnStatistic )
2428 zh[
i*vecLength+
j] += (Fplus[
k]*Fplus[
k] + Fcross[
k] * Fcross[
k])* PTFM[
k]->
data[
i*PTFMlen+
j];
2432 zh[
i*vecLength+
j] += Fplus[
k]*Fplus[
k] * PTFM[
k]->data[
i*PTFMlen+
j];
2433 sh[
i*vecLength+
j] += Fcross[
k]*Fcross[
k] * PTFM[
k]->data[
i*PTFMlen+
j];
2434 yu[
i*vecLength+
j] += Fplus[
k]*Fcross[
k] * PTFM[
k]->data[
i*PTFMlen+
j];
2442 for (
i = 0;
i < vecLengthTwo;
i++ )
2444 for (
j = 0;
j < vecLengthTwo;
j++ )
2446 if (
i < vecLength &&
j < vecLength )
2448 gsl_matrix_set(B2,
i,
j,zh[
i*vecLength+
j]);
2450 else if (
i > (vecLength-1) &&
j > (vecLength-1))
2452 gsl_matrix_set(B2,
i,
j,sh[(
i-vecLength)*vecLength + (
j-vecLength)]);
2454 else if ( i < vecLength && j > (vecLength-1))
2456 gsl_matrix_set(B2,
i,
j, yu[
i*vecLength + (
j-vecLength)]);
2458 else if (
i > (vecLength-1) &&
j < vecLength)
2460 gsl_matrix_set(B2,
i,
j,yu[
j*vecLength + (
i-vecLength)]);
2463 fprintf(stderr,
"BUGGER! Something went wrong.");
2468 gsl_eigen_symmv (B2,eigenvals,eigenvecs,matTemp);
2469 gsl_eigen_symmv_free(matTemp);
2470 gsl_matrix_free(B2);
2481 INT4 *timeOffsetPoints,
2482 gsl_matrix *eigenvecs,
2483 gsl_vector *eigenvals,
2498 REAL4 v1[vecLengthTwo],v2[vecLengthTwo];
2500 for (
j = 0;
j < vecLengthTwo ;
j++ )
2510 if (
params->faceOnStatistic)
2513 if (
params->faceOnStatistic == 1)
2515 v1[
j] += Fplus[
k] * crealf(PTFqVec[
k]->
data[
j*
numPoints+position+timeOffsetPoints[
k]]);
2516 v1[
j] += Fcross[
k] * cimagf(PTFqVec[
k]->
data[
j*
numPoints+position+timeOffsetPoints[
k]]);
2517 v2[
j] += Fcross[
k] * crealf(PTFqVec[
k]->
data[
j*
numPoints+position+timeOffsetPoints[
k]]);
2518 v2[
j] -= Fplus[
k] * cimagf(PTFqVec[
k]->
data[
j*
numPoints+position+timeOffsetPoints[
k]]);
2520 else if (
params->faceOnStatistic == 2)
2522 v1[
j] += Fplus[
k] * crealf(PTFqVec[
k]->
data[
j*
numPoints+position+timeOffsetPoints[
k]]);
2523 v1[
j] -= Fcross[
k] * cimagf(PTFqVec[
k]->
data[
j*
numPoints+position+timeOffsetPoints[
k]]);
2524 v2[
j] += Fcross[
k] * crealf(PTFqVec[
k]->
data[
j*
numPoints+position+timeOffsetPoints[
k]]);
2525 v2[
j] += Fplus[
k] * cimagf(PTFqVec[
k]->
data[
j*
numPoints+position+timeOffsetPoints[
k]]);
2529 fprintf(stderr,
"Face-on stat is not working!");
2532 else if (
j < vecLength)
2534 v1[
j] += Fplus[
k] * crealf(PTFqVec[
k]->
data[
j*
numPoints+position+timeOffsetPoints[
k]]);
2535 v2[
j] += Fplus[
k] * cimagf(PTFqVec[
k]->
data[
j*
numPoints+position+timeOffsetPoints[
k]]);
2539 v1[
j] += Fcross[
k] * crealf(PTFqVec[
k]->
data[(
j-vecLength)*
numPoints+position+timeOffsetPoints[
k]]);
2540 v2[
j] += Fcross[
k] * cimagf(PTFqVec[
k]->
data[(
j-vecLength)*
numPoints+position+timeOffsetPoints[
k]]);
2556 for (
j = 0 ;
j < vecLengthTwo ;
j++ )
2560 for (
k = 0 ;
k < vecLengthTwo ;
k++ )
2562 u1[
j] += gsl_matrix_get(eigenvecs,
k,
j)*v1[
k];
2563 u2[
j] += gsl_matrix_get(eigenvecs,
k,
j)*v2[
k];
2565 u1[
j] = u1[
j] / (pow(gsl_vector_get(eigenvals,
j),0.5));
2566 u2[
j] =
u2[
j] / (pow(gsl_vector_get(eigenvals,
j),0.5));
2587 REAL4 rightAscension,
2590 INT4 *timeOffsetPoints,
2605 trigTime = cohSNR->
epoch;
2610 currEvent->
chi = PTFTemplate.
chi;
2613 currEvent->
eta = PTFTemplate.
eta;
2615 currEvent->
chi = PTFTemplate.
spin1[2];
2619 currEvent->
ra = rightAscension -
2622 currEvent->
dec = declination;
2623 if (
params->doNullStream)
2634 if (
params->doSnglChiSquared)
2699 if (
params->doSnglChiSquared)
2764 if (
params->doSnglChiSquared)
2823 REAL8 sigmasqCorrFac, invSigmaCorrFac;
2826 invSigmaCorrFac = 1. / pow(sigmasqCorrFac, 0.5);
2838 currEvent->amp_term_2*currEvent->
amp_term_2 + \
2839 currEvent->amp_term_3*currEvent->
amp_term_3 + \
2840 currEvent->amp_term_4*currEvent->
amp_term_4 );
2900 if (spinTrigger == 1)
2916 "%s",
params->ifoName[0]);
2918 else if(
params->numIFO == 2)
2923 else if (
params->numIFO == 3)
2928 else if (
params->numIFO == 4)
2934 if (
params->faceOnStatistic == 2)
2965 for (
i = startPoint ;
i < endPoint ;
i++)
2970 &eventId,pValues,bankVeto,autoVeto,chiSquare,PTFM,
i);
2982 *eventList = currEvent;
2983 lastEvent = currEvent;
2987 if (!
params->clusterFlag)
2989 lastEvent->
next = currEvent;
2990 lastEvent = currEvent;
2994 lastEvent->
next = currEvent;
2995 lastEvent = currEvent;
3004 *thisEvent = lastEvent;
3030 thisEvent->
event_id = (*eventId)++;
3032 trigTime = cohSNR->
epoch;
3034 thisEvent->
end = trigTime;
3039 REAL8 sigmasqCorrFac;
3044 for( ifoNumber = 0; ifoNumber <
LAL_NUM_IFO; ifoNumber++)
3046 if (
params->haveTrig[ifoNumber] )
3048 thisEvent->
chisq = chiSquare[ifoNumber]->
data->
data[currPos];
3051 thisEvent->
sigmasq = PTFM[ifoNumber]->
data[0] * sigmasqCorrFac;
3063 atan2( pValues[0]->
data->data[currPos], pValues[1]->
data->
data[currPos]);
3071 for( ifoNumber = 0; ifoNumber <
LAL_NUM_IFO; ifoNumber++)
3073 if (
params->haveTrig[ifoNumber] )
3075 strncpy( thisEvent->
channel, (
params->channel[ifoNumber]) + 3,
3106 memcpy( thisEvent->
search, searchName,
3120 UINT4 loudTrigBefore=0,loudTrigAfter=0;
3122 currEvent = *eventList;
3134 if (thisEvent.
snr < currEvent->
snr\
3141 if (loudTrigBefore && loudTrigAfter)
3147 currEvent = currEvent->
next;
3164 UINT4 triggerNum = 0;
3165 UINT4 lenTriggers = 0;
3171 currEvent = currEvent->
next;
3174 currEvent = *eventList;
3175 UINT4 rejectTriggers[lenTriggers];
3183 rejectTriggers[triggerNum] = 0;
3188 rejectTriggers[triggerNum] = 1;
3191 currEvent = currEvent->
next;
3194 currEvent = *eventList;
3200 if (! rejectTriggers[triggerNum])
3204 newEventHead = currEvent;
3205 newEvent = currEvent;
3209 newEvent->
next = currEvent;
3210 newEvent = currEvent;
3212 currEvent = currEvent->
next;
3216 currEvent2 = currEvent->
next;
3218 currEvent = currEvent2;
3226 newEvent->
next = NULL;
3227 *eventList = newEventHead;
3228 *thisEvent = newEvent;
3235 REAL4FFTPlan *fwdplan,
3236 REAL4FFTPlan *psdplan,
3237 REAL4FFTPlan *revplan,
3238 COMPLEX8FFTPlan *invPlan,
3251 REAL4 *slidTimeOffsets,
3260 REAL4 *timeSlideVectors,
3267 if (
params->injectList )
3273 thisInject = injectList;
3274 injectList = injectList->
next;
3285 events = events->
next;
3288 while ( snglEvents )
3291 thisSnglEvent = snglEvents;
3292 snglEvents = snglEvents->
next;
3296 while ( PTFbankhead )
3299 thisTmplt = PTFbankhead;
3300 PTFbankhead = PTFbankhead->
next;
3304 for( ifoNumber = 0; ifoNumber < (
LAL_NUM_IFO+1); ifoNumber++)
3306 if ( segments[ifoNumber] )
3308 for ( sgmnt = 0; sgmnt < segments[ifoNumber]->
numSgmnt; sgmnt++ )
3310 if (segments[ifoNumber]->sgmnt[sgmnt].
data)
3313 LALFree( segments[ifoNumber]->sgmnt );
3314 LALFree( segments[ifoNumber] );
3316 if ( invspec[ifoNumber] )
3319 LALFree( invspec[ifoNumber] );
3326 if ( PTFM[ifoNumber] )
3328 if ( PTFN[ifoNumber] )
3330 if ( PTFqVec[ifoNumber] )
3344 thisParam = procpar;
3345 procpar = procpar->
next;
3350 if ( fcTmpltParams->
PTFe1 )
3352 if ( fcTmpltParams->
PTFe2 )
3354 if ( fcTmpltParams->
PTFphi )
3364 if ( fcTmplt->
PTFQ )
3368 if ( fcTmplt->
data )
3374 if ( slidTimeOffsets)
3391 if (time_slide_head)
3393 if (time_slide_map_head)
3395 if (segment_table_head)
3397 if (longTimeSlideList)
3399 if (shortTimeSlideList)
3401 if (timeSlideVectors)
3404 for(ifoNumber = 0; ifoNumber <
LAL_NUM_IFO; ifoNumber++)
3419 REAL4FFTPlan *plan = NULL;
3420 if (
params->segmentDuration > 0.0 )
3422 UINT4 segmentLength;
3423 segmentLength =
params->numTimePoints;
3432 REAL4FFTPlan *plan = NULL;
3433 if (
params->psdSegmentDuration > 0.0 )
3435 UINT4 segmentLength;
3436 segmentLength = floor(
params->psdSegmentDuration *
params->sampleRate
3446 REAL4FFTPlan *plan = NULL;
3447 if (
params->segmentDuration > 0.0 )
3449 UINT4 segmentLength;
3450 segmentLength =
params->numTimePoints;
3459 COMPLEX8FFTPlan *plan = NULL;
3460 if (
params->segmentDuration > 0.0 )
3462 UINT4 segmentLength;
3463 segmentLength =
params->numTimePoints;
3478 strncpy( buffer, list,
sizeof( buffer ) - 1 );
3486 if ( (
str = strchr(
str,
',' ) ) )
3490 if ( ( tok2 = strchr( tok,
'-' ) ) )
3495 if ( strcmp( tok,
"^" ) == 0 )
3499 if ( strcmp( tok2,
"$" ) == 0 )
3503 if (
i >= n1 &&
i <= n2 )
3506 else if (
i == atoi( tok ) )
3523 cnvTemplate->
event_id = eventNumber;
3524 cnvTemplate->
mass1 =
template->mass1;
3525 cnvTemplate->
mass2 =
template->mass2;
3526 cnvTemplate->
chi =
template->chi;
3527 cnvTemplate->
kappa =
template->kappa;
3528 cnvTemplate->
f_final =
template->fCutoff;
3553 if (
params->skyPositionsFile != NULL )
3556 UINT4 decColumn = 1;
3558 raColumn, decColumn);
3564 verbose(
"Generating 2 detector all sky map...\n");
3570 verbose(
"Generating 3 detector all sky map...\n");
3579 error(
"all sky mode is not implemented yet, however, you can use --sky-positions-file\n");
3593 verbose(
"Generated full sky grid with %d points, ",
3595 verbose(
"parsing for time-delay degeneracy\n");
3604 verbose(
"Generated final sky grid with %d points, ",
3622 REAL4 lambdamin,lambdamax,lambda;
3624 REAL4 angularResolution;
3625 double baseline,lightTravelTime;
3631 gsl_vector *trigPos;
3634 for(ifoNumber=0; ifoNumber<
LAL_NUM_IFO; ifoNumber++)
3659 lightTravelTime *= 1
e-9;
3662 angle = acos(baseline/lightTravelTime);
3665 lambdamin = angle-
params->skyError;
3666 lambdamax = angle+
params->skyError;
3670 if (lambdamin < LAL_PI_2 && lambdamax >
LAL_PI_2)
3681 detalpha = lightTravelTime * sin(lambda);
3682 if (detalpha >
alpha)
3691 if ((!
params->singlePolFlag) && (
params->numIFO != 1))
3693 angularResolution = 2. *
params->timingAccuracy /
alpha;
3697 angularResolution = 1;
3712 angle = acos ( sin(decNp)*sin(
params->declination) +
3713 cos(decNp)*cos(
params->declination) *
3714 cos( raNp-
params->rightAscension ) );
3717 npPos = gsl_vector_alloc(3);
3718 trigPos = gsl_vector_alloc(3);
3719 axis = gsl_vector_alloc(3);
3721 gsl_vector_set(npPos, 0, 0.);
3722 gsl_vector_set(npPos, 1, 0.);
3723 gsl_vector_set(npPos, 2, 1.);
3725 gsl_vector_set(trigPos, 0,\
3727 gsl_vector_set(trigPos, 1,\
3729 gsl_vector_set(trigPos, 2, sin(
params->declination));
3738 for( ifoNumber = 0; ifoNumber <
LAL_NUM_IFO; ifoNumber++)
3743 gsl_vector_free(npPos);
3744 gsl_vector_free(trigPos);
3745 gsl_vector_free(
axis);
3760 REAL4 angularResolution,
3773 numTheta = (
int) ceil( skyError / angularResolution ) + 1;
3776 UINT4 numPhi[numTheta];
3777 for (
i=0;
i < numTheta;
i++ )
3779 theta = angularResolution *
i;
3781 if ( numPhi[
i] < 1 )
3792 for (
i=0;
i < numTheta;
i++ )
3795 theta = angularResolution *
i;
3796 for (
j=0;
j < numPhi[
i];
j++ )
3799 phi = ( -
LAL_PI + dPhi / 2. ) + dPhi *
j;
3830 for(ifoNumber=0; ifoNumber<
LAL_NUM_IFO; ifoNumber++)
3832 if (
params->haveTrig[ifoNumber])
3854 for (
i = 0;
i <
p;
i++)
3857 if (timeDelays[
i]==0)
3864 if (fabs(timeDelay-timeDelays[
i]) <
dt)
3873 if (appendPoint[
p] == 0)
3876 timeDelays[
p] = timeDelay;
3881 parsedSkyPoints =
LALCalloc(1,
sizeof(*parsedSkyPoints));
3883 parsedSkyPoints->
data =
3890 if (appendPoint[
p] == 0)
3898 for(ifoNumber = 0; ifoNumber <
params->numIFO; ifoNumber++)
3904 return parsedSkyPoints;
3910 gettimeofday(&
t2,NULL);
3911 long int diff = (
t2.tv_usec + 1000000 *
t2.tv_sec) - (
t1->tv_usec + 1000000 *
t1->tv_sec);
3921 printf(
"%lu.%06lu", (
unsigned long)tv->tv_sec, (
unsigned long)tv->tv_usec);
3922 curtime = tv->tv_sec;
3923 strftime(buffer, 30,
"%m-%d-%Y %T", localtime(&curtime));
3924 printf(
" = %s.%06lu\n", buffer, (
unsigned long)tv->tv_usec);
3942 matrix = gsl_matrix_alloc(3, 3);
3968 pos = gsl_vector_alloc(3);
3969 gsl_vector_set(
pos, 0, sin(
theta)*cos(phi));
3970 gsl_vector_set(
pos, 1, sin(
theta)*sin(phi));
3971 gsl_vector_set(
pos, 2, cos(
theta));
3974 rotPos = gsl_vector_alloc(3);
3975 gsl_blas_dgemv(CblasNoTrans, 1.0, matrix,
pos, 0.0, rotPos);
3978 theta = acos(gsl_vector_get(rotPos, 2));
3979 phi = atan2(gsl_vector_get(rotPos, 1), gsl_vector_get(rotPos, 0));
3986 gsl_vector_free(
pos);
3987 gsl_vector_free(rotPos);
3991 gsl_vector *product,
3992 const gsl_vector *u,
3996 double p1 = gsl_vector_get(
u, 1)*gsl_vector_get(v, 2)
3997 - gsl_vector_get(
u, 2)*gsl_vector_get(v, 1);
3999 double p2 = gsl_vector_get(
u, 2)*gsl_vector_get(v, 0)
4000 - gsl_vector_get(
u, 0)*gsl_vector_get(v, 2);
4002 double p3 = gsl_vector_get(
u, 0)*gsl_vector_get(v, 1)
4003 - gsl_vector_get(
u, 1)*gsl_vector_get(v, 0);
4005 gsl_vector_set(product, 0, p1);
4006 gsl_vector_set(product, 1, p2);
4007 gsl_vector_set(product, 2, p3);
4016 gsl_blas_ddot(vec, vec, &mag);
4019 gsl_vector_scale(vec, 1./mag);
4029 gsl_matrix_set(matrix, 0, 0, cos(angle) +\
4030 pow(gsl_vector_get(
axis, 0),2)*(1-cos(angle)));
4031 gsl_matrix_set(matrix, 0, 1, gsl_vector_get(
axis, 0)*gsl_vector_get(
axis, 1)*\
4033 gsl_vector_get(
axis, 2)*sin(angle));
4034 gsl_matrix_set(matrix, 0, 2, gsl_vector_get(
axis, 0)*gsl_vector_get(
axis, 2)*\
4036 gsl_vector_get(
axis, 1)*sin(angle));
4038 gsl_matrix_set(matrix, 1, 0, gsl_vector_get(
axis, 1)*gsl_vector_get(
axis, 0)*\
4040 gsl_vector_get(
axis, 2)*sin(angle));
4041 gsl_matrix_set(matrix, 1, 1, cos(angle) +\
4042 pow(gsl_vector_get(
axis, 1),2)*(1-cos(angle)));
4043 gsl_matrix_set(matrix, 1, 2, gsl_vector_get(
axis, 1)*gsl_vector_get(
axis, 2)*\
4045 gsl_vector_get(
axis, 0)*sin(angle));
4047 gsl_matrix_set(matrix, 2, 0, gsl_vector_get(
axis, 2)*gsl_vector_get(
axis, 0)*\
4049 gsl_vector_get(
axis, 1)*sin(angle));
4050 gsl_matrix_set(matrix, 2, 1, gsl_vector_get(
axis, 2)*gsl_vector_get(
axis, 1)*\
4052 gsl_vector_get(
axis, 0)*sin(angle));
4053 gsl_matrix_set(matrix, 2, 2, cos(angle) +\
4054 pow(gsl_vector_get(
axis, 2),2)*(1-cos(angle)));
4067 char *value,
line[256];
4076 error(
"Error reading sky locations file %s. Please verify this path and try again\n",
fname);
4086 fseek(
data, 0, SEEK_SET);
4094 UINT4 lastColumn = raColumn;
4095 if (decColumn > raColumn)
4096 lastColumn = decColumn;
4105 value = strtok(
line,
" ");
4108 while (
j <= lastColumn)
4112 else if (
j==decColumn)
4116 value = strtok(NULL,
" ");
4135 REAL8 lightTravelTime, timeDelay, angle;
4136 gsl_vector *locations[
params->numIFO], *normal, *northPole, *
axis;
4141 for(ifoNumber=0; ifoNumber<
LAL_NUM_IFO; ifoNumber++)
4143 if (
params->haveTrig[ifoNumber])
4147 locations[
i] = gsl_vector_alloc(3);
4155 lightTravelTime *= 1
e-9;
4170 geoSkyPoints->
data[
i].
longitude = acos(-timeDelay/lightTravelTime);
4177 normal = gsl_vector_alloc(3);
4183 northPole = gsl_vector_alloc(3);
4184 gsl_vector_set(northPole, 0, 0);
4185 gsl_vector_set(northPole, 1, 0);
4186 gsl_vector_set(northPole, 2, 1);
4187 gsl_blas_ddot(normal, northPole, &angle);
4188 angle = acos(angle);
4191 axis = gsl_vector_alloc(3);
4213 for( ifoNumber = 0; ifoNumber <
params->numIFO; ifoNumber++)
4217 if (locations[ifoNumber])
4218 gsl_vector_free(locations[ifoNumber]);
4220 gsl_vector_free(normal);
4221 gsl_vector_free(northPole);
4222 gsl_vector_free(
axis);
4240 gsl_vector *locations[
params->numIFO], *baseline[
params->numIFO],\
4241 *northPole, *xaxis, *normal;
4244 condition, xphi, nphi, ntheta;
4245 UINT4 i,
j,
k,
p, ifoNumber, numXPoints, numYPoints,\
4246 numSkyPoints, totalPoints;
4250 for(ifoNumber=0; ifoNumber<
LAL_NUM_IFO; ifoNumber++)
4252 if (
params->haveTrig[ifoNumber])
4256 locations[
i] = gsl_vector_alloc(3);
4264 baseline[
i-1] = gsl_vector_alloc(3);
4265 gsl_vector_memcpy(baseline[
i-1], locations[
i]);
4266 gsl_vector_sub(baseline[
i-1], locations[0]);
4274 gsl_blas_ddot(baseline[0], baseline[1], &angle);
4275 angle = acos(angle);
4276 verbose(
"angle = %e\n", angle);
4279 numXPoints = 2*(
UINT4) floor(
T[0]/
params->timingAccuracy) + 1;
4280 numYPoints = 2*(
UINT4) floor(
T[1]/
params->timingAccuracy) + 1;
4283 totalPoints = numXPoints * numYPoints;
4284 REAL4 valid[totalPoints];
4288 for (
i=0;
i<numXPoints;
i++)
4291 for (
j=0;
j<numYPoints;
j++)
4293 t3 = (
INT4) (
j - numYPoints/2) *
params->timingAccuracy;
4294 A = -
T[1]/
T[0] *
t2 * cos(angle);
4295 B = pow(
T[1], 2) * (pow(
t2/
T[0], 2) - pow(sin(angle), 2));
4296 condition = pow(t3, 2) + 2*
A*t3 +
B;
4320 normal = gsl_vector_alloc(3);
4321 matrix = gsl_matrix_alloc(3, 3);
4322 xaxis = gsl_vector_alloc(3);
4329 gsl_blas_dgemv(CblasNoTrans, 1.0, matrix, baseline[1], 0.0, xaxis);
4337 northPole = gsl_vector_alloc(3);
4340 gsl_vector_set(northPole, 0, 0);
4341 gsl_vector_set(northPole, 1, 0);
4342 gsl_vector_set(northPole, 2, 1);
4343 gsl_blas_ddot(baseline[0], northPole, &zangle);
4344 zangle = acos(zangle);
4348 verbose(
"xangle = %e\n", xangle);
4349 verbose(
"zangle = %e\n", zangle);
4352 gsl_vector *xaxis2 = gsl_vector_alloc(3);
4353 gsl_blas_dgemv(CblasNoTrans, 1.0, matrix, xaxis2, 0.0, xaxis);
4355 xphi = atan2(gsl_vector_get(xaxis2, 1), gsl_vector_get(xaxis2, 0));
4363 for (
i=0;
i<numXPoints;
i++)
4366 for (
j=0;
j<numYPoints;
j++)
4368 t3 = (
INT4) (
j - numYPoints/2) *
params->timingAccuracy;
4372 ntheta = acos(-
t2/
T[0]);
4373 nphi = acos(-(
T[0]*t3-
T[1]*
t2*cos(angle))/\
4374 (
T[1]*sqrt(pow(
T[0],2)-pow(
t2,2))*sin(angle)));
4401 gsl_vector_set(
output,
i, input[
i]);
4417 UINT4 injSamplePoint, injWindow, tmpStart, tmpEnd;
4419 INT8 startDiff, endDiff;
4423 segmentStart = *
epoch;
4424 segmentEnd = *
epoch;
4426 thisInject =
params->injectList;
4428 tmpStart = tmpEnd = 0;
4437 if ((startDiff > 0) && (endDiff < 0))
4439 verbose(
"Generating analysis segment for injection at %d.\n",
4443 verbose(
"warning: multiple injections in this segment.\n");
4444 tmpStart =
params->analStartPoint;
4445 tmpEnd =
params->analEndPoint;
4451 injSamplePoint = floor(injDiff *
params->sampleRate + 0.5);
4452 injSamplePoint +=
params->analStartPoint;
4453 injWindow = floor(
params->injSearchWindow *
params->sampleRate
4455 tmpStart = injSamplePoint - injWindow;
4456 if (tmpStart < params->analStartPoint)
4457 tmpStart =
params->analStartPoint;
4458 tmpEnd = injSamplePoint + injWindow + 1;
4459 if (tmpEnd >
params->analEndPoint)
4460 tmpEnd =
params->analEndPoint;
4461 verbose(
"Found analysis segment at [%d,%d).\n", tmpStart, tmpEnd);
4464 thisInject = thisInject->
next;
4477 if (
params->trigStartTimeNS)
4480 if (
params->trigStartTimeNS > currTimeNS)
4486 if (
params->trigEndTimeNS)
4489 if (
params->trigStartTimeNS > currTimeNS)
4506 REAL8 tmpltMchirp,injMchirp,mchirpDiff,mchirpWin;
4507 INT8 startDiff, endDiff;
4509 UINT4 passMchirpCheck;
4512 segmentStart = *
epoch;
4513 segmentEnd = *
epoch;
4515 passMchirpCheck = 2;
4516 thisInject =
params->injectList;
4524 if ((startDiff > 0) && (endDiff < 0))
4526 verbose(
"Generating analysis segment for injection at %d.\n",
4528 if (passMchirpCheck != 2)
4530 verbose(
"warning: multiple injections in this segment.\n");
4531 passMchirpCheck = 1;
4534 injMchirp = thisInject->
mchirp;
4536 mchirpDiff = (injMchirp - tmpltMchirp)/tmpltMchirp;
4539 mchirpWin =
params->injMchirpWindow;
4540 else if (injMchirp < 3)
4541 mchirpWin =
params->injMchirpWindow * 2.5;
4542 else if (injMchirp < 4)
4543 mchirpWin =
params->injMchirpWindow * 5;
4546 mchirpWin =
params->injMchirpWindow * 10;
4548 if (fabs(mchirpDiff) > mchirpWin)
4549 passMchirpCheck = 0;
4551 passMchirpCheck = 1;
4553 thisInject = thisInject->
next;
4556 if (passMchirpCheck == 2)
4558 verbose(
"WARNING: No injections found in this segment!? Not analysing\n");
4559 passMchirpCheck = 0;
4561 return passMchirpCheck;
4570 for (
i = 0 ;
i < length ;
i++)
4572 timeSeries[
i] = NULL;
4582 for (
i = 0 ;
i < length ;
i++)
4584 freqSeries[
i] = NULL;
4594 for (
i = 0 ;
i < length ;
i++)
4606 for (
i = 0 ;
i < length ;
i++)
4618 for (
i = 0 ;
i < length ;
i++)
4630 for (
i = 0 ;
i < length ;
i++)
4642 for (
i = 0 ;
i < length ;
i++)
4654 for (
i = 0 ;
i < length ;
i++)
int XLALInspiralGetApproximantString(CHAR *output, UINT4 length, Approximant approx, LALPNOrder order)
SimInspiralTable * XLALSimInspiralTableFromLIGOLw(const char *fileName)
int write_COMPLEX8FrequencySeries(COMPLEX8FrequencySeries *series)
int write_REAL4FrequencySeries(REAL4FrequencySeries *series)
#define sanity_check(condition)
void coh_PTF_normalize(struct coh_PTF_params *params, FindChirpTemplate *fcTmplt, REAL4FrequencySeries *invspec, REAL8Array *PTFM, REAL8Array *PTFN, COMPLEX8VectorSequence *PTFqVec, COMPLEX8FrequencySeries *sgmnt, COMPLEX8FFTPlan *invPlan, UINT4 spinTemplate)
int write_REAL4TimeSeries(REAL4TimeSeries *series)
CohPTFSkyPositions * coh_PTF_read_grid_from_file(const char *fname, UINT4 raColumn, UINT4 decColumn)
void coh_PTF_initialize_time_series(struct coh_PTF_params *params, LIGOTimeGPS segStartTime, REAL8 fLower, REAL4TimeSeries **cohSNRP, REAL4TimeSeries **nullSNRP, REAL4TimeSeries **traceSNRP, REAL4TimeSeries **bankVeto, REAL4TimeSeries **autoVeto, REAL4TimeSeries **chiSquare, REAL4TimeSeries **snrComps, REAL4TimeSeries **pValues, REAL4TimeSeries **gammaBeta, UINT4 spinTemplates)
SnglInspiralTable * conv_insp_tmpl_to_sngl_table(InspiralTemplate *template, UINT4 eventNumber)
void coh_PTF_set_null_input_REAL4(REAL4 **array, UINT4 length)
REAL4FFTPlan * coh_PTF_get_fft_revplan(struct coh_PTF_params *params)
void coh_PTF_create_time_slide_table(struct coh_PTF_params *params, INT8 *slideIDList, RingDataSegments **segments, TimeSlide **time_slide_headP, TimeSlideSegmentMapTable **time_slide_map_headP, SegmentTable **segment_table_headP, TimeSlideVectorList **longTimeSlideListP, TimeSlideVectorList **shortTimeSlideListP, REAL4 *timeSlideVectors, INT4 numSegments)
void coh_PTF_rotate_SkyPosition(SkyPosition *skyPoint, gsl_matrix *matrix)
void coh_PTF_convert_time_offsets_to_points(struct coh_PTF_params *params, REAL4 *timeOffsets, INT4 *timeOffsetPoints)
void coh_PTF_rotate_skyPoints(CohPTFSkyPositions *skyPoints, gsl_vector *axis, REAL8 angle)
void coh_PTF_setup_null_stream(struct coh_PTF_params *params, REAL4TimeSeries **channel, REAL4FrequencySeries **invspec, RingDataSegments **segments, REAL4 *Fplustrig, REAL4 *Fcrosstrig, REAL4 *timeOffsets, REAL4FFTPlan *fwdplan, REAL4FFTPlan *revplan, REAL4FFTPlan *psdplan, REAL4 *timeSlideVectors, struct timeval startTime)
void coh_PTF_calculate_single_detector_filters(struct coh_PTF_params *params, FindChirpTemplate *fcTmplt, REAL4FrequencySeries **invspec, REAL8Array **PTFM, COMPLEX8VectorSequence **PTFqVec, REAL4TimeSeries **snrComps, UINT4 **snglAcceptPoints, UINT4 *snglAcceptCount, RingDataSegments **segments, COMPLEX8FFTPlan *invPlan, UINT4 spinTemplate, UINT4 segNum)
void normalise(gsl_vector *vec)
UINT4 coh_PTF_trig_time_check(struct coh_PTF_params *params, LIGOTimeGPS segStartTime, LIGOTimeGPS segEndTime)
void coh_PTF_calculate_null_stream_snr(struct coh_PTF_params *params, REAL4TimeSeries *nullSNR, COMPLEX8VectorSequence **PTFqVec, gsl_matrix *eigenvecsNull, gsl_vector *eigenvalsNull, UINT4 spinTemplate, UINT4 vecLength, UINT4 vecLoc, UINT4 snrLoc)
void coh_PTF_set_null_input_COMPLEX8VectorSequence(COMPLEX8VectorSequence **vecSeq, UINT4 length)
int coh_PTF_get_null_stream(struct coh_PTF_params *params, REAL4TimeSeries *channel[LAL_NUM_IFO+1], REAL4 *Fplus, REAL4 *Fcross, REAL4 *timeOffsets)
UINT4 coh_PTF_calculate_single_det_spin_snr(struct coh_PTF_params *params, REAL8Array **PTFM, COMPLEX8VectorSequence **PTFqVec, REAL4TimeSeries **snrComps, UINT4 ifoNumber, UINT4 *localAcceptPoints)
static void XLALDestroyTimeSlideSegmentMapTable(TimeSlideSegmentMapTable *head)
void coh_PTF_destroy_time_series(REAL4TimeSeries *cohSNR, REAL4TimeSeries *nullSNR, REAL4TimeSeries *traceSNR, REAL4TimeSeries **bankVeto, REAL4TimeSeries **autoVeto, REAL4TimeSeries **chiSquare, REAL4TimeSeries **pValues, REAL4TimeSeries **gammaBeta, REAL4TimeSeries **snrComps)
UINT8 coh_PTF_add_sngl_triggers(struct coh_PTF_params *params, SnglInspiralTable **eventList, SnglInspiralTable **thisEvent, REAL4TimeSeries *cohSNR, FindChirpTemplate *fcTmplt, InspiralTemplate PTFTemplate, UINT8 eventId, REAL4TimeSeries **pValues, REAL4TimeSeries **bankVeto, REAL4TimeSeries **autoVeto, REAL4TimeSeries **chiSquare, REAL8Array **PTFM, UINT4 startPoint, UINT4 endPoint)
REAL4 coh_PTF_get_spin_SNR(REAL4 *v1p, REAL4 *v2p, UINT4 vecLengthTwo)
CohPTFSkyPositions * coh_PTF_two_det_sky_grid(struct coh_PTF_params *params)
void coh_PTF_calculate_rotated_vectors(struct coh_PTF_params *params, COMPLEX8VectorSequence **PTFqVec, REAL4 *u1, REAL4 *u2, REAL4 *Fplus, REAL4 *Fcross, INT4 *timeOffsetPoints, gsl_matrix *eigenvecs, gsl_vector *eigenvals, UINT4 numPoints, UINT4 position, UINT4 vecLength, UINT4 vecLengthTwo, UINT4 detectorNum)
void coh_PTF_set_null_input_RingDataSegments(RingDataSegments **segment, UINT4 length)
void REALToGSLVector(const REAL8 *input, gsl_vector *output, size_t size)
CohPTFSkyPositions * coh_PTF_generate_sky_points(struct coh_PTF_params *params)
CohPTFSkyPositions * coh_PTF_parse_time_delays(CohPTFSkyPositions *skyPoints, struct coh_PTF_params *params)
void coh_PTF_initialize_structures(struct coh_PTF_params *params, FindChirpTemplate **fcTmpltP, FindChirpTmpltParams **fcTmpltParamsP, REAL8Array **PTFM, REAL8Array **PTFN, COMPLEX8VectorSequence **PTFqVec, REAL4FFTPlan *fwdplan)
RingDataSegments * coh_PTF_get_segments(REAL4TimeSeries *channel, REAL4FrequencySeries *invspec, REAL4FFTPlan *fwdplan, InterferometerNumber NumberIFO, REAL4 *timeSlideVectors, struct coh_PTF_params *params)
REAL4FFTPlan * coh_PTF_get_fft_fwdplan(struct coh_PTF_params *params)
void coh_PTF_cleanup(struct coh_PTF_params *params, ProcessParamsTable *procpar, REAL4FFTPlan *fwdplan, REAL4FFTPlan *psdplan, REAL4FFTPlan *revplan, COMPLEX8FFTPlan *invPlan, REAL4TimeSeries **channel, REAL4FrequencySeries **invspec, RingDataSegments **segments, MultiInspiralTable *events, SnglInspiralTable *snglEvents, InspiralTemplate *PTFbankhead, FindChirpTemplate *fcTmplt, FindChirpTmpltParams *fcTmpltParams, REAL8Array **PTFM, REAL8Array **PTFN, COMPLEX8VectorSequence **PTFqVec, REAL4 *timeOffsets, REAL4 *slidTimeOffsets, REAL4 *Fplus, REAL4 *Fcross, REAL4 *Fplustrig, REAL4 *Fcrosstrig, CohPTFSkyPositions *skyPoints, TimeSlide *time_slide_head, TimeSlideVectorList *longTimeSlideList, TimeSlideVectorList *shortTimeSlideList, REAL4 *timeSlideVectors, LALDetector **detectors, INT8 *slideIDList, TimeSlideSegmentMapTable *time_slide_map_head, SegmentTable *segment_table_head)
void coh_PTF_calculate_trace_snr(struct coh_PTF_params *params, REAL4TimeSeries *traceSNR, COMPLEX8VectorSequence **PTFqVec, gsl_matrix *eigenvecs, gsl_vector *eigenvals, REAL4 *Fplus, REAL4 *Fcross, INT4 *timeOffsetPoints, UINT4 spinTemplate, UINT4 vecLength, UINT4 vecLengthTwo, UINT4 vecLoc, UINT4 snrLoc)
void cross_product(gsl_vector *product, const gsl_vector *u, const gsl_vector *v)
CohPTFSkyPositions * coh_PTF_generate_sky_grid(struct coh_PTF_params *params)
UINT4 checkInjectionMchirp(struct coh_PTF_params *params, InspiralTemplate *tmplt, LIGOTimeGPS *epoch)
void timeval_print(struct timeval *tv)
static TimeSlideSegmentMapTable * XLALCreateTimeSlideSegmentMapTableRow(void)
void coh_PTF_set_null_input_REAL8Array(REAL8Array **array, UINT4 length)
void coh_PTF_calculate_det_stuff(struct coh_PTF_params *params, LALDetector **detectors, REAL4 *timeOffsets, REAL4 *Fplustrig, REAL4 *Fcrosstrig, CohPTFSkyPositions *skyPoints, UINT4 skyPointNum)
SnglInspiralTable * coh_PTF_create_sngl_event(struct coh_PTF_params *params, REAL4TimeSeries *cohSNR, FindChirpTemplate *fcTmplt, InspiralTemplate PTFTemplate, UINT8 *eventId, REAL4TimeSeries **pValues, REAL4TimeSeries **bankVeto, REAL4TimeSeries **autoVeto, REAL4TimeSeries **chiSquare, REAL8Array **PTFM, UINT4 currPos)
static void XLALDestroyTimeSlideSegmentMapTableRow(TimeSlideSegmentMapTable *row)
UINT4 coh_PTF_accept_sngl_trig_check(struct coh_PTF_params *params, SnglInspiralTable **eventList, SnglInspiralTable thisEvent)
CohPTFSkyPositions * coh_PTF_three_det_sky_grid(struct coh_PTF_params *params)
void rotation_matrix(gsl_matrix *matrix, gsl_vector *axis, REAL8 angle)
REAL4FFTPlan * coh_PTF_get_fft_psdplan(struct coh_PTF_params *params)
void coh_PTF_rescale_data(REAL4TimeSeries *channel, REAL8 rescaleFactor)
void coh_PTF_set_null_input_UINT4(UINT4 **array, UINT4 length)
REAL4TimeSeries * coh_PTF_get_data(struct coh_PTF_params *params, const char *ifoChannel, const char *dataCache, UINT4 ifoNumber)
void coh_PTF_set_null_input_REAL4FrequencySeries(REAL4FrequencySeries **freqSeries, UINT4 length)
void coh_PTF_cluster_sngl_triggers(struct coh_PTF_params *params, SnglInspiralTable **eventList, SnglInspiralTable **thisEvent)
void coh_PTF_calculate_bmatrix(struct coh_PTF_params *params, gsl_matrix *eigenvecs, gsl_vector *eigenvals, REAL4 Fplus[LAL_NUM_IFO], REAL4 Fcross[LAL_NUM_IFO], REAL8Array *PTFM[LAL_NUM_IFO+1], UINT4 vecLength, UINT4 vecLengthTwo, UINT4 PTFMlen)
void coh_PTF_calculate_null_stream_norms(UINT4 vecLength, gsl_matrix *eigenvecsNull, gsl_vector *eigenvalsNull, REAL8Array *PTFM[LAL_NUM_IFO+1])
UINT4 coh_PTF_template_time_series_cluster(struct coh_PTF_params *params, REAL4TimeSeries *cohSNR, UINT4 *acceptPoints, INT4 *timeOffsetPoints, INT4 numPointCheck, UINT4 startPoint, UINT4 endPoint, UINT4 **snglAcceptPoints, UINT4 *snglAcceptCount)
COMPLEX8FFTPlan * coh_PTF_get_fft_invplan(struct coh_PTF_params *params)
void findInjectionSegment(UINT4 *start, UINT4 *end, LIGOTimeGPS *epoch, struct coh_PTF_params *params)
void coh_PTF_set_null_input_LALDetector(LALDetector **detector, UINT4 length)
long int timeval_subtract(struct timeval *t1)
CohPTFSkyPositions * coh_PTF_circular_grid(REAL4 angularResolution, REAL4 skyError)
REAL4FrequencySeries * coh_PTF_get_invspec(REAL4TimeSeries *channel, REAL4FFTPlan *fwdplan, REAL4FFTPlan *revplan, REAL4FFTPlan *psdplan, struct coh_PTF_params *params)
INT4 coh_PTF_data_condition(struct coh_PTF_params *params, REAL4TimeSeries **channel, REAL4FrequencySeries **invspec, RingDataSegments **segments, REAL4FFTPlan *fwdplan, REAL4FFTPlan *psdplan, REAL4FFTPlan *revplan, REAL4 **timeSlideVectorsP, struct timeval startTime)
void coh_PTF_reset_time_series(struct coh_PTF_params *params, LIGOTimeGPS segStartTime, REAL4TimeSeries *cohSNR, REAL4TimeSeries *nullSNR, REAL4TimeSeries *traceSNR, REAL4TimeSeries **bankVeto, REAL4TimeSeries **autoVeto, REAL4TimeSeries **chiSquare, REAL4TimeSeries **snrComps, REAL4TimeSeries **pValues, REAL4TimeSeries **gammaBeta, UINT4 spinTemplates)
void coh_PTF_calculate_coherent_SNR(struct coh_PTF_params *params, REAL4 *snrData, REAL4TimeSeries **pValues, REAL4TimeSeries **snrComps, INT4 *timeOffsetPoints, COMPLEX8VectorSequence **PTFqVec, REAL4 *Fplus, REAL4 *Fcross, gsl_matrix *eigenvecs, gsl_vector *eigenvals, UINT4 segStartPoint, UINT4 segEndPoint, UINT4 vecLength, UINT4 vecLengthTwo, UINT4 spinTemplate, UINT4 **snglAcceptPoints, UINT4 *snglAcceptCount)
int is_in_list(int i, const char *list)
MultiInspiralTable * coh_PTF_create_multi_event(struct coh_PTF_params *params, REAL4TimeSeries *cohSNR, FindChirpTemplate *fcTmplt, InspiralTemplate PTFTemplate, UINT8 *eventId, UINT4 spinTrigger, REAL4TimeSeries **pValues, REAL4TimeSeries **gammaBeta, REAL4TimeSeries **snrComps, REAL4TimeSeries *nullSNR, REAL4TimeSeries *traceSNR, REAL4TimeSeries **bankVeto, REAL4TimeSeries **autoVeto, REAL4TimeSeries **chiSquare, REAL8Array **PTFM, REAL4 rightAscension, REAL4 declination, INT8 slideId, INT4 *timeOffsetPoints, UINT4 currPos)
void coh_PTF_set_null_input_REAL4TimeSeries(REAL4TimeSeries **timeSeries, UINT4 length)
UINT4 coh_PTF_test_veto_vals(struct coh_PTF_params *params, REAL4TimeSeries *cohSNR, REAL4TimeSeries *nullSNR, REAL4TimeSeries **bankVeto, REAL4TimeSeries **autoVeto, UINT4 currPointLoc)
void coh_PTF_calculate_null_stream_filters(struct coh_PTF_params *params, FindChirpTemplate *fcTmplt, REAL4FrequencySeries **invspec, REAL8Array **PTFM, COMPLEX8VectorSequence **PTFqVec, RingDataSegments **segments, COMPLEX8FFTPlan *invPlan, UINT4 spinTemplate, UINT4 segNum)
int error(const char *fmt,...)
REAL4TimeSeries * ring_get_frame_data(const char *cacheName, const char *channelName, LIGOTimeGPS *epoch, REAL8 duration, int dataType)
REAL4TimeSeries * get_zero_data(const char *channelName, LIGOTimeGPS *epoch, REAL8 duration, int dataType, REAL8 sampleRate)
int highpass_REAL4TimeSeries(REAL4TimeSeries *series, REAL8 frequency)
REAL4TimeSeries * get_simulated_data_new(const char *channelName, LIGOTimeGPS *epoch, REAL8 duration, REAL8 sampleRate, UINT4 simSeed, REAL8FrequencySeries *psd)
int resample_REAL4TimeSeries(REAL4TimeSeries *series, REAL8 sampleRate)
REAL4TimeSeries * get_frame_data_dbl_convert(const char *cacheName, const char *channelName, LIGOTimeGPS *epoch, REAL8 duration, int dataType, REAL8 dblHighPassFreq)
int trimpad_REAL4TimeSeries(REAL4TimeSeries *series, REAL8 padData)
void XLALDestroyREAL8Array(REAL8Array *)
REAL8Array * XLALCreateREAL8ArrayL(UINT4,...)
void XLALDestroyVectorSequence(REAL4VectorSequence *vecseq)
COMPLEX8VectorSequence * XLALCreateCOMPLEX8VectorSequence(UINT4 length, UINT4 veclen)
void XLALDestroyCOMPLEX8VectorSequence(COMPLEX8VectorSequence *vecseq)
REAL4VectorSequence * XLALCreateVectorSequence(UINT4 length, UINT4 veclen)
COMPLEX8FFTPlan * XLALCreateReverseCOMPLEX8FFTPlan(UINT4 size, int measurelvl)
void XLALDestroyCOMPLEX8FFTPlan(COMPLEX8FFTPlan *plan)
void XLALComputeDetAMResponse(double *fplus, double *fcross, const REAL4 D[3][3], const double ra, const double dec, const double psi, const double gmst)
REAL4FrequencySeries * XLALCreateREAL4FrequencySeries(const CHAR *name, const LIGOTimeGPS *epoch, REAL8 f0, REAL8 deltaF, const LALUnit *sampleUnits, size_t length)
void XLALDestroyREAL8FrequencySeries(REAL8FrequencySeries *series)
#define XLAL_INIT_DECL(var,...)
void * XLALMalloc(size_t n)
int XLALStringPrint(char *s, size_t n, const char *fmt,...) _LAL_GCC_PRINTF_FORMAT_(3
REAL4FFTPlan * XLALCreateReverseREAL4FFTPlan(UINT4 size, int measurelvl)
REAL4FFTPlan * XLALCreateForwardREAL4FFTPlan(UINT4 size, int measurelvl)
void XLALDestroyREAL4FFTPlan(REAL4FFTPlan *plan)
void XLALNormalizeSkyPosition(double *restrict longitude, double *restrict latitude)
COORDINATESYSTEM_GEOGRAPHIC
COORDINATESYSTEM_EQUATORIAL
void LALGeographicToEquatorial(LALStatus *stat, SkyPosition *output, SkyPosition *input, LIGOTimeGPS *gpsTime)
REAL8 XLALTimeDelayFromEarthCenter(const double detector_earthfixed_xyz_metres[3], double source_right_ascension_radians, double source_declination_radians, const LIGOTimeGPS *gpstime)
double XLALArrivalTimeDiff(const double detector1_earthfixed_xyz_metres[3], const double detector2_earthfixed_xyz_metres[3], const double source_right_ascension_radians, const double source_declination_radians, const LIGOTimeGPS *gpstime)
INT8 XLALLightTravelTime(const LALDetector *aDet, const LALDetector *bDet)
REAL4TimeSeries * XLALCreateREAL4TimeSeries(const CHAR *name, const LIGOTimeGPS *epoch, REAL8 f0, REAL8 deltaT, const LALUnit *sampleUnits, size_t length)
void XLALDestroyREAL4TimeSeries(REAL4TimeSeries *series)
const LALUnit lalStrainUnit
const LALUnit lalDimensionlessUnit
REAL4Vector * XLALCreateREAL4Vector(UINT4 length)
void XLALDestroyVector(REAL4Vector *vector)
void XLALDestroyREAL4Vector(REAL4Vector *vector)
COMPLEX8Vector * XLALCreateCOMPLEX8Vector(UINT4 length)
REAL4Vector * XLALCreateVector(UINT4 length)
void XLALDestroyCOMPLEX8Vector(COMPLEX8Vector *vector)
#define XLAL_ERROR_NULL(...)
REAL8 XLALGreenwichMeanSiderealTime(const LIGOTimeGPS *gpstime)
LIGOTimeGPS * XLALGPSAdd(LIGOTimeGPS *epoch, REAL8 dt)
int XLALGPSCmp(const LIGOTimeGPS *t0, const LIGOTimeGPS *t1)
REAL8 XLALGPSDiff(const LIGOTimeGPS *t1, const LIGOTimeGPS *t0)
INT8 XLALGPSToINT8NS(const LIGOTimeGPS *epoch)
int ring_inject_signal(REAL4TimeSeries *series, int injectSignalType, const char *injectFile, const char *calCacheFile, REAL4 responseScale, const char *channel_name)
char name[LIGOMETA_SOURCE_MAX]
int compute_data_segment(COMPLEX8FrequencySeries *segment, UINT4 segmentNumber, REAL4TimeSeries *series, REAL4FrequencySeries *invspec, COMPLEX8FrequencySeries *response, REAL8 segmentDuration, REAL8 strideDuration, REAL4FFTPlan *fwdPlan)
LALDetector detectors[LAL_NUM_DETECTORS]
REAL4FrequencySeries * resample_psd(REAL4FrequencySeries *origspectrum, REAL8 sampleRate, REAL8 segmentDuration)
REAL8FrequencySeries * generate_theoretical_psd(REAL4 deltaT, REAL8 segmentDuration, UINT4 spectrumNumber, REAL8 simScale)
int invert_spectrum(REAL4FrequencySeries *spectrum, REAL8 dataSampleRate, REAL8 UNUSED strideDuration, REAL8 truncateDuration, REAL8 lowCutoffFrequency, REAL4FFTPlan *fwdPlan, REAL4FFTPlan *revPlan)
REAL4FrequencySeries * compute_average_spectrum(REAL4TimeSeries *series, int spectrumAlgthm, REAL8 segmentDuration, REAL8 strideDuration, REAL4FFTPlan *fwdPlan, int whiteSpectrum)
This structure contains a frequency domain template used as input to the FindChirpFilter() routine.
COMPLEX8Vector * data
Vector of length containing the frequency template data ; For a template generated in the frequency ...
COMPLEX8VectorSequence * PTFQtilde
UNDOCUMENTED.
REAL4 tmpltNorm
The template dependent normalisation constant ; For the stationary phase template FindChirpSP this is...
REAL4VectorSequence * PTFQ
UNDOCUMENTED.
This structure contains the parameters for generation of templates by the various template generation...
RealFFTPlan * fwdPlan
For time domain templates, an FFTW plan used to transform the time domain data stored in xfacVec into...
REAL4Vector * PTFphi
UNDOCUMENTED.
REAL4Vector * PTFomega_2_3
UNDOCUMENTED.
UINT4 invSpecTrunc
The length to which to truncate the inverse power spectral density of the data in the time domain; If...
REAL4 maxTempLength
This can be used to store the maximum allowed template length, given the pad length and spectrum trun...
REAL4 fLow
The frequency domain low frequency cutoff ; All frequency domain data is zero below this frequency.
REAL4VectorSequence * PTFe1
UNDOCUMENTED.
LALPNOrder order
Specifies the post-Newtonian order of the templates; Valid pN orders are LAL_PNORDER_TWO,...
REAL4Vector * xfacVec
For frequency domain templates, this is a vector of length which contains the quantity ; For time do...
Approximant approximant
Generate templates of type approximant; Valid approximants are TaylorT1, TaylorT2,...
REAL4 dynRange
A dynamic range factor which cancels from the filter output; This allows quantities to be stored in ...
REAL4VectorSequence * PTFe2
UNDOCUMENTED.
INT4 dynamicTmpltFlow
Use longest template that will fit in pad length.
REAL8 deltaT
The sampling interval of the input data channel.
struct tagInspiralTemplate * next
struct tagMultiInspiralTable * next
CHAR ifos[LIGOMETA_IFOS_MAX]
struct tagProcessParamsTable * next
COMPLEX8FrequencySeries * sgmnt
struct tagSegmentTable * next
LIGOTimeGPS geocent_end_time
struct tagSimInspiralTable * next
CHAR ifo[LIGOMETA_IFO_MAX]
struct tagSnglInspiralTable * next
CHAR channel[LIGOMETA_CHANNEL_MAX]
CHAR search[LIGOMETA_SEARCH_MAX]
CHAR instrument[LIGOMETA_STRING_MAX]
struct tagTimeSlide * next
struct tagTimeSlideSegmentMapTable * next
REAL4 timeSlideVectors[LAL_NUM_IFO]
int output(const char *outfile, int outtype, REAL4TimeSeries *series)