uk.ac.starlink.ttools.mode
Class CubeWriter

java.lang.Object
  extended by uk.ac.starlink.ttools.mode.CubeWriter
All Implemented Interfaces:
TableConsumer

public class CubeWriter
extends Object
implements TableConsumer

TableConsumer implementation which constructs and outputs a histogram data cube for an input table.

Since:
9 May 2006
Author:
Mark Taylor

Constructor Summary
CubeWriter(double[] loBounds, double[] hiBounds, int[] nbins, double[] binSizes, String[] colIds, String scaleId, Destination dest, Class outType)
          Constructor.
 
Method Summary
static double[] calculateCube(StarTable table, double[] loBounds, int[] nbins, double[] binSizes)
          Accumulates the contents of an N-dimensional histogram representing data from an N+1-columned table.
 void consume(StarTable inTable)
          Consumes a table.
static uk.ac.starlink.ttools.mode.CubeWriter.NumberWriter createNumberWriter(DataOutput out, Class clazz)
          Constructs an object which can write signed integer values to a DataOutput object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CubeWriter

public CubeWriter(double[] loBounds,
                  double[] hiBounds,
                  int[] nbins,
                  double[] binSizes,
                  String[] colIds,
                  String scaleId,
                  Destination dest,
                  Class outType)
Constructor. One, but not both, of nbins and binSizes may be null (it will be worked out from the other). Elements of loBounds and hiBounds may be NaN to indicate that the corresponding bound should be calculated from a pass through the data.

Parameters:
loBounds - lower bounds for each dimension
hiBounds - upper bounds for each dimension
nbins - number of bins in each dimension
binSizes - extent of bins in each dimension
colIds - column ID strings for axes
scaleId - column ID string for scale column (or null)
dest - data output locator
outType - primitive numeric data type for output data; if null worked out automatically
Method Detail

consume

public void consume(StarTable inTable)
             throws IOException
Description copied from interface: TableConsumer
Consumes a table.

Specified by:
consume in interface TableConsumer
Parameters:
inTable - table to consume
Throws:
IOException

calculateCube

public static double[] calculateCube(StarTable table,
                                     double[] loBounds,
                                     int[] nbins,
                                     double[] binSizes)
                              throws IOException
Accumulates the contents of an N-dimensional histogram representing data from an N+1-columned table. The final column is a scaling value.

Parameters:
table - table with N+1 columns
loBounds - N-element array of lower bounds by dimension
nbins - N-element array of number of bins by dimension
binSizes - N-element array of bin extents by dimension
Throws:
IOException

createNumberWriter

public static uk.ac.starlink.ttools.mode.CubeWriter.NumberWriter createNumberWriter(DataOutput out,
                                                                                    Class clazz)
Constructs an object which can write signed integer values to a DataOutput object.

Parameters:
out - destination stream
clazz - primitive numeric type for output


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