uk.ac.starlink.ast
Class UinterpCalculator

java.lang.Object
  extended by uk.ac.starlink.ast.UinterpCalculator

public abstract class UinterpCalculator
extends Object

Abstract class for user-provided general interpolation functions. An object extending this class and implementing one or more of the (type-specific) uinterp* methods is required in order to perform custom interpolation in the resample* methods of the Mapping class. If it is known that some types will not be processed, the corresponding methods do not need to be implemented.

Author:
Mark Taylor (Starlink)

Constructor Summary
UinterpCalculator()
           
 
Method Summary
 int uinterpB(int ndim_in, int[] lbnd_in, int[] ubnd_in, byte[] in, byte[] in_var, int npoint, int[] offset, double[][] coords, ResampleFlags flags, byte badval, byte[] out, byte[] out_var)
          Interpolates an input grid of byte data at a specified set of points.
 int uinterpD(int ndim_in, int[] lbnd_in, int[] ubnd_in, double[] in, double[] in_var, int npoint, int[] offset, double[][] coords, ResampleFlags flags, double badval, double[] out, double[] out_var)
          Interpolates an input grid of double precision data at a specified set of points.
 int uinterpF(int ndim_in, int[] lbnd_in, int[] ubnd_in, float[] in, float[] in_var, int npoint, int[] offset, double[][] coords, ResampleFlags flags, float badval, float[] out, float[] out_var)
          Interpolates an input grid of floating point data at a specified set of points.
 int uinterpI(int ndim_in, int[] lbnd_in, int[] ubnd_in, int[] in, int[] in_var, int npoint, int[] offset, double[][] coords, ResampleFlags flags, int badval, int[] out, int[] out_var)
          Interpolates an input grid of integer data at a specified set of points.
 int uinterpL(int ndim_in, int[] lbnd_in, int[] ubnd_in, long[] in, long[] in_var, int npoint, int[] offset, double[][] coords, ResampleFlags flags, long badval, long[] out, long[] out_var)
          Interpolates an input grid of long integer data at a specified set of points.
 int uinterpS(int ndim_in, int[] lbnd_in, int[] ubnd_in, short[] in, short[] in_var, int npoint, int[] offset, double[][] coords, ResampleFlags flags, short badval, short[] out, short[] out_var)
          Interpolates an input grid of short integer data at a specified set of points.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UinterpCalculator

public UinterpCalculator()
Method Detail

uinterpD

public int uinterpD(int ndim_in,
                    int[] lbnd_in,
                    int[] ubnd_in,
                    double[] in,
                    double[] in_var,
                    int npoint,
                    int[] offset,
                    double[][] coords,
                    ResampleFlags flags,
                    double badval,
                    double[] out,
                    double[] out_var)
             throws Exception
Interpolates an input grid of double precision data at a specified set of points.

Parameters:
ndim_in - number of dimensions in the input grid. This will be at least one.
lbnd_in - an array of integers of size ndim_in, containing the coordinates of the centre of the first pixel in the input grid along each dimension.
ubnd_in - an array of integers of size ndim_in, containing the coordinates of the centre of the last pixel in the grid along each dimension.

Note that lbnd_in and ubnd_in together define the shape, size and coordinate system of the input grid in the same way as they do in resampleD.

in - An array with one element for each pixel in the input grid, containing the input data. This will be the same array as was passed to resampleD via the in parameter.
in_var - Optionally, an array with the same size as in. If given, this will contain the set of variance values associated with the input data and will be the same array as was passed to resampleD via the in_var parameter. If no variance calculations are required it will be null.
npoint - The number of points at which the input grid is to be interpolated. This will be at least one.
offset - An array of integers with npoint elements. or each interpolation point, this will contain the zero-based index in the out (and out_var) array(s) at which the interpolated value (and its variance, if required) should be stored. For example, the interpolated value for point number point should be stored in out[offset[point]].
coords - An array of ndim_in arrays of doubles. Element coords[coord] will point at the first element of an array of double (with npoint elements) which contains the values of coordinate number coord for each interpolation point. The value of coordinate number coord for interpolation point number point is therefore given by coords[coord][point].

If any interpolation point has any of its coordinates equal to the value AstObject.AST__BAD then the corresponding output data (and variance) should be set to the value given by badval (see below).

flags - flag object giving more details about resampling procedure
badval - This will be the same value as was given via the badval parameter of resampleD, and will have the same numerical type as the data being processed (as elements of the in array). It should be used to test for bad pixels in the input grid (but only if flags.usebad is true) and for identifying bad output values in the out (and out_var) array(s).
out - An array into which interpolated data values should be returned. Note that details of the storage order and number of dimensions of this array are not required, since the offset array contains all necessary information about where each returned value should be stored.

In general, not all elements of this array (or the out_var array below) may be used in any particular invocation of the function. Those which are not used should be returned unchanged.

out_var - An optional array with the same size as the out array, into which variance estimates for the resampled values should be returned. This array will only be given if the in_var array has also been given.

If given, it is addressed in exactly the same way (via the offset array) as the out array. The values returned should be estimates of the statistical variance of the corresponding values in the out array, on the assumption that all errors in input data values are statistically independent and that their variance estimates may simply be summed (with appropriate weighting factors).

If no output variance estimates are required, null will be given.

Returns:
the number of pixels which were set to the BAD value by the resampling operation.
Throws:
Exception - The method may throw an exception if any error occurs during the calculation. In this case, the resampling will terminate with an exception.

uinterpF

public int uinterpF(int ndim_in,
                    int[] lbnd_in,
                    int[] ubnd_in,
                    float[] in,
                    float[] in_var,
                    int npoint,
                    int[] offset,
                    double[][] coords,
                    ResampleFlags flags,
                    float badval,
                    float[] out,
                    float[] out_var)
             throws Exception
Interpolates an input grid of floating point data at a specified set of points.

Parameters:
ndim_in - number of dimensions in the input grid. This will be at least one.
lbnd_in - an array of integers of size ndim_in, containing the coordinates of the centre of the first pixel in the input grid along each dimension.
ubnd_in - an array of integers of size ndim_in, containing the coordinates of the centre of the last pixel in the grid along each dimension.

Note that lbnd_in and ubnd_in together define the shape, size and coordinate system of the input grid in the same way as they do in resampleF.

in - An array with one element for each pixel in the input grid, containing the input data. This will be the same array as was passed to resampleF via the in parameter.
in_var - Optionally, an array with the same size as in. If given, this will contain the set of variance values associated with the input data and will be the same array as was passed to resampleF via the in_var parameter. If no variance calculations are required it will be null.
npoint - The number of points at which the input grid is to be interpolated. This will be at least one.
offset - An array of integers with npoint elements. or each interpolation point, this will contain the zero-based index in the out (and out_var) array(s) at which the interpolated value (and its variance, if required) should be stored. For example, the interpolated value for point number point should be stored in out[offset[point]].
coords - An array of ndim_in arrays of doubles. Element coords[coord] will point at the first element of an array of double (with npoint elements) which contains the values of coordinate number coord for each interpolation point. The value of coordinate number coord for interpolation point number point is therefore given by coords[coord][point].

If any interpolation point has any of its coordinates equal to the value AstObject.AST__BAD then the corresponding output data (and variance) should be set to the value given by badval (see below).

flags - flag object giving more details about resampling procedure
badval - This will be the same value as was given via the badval parameter of resampleF, and will have the same numerical type as the data being processed (as elements of the in array). It should be used to test for bad pixels in the input grid (but only if flags.usebad is true) and for identifying bad output values in the out (and out_var) array(s).
out - An array into which interpolated data values should be returned. Note that details of the storage order and number of dimensions of this array are not required, since the offset array contains all necessary information about where each returned value should be stored.

In general, not all elements of this array (or the out_var array below) may be used in any particular invocation of the function. Those which are not used should be returned unchanged.

out_var - An optional array with the same size as the out array, into which variance estimates for the resampled values should be returned. This array will only be given if the in_var array has also been given.

If given, it is addressed in exactly the same way (via the offset array) as the out array. The values returned should be estimates of the statistical variance of the corresponding values in the out array, on the assumption that all errors in input data values are statistically independent and that their variance estimates may simply be summed (with appropriate weighting factors).

If no output variance estimates are required, null will be given.

Returns:
the number of pixels which were set to the BAD value by the resampling operation.
Throws:
Exception - The method may throw an exception if any error occurs during the calculation. In this case, the resampling will terminate with an exception.

uinterpL

public int uinterpL(int ndim_in,
                    int[] lbnd_in,
                    int[] ubnd_in,
                    long[] in,
                    long[] in_var,
                    int npoint,
                    int[] offset,
                    double[][] coords,
                    ResampleFlags flags,
                    long badval,
                    long[] out,
                    long[] out_var)
             throws Exception
Interpolates an input grid of long integer data at a specified set of points.

Parameters:
ndim_in - number of dimensions in the input grid. This will be at least one.
lbnd_in - an array of integers of size ndim_in, containing the coordinates of the centre of the first pixel in the input grid along each dimension.
ubnd_in - an array of integers of size ndim_in, containing the coordinates of the centre of the last pixel in the grid along each dimension.

Note that lbnd_in and ubnd_in together define the shape, size and coordinate system of the input grid in the same way as they do in resampleL.

in - An array with one element for each pixel in the input grid, containing the input data. This will be the same array as was passed to resampleL via the in parameter.
in_var - Optionally, an array with the same size as in. If given, this will contain the set of variance values associated with the input data and will be the same array as was passed to resampleL via the in_var parameter. If no variance calculations are required it will be null.
npoint - The number of points at which the input grid is to be interpolated. This will be at least one.
offset - An array of integers with npoint elements. or each interpolation point, this will contain the zero-based index in the out (and out_var) array(s) at which the interpolated value (and its variance, if required) should be stored. For example, the interpolated value for point number point should be stored in out[offset[point]].
coords - An array of ndim_in arrays of doubles. Element coords[coord] will point at the first element of an array of double (with npoint elements) which contains the values of coordinate number coord for each interpolation point. The value of coordinate number coord for interpolation point number point is therefore given by coords[coord][point].

If any interpolation point has any of its coordinates equal to the value AstObject.AST__BAD then the corresponding output data (and variance) should be set to the value given by badval (see below).

flags - flag object giving more details about resampling procedure
badval - This will be the same value as was given via the badval parameter of resampleL, and will have the same numerical type as the data being processed (as elements of the in array). It should be used to test for bad pixels in the input grid (but only if flags.usebad is true) and for identifying bad output values in the out (and out_var) array(s).
out - An array into which interpolated data values should be returned. Note that details of the storage order and number of dimensions of this array are not required, since the offset array contains all necessary information about where each returned value should be stored.

In general, not all elements of this array (or the out_var array below) may be used in any particular invocation of the function. Those which are not used should be returned unchanged.

out_var - An optional array with the same size as the out array, into which variance estimates for the resampled values should be returned. This array will only be given if the in_var array has also been given.

If given, it is addressed in exactly the same way (via the offset array) as the out array. The values returned should be estimates of the statistical variance of the corresponding values in the out array, on the assumption that all errors in input data values are statistically independent and that their variance estimates may simply be summed (with appropriate weighting factors).

If no output variance estimates are required, null will be given.

Returns:
the number of pixels which were set to the BAD value by the resampling operation.
Throws:
Exception - The method may throw an exception if any error occurs during the calculation. In this case, the resampling will terminate with an exception.

uinterpI

public int uinterpI(int ndim_in,
                    int[] lbnd_in,
                    int[] ubnd_in,
                    int[] in,
                    int[] in_var,
                    int npoint,
                    int[] offset,
                    double[][] coords,
                    ResampleFlags flags,
                    int badval,
                    int[] out,
                    int[] out_var)
             throws Exception
Interpolates an input grid of integer data at a specified set of points.

Parameters:
ndim_in - number of dimensions in the input grid. This will be at least one.
lbnd_in - an array of integers of size ndim_in, containing the coordinates of the centre of the first pixel in the input grid along each dimension.
ubnd_in - an array of integers of size ndim_in, containing the coordinates of the centre of the last pixel in the grid along each dimension.

Note that lbnd_in and ubnd_in together define the shape, size and coordinate system of the input grid in the same way as they do in resampleI.

in - An array with one element for each pixel in the input grid, containing the input data. This will be the same array as was passed to resampleI via the in parameter.
in_var - Optionally, an array with the same size as in. If given, this will contain the set of variance values associated with the input data and will be the same array as was passed to resampleI via the in_var parameter. If no variance calculations are required it will be null.
npoint - The number of points at which the input grid is to be interpolated. This will be at least one.
offset - An array of integers with npoint elements. or each interpolation point, this will contain the zero-based index in the out (and out_var) array(s) at which the interpolated value (and its variance, if required) should be stored. For example, the interpolated value for point number point should be stored in out[offset[point]].
coords - An array of ndim_in arrays of doubles. Element coords[coord] will point at the first element of an array of double (with npoint elements) which contains the values of coordinate number coord for each interpolation point. The value of coordinate number coord for interpolation point number point is therefore given by coords[coord][point].

If any interpolation point has any of its coordinates equal to the value AstObject.AST__BAD then the corresponding output data (and variance) should be set to the value given by badval (see below).

flags - flag object giving more details about resampling procedure
badval - This will be the same value as was given via the badval parameter of resampleI, and will have the same numerical type as the data being processed (as elements of the in array). It should be used to test for bad pixels in the input grid (but only if flags.usebad is true) and for identifying bad output values in the out (and out_var) array(s).
out - An array into which interpolated data values should be returned. Note that details of the storage order and number of dimensions of this array are not required, since the offset array contains all necessary information about where each returned value should be stored.

In general, not all elements of this array (or the out_var array below) may be used in any particular invocation of the function. Those which are not used should be returned unchanged.

out_var - An optional array with the same size as the out array, into which variance estimates for the resampled values should be returned. This array will only be given if the in_var array has also been given.

If given, it is addressed in exactly the same way (via the offset array) as the out array. The values returned should be estimates of the statistical variance of the corresponding values in the out array, on the assumption that all errors in input data values are statistically independent and that their variance estimates may simply be summed (with appropriate weighting factors).

If no output variance estimates are required, null will be given.

Returns:
the number of pixels which were set to the BAD value by the resampling operation.
Throws:
Exception - The method may throw an exception if any error occurs during the calculation. In this case, the resampling will terminate with an exception.

uinterpS

public int uinterpS(int ndim_in,
                    int[] lbnd_in,
                    int[] ubnd_in,
                    short[] in,
                    short[] in_var,
                    int npoint,
                    int[] offset,
                    double[][] coords,
                    ResampleFlags flags,
                    short badval,
                    short[] out,
                    short[] out_var)
             throws Exception
Interpolates an input grid of short integer data at a specified set of points.

Parameters:
ndim_in - number of dimensions in the input grid. This will be at least one.
lbnd_in - an array of integers of size ndim_in, containing the coordinates of the centre of the first pixel in the input grid along each dimension.
ubnd_in - an array of integers of size ndim_in, containing the coordinates of the centre of the last pixel in the grid along each dimension.

Note that lbnd_in and ubnd_in together define the shape, size and coordinate system of the input grid in the same way as they do in resampleS.

in - An array with one element for each pixel in the input grid, containing the input data. This will be the same array as was passed to resampleS via the in parameter.
in_var - Optionally, an array with the same size as in. If given, this will contain the set of variance values associated with the input data and will be the same array as was passed to resampleS via the in_var parameter. If no variance calculations are required it will be null.
npoint - The number of points at which the input grid is to be interpolated. This will be at least one.
offset - An array of integers with npoint elements. or each interpolation point, this will contain the zero-based index in the out (and out_var) array(s) at which the interpolated value (and its variance, if required) should be stored. For example, the interpolated value for point number point should be stored in out[offset[point]].
coords - An array of ndim_in arrays of doubles. Element coords[coord] will point at the first element of an array of double (with npoint elements) which contains the values of coordinate number coord for each interpolation point. The value of coordinate number coord for interpolation point number point is therefore given by coords[coord][point].

If any interpolation point has any of its coordinates equal to the value AstObject.AST__BAD then the corresponding output data (and variance) should be set to the value given by badval (see below).

flags - flag object giving more details about resampling procedure
badval - This will be the same value as was given via the badval parameter of resampleS, and will have the same numerical type as the data being processed (as elements of the in array). It should be used to test for bad pixels in the input grid (but only if flags.usebad is true) and for identifying bad output values in the out (and out_var) array(s).
out - An array into which interpolated data values should be returned. Note that details of the storage order and number of dimensions of this array are not required, since the offset array contains all necessary information about where each returned value should be stored.

In general, not all elements of this array (or the out_var array below) may be used in any particular invocation of the function. Those which are not used should be returned unchanged.

out_var - An optional array with the same size as the out array, into which variance estimates for the resampled values should be returned. This array will only be given if the in_var array has also been given.

If given, it is addressed in exactly the same way (via the offset array) as the out array. The values returned should be estimates of the statistical variance of the corresponding values in the out array, on the assumption that all errors in input data values are statistically independent and that their variance estimates may simply be summed (with appropriate weighting factors).

If no output variance estimates are required, null will be given.

Returns:
the number of pixels which were set to the BAD value by the resampling operation.
Throws:
Exception - The method may throw an exception if any error occurs during the calculation. In this case, the resampling will terminate with an exception.

uinterpB

public int uinterpB(int ndim_in,
                    int[] lbnd_in,
                    int[] ubnd_in,
                    byte[] in,
                    byte[] in_var,
                    int npoint,
                    int[] offset,
                    double[][] coords,
                    ResampleFlags flags,
                    byte badval,
                    byte[] out,
                    byte[] out_var)
             throws Exception
Interpolates an input grid of byte data at a specified set of points.

Parameters:
ndim_in - number of dimensions in the input grid. This will be at least one.
lbnd_in - an array of integers of size ndim_in, containing the coordinates of the centre of the first pixel in the input grid along each dimension.
ubnd_in - an array of integers of size ndim_in, containing the coordinates of the centre of the last pixel in the grid along each dimension.

Note that lbnd_in and ubnd_in together define the shape, size and coordinate system of the input grid in the same way as they do in resampleB.

in - An array with one element for each pixel in the input grid, containing the input data. This will be the same array as was passed to resampleB via the in parameter.
in_var - Optionally, an array with the same size as in. If given, this will contain the set of variance values associated with the input data and will be the same array as was passed to resampleB via the in_var parameter. If no variance calculations are required it will be null.
npoint - The number of points at which the input grid is to be interpolated. This will be at least one.
offset - An array of integers with npoint elements. or each interpolation point, this will contain the zero-based index in the out (and out_var) array(s) at which the interpolated value (and its variance, if required) should be stored. For example, the interpolated value for point number point should be stored in out[offset[point]].
coords - An array of ndim_in arrays of doubles. Element coords[coord] will point at the first element of an array of double (with npoint elements) which contains the values of coordinate number coord for each interpolation point. The value of coordinate number coord for interpolation point number point is therefore given by coords[coord][point].

If any interpolation point has any of its coordinates equal to the value AstObject.AST__BAD then the corresponding output data (and variance) should be set to the value given by badval (see below).

flags - flag object giving more details about resampling procedure
badval - This will be the same value as was given via the badval parameter of resampleB, and will have the same numerical type as the data being processed (as elements of the in array). It should be used to test for bad pixels in the input grid (but only if flags.usebad is true) and for identifying bad output values in the out (and out_var) array(s).
out - An array into which interpolated data values should be returned. Note that details of the storage order and number of dimensions of this array are not required, since the offset array contains all necessary information about where each returned value should be stored.

In general, not all elements of this array (or the out_var array below) may be used in any particular invocation of the function. Those which are not used should be returned unchanged.

out_var - An optional array with the same size as the out array, into which variance estimates for the resampled values should be returned. This array will only be given if the in_var array has also been given.

If given, it is addressed in exactly the same way (via the offset array) as the out array. The values returned should be estimates of the statistical variance of the corresponding values in the out array, on the assumption that all errors in input data values are statistically independent and that their variance estimates may simply be summed (with appropriate weighting factors).

If no output variance estimates are required, null will be given.

Returns:
the number of pixels which were set to the BAD value by the resampling operation.
Throws:
Exception - The method may throw an exception if any error occurs during the calculation. In this case, the resampling will terminate with an exception.


Copyright © 2017 Central Laboratory of the Research Councils. All Rights Reserved.