uk.ac.starlink.ndx
Class Ndxs

java.lang.Object
  extended by uk.ac.starlink.ndx.Ndxs

public class Ndxs
extends Object

Utility methods for Ndx manipulation.

Author:
Mark Taylor (Starlink)

Method Summary
static FrameSet getAst(Ndx ndx)
          Unconditionally returns world coordinate system information for an NDX as a FrameSet.
static FrameSet getDefaultAst(Ndx ndx)
          Returns a default AST FrameSet for an Ndx.
static NDArray getMaskedErrors(Ndx ndx)
          Returns a view of the Errors of an Ndx with any masking implied by its Quality array taken care of.
static NDArray getMaskedErrors(Ndx ndx, Requirements req)
          Returns a view of the Errors of an Ndx with any masking implied by its Quality array taken care of, and additional constraints supplied by a Requirements object.
static NDArray getMaskedImage(Ndx ndx)
          Returns a view of the Image array of an Ndx with any masking implied by its Quality array taken care of.
static NDArray getMaskedImage(Ndx ndx, Requirements req)
          Returns a view of the Image array of an Ndx with any masking implied by its Quality array taken care of, and additional constraints supplied by a Requirements object.
static NDArray getMaskedVariance(Ndx ndx)
          Returns a view of the Variance array of an Ndx with any masking implied by its Quality array taken care of.
static NDArray getMaskedVariance(Ndx ndx, Requirements req)
          Returns a view of the Variance array of an Ndx with any masking implied by its Quality array taken care of, and additional constraints supplied by an Requirements object.
static NDArray maskArray(NDArray target, NDArray quality, int badbits, Requirements req)
          Applies quality masking to an NDArray based on another NDArray representing quality values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getMaskedImage

public static NDArray getMaskedImage(Ndx ndx,
                                     Requirements req)
                              throws IOException
Returns a view of the Image array of an Ndx with any masking implied by its Quality array taken care of, and additional constraints supplied by a Requirements object.

Parameters:
ndx - the NDX whose image is sought
req - additional requirements for the returned array. May be null
Returns:
an NDArray representing the masked image data
Throws:
IOException - if an I/O error occurs
See Also:
maskArray(uk.ac.starlink.array.NDArray, uk.ac.starlink.array.NDArray, int, uk.ac.starlink.array.Requirements)

getMaskedImage

public static NDArray getMaskedImage(Ndx ndx)
                              throws IOException
Returns a view of the Image array of an Ndx with any masking implied by its Quality array taken care of.

Parameters:
ndx - the NDX whose image is sought
Returns:
an NDArray representing the masked image data
Throws:
IOException - if an I/O error occurs
See Also:
maskArray(uk.ac.starlink.array.NDArray, uk.ac.starlink.array.NDArray, int, uk.ac.starlink.array.Requirements)

getMaskedVariance

public static NDArray getMaskedVariance(Ndx ndx,
                                        Requirements req)
                                 throws IOException
Returns a view of the Variance array of an Ndx with any masking implied by its Quality array taken care of, and additional constraints supplied by an Requirements object.

Parameters:
ndx - the NDX whose variance is sought
req - additional requirements for the returned array. May be null
Returns:
an NDArray representing the masked variance data
Throws:
IOException - if an I/O error occurs
See Also:
maskArray(uk.ac.starlink.array.NDArray, uk.ac.starlink.array.NDArray, int, uk.ac.starlink.array.Requirements)

getMaskedVariance

public static NDArray getMaskedVariance(Ndx ndx)
                                 throws IOException
Returns a view of the Variance array of an Ndx with any masking implied by its Quality array taken care of.

Parameters:
ndx - the NDX whose variance is sought
Returns:
an NDArray representing the masked variance data
Throws:
IOException - if an I/O error occurs
See Also:
maskArray(uk.ac.starlink.array.NDArray, uk.ac.starlink.array.NDArray, int, uk.ac.starlink.array.Requirements)

getMaskedErrors

public static NDArray getMaskedErrors(Ndx ndx,
                                      Requirements req)
                               throws IOException
Returns a view of the Errors of an Ndx with any masking implied by its Quality array taken care of, and additional constraints supplied by a Requirements object. The resulting object has pixels which are the square roots of those in the array returned by getMaskedVariance(Ndx,Requirements).

Parameters:
ndx - the NDX whose errors are sought
req - additional requirements for the returned array. May be null
Returns:
an NDArray representing the square root of the variance data
Throws:
IOException - if an I/O error occurs
See Also:
maskArray(uk.ac.starlink.array.NDArray, uk.ac.starlink.array.NDArray, int, uk.ac.starlink.array.Requirements)

getMaskedErrors

public static NDArray getMaskedErrors(Ndx ndx)
                               throws IOException
Returns a view of the Errors of an Ndx with any masking implied by its Quality array taken care of. The resulting object has pixels which are the square roots of those in the array returned by getMaskedVariance(Ndx).

Parameters:
ndx - the NDX whose errors are sought
Returns:
an NDArray representing the square root of the masked variance data
Throws:
IOException - if an I/O error occurs
See Also:
maskArray(uk.ac.starlink.array.NDArray, uk.ac.starlink.array.NDArray, int, uk.ac.starlink.array.Requirements)

maskArray

public static NDArray maskArray(NDArray target,
                                NDArray quality,
                                int badbits,
                                Requirements req)
                         throws IOException
Applies quality masking to an NDArray based on another NDArray representing quality values. The pixels of the returned array are the same as those of the target, except where a bitwise AND of the badbits mask and the corresponding pixel of the quality array is non-zero, in which case they have the bad value. A Requirements object may be supplied to specify additional required characteristics of the returned array.

This method does the work for the various Ndx array masking methods in this class.

Parameters:
target - the target NDArray to be masked
quality - an NDArray of an integer type
badbits - the quality mask
req - additional requirements on the returned object. May be null
Returns:
an NDArray based on the target array target but with bad pixels where the indicated by quality May or may not be the same object as target
Throws:
IOException - if an I/O error occurs

getAst

public static FrameSet getAst(Ndx ndx)
Unconditionally returns world coordinate system information for an NDX as a FrameSet. If ndx has a WCS component it is generated from that, otherwise a suitable default one is returned.

Parameters:
ndx - the NDX for which WCS are required

getDefaultAst

public static FrameSet getDefaultAst(Ndx ndx)
Returns a default AST FrameSet for an Ndx. This has GRID and PIXEL Frames, such that when the unit hypercube (having coordinates xi in the range 0<=xi..1 in each dimension i) is transformed into the PIXEL frame it becomes the hypercube with coordinates in the range Origini-1<=xi<=Origini, where Origin is the origin of the Image array component.

Parameters:
ndx - the Ndx for which to find the default FrameSet
Returns:
the default FrameSet for ndx


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