Localiser
Class MLGridBearingLocaliser

java.lang.Object
  extended by Localiser.MLGridBearingLocaliser
All Implemented Interfaces:
BearingLocaliser

public class MLGridBearingLocaliser
extends java.lang.Object
implements BearingLocaliser

Maximum likelihood bearing localiser to get bearings from a closely spaced hydrophone array.

Author:
Doug Gillespie.

Field Summary
private  PamVector[] arrayAxis
           
private  int arrayType
           
private  int[][] crawlPairs
           
private  PamArray currentArray
           
private  double[][][] delayErrorGrid
           
private  double[][][] delayGrid
           
private  boolean firstGrid
           
(package private)  double[][] likelihoodLUT
           
private  int nPairs
           
private  int nPhiBins
           
private  int nPhones
           
private  int nThetaBins
           
private  int[] pairBearingLocaliserPairs
           
private  PairBearingLocaliser[] pairBearingLocalisers
           
private  double[] phiRange
           
private  double phiStep
           
private  int[] phoneNumbers
           
private  int[][] phonePairs
           
(package private)  int[][] simplex
           
private  double speedOfSound
           
private  double speedOfSoundError
           
private  double[] thetaRange
           
private  double thetaStep
           
private  double timingError
           
 
Constructor Summary
MLGridBearingLocaliser(int[] hydrophoneList, double timingError)
           
MLGridBearingLocaliser(int hydrophoneBitMap, double timingError)
           
 
Method Summary
private  int findPairLocaliser(PamVector pamVector)
          Find a pair of phones which line up well with pamVector and return a pair localiser made from them .
private  double[][] fullGridSearch(double[] delays)
           
 PamVector[] getArrayAxis()
          Get the principle axis of the array
 int getArrayType()
           
private  double getCurvature(double v1, double v2, double v3)
           
private  double[] getErrors(int thetaBin, int phiBin, double[] delays)
          Calculate the errors on theta and phi based on the curvature of the likelihood surface around the central bins
private  double getLLValue(int[] bins, double[] delays)
           
private  double getLLValue(int thetaBin, int phiBin, double[] delays)
           
private  void initialiseLLLut()
           
 double[][] localise(double[] delays)
          Calculate angles theta and phi, based on a set of delays.
 double[][] localiseByBisection(double[] delays)
           
 double[][] localiseByCrawl(double[] delays)
           
private  double[][] localiseBySimplex(double[] delays)
           
private  int phiAngleToBin(double phi)
          Convert an angle into a bin, constrained to 0 <= bin < nBins
private  double phiBintoAngle(double bin)
          Convert a bin into an angle.
 void prepare(int[] arrayElements, double timingError)
          Do any preparation necessary (e.g.
private  void prepare(int[] arrayElements, double timingError, double thetaStep, double phiStep)
           
private  int thetaAngleToBin(double theta)
          Convert an angle into a bin, constrained to 0 <= bin < nBins
private  double thetaBinToAngle(double bin)
          Convert a bin into an angle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nPhones

private int nPhones

nPairs

private int nPairs

phoneNumbers

private int[] phoneNumbers

arrayType

private int arrayType

arrayAxis

private PamVector[] arrayAxis

currentArray

private PamArray currentArray

speedOfSound

private double speedOfSound

speedOfSoundError

private double speedOfSoundError

delayGrid

private double[][][] delayGrid

delayErrorGrid

private double[][][] delayErrorGrid

phonePairs

private int[][] phonePairs

thetaRange

private double[] thetaRange

phiRange

private double[] phiRange

nThetaBins

private int nThetaBins

nPhiBins

private int nPhiBins

thetaStep

private double thetaStep

phiStep

private double phiStep

pairBearingLocalisers

private PairBearingLocaliser[] pairBearingLocalisers

pairBearingLocaliserPairs

private int[] pairBearingLocaliserPairs

timingError

private double timingError

simplex

int[][] simplex

likelihoodLUT

double[][] likelihoodLUT

crawlPairs

private int[][] crawlPairs

firstGrid

private boolean firstGrid
Constructor Detail

MLGridBearingLocaliser

public MLGridBearingLocaliser(int hydrophoneBitMap,
                              double timingError)

MLGridBearingLocaliser

public MLGridBearingLocaliser(int[] hydrophoneList,
                              double timingError)
Method Detail

prepare

public void prepare(int[] arrayElements,
                    double timingError)
Description copied from interface: BearingLocaliser
Do any preparation necessary (e.g. creation of look up tables)

Specified by:
prepare in interface BearingLocaliser
Parameters:
arrayElements - list of hydrophone array elements in the sub array for this localiser.
timingError - expected timing error for each measurement (typically 1/12 of an ADC bin, or less if interpolation is being used in the cross correlation function).

prepare

private void prepare(int[] arrayElements,
                     double timingError,
                     double thetaStep,
                     double phiStep)

findPairLocaliser

private int findPairLocaliser(PamVector pamVector)
Find a pair of phones which line up well with pamVector and return a pair localiser made from them .

Parameters:
pamVector -
Returns:

thetaBinToAngle

private double thetaBinToAngle(double bin)
Convert a bin into an angle.

Parameters:
bin - bin index
Returns:
angle

thetaAngleToBin

private int thetaAngleToBin(double theta)
Convert an angle into a bin, constrained to 0 <= bin < nBins

Parameters:
theta - angle
Returns:
bin

phiBintoAngle

private double phiBintoAngle(double bin)
Convert a bin into an angle.

Parameters:
bin - bin index
Returns:
angle

phiAngleToBin

private int phiAngleToBin(double phi)
Convert an angle into a bin, constrained to 0 <= bin < nBins

Parameters:
phi - angle
Returns:
bin

getArrayAxis

public PamVector[] getArrayAxis()
Description copied from interface: BearingLocaliser
Get the principle axis of the array

Specified by:
getArrayAxis in interface BearingLocaliser
Returns:
for a linear array this will be a vector along the array;

for a planar array, this will be the vector on the plane between two hydrophones which is closest to the y axis.


getArrayType

public int getArrayType()
Specified by:
getArrayType in interface BearingLocaliser
Returns:
the type of array - linear, planar, volumetric, etc.

localise

public double[][] localise(double[] delays)
Description copied from interface: BearingLocaliser
Calculate angles theta and phi, based on a set of delays. The number of delays should be equal to n(n-1)/2 where n is the number of hydrophone elements in the sub array.

Specified by:
localise in interface BearingLocaliser
Parameters:
delays - array of delay times.
Returns:
theta, phi and their estimated errors all in radians.

Data are packed into a two row array, the first row of which contains one or two angles, the second (optional) row contains the errors on those angles.


localiseBySimplex

private double[][] localiseBySimplex(double[] delays)

initialiseLLLut

private void initialiseLLLut()

getLLValue

private double getLLValue(int[] bins,
                          double[] delays)

getLLValue

private double getLLValue(int thetaBin,
                          int phiBin,
                          double[] delays)

getErrors

private double[] getErrors(int thetaBin,
                           int phiBin,
                           double[] delays)
Calculate the errors on theta and phi based on the curvature of the likelihood surface around the central bins

Parameters:
thetaBin - central theta bin
phiBin - central phi bin
Returns:
errors on theta and phi.

getCurvature

private double getCurvature(double v1,
                            double v2,
                            double v3)

localiseByCrawl

public double[][] localiseByCrawl(double[] delays)

fullGridSearch

private double[][] fullGridSearch(double[] delays)

localiseByBisection

public double[][] localiseByBisection(double[] delays)