public class TwoFibreWatsonFitter extends MarquardtMinimiser
Constructor and Description |
---|
TwoFibreWatsonFitter(Vector3D[] axes) |
Modifier and Type | Method and Description |
---|---|
void |
firstDeriv(double[] atry,
double[] g,
double[][] dgda,
double[] dfda,
double hyper1F1k1,
double hyper1F1k2,
double dHyperDk1,
double dHyperDk2) |
void |
fitEstimatedParams(double initAlpha,
int attempts)
Make estimates of the initial parameters and attempt a minimisation with each.
|
WatsonDistribution[] |
getDistributions() |
double[] |
getKappas() |
double |
getMixingParameter() |
Vector3D[] |
getMus() |
double[] |
getParameters()
Returns the values of the parameters.
|
static void |
main(java.lang.String[] args) |
void |
setFixedParams(boolean[] ai) |
void |
setInitParams(double[] aInit)
Sets the initial values of the parameters.
|
void |
setKappa1Variable(boolean variable) |
void |
setKappa2Variable(boolean variable) |
void |
setMixingParameterVariable(boolean variable) |
void |
setMu1Variable(boolean variable) |
void |
setMu2Variable(boolean variable) |
getCONVERGETHRESH, getFObjVal, minimise, setConvergence, setCONVERGETHRESH, setMAXITER
public TwoFibreWatsonFitter(Vector3D[] axes)
public void firstDeriv(double[] atry, double[] g, double[][] dgda, double[] dfda, double hyper1F1k1, double hyper1F1k2, double dHyperDk1, double dHyperDk2)
atry
- the parameter valuesg
- the values of the function g = \left( \alpha W(\mu_1, \kappa_1, x_i) + (1 - \alpha)W(\mu_2, \kappa_2, x_i) \right) for all idgda
- Will be filled with the derivatives of g_i wrt adfda
- Will be filled with the derivatives of f wrt apublic WatsonDistribution[] getDistributions()
public Vector3D[] getMus()
public double getMixingParameter()
public double[] getKappas()
public void setInitParams(double[] aInit) throws MarquardtMinimiserException
setInitParams
in class MarquardtMinimiser
aInit
- Array containing the new parameter values starting
from index 0: {theta1, phi1, kappa1, theta2, phi2, kappa2, alpha}. (theta, phi) are the spherical
polar coordinates of the mean axes of the distributions. Alpha is a mixing parameter, and should be
between 0.0 and 1.0.MarquardtMinimiserException
public void fitEstimatedParams(double initAlpha, int attempts) throws MarquardtMinimiserException
This method works well when the data comes from two orthogonal bipolar distributions of moderate concentration (kappa approx. 30-250). It fits a girdle distribution to the combined set of samples. The polar axis of the girdle distribution is taken as a normal to mu1 and mu2. The fitter will try sets of axes rotated at evenly spaced angles about the polar axis. The values of kappa1 and kappa2 are initialised to the negated kappa of the girdle distribution.
initAlpha
- the mixing parameter. This cannot be estimated automatically from the sample. Set to 0.5 or give a better guess if you have one.attempts
- the number of sets of parameters to try.MarquardtMinimiserException
public double[] getParameters()
MarquardtMinimiser
getParameters
in class MarquardtMinimiser
public void setFixedParams(boolean[] ai)
ai
- an array of boolean. Parameter i is fixed if ai[i] == false.public void setMixingParameterVariable(boolean variable)
variable
- true if alpha is to be variable (default is variable)public void setMu1Variable(boolean variable)
variable
- true if the principal axis mu1 is to be variable (default is variable)public void setMu2Variable(boolean variable)
variable
- true if the principal axis mu2 is to be variable (default is variable)public void setKappa1Variable(boolean variable)
variable
- true if kappa1 is to be variable (default is variable)public void setKappa2Variable(boolean variable)
variable
- true if kappa2 is to be variable (default is variable)public static void main(java.lang.String[] args)