next up previous 264
Next: AST_RATE - Calculate the rate of change of a Mapping output
Up: AST Routine Descriptions
Previous: AST_PUTTABLES - Store one or more FitsTables in a FitsChan


AST_QUADAPPROX - Obtain a quadratic approximation to a 2D Mapping

Description:
This function returns the co-efficients of a quadratic fit to the supplied Mapping over the input area specified by LBND and UBND. The Mapping must have 2 inputs, but may have any number of outputs. The i'th Mapping output is modelled as a quadratic function of the 2 inputs (x,y):

output_i = a_i_0 $+$ a_i_1$*$x $+$ a_i_2$*$y $+$ a_i_3$*$x$*$y $+$ a_i_4$*$x$*$x $+$ a_i_5$*$y$*$y

The FIT array is returned holding the values of the co-efficients a_0_0, a_0_1, etc.

Invocation:
RESULT = AST_QUADAPPROX( THIS, LBND, UBND, NX, NY, FIT, RMS, STATUS )
Arguments:
THIS = INTEGER (Given)
Pointer to the Mapping.
LBND( $*$ ) = DOUBLE PRECISION (Given)
An array containing the lower bounds of a box defined within the input coordinate system of the Mapping. The number of elements in this array should equal the value of the Mapping's Nin attribute. This box should specify the region over which the fit is to be performed.
UBND( $*$ ) = DOUBLE PRECISION (Given)
An array containing the upper bounds of the box specifying the region over which the fit is to be performed.
NX = INTEGER (Given)
The number of points to place along the first Mapping input. The first point is at LBND( 1 ) and the last is at UBND( 1 ). If a value less than three is supplied a value of three will be used.
NY = INTEGER (Given)
The number of points to place along the second Mapping input. The first point is at LBND( 2 ) and the last is at UBND( 2 ). If a value less than three is supplied a value of three will be used.
FIT( $*$ ) = DOUBLE PRECISION (Returned)
An array in which to return the co-efficients of the quadratic approximation to the specified transformation. This array should have at least "6$*$Nout", elements. The first 6 elements hold the fit to the first Mapping output. The next 6 elements hold the fit to the second Mapping output, etc. So if the Mapping has 2 inputs and 2 outputs the quadratic approximation to the forward transformation is:

X_out = fit(1) $+$ fit(2)$*$X_in $+$ fit(3)$*$Y_in $+$ fit(4)$*$X_in$*$Y_in $+$ fit(5)$*$X_in$*$X_in $+$ fit(6)$*$Y_in$*$Y_in Y_out = fit(7) $+$ fit(8)$*$X_in $+$ fit(9)$*$Y_in $+$ fit(10)$*$X_in$*$Y_in $+$ fit(11)$*$X_in$*$X_in $+$ fit(12)$*$Y_in$*$Y_in

RMS = DOUBLE PRECISION (Returned)
The RMS residual between the fit and the Mapping, summed over all Mapping outputs.
STATUS = INTEGER (Given and Returned)
The global status.
Returned Value:
AST_QUADAPPROX = LOGICAL
If a quadratic approximation was created, .TRUE is returned. Otherwise .FALSE. is returned and the fit co-efficients are set to AST__BAD.
Notes:
  • This function fits the Mapping's forward transformation. To fit the inverse transformation, the Mapping should be inverted using AST_INVERT before invoking this function.

  • A value of .FALSE. will be returned if this function is invoked with the global error status set, or if it should fail for any reason.


next up previous 264
Next: AST_RATE - Calculate the rate of change of a Mapping output
Up: AST Routine Descriptions
Previous: AST_PUTTABLES - Store one or more FitsTables in a FitsChan

AST A Library for Handling World Coordinate Systems in Astronomy
Starlink User Note 210
R.F. Warren-Smith & D.S. Berry
24th May 2011
E-mail:ussc@star.rl.ac.uk

Copyright (C) 2009 Science \& Technology Facilities Council