29#define UNUSED __attribute__ ((unused))
34#define HSMAX(x,y) ( (x) > (y) ? (x) : (y) )
35#define HSMIN(x,y) ( (x) < (y) ? (x) : (y) )
41extern UINT4 nSkyRefine;
62#define LocalHOUGHComputeSizePar LALHOUGHComputeSizePar
63#define LocalHOUGHFillPatchGrid LALHOUGHFillPatchGrid
64#define LocalHOUGHCalcParamPLUT LALHOUGHCalcParamPLUT
65#define LocalHOUGHConstructPLUT LALHOUGHConstructPLUT
66#define LocalHOUGHConstructSpacePHMD LALHOUGHConstructSpacePHMD
67#define LocalHOUGHWeighSpacePHMD LALHOUGHWeighSpacePHMD
68#define LocalHOUGHInitializeHT LALHOUGHInitializeHT
69#define LocalHOUGHupdateSpacePHMDup LALHOUGHupdateSpacePHMDup
70#define LocalHOUGHWeighSpacePHMD LALHOUGHWeighSpacePHMD
83#define ALWAYS_INLINE __attribute__ ((always_inline))
130 UINT2 xSide, ySide, maxNBins, maxNBorders;
131 INT8 fBinIni, fBinFin, fBin;
135 REAL8 patchSizeX, patchSizeY;
151 if (
out->length == 0 ) {
154 if (
out->list == NULL ) {
163 if ( pgV->
pg == NULL ) {
187 refTimeGPS =
params->refTime;
196 patchSizeX =
params->patchSizeX;
197 patchSizeY =
params->patchSizeY;
202 for (
k=0;
k<nStacks;
k++) {
205 timeDiffV->
data[
k] = tMidStack - refTime;
215 if ( lutV.
lut == NULL ) {
224 REAL8 maxTimeDiff, startTimeDiff, endTimeDiff;
226 startTimeDiff = fabs(timeDiffV->
data[0]);
227 endTimeDiff = fabs(timeDiffV->
data[timeDiffV->
length - 1]);
228 maxTimeDiff =
HSMAX( startTimeDiff, endTimeDiff);
233 phmdVS.
nfSize = 2 * floor((nfdot-1) * (
REAL4)(dfdot * maxTimeDiff /
deltaF) + 0.5f) + 1;
239 if ( phmdVS.
phmd == NULL ) {
248 if ( freqInd.
data == NULL ) {
299 parRes.
f0Bin = fBinIni;
301 fBinIni +=
params->extraBinsFstat;
302 fBinFin -=
params->extraBinsFstat;
311 out->nCandidates = 0;
319 INT4 numHmaps = (fBinFin - fBinIni + 1)*phmdVS.
nfSize;
320 if (
out->length != numHmaps) {
321 out->length = numHmaps;
323 if (
out->list == NULL ) {
334 while( fBin <= fBinFin ){
335 INT8 fBinSearch, fBinSearchMax;
340 xSide = parSize.
xSide;
341 ySide = parSize.
ySide;
352 if ( patch.
xCoor == NULL ) {
357 if ( patch.
yCoor == NULL ) {
372 if ( lutV.
lut[
j].
bin == NULL ) {
376 for (
i=0;
i<maxNBorders; ++
i){
443 if ( ht.
map == NULL ) {
451 fBinSearchMax = fBin + parSize.
nFreqValid - 1;
454 while ( (fBinSearch <= fBinFin) && (fBinSearch < fBinSearchMax) ) {
461 ht.
f0Bin = fBinSearch;
465 for(
n = -nfdotBy2;
n <= nfdotBy2 ;
n++ ){
469 for (
j=0;
j < (
UINT4)nStacks;
j++) {
476 if (
params->useToplist ) {
508 for (
i=0;
i<maxNBorders; ++
i){
535 if (
params->useToplist ) {
536 for (
k=0;
k<houghToplist->
elems;
k++) {
539 out->nCandidates = houghToplist->
elems;
620 if (hd. map == NULL) {
627 for (
k=0;
k<length; ++
k ){
629 fBin =freqInd->
data[
k] -fBinMin;
635 j = (fBin + breakLine) % nfSize;
688 for (
k=0;
k< ySide; ++
k ){
721#define PREFETCH(a) __builtin_prefetch(a)
722#elif defined(__INTEL_COMPILER) || defined(_MSC_VER)
723#include "xmmintrin.h"
724#define PREFETCH(a) _mm_prefetch((char *)(void *)(a),_MM_HINT_T0)
730#if defined(__GNUC__) && ( defined(__i386__) || defined(__x86_64__) )
749 INT4 xSideP1 = xSide +1;
755 for (
k=0;
k< length; ++
k){
757 borderP = pBorderP[
k];
758 xPixel = &( (*borderP).xPixel[0] );
760 yLower = (*borderP).
yLower;
761 yUpper = (*borderP).yUpper;
765 PREFETCH(&(pBorderP[
k+1]->xPixel[ylkp1]));
773 fprintf(stderr,
"WARNING: Fixing yLower (%d -> 0) [HoughMap.c %d]\n",
777 if (yUpper >= ySide) {
778 fprintf(stderr,
"WARNING: Fixing yUpper (%d -> %d) [HoughMap.c %d]\n",
779 yUpper, ySide-1, __LINE__);
789#elif defined(PREFETCH) && ( defined(__SSE__) || defined(__ALTIVEC__) )
793#ifndef EAH_HOUGH_BATCHSIZE_LOG2
794#define EAH_HOUGH_BATCHSIZE_LOG2 2
796#define EAH_HOUGH_BATCHSIZE (1 << EAH_HOUGH_BATCHSIZE_LOG2)
800#define CHECK_INDEX(IDX,OFFSET) \
801 if ((IDX < 0) || ( IDX >= ySide*(xSide+1))|| xPixel[OFFSET] < 0 || xPixel[OFFSET] >= xSideP1) { \
802 fprintf(stderr,"\nERROR: %s %d: map index out of bounds: %d [0..%d] j:%d xp[j]:%d xSide:%d\n", \
803 __FILE__,__LINE__,IDX,ySide*(xSide+1),OFFSET,xPixel[OFFSET],xSide ); \
804 ABORT(status, HOUGHMAPH_ESIZE, HOUGHMAPH_MSGESIZE); \
819 register HoughDT tempM0,tempM1,tempM2,tempM3;
820 INT4 sidx,sidx0,sidx1,sidx2,sidx3,sidxBase, sidxBase_n;
824 INT4 xSideP1 = xSide +1;
825 INT4 xSideP1_2=xSideP1+xSideP1;
826 INT4 xSideP1_3=xSideP1_2+xSideP1;
830 for (k=0;
k< length; ++
k) {
836 borderP = pBorderP[
k];
837 xPixel = &( (*borderP).xPixel[0] );
842 sidxBase=yLower*xSideP1;
843 sidxBase_n = sidxBase+(xSideP1 << EAH_HOUGH_BATCHSIZE_LOG2);
848 PREFETCH(&(pBorderP[k+1]->xPixel[ylkp1]));
857 fprintf(stderr,
"WARNING: Fixing yLower (%d -> 0) [HoughMap.c %d]\n",
861 if (yUpper >= ySide) {
862 fprintf(stderr,
"WARNING: Fixing yUpper (%d -> %d) [HoughMap.c %d]\n",
863 yUpper, ySide-1, __LINE__);
870 c_n =EAH_HOUGH_BATCHSIZE;
872 offs = yUpper - yLower+1;
873 if (offs > EAH_HOUGH_BATCHSIZE) {
874 offs = EAH_HOUGH_BATCHSIZE;
878 for(j=yLower;
j < yLower+offs;
j++) {
879 sidx0=xPixel[
j]+
j*xSideP1;
880 PREFETCH(pf_addr[c_c++] = map + sidx0);
881#ifndef NO_CHECK_INDEX
882 CHECK_INDEX(sidx0,j);
887 for(j=yLower;
j<=yUpper-(2*EAH_HOUGH_BATCHSIZE-1);
j+=EAH_HOUGH_BATCHSIZE){
889 sidx0 = xPixel[
j+EAH_HOUGH_BATCHSIZE]+sidxBase_n;;
890 sidx1 = xPixel[
j+EAH_HOUGH_BATCHSIZE+1]+sidxBase_n+xSideP1;
891 sidx2 = xPixel[
j+EAH_HOUGH_BATCHSIZE+2]+sidxBase_n+xSideP1_2;
892 sidx3 = xPixel[
j+EAH_HOUGH_BATCHSIZE+3]+sidxBase_n+xSideP1_3;;
894 PREFETCH(xPixel +(j+(EAH_HOUGH_BATCHSIZE+EAH_HOUGH_BATCHSIZE)));
896 PREFETCH(pf_addr[c_n] = map + sidx0);
897 PREFETCH(pf_addr[c_n+1] = map + sidx1);
898 PREFETCH(pf_addr[c_n+2] = map + sidx2);
899 PREFETCH(pf_addr[c_n+3] = map + sidx3);
901#ifndef NO_CHECK_INDEX
902 CHECK_INDEX(sidx0,j+EAH_HOUGH_BATCHSIZE);
903 CHECK_INDEX(sidx1,j+EAH_HOUGH_BATCHSIZE+1);
904 CHECK_INDEX(sidx2,j+EAH_HOUGH_BATCHSIZE+2);
905 CHECK_INDEX(sidx3,j+EAH_HOUGH_BATCHSIZE+3);
908 tempM0 = *(pf_addr[c_c]) +weight;
909 tempM1 = *(pf_addr[c_c+1]) +weight;
910 tempM2 = *(pf_addr[c_c+2]) +weight;
911 tempM3 = *(pf_addr[c_c+3]) +weight;
913 sidxBase = sidxBase_n;
914 sidxBase_n+=xSideP1 << EAH_HOUGH_BATCHSIZE_LOG2;
916 (*(pf_addr[c_c]))=tempM0;
917 (*(pf_addr[c_c+1]))=tempM1;
918 (*(pf_addr[c_c+2]))=tempM2;
919 (*(pf_addr[c_c+3]))=tempM3;
921 c_c ^= EAH_HOUGH_BATCHSIZE;
922 c_n ^= EAH_HOUGH_BATCHSIZE;
926 for(;
j<=yUpper;++
j){
927 sidx = sidxBase + xPixel[
j];
928#ifndef NO_CHECK_INDEX
929 CHECK_INDEX(sidx0,j);
958 for (
k=0;
k< length; ++
k) {
961 borderP = pBorderP[
k];
962 yLower = (*borderP).
yLower;
963 yUpper = (*borderP).yUpper;
964 xPixel = &((*borderP).xPixel[0]);
968 fprintf(stderr,
"WARNING: Fixing yLower (%d -> 0) [HoughMap.c %d]\n",
972 if (yUpper >= ySide) {
973 fprintf(stderr,
"WARNING: Fixing yUpper (%d -> %d) [HoughMap.c %d]\n",
974 yUpper, ySide-1, __LINE__);
979 for(
j = yLower;
j <= yUpper;
j++){
980 sidx =
j*(xSide+1) + xPixel[
j];
981 if ((sidx < 0) || (sidx >= ySide*(xSide+1))) {
982 fprintf(stderr,
"\nERROR: %s %d: map index out of bounds: %d [0..%d] j:%d xp[j]:%d\n",
983 __FILE__,__LINE__,sidx,ySide*(xSide+1),
j,xPixel[
j] );
int create_toplist(toplist_t **list, size_t length, size_t size, int(*smaller)(const void *, const void *))
void free_toplist(toplist_t **list)
void * toplist_elem(toplist_t *list, size_t ind)
#define HIERARCHICALSEARCH_MSGENULL
#define HIERARCHICALSEARCH_ENULL
#define HIERARCHICALSEARCH_EVAL
#define HIERARCHICALSEARCH_MSGEVAL
void GetHoughCandidates_toplist(LALStatus *status, toplist_t *list, HOUGHMapTotal *ht, HOUGHPatchGrid *patch, HOUGHDemodPar *parDem)
Get Hough candidates as a toplist.
void GetHoughCandidates_threshold(LALStatus *status, SemiCohCandidateList *out, HOUGHMapTotal *ht, HOUGHPatchGrid *patch, HOUGHDemodPar *parDem, REAL8 threshold)
Get Hough candidates as a toplist using a fixed threshold.
Header file for DriveHoughFstat.c.
static double double delta
#define ABORT(statusptr, code, mesg)
#define TRY(func, statusptr)
#define ATTATCHSTATUSPTR(statusptr)
#define ASSERT(assertion, statusptr, code, mesg)
#define DETATCHSTATUSPTR(statusptr)
#define INITSTATUS(statusptr)
#define RETURN(statusptr)
#define LocalHOUGHFillPatchGrid
void LocalComputeFstatHoughMap(LALStatus *status, SemiCohCandidateList *out, HOUGHPeakGramVector *pgV, SemiCoherentParams *params)
#define LocalHOUGHCalcParamPLUT
#define LocalHOUGHWeighSpacePHMD
static void LocalHOUGHConstructHMT_W(LALStatus *status, HOUGHMapTotal *ht, UINT8FrequencyIndexVector *freqInd, PHMDVectorSequence *phmdVS)
set of partial hough map derivatives
#define LocalHOUGHComputeSizePar
#define LocalHOUGHInitializeHT
#define LocalHOUGHConstructSpacePHMD
#define LocalHOUGHupdateSpacePHMDup
static void LocalHOUGHAddPHMD2HD_W(LALStatus *status, HOUGHMapDeriv *hd, HOUGHphmd *phmd)
info from a partial map
INLINE void LocalHOUGHAddPHMD2HD_Wlr(LALStatus *status, HoughDT *map, HOUGHBorder **pBorderP, INT4 length, HoughDT weight, INT4 xSide, INT4 ySide) ALWAYS_INLINE
static int smallerHough(const void *a, const void *b)
#define LocalHOUGHConstructPLUT
void LALHOUGHInitializeHD(LALStatus *status, HOUGHMapDeriv *hd)
This function initializes the Hough map derivative space HOUGHMapDeriv *hd to zero.
#define HOUGHMAPH_MSGESIZE
REAL8 HoughTT
Total Hough Map pixel type.
#define HOUGHMAPH_MSGENULL
void LALHOUGHIntegrHD2HT(LALStatus *status, HOUGHMapTotal *ht, HOUGHMapDeriv *hd)
This function constructs a total Hough map HOUGHMapTotal *ht from its derivative HOUGHMapDeriv *hd by...
#define LALHOUGHH_MSGESZMM
#define LALHOUGHH_MSGESIZE
#define LALHOUGHH_MSGEMEM
#define LALHOUGHH_MSGENULL
#define LALHOUGHH_MSGEVAL
#define VTOT
Total detector velocity/c TO BE CHANGED DEPENDING ON DETECTOR.
#define PIXERR
Maximum `‘error’' (as a fraction of the width of the thinnest annulus) which allows to consider two b...
#define LINERR
Maximum `‘error’' (as a fraction of the width of the thinnest annulus) which allows to represent a ci...
INT2 COORType
To be changed to {INT2 COORType} if the number of pixels in the x-direction exceeds 255.
void LogPrintf(LogLevel_t, const char *format,...) _LAL_GCC_PRINTF_FORMAT_(2
REAL8 HoughDT
Hough Map derivative pixel type.
void LALDCreateVector(LALStatus *, REAL8Vector **, UINT4)
void LALDDestroyVector(LALStatus *, REAL8Vector **)
REAL8 XLALGPSGetREAL8(const LIGOTimeGPS *epoch)
#define ADDPHMD2HD_WLR_LOOP(_XPIXEL, _YLOWER, _YUPPER, _XSIDEP1, _MAP, _WEIGHT)
This structure stores the border indexes corresponding to one frequency bin plus the corrections to b...
This structure stores the border of a circle clipped on the projected plane.
COORType * xPixel
x pixel index to be marked
INT4 yLower
lower y pixel affected by this border and yUpper<yLower or yUpper<0 are possible
UINT2 ySide
length of xPixel
INT4 yUpper
upper y pixel affected by this border
Demodulation parameters needed for the Hough transform; all coordinates are assumed to be with respec...
REAL8Cart3Coor positC
(x,y,z): Position of the detector
REAL8 deltaF
Frequency resolution: df=1/TCOH
REAL8 timeDiff
: time difference
REAL8Cart3Coor veloC
(x,y,z): Relative detector velocity
REAL8Vector spin
Spin down information.
REAL8UnitPolarCoor skyPatch
(alpha, delta): position of the center of the patch
This structure stores the Hough map derivative.
UINT2 ySide
number of physical pixels in the y direction
UINT2 xSide
number of physical pixels in the x direction
HoughDT * map
the pixel count derivatives; the number of elements to allocate is ySide*(xSide+1)*
This structure stores the Hough map.
UINT2 ySide
number of physical pixels in the y direction
UINT2 xSide
number of physical pixels in the x direction
HoughTT * map
the pixel counts; the number of elements to allocate is ySide*xSide
REAL8Vector dFdot
resolution in spindown parameters
REAL8Vector spinRes
Refined spin parameters used in the Hough transform.
REAL8UnitPolarCoor skyPatch
Coordinates of the versor (alpha, delta) pointing to the center of the sky patch.
INT8 f0Bin
frequency bin for which it has been constructed
UINT4 mObsCoh
ratio of observation time and coherent timescale
REAL8 patchSizeX
x size of patch
REAL8 deltaF
frequency resolution
REAL8 patchSizeY
y size of patch
REAL8Vector spinDem
Spin parameters used in the demodulation stage.
Parameters needed to construct the partial look up table.
This structure stores patch-frequency grid information.
UINT2 ySide
Real number of pixels in the y-direction (in the projected plane).
REAL8 * xCoor
Coordinates of the pixel centers.
UINT2 xSide
Real number of pixels in the x direction (in the projected plane); it should be less than or equal to...
REAL8 * yCoor
Coordinates of the pixel centers.
REAL8 deltaF
Frequency resolution: df=1/TCOH
UINT8 fBinFin
Frequency index of the last element of the spectrum covered by this peak-gram.
UINT8 fBinIni
Frequency index of the first element of the spectrum covered by this peak-gram; it can be seen as an ...
This structure contains a vector of peak-grams (for the different time stamps)
UINT4 length
number of elements
HOUGHPeakGram * pg
the Peakgrams
parameters needed for gridding the patch
REAL8 deltaF
Frequency resolution: df=1/TCOH
REAL8 pixErr
for validity of LUT as PIXERR
INT8 f0Bin
Frequency bin at which construct the grid.
REAL8 patchSkySizeY
Patch size in radians along y-axis.
REAL8 patchSkySizeX
Patch size in radians along x-axis.
REAL8 pixelFactor
number of pixel that fit in the thinnest annulus
REAL8 vTotC
estimate value of v-total/C as VTOT
REAL8 linErr
as LINERR circle ->line
required for constructing patch
UINT2 maxNBorders
maximum number of borders affecting the patch; for memory allocation
UINT2 maxNBins
maximum number of bins affecting the patch; for memory allocation
UINT2 ySide
number of pixels in the y direction
INT8 nFreqValid
number of frequencies where the LUT is valid
UINT2 xSide
number of pixels in the x direction (projected plane)
This structure stores a partial Hough map derivative.
UINT2 lengthRight
Exact number of Right borders.
UINT2 lengthLeft
Exact number of Left borders.
HoughDT weight
First column border, containing the edge effects when clipping on a finite patch.
UCHAR * firstColumn
Number of elements of firstColumn.
UINT2 ySide
number of elements of firstColumn
HOUGHBorder ** rightBorderP
Pointers to borders.
UINT2 maxNBorders
Maximun number of borders of each type (for memory allocation purposes), i.e. length of *leftBorderP ...
HOUGHBorder ** leftBorderP
Pointers to borders.
This structure stores the patch-time-frequency look up table.
UINT2 maxNBins
Maximum number of bins affecting the patch (for memory allocation purposes)
HOUGHBorder * border
The annulus borders.
HOUGHBin2Border * bin
Bin to border correspondence.
UINT2 maxNBorders
Maximum number of borders affecting the patch (for memory allocation purposes)
This structure contains a vector of partial look up tables (for the different time stamps)
HOUGHptfLUT * lut
the partial Look Up Tables
UINT4 length
number of elements
A vector of 'timestamps' of type LIGOTimeGPS.
LIGOTimeGPS * data
array of timestamps
This structure contains a vector sequence of partial-Hough maps derivatives (for different time stamp...
UINT8 fBinMin
frequency index of smallest intrinsic frequency in circular buffer
UINT4 breakLine
Mark [0, nfSize) (of the circular buffer) pointing to the starting of the fBinMin line.
UINT4 nfSize
number of different frequencies
REAL8 deltaF
frequency resolution
HOUGHphmd * phmd
the partial Hough map derivatives
UINT4 length
number of elements for each frequency
REAL8 delta
In the interval [ ].
one hough or stackslide candidate
REAL8 significance
significance
structure for storing candidates produced by Hough search
parameters for the semicoherent stage
This structure stores the frequency indexes of the partial-Hough map derivatives at different time st...
UINT8 * data
the frequency indexes
REAL8 deltaF
frequency resolution
UINT4 length
number of elements