ProSHADE: ProSHADE_internal_peakSearch Namespace Reference

| ProSHADE 0.7.5.4 (MAR 2021) Protein Shape Detection

Functions
ProSHADE_internal_peakSearch Namespace Reference

This namespace contains all the functions required for peak searching in 3D maps. More...

## Functions
std::vector< proshade_double * > | findAllPointsAboveNeighbours (proshade_complex *map, proshade_unsign dim, proshade_signed peakSize, proshade_double *medianIQR)
| This function finds all indices with higher value then all neighbours. More...
void | pointsAboveNeighboursRemoveSmallHeight (std::vector< proshade_double * > *pointVec, proshade_double *medianIQR, proshade_double noIQRs)
| This function clears the 'higher than neighbour' vector from background values. More...
void | allocatePeakOptimisationMemory (proshade_double *&avgMat, proshade_double *&hlpMap, proshade_double *&eA, proshade_double *&eB, proshade_double *&eG, proshade_double *&uAV)
| This function allocates and checks all the peak optimisation memory. More...
void | releasePeakOptimisationMemory (proshade_double *&avgMat, proshade_double *&hlpMap, proshade_double *&eA, proshade_double *&eB, proshade_double *&eG, proshade_double *&uAV)
| This function deletes all the peak optimisation memory. More...
void | optimisePeakPositions (std::vector< proshade_double * > *pointVec, proshade_signed peakSize, proshade_signed band)
| This function optimises all the peaks in the input vector using the values of their neighbours. More...
std::vector< proshade_double * > | getAllPeaksNaive (proshade_complex *map, proshade_unsign dim, proshade_signed peakSize, proshade_double noIQRs)
| This function finds peaks in the 3D map using the "naive" approach. More...
void | getBestPeakEulerAngsNaive (proshade_complex *map, proshade_unsign dim, proshade_double *eulA, proshade_double *eulB, proshade_double *eulG, ProSHADE_settings *settings)
| This function finds the highest peaks optimised Euler angles using the "naive" approach. More...
void | allocateSmoothingZScoreMemory (proshade_unsign dim, proshade_double *&scoreOverVals, proshade_signed *&signals, proshade_double *&filteredY, proshade_double *&avgFilter, proshade_double *&stdFilter, proshade_double *&subVec, proshade_double *&medianIQR, proshade_double *&YZMap, proshade_double *&XZMap, proshade_double *&XYMap, proshade_unsign smLag)
| This function allocates the memory required for smoothed Z score computation. More...
void | releaseSmoothingZScoreMemory (proshade_double *&scoreOverVals, proshade_signed *&signals, proshade_double *&filteredY, proshade_double *&avgFilter, proshade_double *&stdFilter, proshade_double *&subVec, proshade_double *&medianIQR, proshade_double *&YZMap, proshade_double *&XZMap, proshade_double *&XYMap)
| This function releases the memory required for smoothed Z score computation. More...
void | getSmoothedZScore1D (proshade_unsign dim, proshade_unsign smoothingLag, proshade_double ZScoreThreshold, proshade_signed *signals, proshade_double *filteredY, proshade_double *avgFilter, proshade_double *stdFilter, proshade_double *subVec, proshade_double *medianIQR, proshade_double *scoreOverVals)
| This function computes the 1D peaks for a 1D input array and returns array of int's as signal. More...
void | getXAxisArraysSmoothedZScorePeaks (proshade_unsign dim, proshade_unsign smoothingLag, proshade_double ZScoreThreshold, proshade_signed *signals, proshade_double *filteredY, proshade_double *avgFilter, proshade_double *stdFilter, proshade_double *subVec, proshade_double *medianIQR, proshade_double *scoreOverVals, proshade_complex *map, proshade_double *YZMap)
| This function runs the 1D smoothed Z score algorithm on all X-axis arrays as its inputs. More...
void | getYAxisArraysSmoothedZScorePeaks (proshade_unsign dim, proshade_unsign smoothingLag, proshade_double ZScoreThreshold, proshade_signed *signals, proshade_double *filteredY, proshade_double *avgFilter, proshade_double *stdFilter, proshade_double *subVec, proshade_double *medianIQR, proshade_double *scoreOverVals, proshade_complex *map, proshade_double *XZMap)
| This function runs the 1D smoothed Z score algorithm on all Y-axis arrays as its inputs. More...
void | getZAxisArraysSmoothedZScorePeaks (proshade_unsign dim, proshade_unsign smoothingLag, proshade_double ZScoreThreshold, proshade_signed *signals, proshade_double *filteredY, proshade_double *avgFilter, proshade_double *stdFilter, proshade_double *subVec, proshade_double *medianIQR, proshade_double *scoreOverVals, proshade_complex *map, proshade_double *XYMap)
| This function runs the 1D smoothed Z score algorithm on all Z-axis arrays as its inputs. More...
void | findAllPointNeighbours (proshade_double *YZMap, proshade_double *XZMap, proshade_double *XYMap, proshade_unsign *visitedMap, proshade_signed dim, proshade_signed x, proshade_signed y, proshade_signed z, std::vector< proshade_unsign > *retVals)
| This is a support function for the Z-score peak detection. It is currently not being used. More...
void | findAllDisconnectedIslands (proshade_complex *map, proshade_double *YZMap, proshade_double *XZMap, proshade_double *XYMap, proshade_unsign dim, std::vector< proshade_unsign > *allIslandBests)
| This function combines the three Z score maps, locates individual islands and returns a vector of highest point indices for each such island. More...
void | findAllSmoothedZScorePeaksWithNeighbours (proshade_complex *map, proshade_double *YZMap, proshade_double *XZMap, proshade_double *XYMap, proshade_signed dim, proshade_signed peakSize, std::vector< proshade_double * > *allPeaksWithNeighbours)
| This function firstly determines the highest peak of all smoothed Z score islands and then returns this point as well as all its neighbours. More...
std::vector< proshade_double * > | getAllPeaksSmoothedZ (proshade_complex *map, proshade_unsign dim, proshade_double smoothingFraction, proshade_double noIQRs, proshade_signed peakSize)
| This function finds peaks in the 3D map using the smoothed Z score approach. More...
void | getBestPeakEulerAngsSmoothedZ (proshade_complex *map, proshade_unsign dim, proshade_double smoothingFraction, proshade_double noIQRs, proshade_signed peakSize, proshade_double *eulA, proshade_double *eulB, proshade_double *eulG)
| This function finds the highest peaks optimised Euler angles using the smoothed Z score approach. More...

## Detailed Description

This namespace contains all the functions required for peak searching in 3D maps.

Peak searching may be one of the bottlenecks of the "old" ProSHADE and therefore a dedicated header with functions related to 3D peak searching is created to allow more testing and work to be done on this task.

## Function Documentation

## ◆ allocatePeakOptimisationMemory()

void ProSHADE_internal_peakSearch::allocatePeakOptimisationMemory | ( | proshade_double *& | avgMat,
|  | proshade_double *& | hlpMat,
|  | proshade_double *& | eA,
|  | proshade_double *& | eB,
|  | proshade_double *& | eG,
|  | proshade_double *& | uAV
| ) |  |

This function allocates and checks all the peak optimisation memory.

Parameters

  [in] | avgMat | The matrix which will take the weighted sum of the neighbour values.
  [in] | hlpMat | The helper matrix to store temporary results.
  [in] | eA | The Euler angle alpha value.
  [in] | eB | The Euler beta alpha value.
  [in] | eG | The Euler gamma alpha value.
  [in] | uAV | The U and V^T matrices resulting from the SVD.

Definition at line 161 of file ProSHADE_peakSearch.cpp.

162 {
163 //================================================ Allocate the memory
164 avgMat = new proshade_double [9];
165 hlpMat = new proshade_double [9];
166 eA = new proshade_double;
167 eB = new proshade_double;
168 eG = new proshade_double;
169 uAV = new proshade_double [18];
170
171 //================================================ Check the memory allocation
172 ProSHADE_internal_misc::checkMemoryAllocation ( avgMat, __FILE__, __LINE__, __func__ );
173 ProSHADE_internal_misc::checkMemoryAllocation ( hlpMat, __FILE__, __LINE__, __func__ );
174 ProSHADE_internal_misc::checkMemoryAllocation ( eA, __FILE__, __LINE__, __func__ );
175 ProSHADE_internal_misc::checkMemoryAllocation ( eB, __FILE__, __LINE__, __func__ );
176 ProSHADE_internal_misc::checkMemoryAllocation ( eG, __FILE__, __LINE__, __func__ );
177 ProSHADE_internal_misc::checkMemoryAllocation ( uAV, __FILE__, __LINE__, __func__ );
178
179 //================================================ Done
180 return ;
181
182 }

## ◆ allocateSmoothingZScoreMemory()

void ProSHADE_internal_peakSearch::allocateSmoothingZScoreMemory | ( | proshade_unsign | dim,
|  | proshade_double *& | scoreOverVals,
|  | proshade_signed *& | signals,
|  | proshade_double *& | filteredY,
|  | proshade_double *& | avgFilter,
|  | proshade_double *& | stdFilter,
|  | proshade_double *& | subVec,
|  | proshade_double *& | medianIQR,
|  | proshade_double *& | YZMap,
|  | proshade_double *& | XZMap,
|  | proshade_double *& | XYMap,
|  | proshade_unsign | smLag
| ) |  |

This function allocates the memory required for smoothed Z score computation.

Parameters

  [in] | dim | The size of one dimension of the map (assuming cube map).
  [in] | scoreOverVals | Pointer to where the 1D cuts from the 3D map will be saved.
  [in] | signals | Pointer to where the results of the 1D peak searches will be saved.
  [in] | filteredY | Pointer to where the weighted smoothed scores will be saved.
  [in] | avgFilter | Pointer to where the median values will be saved.
  [in] | stdFilter | Pointer to where the IQR values will be saved.
  [in] | subVec | Pointer to where temporary computations will be done.
  [in] | medianIQR | Pointer to simple array of 2 for returning results.
  [in] | YZMap | Pointer to where the X-axis peaks will be saved.
  [in] | XZMap | Pointer to where the Y-axis peaks will be saved.
  [in] | XYMap | Pointer to where the Z-axis peaks will be saved.
  [in] | PeakMap | Pointer to where the axis peak combinations will be saved.
  [in] | smLag | The size of the smoothing window.

Definition at line 418 of file ProSHADE_peakSearch.cpp.

419 {
420 //================================================ Allocate the memory
421 signals = new proshade_signed[dim];
422 scoreOverVals = new proshade_double[dim];
423 filteredY = new proshade_double[dim];
424 avgFilter = new proshade_double[dim];
425 stdFilter = new proshade_double[dim];
426 subVec = new proshade_double[smLag];
427 medianIQR = new proshade_double[2];
428 YZMap = new proshade_double[dim * dim * dim];
429 XZMap = new proshade_double[dim * dim * dim];
430 XYMap = new proshade_double[dim * dim * dim];
431
432 //================================================ Check memory allocation
433 ProSHADE_internal_misc::checkMemoryAllocation ( signals, __FILE__, __LINE__, __func__ );
434 ProSHADE_internal_misc::checkMemoryAllocation ( scoreOverVals, __FILE__, __LINE__, __func__ );
435 ProSHADE_internal_misc::checkMemoryAllocation ( filteredY, __FILE__, __LINE__, __func__ );
436 ProSHADE_internal_misc::checkMemoryAllocation ( avgFilter, __FILE__, __LINE__, __func__ );
437 ProSHADE_internal_misc::checkMemoryAllocation ( stdFilter, __FILE__, __LINE__, __func__ );
438 ProSHADE_internal_misc::checkMemoryAllocation ( subVec, __FILE__, __LINE__, __func__ );
439 ProSHADE_internal_misc::checkMemoryAllocation ( medianIQR, __FILE__, __LINE__, __func__ );
440 ProSHADE_internal_misc::checkMemoryAllocation ( YZMap, __FILE__, __LINE__, __func__ );
441 ProSHADE_internal_misc::checkMemoryAllocation ( XZMap, __FILE__, __LINE__, __func__ );
442 ProSHADE_internal_misc::checkMemoryAllocation ( XYMap, __FILE__, __LINE__, __func__ );
443
444 //================================================ Done
445 return ;
446
447 }

## ◆ findAllDisconnectedIslands()

void ProSHADE_internal_peakSearch::findAllDisconnectedIslands | ( | proshade_complex * | map,
|  | proshade_double * | YZMap,
|  | proshade_double * | XZMap,
|  | proshade_double * | XYMap,
|  | proshade_unsign | dim,
|  | std::vector< proshade_unsign > * | allIslandBests
| ) |  |

This function combines the three Z score maps, locates individual islands and returns a vector of highest point indices for each such island.

This function considers each point common to all the three input maps and checks if this point has a signal along all three axes (i.e. is a peak in terms of the 3D smoothed Z score). If so, it finds all its neighbours and from this set (island), it finds the one point with the highest height. It then saves the index of this point and proceeds to another common point in the three input maps.

Parameters

  [in] | map | Pointer to 1D array holding the 3D map value in which the peaks are to be found. Map must be cube!
  [in] | YZMap | The map containing peaks detected along the X-axis dimension using the smoothed Z score method.
  [in] | XZMap | The map containing peaks detected along the Y-axis dimension using the smoothed Z score method.
  [in] | XYMap | The map containing peaks detected along the z-axis dimension using the smoothed Z score method.
  [in] | dim | The size of one dimension of the map (assuming cube map).
  [in] | allIslandBests | A vector which will be filled with the indices of the highest height point indices for each island.

Definition at line 778 of file ProSHADE_peakSearch.cpp.

779 {
780 //================================================ Initialise local variables
781 std::vector< proshade_unsign > ret;
782 std::vector< proshade_unsign > thisIsland;
783 proshade_unsign* visitedMap = new proshade_unsign[dim*dim*dim];
784 ProSHADE_internal_misc::checkMemoryAllocation ( visitedMap, __FILE__, __LINE__, __func__ );
785 for ( proshade_unsign i = 0; i < ( dim * dim * dim ); i++ ) { visitedMap[i] = 0; }
786 proshade_unsign index, maxIndex;
787 proshade_double maxHeight;
788
789 //================================================ For each point
790 for ( proshade_unsign xIt = 0; xIt < dim; xIt++ )
791 {
792 for ( proshade_unsign yIt = 0; yIt < dim; yIt++ )
793 {
794 for ( proshade_unsign zIt = 0; zIt < dim; zIt++ )
795 {
796 //==================================== Find index
797 index = xIt * static_cast<proshade_unsign>(4 * pow ( ( dim / 2 ), 2 )) + yIt * dim + zIt;
798
799 //==================================== If already visited, next point
800 if ( visitedMap[index] == 1 ) { continue; }
801 else { visitedMap[index] = 1; }
802
803 //==================================== If not peak, next point
804 if ( ( YZMap[index] + XZMap[index] + XYMap[index] ) != 3 ) { continue; }
805
806 //==================================== This is a new island! Save this point
807 thisIsland.clear ( );
808 ProSHADE_internal_misc::addToUnsignVector ( &thisIsland, index );
809
810 //==================================== ... and find all neighbours
811 findAllPointNeighbours ( YZMap, XZMap, XYMap, visitedMap, static_cast<proshade_signed>(dim), static_cast<proshade_signed>(xIt), static_cast<proshade_signed>(yIt), static_cast<proshade_signed>(zIt), &thisIsland );
812
813 //==================================== Find the largest of the island peaks
814 maxHeight = 0.0;
815 maxIndex = 0;
816 for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( thisIsland.size() ); iter++ )
817 {
818 if ( ( pow( map[thisIsland.at(iter)][0], 2.0 ) + pow( map[thisIsland.at(iter)][1], 2.0) ) > maxHeight )
819 {
820 maxHeight = pow( map[thisIsland.at(iter)][0], 2.0 ) + pow( map[thisIsland.at(iter)][1], 2.0 );
821 maxIndex = thisIsland.at(iter);
822 }
823 }
824
825 //==================================== Save the results
826 ProSHADE_internal_misc::addToUnsignVector ( allIslandBests, maxIndex );
827 }
828 }
829 }
830
831 //================================================ Release memory
832 delete[] visitedMap;
833
834 //================================================ Done
835 return ;
836
837 }

## ◆ findAllPointNeighbours()

void ProSHADE_internal_peakSearch::findAllPointNeighbours | ( | proshade_double * | YZMap,
|  | proshade_double * | XZMap,
|  | proshade_double * | XYMap,
|  | proshade_unsign * | visitedMap,
|  | proshade_signed | dim,
|  | proshade_signed | x,
|  | proshade_signed | y,
|  | proshade_signed | z,
|  | std::vector< proshade_unsign > * | retVals
| ) |  |

This is a support function for the Z-score peak detection. It is currently not being used.

This function should not really be present here, it is a support function for smoothed Z-score peak detection, which is currently not being used.

Parameters

  [in] | YZMap | The map containing peaks detected along the X-axis dimension using the smoothed Z score method.
  [in] | XZMap | The map containing peaks detected along the Y-axis dimension using the smoothed Z score method.
  [in] | XYMap | The map containing peaks detected along the z-axis dimension using the smoothed Z score method.
  [in] | visitedMap | The map with 0 if point not yet considered and 1 if already done.
  [in] | dim | The size of one dimension of the map (assuming cube map).
  [in] | x | The X-axis position of the currently considered point.
  [in] | y | The Y-axis position of the currently considered point.
  [in] | z | The Z-axis position of the currently considered point.
  [in] | retVals | A vector to which all neighbour indices will be added.

Definition at line 720 of file ProSHADE_peakSearch.cpp.

721 {
722 //================================================ Initialise local variables
723 proshade_signed newIter = 0;
724 proshade_signed peakX, peakY, peakZ;
725 proshade_signed xDim = static_cast<proshade_signed>(4 * pow ( ( dim / 2 ), 2 ));
726
727 //================================================ Iterate through all neighbours
728 for ( proshade_signed xCh = -1; xCh <= +1; xCh++ )
729 {
730 for ( proshade_signed yCh = -1; yCh <= +1; yCh++ )
731 {
732 for ( proshade_signed zCh = -1; zCh <= +1; zCh++ )
733 {
734 //==================================== Do not use this point
735 if ( ( xCh == 0 ) && ( yCh == 0 ) && ( zCh == 0 ) ) { continue; }
736
737 //==================================== Find the nieghbout peak indices (with periodicity)
738 peakX = x + xCh; if ( peakX >= dim ) { peakX -= dim; }; if ( peakX < 0 ) { peakX += dim; }
739 peakY = y + yCh; if ( peakY >= dim ) { peakY -= dim; }; if ( peakY < 0 ) { peakY += dim; }
740 peakZ = z + zCh; if ( peakZ >= dim ) { peakZ -= dim; }; if ( peakZ < 0 ) { peakZ += dim; }
741 newIter = peakX * xDim + peakY * dim + peakZ;
742
743 //==================================== If already visited, next point
744 if ( visitedMap[newIter] == 1 ) { continue; }
745 else { visitedMap[newIter] = 1; }
746
747 //==================================== If not peak, next point
748 if ( ( YZMap[newIter] + XZMap[newIter] + XYMap[newIter] ) != 3 ) { continue; }
749
750 //==================================== This is a valid neighbour! Save
751 ProSHADE_internal_misc::addToUnsignVector ( retVals, newIter );
752
753 //==================================== ... and recurse!
754 findAllPointNeighbours ( YZMap, XZMap, XYMap, visitedMap, dim, peakX, peakY, peakZ, retVals );
755 }
756 }
757 }
758
759 //================================================ Done
760 return ;
761
762 }

## ◆ findAllPointsAboveNeighbours()

std::vector< proshade_double * > ProSHADE_internal_peakSearch::findAllPointsAboveNeighbours | ( | proshade_complex * | map,
|  | proshade_unsign | dim,
|  | proshade_signed | peakSize,
|  | proshade_double * | medianIQR
| ) |  |

This function finds all indices with higher value then all neighbours.

This function finds all map indices with higher height than all their neighbours (the size of neighbours in terms of surrounding points can be changed) and saves these as well as the neighbours into the output vector of double*. It also keeps track of the non-peak values and saves their median height and its IQR, so that the output vector could be cleared from these small (background) values.

Parameters

  [in] | map | Pointer to 1D array holding the 3D map value in which the peaks are to be found. Map must be cube!
  [in] | dim | The size of one dimension of the map (assuming cube map).
  [in] | peakSize | The number of neighbouring points in single direction which should be considered as neighbours.
  [in] | medianIQR | Pointer to double[2] array where median and IQR of non-peak values will be saved.
  [out] | X | Vector of pointers to double numbers, first is the 'peak' (x,y,z and height) and then all neighbours follow in sets of 4 numbers.

Definition at line 38 of file ProSHADE_peakSearch.cpp.

39 {
40 //================================================ Initialise local variables
41 std::vector< proshade_double* > ret;
42 std::vector< proshade_double > nonPeakVals;
43 proshade_double* retHlp = NULL;
44 proshade_double pointHeight = 0.0;
45 proshade_signed x, y, z, peakX, peakY, peakZ, newIter, ptrIter;
46 proshade_signed xDim = pow ( dim, 2 );
47 proshade_signed yDim = dim;
48 bool breakPeak;
49
50 //================================================ Check all points
51 for ( proshade_unsign iter = 0; iter < ( pow( static_cast<proshade_unsign> ( dim ), 3 ) ); iter++ )
52 {
53 //============================================ Find point height
54 pointHeight = pow( map[iter][0], 2.0 ) + pow( map[iter][1], 2.0 );
55
56 //============================================ Find the x, y and z
57 x = std::floor ( iter / xDim );
58 y = std::floor ( ( iter - x * xDim ) / yDim );
59 z = iter - x * xDim - y * yDim;
60
61 //==================================== Initialise the output pointer
62 if ( retHlp == NULL )
63 {
64 retHlp = new proshade_double[static_cast<proshade_unsign>( pow( ((peakSize*2)+1), 3) * 4 )];
65 ProSHADE_internal_misc::checkMemoryAllocation ( retHlp, __FILE__, __LINE__, __func__ );
66 }
67
68 //============================================ Get the X surrounding values and check for all being lower than point in question
69 breakPeak = false;
70 ptrIter = 4;
71 for ( proshade_signed xCh = -peakSize; xCh <= +peakSize; xCh++ )
72 {
73 if ( breakPeak ) { break; }
74 for ( proshade_signed yCh = -peakSize; yCh <= +peakSize; yCh++ )
75 {
76 if ( breakPeak ) { break; }
77 for ( proshade_signed zCh = -peakSize; zCh <= +peakSize; zCh++ )
78 {
79 if ( breakPeak ) { break; }
80 if ( ( xCh == 0 ) && ( yCh == 0 ) && ( zCh == 0 ) ) { continue; }
81
82 //================================ Find the nieghbout peak indices (with periodicity)
83 peakX = x + xCh; if ( peakX >= yDim ) { peakX = yDim - 1; }; if ( peakX < 0 ) { peakX = 0; }
84 peakY = y + yCh; if ( peakY >= yDim ) { peakY = yDim - 1; }; if ( peakY < 0 ) { peakY = 0; }
85 peakZ = z + zCh; if ( peakZ >= yDim ) { peakZ = yDim - 1; }; if ( peakZ < 0 ) { peakZ = 0; }
86 newIter = peakX * xDim + peakY * yDim + peakZ;
87
88 //================================ If neighbour has higher value than index in question, break out
89 if ( ( pow ( map[newIter][0], 2.0 ) + pow( map[newIter][1], 2.0 ) ) > pointHeight ) { breakPeak = true; break; }
90
91 //================================ Save neighbour values for optimisation of peaks later
92 retHlp[ptrIter] = static_cast<proshade_double> ( peakX );
93 retHlp[ptrIter+1] = static_cast<proshade_double> ( peakY );
94 retHlp[ptrIter+2] = static_cast<proshade_double> ( peakZ );
95 retHlp[ptrIter+3] = pow ( map[newIter][0], 2.0 ) + pow( map[newIter][1], 2.0 );
96 ptrIter += 4;
97 }
98 }
99 }
100 if ( breakPeak ) { ProSHADE_internal_misc::addToDoubleVector ( &nonPeakVals, pointHeight ); continue; }
101
102 //============================================ If passing, save for returning
103 retHlp[0] = x;
104 retHlp[1] = y;
105 retHlp[2] = z;
106 retHlp[3] = pointHeight;
107 ProSHADE_internal_misc::addToDblPtrVector ( &ret, retHlp );
108 retHlp = NULL;
109 }
110
111 //================================================ Save non-peak median and IQR
112 ProSHADE_internal_maths::vectorMedianAndIQR ( &nonPeakVals, medianIQR );
113
114 //================================================ Release memory if need be
115 if ( retHlp != NULL ) { delete[] retHlp; }
116
117 //================================================ Done
118 return ( ret );
119
120 }

## ◆ findAllSmoothedZScorePeaksWithNeighbours()

void ProSHADE_internal_peakSearch::findAllSmoothedZScorePeaksWithNeighbours | ( | proshade_complex * | map,
|  | proshade_double * | YZMap,
|  | proshade_double * | XZMap,
|  | proshade_double * | XYMap,
|  | proshade_signed | dim,
|  | proshade_signed | peakSize,
|  | std::vector< proshade_double * > * | allPeaksWithNeighbours
| ) |  |

This function firstly determines the highest peak of all smoothed Z score islands and then returns this point as well as all its neighbours.

This function firstly uses the findAllDisconnectedIslands function to combine the smoothed Z score maps and detect all discontinuous inslands in the combined map. Then, it uses the highest point in each island, finds all its neighbours as well as its X, Y and Z position and returns a vector containing all these values in a proshade_double pointer, which it allocates.

Parameters

  [in] | map | Pointer to 1D array holding the 3D map value in which the peaks are to be found. Map must be cube!
  [in] | YZMap | The map containing peaks detected along the X-axis dimension using the smoothed Z score method.
  [in] | XZMap | The map containing peaks detected along the Y-axis dimension using the smoothed Z score method.
  [in] | XYMap | The map containing peaks detected along the z-axis dimension using the smoothed Z score method.
  [in] | dim | The size of one dimension of the map (assuming cube map).
  [in] | peakSize | The number of neighbouring points in single direction which should be considered as neighbours.
  [in] | allPeaksWithNeighbours | A vector which will have the x, y, and z positions and heights of all peaks and all their neighbours.

Definition at line 853 of file ProSHADE_peakSearch.cpp.

854 {
855 //================================================ Initialise local variables
856 proshade_signed x, y, z, peakX, peakY, peakZ, newIter, ptrIter;
857 proshade_unsign noNeighbours = pow( ((peakSize*2)+1), 3) * 4;
858
859 //================================================ Find all islands and their best representative
860 std::vector < proshade_unsign > allPeaksRepresentatives;
861 findAllDisconnectedIslands ( map, YZMap, XZMap, XYMap, dim, &allPeaksRepresentatives );
862
863 //================================================ For each peak
864 for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( allPeaksRepresentatives.size() ); iter++ )
865 {
866 //============================================ Reset loop
867 ptrIter = 0;
868
869 //============================================ Determine x, y and z
870 z = ( allPeaksRepresentatives.at(iter) % (dim*dim) ) % dim;
871 y = ( allPeaksRepresentatives.at(iter) - z ) % (dim*dim) / dim;
872 x = ( allPeaksRepresentatives.at(iter) - z - ( y * dim ) ) / (dim*dim);
873
874 //============================================ Allocate the memory
875 proshade_double* neighbours = new proshade_double[noNeighbours];
876 ProSHADE_internal_misc::checkMemoryAllocation ( neighbours, __FILE__, __LINE__, __func__ );
877 ProSHADE_internal_misc::addToDblPtrVector ( allPeaksWithNeighbours, neighbours );
878
879 //============================================ Find all neighbours
880 for ( proshade_signed xCh = -peakSize; xCh <= +peakSize; xCh++ )
881 {
882 for ( proshade_signed yCh = -peakSize; yCh <= +peakSize; yCh++ )
883 {
884 for ( proshade_signed zCh = -peakSize; zCh <= +peakSize; zCh++ )
885 {
886 //================================ Find the nieghbout peak indices (with periodicity)
887 peakX = x + xCh; if ( peakX >= dim ) { peakX -= dim; }; if ( peakX < 0 ) { peakX += dim; }
888 peakY = y + yCh; if ( peakY >= dim ) { peakY -= dim; }; if ( peakY < 0 ) { peakY += dim; }
889 peakZ = z + zCh; if ( peakZ >= dim ) { peakZ -= dim; }; if ( peakZ < 0 ) { peakZ += dim; }
890 newIter = peakX * (dim*dim) + peakY * dim + peakZ;
891
892 //================================ Save neighbour values for optimisation of peaks later
893 allPeaksWithNeighbours->at(iter)[ptrIter] = static_cast<proshade_double> ( peakX );
894 allPeaksWithNeighbours->at(iter)[ptrIter+1] = static_cast<proshade_double> ( peakY );
895 allPeaksWithNeighbours->at(iter)[ptrIter+2] = static_cast<proshade_double> ( peakZ );
896 allPeaksWithNeighbours->at(iter)[ptrIter+3] = pow ( map[newIter][0], 2.0 ) + pow( map[newIter][1], 2.0 );
897 ptrIter += 4;
898 }
899 }
900 }
901
902 //============================================ Release memory
903 delete[] neighbours;
904 }
905
906 //================================================ Done
907 return ;
908
909 }

## ◆ getAllPeaksNaive()

std::vector< proshade_double * > ProSHADE_internal_peakSearch::getAllPeaksNaive | ( | proshade_complex * | map,
|  | proshade_unsign | dim,
|  | proshade_signed | peakSize,
|  | proshade_double | noIQRs
| ) |  |

This function finds peaks in the 3D map using the "naive" approach.

This function uses the "naive" approach (used in early versions of ProSHADE) to find all significant peaks in a map. To do this, it firstly locates all map points which have higher value than all their neighbours in all directions. It also computes the median and IQR of all non-higher points and it then uses the median + x * IQR threshold (x is the noIQRs parameter) to remove all map points with value under this thereshold. Finally, it optimises all the remaining values using the weighted average of all the neighbour points. The final output then is a vector with a single entry for each passing peak; this array has 4 values, the alpha, beta and gamma Euler angle values and the maximum peak heigh.

Parameters

  [in] | map | Pointer to 1D array holding the 3D map value in which the peaks are to be found. Map must be cube!
  [in] | dim | The size of one dimension of the map (assuming cube map).
  [in] | peakSize | The number of neighbouring points in single direction which should be considered as neighbours.
  [in] | noIQRs | The number of IQRs from the median to determine minimal peak height.
  [out] | X | Vector of located peaks with pointers to arrays of 4 values: alpha, beta, gamma and peak heighht.

Definition at line 315 of file ProSHADE_peakSearch.cpp.

316 {
317 //================================================ Find all indices with higher value than all neighbours
318 std::vector< proshade_double* > allHigherIndices;
319 proshade_double* nonPeakMedianIQR = new proshade_double[2];
320 ProSHADE_internal_misc::checkMemoryAllocation ( nonPeakMedianIQR, __FILE__, __LINE__, __func__ );
321 allHigherIndices = findAllPointsAboveNeighbours ( map, dim, peakSize, nonPeakMedianIQR );
322
323 //================================================ Remove all indices with too small height
324 pointsAboveNeighboursRemoveSmallHeight ( &allHigherIndices, nonPeakMedianIQR, noIQRs );
325
326 //================================================ Optimise the peaks using the neighbour values
327 optimisePeakPositions ( &allHigherIndices, peakSize, dim/2 );
328
329 //================================================ Release memory
330 delete[] nonPeakMedianIQR;
331
332 //================================================ Done
333 return ( allHigherIndices );
334
335 }

## ◆ getAllPeaksSmoothedZ()

std::vector< proshade_double * > ProSHADE_internal_peakSearch::getAllPeaksSmoothedZ | ( | proshade_complex * | map,
|  | proshade_unsign | dim,
|  | proshade_double | smoothingFraction,
|  | proshade_double | noIQRs,
|  | proshade_signed | peakSize
| ) |  |

This function finds peaks in the 3D map using the smoothed Z score approach.

This function implements the smoothed Z-score peak detection. It is currently not being used and is most likely severly bugged.

Parameters

  [in] | map | Pointer to 1D array holding the 3D map values in which the peaks are to be found. Map must be cube!
  [in] | dim | The size of one dimension of the map (assuming cube map).
  [in] | peakSize | The number of neighbouring points in single direction which should be considered as neighbours.
  [in] | noIQRs | The number of IQRs from the median to determine minimal peak height.
  [in] | peakSize | The number of neighbouring points in single direction which should be considered as neighbours.
  [out] | X | Vector of located peaks with pointers to arrays of 5 values: x, y, z, angle and peak heighht.

Definition at line 922 of file ProSHADE_peakSearch.cpp.

923 {
924 //================================================ Initialise local variables
925 std::vector< proshade_double* > allHigherIndices;
926 proshade_unsign smoothingLag = std::floor ( smoothingFraction * dim );
927 proshade_double ZScoreThreshold = noIQRs;
928 proshade_signed *signals;
929 proshade_double *scoreOverVals, *filteredY, *avgFilter, *stdFilter, *subVec, *medianIQR, *YZMap, *XZMap, *XYMap;
930
931 //================================================ Sanity check
932 if ( dim <= smoothingLag + 2)
933 {
934 // throw error
935 }
936
937 //================================================ Allocate required memory
938 allocateSmoothingZScoreMemory ( dim, scoreOverVals, signals, filteredY, avgFilter, stdFilter, subVec, medianIQR, YZMap, XZMap, XYMap, smoothingLag );
939
940 //================================================ Get smoothed Z score peaks for X-axis arrays
941 getXAxisArraysSmoothedZScorePeaks ( dim, smoothingLag, ZScoreThreshold, signals, filteredY, avgFilter, stdFilter, subVec, medianIQR, scoreOverVals, map, YZMap );
942
943 //================================================ Get smoothed Z score peaks for Y-axis arrays
944 getYAxisArraysSmoothedZScorePeaks ( dim, smoothingLag, ZScoreThreshold, signals, filteredY, avgFilter, stdFilter, subVec, medianIQR, scoreOverVals, map, XZMap );
945
946 //================================================ Get smoothed Z score peaks for Y-axis arrays
947 getZAxisArraysSmoothedZScorePeaks ( dim, smoothingLag, ZScoreThreshold, signals, filteredY, avgFilter, stdFilter, subVec, medianIQR, scoreOverVals, map, XYMap );
948
949 //================================================ Put all dimension peaks together and detect disconnected islands
950 findAllSmoothedZScorePeaksWithNeighbours ( map, YZMap, XZMap, XYMap, dim, peakSize, &allHigherIndices );
951
952 //================================================ Optimise the peaks using the neighbour values
953 optimisePeakPositions ( &allHigherIndices, peakSize, dim/2 );
954
955 //================================================ Release the required memory
956 releaseSmoothingZScoreMemory ( scoreOverVals, signals, filteredY, avgFilter, stdFilter, subVec, medianIQR, YZMap, XZMap, XYMap );
957
958 //================================================ Done
959 return ( allHigherIndices );
960
961 }

## ◆ getBestPeakEulerAngsNaive()

void ProSHADE_internal_peakSearch::getBestPeakEulerAngsNaive | ( | proshade_complex * | map,
|  | proshade_unsign | dim,
|  | proshade_double * | eulA,
|  | proshade_double * | eulB,
|  | proshade_double * | eulG,
|  | ProSHADE_settings * | settings
| ) |  |

This function finds the highest peaks optimised Euler angles using the "naive" approach.

This function uses the same "naive" approach as discussed in the previous function. It firstly gets the full list of all "naive" peaks, it then optimises all such peaks and finds the largest (i.e. highest height) peak. For this single best peak, it finally returns the Euler angle values.

Parameters

  [in] | map | Pointer to 1D array holding the 3D map value in which the peaks are to be found. Map must be cube!
  [in] | dim | The size of one dimension of the map (assuming cube map).
  [in] | noIQRs | The number of IQRs from the median to determine minimal peak height.
  [in] | eulA | Pointer to where the Euler alpha angle value will be saved.
  [in] | eulB | Pointer to where the Euler beta angle value will be saved.
  [in] | eulG | Pointer to where the Euler gamma angle value will be saved.
  [in] | settings | The ProSHADE_settings object containing all the values required for making decisions.

Definition at line 351 of file ProSHADE_peakSearch.cpp.

352 {
353 //================================================ Report progress
354 ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 2, "Looking for Euler angles of highest peak." );
355
356 //================================================ Get all peaks
357 std::vector< proshade_double* > allPeaks = getAllPeaksNaive ( map, dim, settings->peakNeighbours, settings->noIQRsFromMedianNaivePeak );
358
359 //================================================ Report progress
360 std::stringstream hlpSSP;
361 hlpSSP << "Found " << allPeaks.size() << " possible peaks.";
362 ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 3, hlpSSP.str() );
363
364 //================================================ Sanity check
365 if ( allPeaks.size() == 0 )
366 {
367 *eulA = 0.0;
368 *eulB = 0.0;
369 *eulG = 0.0;
370 return ;
371 }
372
373 //================================================ Find the highest peak from the list
374 proshade_double highestPeak = 0.0;
375 proshade_unsign highestPeakIndex = 0;
376 for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign>( allPeaks.size() ); iter++ )
377 {
378 if ( allPeaks.at(iter)[3] > highestPeak ) { highestPeak = allPeaks.at(iter)[3]; highestPeakIndex = iter; }
379 }
380
381 //================================================ Get Euler ZXZ for the highest peak
382 *eulA = allPeaks.at(highestPeakIndex)[0];
383 *eulB = allPeaks.at(highestPeakIndex)[1];
384 *eulG = allPeaks.at(highestPeakIndex)[2];
385
386 //================================================ Release memory
387 for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( allPeaks.size() ); iter++ )
388 {
389 delete[] allPeaks.at(iter);
390 }
391
392 //================================================ Report progress
393 std::stringstream hlpSS;
394 hlpSS << "Optimal Euler angles are " << *eulA << " ; " << *eulB << " ; " << *eulG << " with peak height " << highestPeak;
395 ProSHADE_internal_messages::printProgressMessage ( settings->verbose, 3, hlpSS.str() );
396
397 //================================================ Done
398 return ;
399
400 }

## ◆ getBestPeakEulerAngsSmoothedZ()

void ProSHADE_internal_peakSearch::getBestPeakEulerAngsSmoothedZ | ( | proshade_complex * | map,
|  | proshade_unsign | dim,
|  | proshade_double | smoothingFraction,
|  | proshade_double | noIQRs,
|  | proshade_signed | peakSize,
|  | proshade_double * | eulA,
|  | proshade_double * | eulB,
|  | proshade_double * | eulG
| ) |  |

This function finds the highest peaks optimised Euler angles using the smoothed Z score approach.

This function uses the best peak detected using the smoothed Z-score peak detection to compute its Euler angles. It is currently not being used and is most likely severly bugged.

Parameters

  [in] | map | Pointer to 1D array holding the 3D map value in which the peaks are to be found. Map must be cube!
  [in] | dim | The size of one dimension of the map (assuming cube map).
  [in] | peakSize | The number of neighbouring points in single direction which should be considered as neighbours.
  [in] | noIQRs | The number of IQRs from the median to determine minimal peak height.
  [in] | eulA | Pointer to where the Euler alpha angle value will be saved.
  [in] | eulB | Pointer to where the Euler beta angle value will be saved.
  [in] | eulG | Pointer to where the Euler gamma angle value will be saved.

Definition at line 975 of file ProSHADE_peakSearch.cpp.

976 {
977 //================================================ Get all peaks
978 std::vector< proshade_double* > allPeaks = getAllPeaksSmoothedZ ( map, dim, smoothingFraction, noIQRs, peakSize );
979
980 //================================================ Find the highest peak from the list
981 proshade_double highestPeak = 0.0;
982 proshade_unsign highestPeakIndex = 0;
983 for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign>( allPeaks.size() ); iter++ )
984 {
985 if ( allPeaks.at(iter)[4] > highestPeak ) { highestPeak = allPeaks.at(iter)[4]; highestPeakIndex = iter; }
986 }
987
988 //================================================ Get Euler ZXZ from Angle-axis
989 proshade_double* rotMat = new proshade_double[9];
990 ProSHADE_internal_misc::checkMemoryAllocation ( rotMat, __FILE__, __LINE__, __func__ );
991 ProSHADE_internal_maths::getRotationMatrixFromAngleAxis ( rotMat, allPeaks.at(highestPeakIndex)[0], allPeaks.at(highestPeakIndex)[1], allPeaks.at(highestPeakIndex)[2], allPeaks.at(highestPeakIndex)[3] );
992 ProSHADE_internal_maths::getEulerZXZFromRotMatrix ( rotMat, eulA, eulB, eulG );
993
994 //================================================ Release memory
995 delete[] rotMat;
996 for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( allPeaks.size() ); iter++ )
997 {
998 delete[] allPeaks.at(iter);
999 }
1000
1001 //================================================ Done
1002 return ;
1003
1004 }

## ◆ getSmoothedZScore1D()

void ProSHADE_internal_peakSearch::getSmoothedZScore1D | ( | proshade_unsign | dim,
|  | proshade_unsign | smoothingLag,
|  | proshade_double | ZScoreThreshold,
|  | proshade_signed * | signals,
|  | proshade_double * | filteredY,
|  | proshade_double * | avgFilter,
|  | proshade_double * | stdFilter,
|  | proshade_double * | subVec,
|  | proshade_double * | medianIQR,
|  | proshade_double * | scoreOverVals
| ) |  |

This function computes the 1D peaks for a 1D input array and returns array of int's as signal.

This function implements the smoothed Z score peak searching algorithm. It takes a number of previous values (assuming periodicity) and computes the median and IQR. It then checks if the current value is X IQR's from the median and reports peak if so. In this case, it also saves the value with decreased weight to make sure the sliding window for following indices will not have too high values due to previous peaks. If no peak is found, it saves the value as is. Finally, the function pre- computes the median and IQR for the next index and iterates.

Parameters

  [in] | dim | The size of one dimension of the map (assuming cube map).
  [in] | smoothingLag | The size of the smoothing window.
  [in] | ZScoreThreshold | The number of IQRs from median forming a peak.
  [in] | signals | Pointer to where the results of the 1D peak searches will be saved.
  [in] | filteredY | Pointer to where the weighted smoothed scores will be saved.
  [in] | avgFilter | Pointer to where the median values will be saved.
  [in] | stdFilter | Pointer to where the IQR values will be saved.
  [in] | subVec | Pointer to where temporary computations will be done.
  [in] | medianIQR | Pointer to simple array of 2 for returning results.
  [in] | scoreOverVals | Pointer to where the 1D cuts from the 3D map live.

Definition at line 500 of file ProSHADE_peakSearch.cpp.

501 {
502 //================================================ Re-set the run
503 for ( proshade_unsign i = 0; i < dim; i++ ) { signals[i] = 0; avgFilter[i] = 0.0; stdFilter[i] = 0.0; filteredY[i] = 0.0; }
504 for ( proshade_unsign i = 0; i < smoothingLag; i++ ) { subVec[i] = scoreOverVals[i-smoothingLag+dim]; }
505 ProSHADE_internal_maths::arrayMedianAndIQR ( subVec, smoothingLag, medianIQR );
506 avgFilter[0] = medianIQR[0];
507 stdFilter[0] = medianIQR[1];
508
509 //================================================ Find peaks for 1D array
510 for ( proshade_unsign i = 0; i < dim; i++)
511 {
512 //============================================ Is this peak?
513 if ( std::abs ( scoreOverVals[i] - avgFilter[i]) > ZScoreThreshold * stdFilter[i] )
514 {
515 if ( scoreOverVals[i] > avgFilter[i] )
516 {
517 signals[i] = 1;
518 }
519 else
520 {
521 signals[i] = -1;
522 }
523
524 //======================================== Decrease influence for this window
525 if ( i != 0 ) { filteredY[i] = 0.5 * scoreOverVals[i] + (1 - 0.5) * filteredY[i - 1]; }
526 else { filteredY[i] = 0.5 * scoreOverVals[i]; }
527 }
528 else
529 {
530 signals[i] = 0;
531 filteredY[i] = scoreOverVals[i];
532 }
533
534 //============================================ Filters adjustments
535 for ( proshade_signed subIt = 0; subIt < static_cast<proshade_signed> ( smoothingLag ); subIt++ )
536 {
537 if ( ( static_cast<proshade_signed>(i) + static_cast<proshade_signed>(subIt) - static_cast<proshade_signed>(smoothingLag) + 1 ) < 0 )
538 {
539 subVec[subIt] = scoreOverVals[( static_cast<proshade_signed>(i) + static_cast<proshade_signed>(subIt) -
540 static_cast<proshade_signed>(smoothingLag) + 1 ) + dim];
541 }
542 else
543 {
544 subVec[subIt] = filteredY[( static_cast<proshade_signed>(i) + static_cast<proshade_signed>(subIt) -
545 static_cast<proshade_signed>(smoothingLag) + 1 )];
546 }
547 }
548 ProSHADE_internal_maths::arrayMedianAndIQR ( subVec, smoothingLag, medianIQR );
549 avgFilter[i+1] = medianIQR[0];
550 stdFilter[i+1] = medianIQR[1];
551 }
552
553 //================================================ Done
554 return ;
555
556 }

## ◆ getXAxisArraysSmoothedZScorePeaks()

void ProSHADE_internal_peakSearch::getXAxisArraysSmoothedZScorePeaks | ( | proshade_unsign | dim,
|  | proshade_unsign | smoothingLag,
|  | proshade_double | ZScoreThreshold,
|  | proshade_signed * | signals,
|  | proshade_double * | filteredY,
|  | proshade_double * | avgFilter,
|  | proshade_double * | stdFilter,
|  | proshade_double * | subVec,
|  | proshade_double * | medianIQR,
|  | proshade_double * | scoreOverVals,
|  | proshade_complex * | map,
|  | proshade_double * | YZMap
| ) |  |

This function runs the 1D smoothed Z score algorithm on all X-axis arrays as its inputs.

This function iterates through all YZ map positions and at each, takes all the X values and subjects them to the 1D smoothed Z score peak search. It also saves the resulting signals into a map, which therefore contains all the X-axis peaks of the map.

Parameters

  [in] | dim | The size of one dimension of the map (assuming cube map).
  [in] | smoothingLag | The size of the smoothing window.
  [in] | ZScoreThreshold | The number of IQRs from median forming a peak.
  [in] | signals | Pointer to where the results of the 1D peak searches will be saved.
  [in] | filteredY | Pointer to where the weighted smoothed scores will be saved.
  [in] | avgFilter | Pointer to where the median values will be saved.
  [in] | stdFilter | Pointer to where the IQR values will be saved.
  [in] | subVec | Pointer to where temporary computations will be done.
  [in] | medianIQR | Pointer to simple array of 2 for returning results.
  [in] | scoreOverVals | Pointer to where the 1D cuts from the 3D map live.
  [in] | map | The map in which the peaks are to be found.
  [in] | YZMap | The map where the results will be saved.

Definition at line 577 of file ProSHADE_peakSearch.cpp.

578 {
579 //================================================ For each YZ point
580 for ( proshade_unsign yIt = 0; yIt < dim; yIt++ )
581 {
582 for ( proshade_unsign zIt = 0; zIt < dim; zIt++ )
583 {
584 //======================================== Get all X values for this YZ position
585 for ( proshade_unsign xIt = 0; xIt < dim; xIt++ )
586 {
587 scoreOverVals[xIt] = pow ( map[xIt * static_cast<proshade_unsign>(4 * pow ( ( dim / 2 ), 2 )) + yIt * dim + zIt][0], 2.0 ) +
588 pow ( map[xIt * static_cast<proshade_unsign>(4 * pow ( ( dim / 2 ), 2 )) + yIt * dim + zIt][1], 2.0 );
589 }
590
591 //======================================== Run 1D smoothed Z score algorithm
592 getSmoothedZScore1D ( dim, smoothingLag, ZScoreThreshold, signals, filteredY, avgFilter, stdFilter, subVec, medianIQR, scoreOverVals );
593
594 //======================================== Save signals to YZMap
595 for ( proshade_unsign xIt = 0; xIt < dim; xIt++ )
596 {
597 YZMap[xIt * static_cast<proshade_unsign> (4 * pow ( ( dim / 2 ), 2 )) + yIt * dim + zIt] = signals[xIt];
598 }
599 }
600 }
601
602 //================================================ Done
603 return ;
604
605 }

## ◆ getYAxisArraysSmoothedZScorePeaks()

void ProSHADE_internal_peakSearch::getYAxisArraysSmoothedZScorePeaks | ( | proshade_unsign | dim,
|  | proshade_unsign | smoothingLag,
|  | proshade_double | ZScoreThreshold,
|  | proshade_signed * | signals,
|  | proshade_double * | filteredY,
|  | proshade_double * | avgFilter,
|  | proshade_double * | stdFilter,
|  | proshade_double * | subVec,
|  | proshade_double * | medianIQR,
|  | proshade_double * | scoreOverVals,
|  | proshade_complex * | map,
|  | proshade_double * | XZMap
| ) |  |

This function runs the 1D smoothed Z score algorithm on all Y-axis arrays as its inputs.

This function iterates through all YZ map positions and at each, takes all the Y values and subjects them to the 1D smoothed Z score peak search. It also saves the resulting signals into a map, which therefore contains all the Y-axis peaks of the map.

Parameters

  [in] | dim | The size of one dimension of the map (assuming cube map).
  [in] | smoothingLag | The size of the smoothing window.
  [in] | ZScoreThreshold | The number of IQRs from median forming a peak.
  [in] | signals | Pointer to where the results of the 1D peak searches will be saved.
  [in] | filteredY | Pointer to where the weighted smoothed scores will be saved.
  [in] | avgFilter | Pointer to where the median values will be saved.
  [in] | stdFilter | Pointer to where the IQR values will be saved.
  [in] | subVec | Pointer to where temporary computations will be done.
  [in] | medianIQR | Pointer to simple array of 2 for returning results.
  [in] | scoreOverVals | Pointer to where the 1D cuts from the 3D map live.
  [in] | map | The map in which the peaks are to be found.
  [in] | XZMap | The map where the results will be saved.

Definition at line 626 of file ProSHADE_peakSearch.cpp.

627 {
628 //================================================ For each XZ point
629 for ( proshade_unsign xIt = 0; xIt < dim; xIt++ )
630 {
631 for ( proshade_unsign zIt = 0; zIt < dim; zIt++ )
632 {
633 //======================================== Get all Y values for this XZ position
634 for ( proshade_unsign yIt = 0; yIt < dim; yIt++ )
635 {
636 scoreOverVals[yIt] = pow ( map[xIt * static_cast<proshade_unsign>(4 * pow ( ( dim / 2 ), 2 )) + yIt * dim + zIt][0], 2.0 ) +
637 pow ( map[xIt * static_cast<proshade_unsign>(4 * pow ( ( dim / 2 ), 2 )) + yIt * dim + zIt][1], 2.0 );
638 }
639
640 //======================================== Run 1D smoothed Z score algorithm
641 getSmoothedZScore1D ( dim, smoothingLag, ZScoreThreshold, signals, filteredY, avgFilter, stdFilter, subVec, medianIQR, scoreOverVals );
642
643 //======================================== Save signals to YZMap
644 for ( proshade_unsign yIt = 0; yIt < dim; yIt++ )
645 {
646 XZMap[xIt * static_cast<proshade_unsign> (4 * pow ( ( dim / 2 ), 2 )) + yIt * dim + zIt] = signals[xIt];
647 }
648 }
649 }
650
651 //================================================ Done
652 return ;
653
654 }

## ◆ getZAxisArraysSmoothedZScorePeaks()

void ProSHADE_internal_peakSearch::getZAxisArraysSmoothedZScorePeaks | ( | proshade_unsign | dim,
|  | proshade_unsign | smoothingLag,
|  | proshade_double | ZScoreThreshold,
|  | proshade_signed * | signals,
|  | proshade_double * | filteredY,
|  | proshade_double * | avgFilter,
|  | proshade_double * | stdFilter,
|  | proshade_double * | subVec,
|  | proshade_double * | medianIQR,
|  | proshade_double * | scoreOverVals,
|  | proshade_complex * | map,
|  | proshade_double * | XYMap
| ) |  |

This function runs the 1D smoothed Z score algorithm on all Z-axis arrays as its inputs.

This function iterates through all XY map positions and at each, takes all the Z values and subjects them to the 1D smoothed Z score peak search. It also saves the resulting signals into a map, which therefore contains all the Z-axis peaks of the map.

Parameters

  [in] | dim | The size of one dimension of the map (assuming cube map).
  [in] | smoothingLag | The size of the smoothing window.
  [in] | ZScoreThreshold | The number of IQRs from median forming a peak.
  [in] | signals | Pointer to where the results of the 1D peak searches will be saved.
  [in] | filteredY | Pointer to where the weighted smoothed scores will be saved.
  [in] | avgFilter | Pointer to where the median values will be saved.
  [in] | stdFilter | Pointer to where the IQR values will be saved.
  [in] | subVec | Pointer to where temporary computations will be done.
  [in] | medianIQR | Pointer to simple array of 2 for returning results.
  [in] | scoreOverVals | Pointer to where the 1D cuts from the 3D map live.
  [in] | map | The map in which the peaks are to be found.
  [in] | XYMap | The map where the results will be saved.

Definition at line 675 of file ProSHADE_peakSearch.cpp.

676 {
677 //================================================ For each XZ point
678 for ( proshade_unsign xIt = 0; xIt < dim; xIt++ )
679 {
680 for ( proshade_unsign yIt = 0; yIt < dim; yIt++ )
681 {
682 //======================================== Get all Y values for this XZ position
683 for ( proshade_unsign zIt = 0; zIt < dim; zIt++ )
684 {
685 scoreOverVals[yIt] = pow ( map[xIt * static_cast<proshade_unsign>(4 * pow ( ( dim / 2 ), 2 )) + yIt * dim + zIt][0], 2.0 ) +
686 pow ( map[xIt * static_cast<proshade_unsign>(4 * pow ( ( dim / 2 ), 2 )) + yIt * dim + zIt][1], 2.0 );
687 }
688
689 //======================================== Run 1D smoothed Z score algorithm
690 getSmoothedZScore1D ( dim, smoothingLag, ZScoreThreshold, signals, filteredY, avgFilter, stdFilter, subVec, medianIQR, scoreOverVals );
691
692 //======================================== Save signals to YZMap
693 for ( proshade_unsign zIt = 0; zIt < dim; zIt++ )
694 {
695 XYMap[xIt * static_cast<proshade_unsign> (4 * pow ( ( dim / 2 ), 2 )) + yIt * dim + zIt] = signals[xIt];
696 }
697 }
698 }
699
700 //================================================ Done
701 return ;
702
703 }

## ◆ optimisePeakPositions()

void ProSHADE_internal_peakSearch::optimisePeakPositions | ( | std::vector< proshade_double * > * | pointVec,
|  | proshade_signed | peakSize,
|  | proshade_signed | band
| ) |  |

This function optimises all the peaks in the input vector using the values of their neighbours.

This function takes the vector of arrays containing the peak and all its neighbours and proceeds to obtain the rotation matrices for the peak and all its neighbours. It then computes the weighted average matrix from the combination of all the matrices. By subjecting this weighted average matrix to SVD (using LAPACK) and combining the two rotation matrices (U and V^T), the optimised rotation matrix is obtained. This rotation matrix is then converted to Euler angles representation and these values are finally saved over the old all neighbours containing pointers. Thus, the number of peaks does not change, but each peak now only has 4 values - alpha, beta, gamma and peak height.

Parameters

  [in] | pointVec | Vector of double pointers as returned by pointsAboveNeighboursRemoveSmallHeight().
  [in] | peakSize | The number of neighbouring points in single direction which should be considered as neighbours.
  [in] | band | The maximum bandwidth of the computation.

Definition at line 221 of file ProSHADE_peakSearch.cpp.

222 {
223 //================================================ Initialise local variables
224 proshade_double *avgMat, *hlpMat, *eulA, *eulB, *eulG, *uAndV;
225 proshade_unsign noPoints = pow( ( ( peakSize * 2 ) + 1 ), 3 ) * 4;
226 proshade_double matWeight;
227
228 //================================================ Allocate the required memory
229 allocatePeakOptimisationMemory ( avgMat, hlpMat, eulA, eulB, eulG, uAndV );
230
231 //================================================ For each peak
232 for ( proshade_unsign iter = 0; iter < static_cast<proshade_unsign> ( pointVec->size() ); iter++ )
233 {
234 //============================================ Re-set loop
235 for ( proshade_unsign i = 0; i < 9; i++ ) { avgMat[i] = 0.0; }
236 matWeight = 0.0;
237
238 //============================================ For each neighbout and the point itself
239 for ( proshade_unsign it = 0; it < noPoints; it += 4 )
240 {
241 //======================================== Get the Euler angles
242 ProSHADE_internal_maths::getEulerZXZFromSOFTPosition ( band, pointVec->at(iter)[it+0], pointVec->at(iter)[it+1], pointVec->at(iter)[it+2], eulA, eulB, eulG );
243
244 //======================================== Convert Euler angles to rotation matrix
245 ProSHADE_internal_maths::getRotationMatrixFromEulerZXZAngles ( *eulA, *eulB, *eulG, hlpMat );
246
247 //======================================== Add the matrix to the sum
248 for ( proshade_unsign i = 0; i < 9; i++ ) { avgMat[i] += hlpMat[i] * pointVec->at(iter)[it+3]; }
249
250 //======================================== Find matrix weight
251 matWeight += pointVec->at(iter)[it+3];
252 }
253
254 //============================================ Normalise weighted sum matrix by sum of weights
255 for ( proshade_unsign i = 0; i < 9; i++ ) { avgMat[i] /= matWeight; }
256
257 //============================================ Decompose the average matrix using SVD
258 ProSHADE_internal_maths::complexMatrixSVDUandVOnly ( avgMat, 3, uAndV, false );
259 if ( uAndV[0] == -777.7 )
260 {
261 //======================================== SVD Failed. Just use the central value
262 ProSHADE_internal_maths::getEulerZXZFromSOFTPosition ( band, pointVec->at(iter)[0], pointVec->at(iter)[1], pointVec->at(iter)[2], eulA, eulB, eulG );
263 matWeight = pointVec->at(iter)[3];
264 pointVec->at(iter) = new proshade_double [4];
265 ProSHADE_internal_misc::checkMemoryAllocation ( pointVec->at(iter), __FILE__, __LINE__, __func__ );
266 pointVec->at(iter)[0] = *eulA;
267 pointVec->at(iter)[1] = *eulB;
268 pointVec->at(iter)[2] = *eulG;
269 pointVec->at(iter)[3] = matWeight;
270
271 continue ;
272 }
273
274 //============================================ SVD Succeeded. Compute U * V^T
275 for ( proshade_unsign i = 0; i < 9; i++ ) { avgMat[i] = 0.0; }
276 ProSHADE_internal_maths::multiplyTwoSquareMatrices ( uAndV, uAndV+9, avgMat, 3 );
277
278 //============================================ Convert to Euler
279 ProSHADE_internal_maths::getEulerZXZFromRotMatrix ( avgMat, eulA, eulB, eulG );
280
281 //============================================ Save over input
282 matWeight = pointVec->at(iter)[3];
283 delete[] pointVec->at(iter);
284 pointVec->at(iter) = new proshade_double [4];
285 ProSHADE_internal_misc::checkMemoryAllocation ( pointVec->at(iter), __FILE__, __LINE__, __func__ );
286 pointVec->at(iter)[0] = *eulA;
287 pointVec->at(iter)[1] = *eulB;
288 pointVec->at(iter)[2] = *eulG;
289 pointVec->at(iter)[3] = matWeight;
290 }
291
292 //================================================ Release memory
293 releasePeakOptimisationMemory ( avgMat, hlpMat, eulA, eulB, eulG, uAndV );
294
295 //================================================ Done
296 return ;
297
298 }

## ◆ pointsAboveNeighboursRemoveSmallHeight()

void ProSHADE_internal_peakSearch::pointsAboveNeighboursRemoveSmallHeight | ( | std::vector< proshade_double * > * | pointVec,
|  | proshade_double * | medianIQR,
|  | proshade_double | noIQRs
| ) |  |

This function clears the 'higher than neighbour' vector from background values.

This function simply takes all the 'higher than all neighbours' indices vector and a threshold defining values and proceeds to compute the threshold for calling the indice a peak. Then, it applies this threshold to the vector, keeping only the indices which have higher value than the threshold.

Parameters

  [in] | pointVec | Vector of double pointers as returned by findAllPointsAboveNeighbours().
  [in] | medianIQR | Array of two numbers, the median and IQR for which should be used to remove 'background' points in the vector.
  [in] | noIQRs | The number of IQRs from median to be used to create the cut-off threshold.

Definition at line 132 of file ProSHADE_peakSearch.cpp.

133 {
134 //================================================ Determine the threshold
135 proshade_double backgroundThreshold = std::min ( std::max ( medianIQR[0] + ( medianIQR[1] * noIQRs ), 0.05 ), 0.3 );
136
137 //================================================ Check for passing the threshold
138 for ( proshade_signed iter = static_cast<proshade_signed> ( pointVec->size()-1 ); iter >= 0 ; iter-- )
139 {
140 if ( pointVec->at(iter)[3] <= backgroundThreshold )
141 {
142 delete[] pointVec->at(iter);
143 pointVec->erase ( pointVec->begin() + iter );
144 }
145 }
146
147 //================================================ Done
148 return ;
149
150 }

## ◆ releasePeakOptimisationMemory()

void ProSHADE_internal_peakSearch::releasePeakOptimisationMemory | ( | proshade_double *& | avgMat,
|  | proshade_double *& | hlpMat,
|  | proshade_double *& | eA,
|  | proshade_double *& | eB,
|  | proshade_double *& | eG,
|  | proshade_double *& | uAV
| ) |  |

This function deletes all the peak optimisation memory.

Parameters

  [in] | avgMat | The matrix which will take the weighted sum of the neighbour values.
  [in] | hlpMat | The helper matrix to store temporary results.
  [in] | eA | The Euler angle alpha value.
  [in] | eB | The Euler beta alpha value.
  [in] | eG | The Euler gamma alpha value.
  [in] | uAV | The U and V^T matrices resulting from the SVD.

Definition at line 193 of file ProSHADE_peakSearch.cpp.

194 {
195 //================================================ Release the memory
196 delete[] avgMat;
197 delete[] hlpMat;
198 delete[] eA;
199 delete[] eB;
200 delete[] eG;
201 delete[] uAV;
202
203 //================================================ Done
204 return ;
205
206 }

## ◆ releaseSmoothingZScoreMemory()

void ProSHADE_internal_peakSearch::releaseSmoothingZScoreMemory | ( | proshade_double *& | scoreOverVals,
|  | proshade_signed *& | signals,
|  | proshade_double *& | filteredY,
|  | proshade_double *& | avgFilter,
|  | proshade_double *& | stdFilter,
|  | proshade_double *& | subVec,
|  | proshade_double *& | medianIQR,
|  | proshade_double *& | YZMap,
|  | proshade_double *& | XZMap,
|  | proshade_double *& | XYMap
| ) |  |

This function releases the memory required for smoothed Z score computation.

Parameters

  [in] | scoreOverVals | Pointer to where the 1D cuts from the 3D map will be saved.
  [in] | signals | Pointer to where the results of the 1D peak searches will be saved.
  [in] | filteredY | Pointer to where the weighted smoothed scores will be saved.
  [in] | avgFilter | Pointer to where the median values will be saved.
  [in] | stdFilter | Pointer to where the IQR values will be saved.
  [in] | subVec | Pointer to where temporary computations will be done.
  [in] | medianIQR | Pointer to simple array of 2 for returning results.
  [in] | YZMap | Pointer to where the X-axis peaks will be saved.
  [in] | XZMap | Pointer to where the Y-axis peaks will be saved.
  [in] | XYMap | Pointer to where the Z-axis peaks will be saved.

Definition at line 462 of file ProSHADE_peakSearch.cpp.

463 {
464 //================================================ Release the memory
465 delete[] scoreOverVals;
466 delete[] signals;
467 delete[] filteredY;
468 delete[] avgFilter;
469 delete[] stdFilter;
470 delete[] subVec;
471 delete[] medianIQR;
472 delete[] YZMap;
473 delete[] XZMap;
474 delete[] XYMap;
475
476 //================================================ Done
477 return ;
478
479 }
ProSHADE_settings::noIQRsFromMedianNaivePeak
proshade_double noIQRsFromMedianNaivePeak
When doing peak searching, how many IQRs from the median the threshold for peak height should be (in ...
Definition: ProSHADE_settings.hpp:165
ProSHADE_internal_peakSearch::releaseSmoothingZScoreMemory
void releaseSmoothingZScoreMemory(proshade_double *&scoreOverVals, proshade_signed *&signals, proshade_double *&filteredY, proshade_double *&avgFilter, proshade_double *&stdFilter, proshade_double *&subVec, proshade_double *&medianIQR, proshade_double *&YZMap, proshade_double *&XZMap, proshade_double *&XYMap)
This function releases the memory required for smoothed Z score computation.
Definition: ProSHADE_peakSearch.cpp:462
ProSHADE_internal_misc::addToDblPtrVector
void addToDblPtrVector(std::vector< proshade_double * > *vecToAddTo, proshade_double *elementToAdd)
Adds the element to the vector.
Definition: ProSHADE_misc.cpp:143
ProSHADE_internal_peakSearch::getSmoothedZScore1D
void getSmoothedZScore1D(proshade_unsign dim, proshade_unsign smoothingLag, proshade_double ZScoreThreshold, proshade_signed *signals, proshade_double *filteredY, proshade_double *avgFilter, proshade_double *stdFilter, proshade_double *subVec, proshade_double *medianIQR, proshade_double *scoreOverVals)
This function computes the 1D peaks for a 1D input array and returns array of int's as signal.
Definition: ProSHADE_peakSearch.cpp:500
ProSHADE_internal_maths::getEulerZXZFromRotMatrix
void getEulerZXZFromRotMatrix(proshade_double *rotMat, proshade_double *eA, proshade_double *eB, proshade_double *eG)
This function converts rotation matrix to the Euler ZXZ angles representation.
Definition: ProSHADE_maths.cpp:1394
ProSHADE_internal_peakSearch::getAllPeaksNaive
std::vector< proshade_double * > getAllPeaksNaive(proshade_complex *map, proshade_unsign dim, proshade_signed peakSize, proshade_double noIQRs)
This function finds peaks in the 3D map using the "naive" approach.
Definition: ProSHADE_peakSearch.cpp:315
ProSHADE_internal_peakSearch::getAllPeaksSmoothedZ
std::vector< proshade_double * > getAllPeaksSmoothedZ(proshade_complex *map, proshade_unsign dim, proshade_double smoothingFraction, proshade_double noIQRs, proshade_signed peakSize)
This function finds peaks in the 3D map using the smoothed Z score approach.
Definition: ProSHADE_peakSearch.cpp:922
ProSHADE_internal_maths::getRotationMatrixFromEulerZXZAngles
void getRotationMatrixFromEulerZXZAngles(proshade_double eulerAlpha, proshade_double eulerBeta, proshade_double eulerGamma, proshade_double *matrix)
Function to find the rotation matrix from Euler angles (ZXZ convention).
Definition: ProSHADE_maths.cpp:1005
ProSHADE_internal_peakSearch::getYAxisArraysSmoothedZScorePeaks
void getYAxisArraysSmoothedZScorePeaks(proshade_unsign dim, proshade_unsign smoothingLag, proshade_double ZScoreThreshold, proshade_signed *signals, proshade_double *filteredY, proshade_double *avgFilter, proshade_double *stdFilter, proshade_double *subVec, proshade_double *medianIQR, proshade_double *scoreOverVals, proshade_complex *map, proshade_double *XZMap)
This function runs the 1D smoothed Z score algorithm on all Y-axis arrays as its inputs.
Definition: ProSHADE_peakSearch.cpp:626
ProSHADE_internal_peakSearch::findAllPointNeighbours
void findAllPointNeighbours(proshade_double *YZMap, proshade_double *XZMap, proshade_double *XYMap, proshade_unsign *visitedMap, proshade_signed dim, proshade_signed x, proshade_signed y, proshade_signed z, std::vector< proshade_unsign > *retVals)
This is a support function for the Z-score peak detection. It is currently not being used.
Definition: ProSHADE_peakSearch.cpp:720
ProSHADE_internal_peakSearch::allocatePeakOptimisationMemory
void allocatePeakOptimisationMemory(proshade_double *&avgMat, proshade_double *&hlpMap, proshade_double *&eA, proshade_double *&eB, proshade_double *&eG, proshade_double *&uAV)
This function allocates and checks all the peak optimisation memory.
Definition: ProSHADE_peakSearch.cpp:161
ProSHADE_settings::verbose
proshade_signed verbose
Should the software report on the progress, or just be quiet? Value between -1 (nothing) and 4 (loud)
Definition: ProSHADE_settings.hpp:188
ProSHADE_internal_misc::addToDoubleVector
void addToDoubleVector(std::vector< proshade_double > *vecToAddTo, proshade_double elementToAdd)
Adds the element to the vector.
Definition: ProSHADE_misc.cpp:77
ProSHADE_internal_peakSearch::pointsAboveNeighboursRemoveSmallHeight
void pointsAboveNeighboursRemoveSmallHeight(std::vector< proshade_double * > *pointVec, proshade_double *medianIQR, proshade_double noIQRs)
This function clears the 'higher than neighbour' vector from background values.
Definition: ProSHADE_peakSearch.cpp:132
ProSHADE_internal_peakSearch::findAllSmoothedZScorePeaksWithNeighbours
void findAllSmoothedZScorePeaksWithNeighbours(proshade_complex *map, proshade_double *YZMap, proshade_double *XZMap, proshade_double *XYMap, proshade_signed dim, proshade_signed peakSize, std::vector< proshade_double * > *allPeaksWithNeighbours)
This function firstly determines the highest peak of all smoothed Z score islands and then returns th...
Definition: ProSHADE_peakSearch.cpp:853
ProSHADE_internal_peakSearch::getXAxisArraysSmoothedZScorePeaks
void getXAxisArraysSmoothedZScorePeaks(proshade_unsign dim, proshade_unsign smoothingLag, proshade_double ZScoreThreshold, proshade_signed *signals, proshade_double *filteredY, proshade_double *avgFilter, proshade_double *stdFilter, proshade_double *subVec, proshade_double *medianIQR, proshade_double *scoreOverVals, proshade_complex *map, proshade_double *YZMap)
This function runs the 1D smoothed Z score algorithm on all X-axis arrays as its inputs.
Definition: ProSHADE_peakSearch.cpp:577
ProSHADE_internal_maths::getRotationMatrixFromAngleAxis
void getRotationMatrixFromAngleAxis(proshade_double *rotMat, proshade_double x, proshade_double y, proshade_double z, proshade_double ang)
This function converts the axis-angle representation to the rotation matrix representation.
Definition: ProSHADE_maths.cpp:1343
ProSHADE_internal_peakSearch::getZAxisArraysSmoothedZScorePeaks
void getZAxisArraysSmoothedZScorePeaks(proshade_unsign dim, proshade_unsign smoothingLag, proshade_double ZScoreThreshold, proshade_signed *signals, proshade_double *filteredY, proshade_double *avgFilter, proshade_double *stdFilter, proshade_double *subVec, proshade_double *medianIQR, proshade_double *scoreOverVals, proshade_complex *map, proshade_double *XYMap)
This function runs the 1D smoothed Z score algorithm on all Z-axis arrays as its inputs.
Definition: ProSHADE_peakSearch.cpp:675
ProSHADE_settings::peakNeighbours
proshade_unsign peakNeighbours
Number of points in any direction that have to be lower than the considered index in order to conside...
Definition: ProSHADE_settings.hpp:164
ProSHADE_internal_misc::checkMemoryAllocation
void checkMemoryAllocation(chVar checkVar, std::string fileP, unsigned int lineP, std::string funcP, std::string infoP="This error may occurs when ProSHADE requests memory to be\n : allocated to it and this operation fails. This could\n : happen when not enough memory is available, either due to\n : other processes using a lot of memory, or when the machine\n : does not have sufficient memory available. Re-run to see\n : if this problem persists.")
Checks if memory was allocated properly.
Definition: ProSHADE_misc.hpp:65
ProSHADE_internal_maths::getEulerZXZFromSOFTPosition
void getEulerZXZFromSOFTPosition(proshade_signed band, proshade_signed x, proshade_signed y, proshade_signed z, proshade_double *eulerAlpha, proshade_double *eulerBeta, proshade_double *eulerGamma)
Function to find Euler angles (ZXZ convention) from index position in the inverse SOFT map.
Definition: ProSHADE_maths.cpp:961
ProSHADE_internal_peakSearch::optimisePeakPositions
void optimisePeakPositions(std::vector< proshade_double * > *pointVec, proshade_signed peakSize, proshade_signed band)
This function optimises all the peaks in the input vector using the values of their neighbours.
Definition: ProSHADE_peakSearch.cpp:221
ProSHADE_internal_maths::vectorMedianAndIQR
void vectorMedianAndIQR(std::vector< proshade_double > *vec, proshade_double *&ret)
Function to get vector median and inter-quartile range.
Definition: ProSHADE_maths.cpp:147
ProSHADE_internal_misc::addToUnsignVector
void addToUnsignVector(std::vector< proshade_unsign > *vecToAddTo, proshade_unsign elementToAdd)
Adds the element to the vector.
Definition: ProSHADE_misc.cpp:99
ProSHADE_internal_peakSearch::releasePeakOptimisationMemory
void releasePeakOptimisationMemory(proshade_double *&avgMat, proshade_double *&hlpMap, proshade_double *&eA, proshade_double *&eB, proshade_double *&eG, proshade_double *&uAV)
This function deletes all the peak optimisation memory.
Definition: ProSHADE_peakSearch.cpp:193
ProSHADE_internal_peakSearch::allocateSmoothingZScoreMemory
void allocateSmoothingZScoreMemory(proshade_unsign dim, proshade_double *&scoreOverVals, proshade_signed *&signals, proshade_double *&filteredY, proshade_double *&avgFilter, proshade_double *&stdFilter, proshade_double *&subVec, proshade_double *&medianIQR, proshade_double *&YZMap, proshade_double *&XZMap, proshade_double *&XYMap, proshade_unsign smLag)
This function allocates the memory required for smoothed Z score computation.
Definition: ProSHADE_peakSearch.cpp:418
ProSHADE_internal_peakSearch::findAllDisconnectedIslands
void findAllDisconnectedIslands(proshade_complex *map, proshade_double *YZMap, proshade_double *XZMap, proshade_double *XYMap, proshade_unsign dim, std::vector< proshade_unsign > *allIslandBests)
This function combines the three Z score maps, locates individual islands and returns a vector of hig...
Definition: ProSHADE_peakSearch.cpp:778
ProSHADE_internal_maths::multiplyTwoSquareMatrices
void multiplyTwoSquareMatrices(proshade_double *A, proshade_double *B, proshade_double *res, proshade_unsign dim=3)
Function to compute matrix multiplication.
Definition: ProSHADE_maths.cpp:1613
ProSHADE_internal_peakSearch::findAllPointsAboveNeighbours
std::vector< proshade_double * > findAllPointsAboveNeighbours(proshade_complex *map, proshade_unsign dim, proshade_signed peakSize, proshade_double *medianIQR)
This function finds all indices with higher value then all neighbours.
Definition: ProSHADE_peakSearch.cpp:38
ProSHADE_internal_messages::printProgressMessage
void printProgressMessage(proshade_signed verbose, proshade_signed messageLevel, std::string message)
General stdout message printing.
Definition: ProSHADE_messages.cpp:70
ProSHADE_internal_maths::complexMatrixSVDUandVOnly
void complexMatrixSVDUandVOnly(proshade_double *mat, int dim, proshade_double *uAndV, bool fail=true)
Function to compute the real matrix SVD and return the U and V matrices.
Definition: ProSHADE_maths.cpp:869
ProSHADE_internal_maths::arrayMedianAndIQR
void arrayMedianAndIQR(proshade_double *vec, proshade_unsign vecSize, proshade_double *&ret)
Function to get array median and inter-quartile range.
Definition: ProSHADE_maths.cpp:198