public class PamUtils
extends java.lang.Object
Constructor and Description |
---|
PamUtils() |
Modifier and Type | Method and Description |
---|---|
static int |
calcHydrophoneNumber(int numberOfDelays)
For N synchronised hydrophones there are N*(N-1)/2 time delays.
|
static int |
calcTDNumber(int numberofHydrophones)
For N synchronised hydrophones there are N*(N-1)/2 time delays.
|
static double |
constrainedAngle(double angle)
Force an angle to sit 0<= angle < 360.
|
static double |
constrainedAngle(double angle,
double maxAngle)
Force an angle to sit within some range.
|
static double |
constrainedAngleR(double angle,
double maxAngle)
Force an angle to sit within some range.
|
static java.lang.Double |
doubleAverage(java.lang.Double d1,
java.lang.Double d2)
Return the average ot two double numbers, either or both of which may be null
|
static java.lang.String |
formatFrequency(double f)
Format a frequency in Hz as Hz, kHz, MHz, etc.
|
static double |
getAbsMax(double[] array)
Get the absolute maximum value of a double array
|
static int[] |
getChannelArray(int channelMap)
Turn a bitmap into an array of channel numbers.
|
static java.lang.String |
getChannelList(int channelMap)
Create a string of channel numbers in the channel
map separated by commas.
|
static int |
getChannelPos(int singleChannel,
int channelBitmap)
Works out the index of a particular channel in a channel list - often,
if channelBitmap is a set of continuous channels starting with 0, then
the channel pos is the same as the single channel number.
|
static int[] |
getChannelPositionLUT(int channelBitmap)
Create a LUT which allows conversion of absolute to relative channel numbers
|
static int |
getHighestChannel(int channelBitmap)
Get the highest channel number in a channel map.
|
static int |
getLowestChannel(int channelBitmap)
Get the lowest channel number in a channel map.
|
static double[] |
getMinAndMax(double[] array) |
static double[] |
getMinAndMax(double[][] array) |
static int |
getMinFftLength(long len) |
static int |
getNthChannel(int singleChannel,
int channelBitmap)
get's the number of the nth used channel in a bitmap.
|
static int |
getNumChannels(int channelBitmap) |
static int |
getSingleChannel(int channelMap)
check that the bits represent a single channel and return the number of
that channel
|
static int[] |
getSortedInds(int[] data)
Leave data alone, but create a list of indexes which will
give the ascending order of data.
|
static double |
linterp(double x0,
double x1,
double y0,
double y1,
double x)
Linear interpolation.
|
static int |
log2(int n)
Gets the next integer log of 2 which will
give 2^ans >= n, i.e.
|
static int |
makeChannelMap(int nChannels)
Make a simple bitmap for nChannels of data,
i.e.
|
static int |
makeChannelMap(int[] channelList)
Make a channel bitmap from a list.
|
static int |
makeChannelMap(int nChannels,
int[] channelList)
Deprecated.
|
static double |
roundNumber(double number,
double step) |
static int |
SetBit(int bitMap,
int bitNumber,
boolean bitSet) |
static int |
SetBit(int bitMap,
int bitNumber,
int bitValue) |
public static int getSingleChannel(int channelMap)
channelMap
- bitmap for multiple channelspublic static int getNumChannels(int channelBitmap)
public static int getChannelPos(int singleChannel, int channelBitmap)
singleChannel
- channelBitmap
- public static int getNthChannel(int singleChannel, int channelBitmap)
singleChannel
- nth channel in a listchannelBitmap
- bitmap of all used channels.public static int[] getChannelPositionLUT(int channelBitmap)
channelBitmap
- public static int getHighestChannel(int channelBitmap)
channelBitmap
- public static int getLowestChannel(int channelBitmap)
channelBitmap
- public static int makeChannelMap(int nChannels)
if nChannels = 1, map = 1
if nChannels = 2, map = 3
if nChannels = 3, map = 7
if nChannels = 4, map = 15
etc.
nChannels
- @Deprecated public static int makeChannelMap(int nChannels, int[] channelList)
nChannels
- number of elements in the listchannelList
- listpublic static int makeChannelMap(int[] channelList)
channelList
- channel listpublic static int SetBit(int bitMap, int bitNumber, int bitValue)
public static int SetBit(int bitMap, int bitNumber, boolean bitSet)
public static int getMinFftLength(long len)
public static int log2(int n)
n
- lengthpublic static double linterp(double x0, double x1, double y0, double y1, double x)
author Dave Mellinger
public static java.lang.String getChannelList(int channelMap)
channelMap
- channel mappublic static int[] getChannelArray(int channelMap)
channelMap
- channel mappublic static double constrainedAngle(double angle)
angle
- input angle (degrees)public static double constrainedAngle(double angle, double maxAngle)
angle
- input angle (degrees)maxAngle
- maximum angle in degreespublic static double constrainedAngleR(double angle, double maxAngle)
angle
- input angle (radians)maxAngle
- maximum angle in degreespublic static double roundNumber(double number, double step)
public static java.lang.Double doubleAverage(java.lang.Double d1, java.lang.Double d2)
d1
- number 1d2
- number 2public static java.lang.String formatFrequency(double f)
f
- frequency value in Hzpublic static int[] getSortedInds(int[] data)
data
- array to sortpublic static int calcHydrophoneNumber(int numberOfDelays)
public static int calcTDNumber(int numberofHydrophones)
public static double[] getMinAndMax(double[][] array)
array
- two dimensional array of doublespublic static double[] getMinAndMax(double[] array)
array
- one dimensional array of doublespublic static double getAbsMax(double[] array)
array
- array of numbers