Package uk.ac.starlink.ttools.mode
Class CubeWriter
- java.lang.Object
-
- uk.ac.starlink.ttools.mode.CubeWriter
-
- All Implemented Interfaces:
TableConsumer
public class CubeWriter extends java.lang.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
Constructors Constructor Description CubeWriter(double[] loBounds, double[] hiBounds, int[] nbins, double[] binSizes, java.lang.String[] colIds, java.lang.String scaleId, uk.ac.starlink.util.Destination dest, java.lang.Class outType)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static double[]
calculateCube(uk.ac.starlink.table.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(uk.ac.starlink.table.StarTable inTable)
Consumes a table.static uk.ac.starlink.ttools.mode.CubeWriter.NumberWriter
createNumberWriter(java.io.DataOutput out, java.lang.Class clazz)
Constructs an object which can write signed integer values to a DataOutput object.
-
-
-
Constructor Detail
-
CubeWriter
public CubeWriter(double[] loBounds, double[] hiBounds, int[] nbins, double[] binSizes, java.lang.String[] colIds, java.lang.String scaleId, uk.ac.starlink.util.Destination dest, java.lang.Class outType)
Constructor. One, but not both, ofnbins
andbinSizes
may be null (it will be worked out from the other). Elements ofloBounds
andhiBounds
may be NaN to indicate that the corresponding bound should be calculated from a pass through the data.- Parameters:
loBounds
- lower bounds for each dimensionhiBounds
- upper bounds for each dimensionnbins
- number of bins in each dimensionbinSizes
- extent of bins in each dimensioncolIds
- column ID strings for axesscaleId
- column ID string for scale column (or null)dest
- data output locatoroutType
- primitive numeric data type for output data; if null worked out automatically
-
-
Method Detail
-
consume
public void consume(uk.ac.starlink.table.StarTable inTable) throws java.io.IOException
Description copied from interface:TableConsumer
Consumes a table.- Specified by:
consume
in interfaceTableConsumer
- Parameters:
inTable
- table to consume- Throws:
java.io.IOException
-
calculateCube
public static double[] calculateCube(uk.ac.starlink.table.StarTable table, double[] loBounds, int[] nbins, double[] binSizes) throws java.io.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 columnsloBounds
- N-element array of lower bounds by dimensionnbins
- N-element array of number of bins by dimensionbinSizes
- N-element array of bin extents by dimension- Throws:
java.io.IOException
-
createNumberWriter
public static uk.ac.starlink.ttools.mode.CubeWriter.NumberWriter createNumberWriter(java.io.DataOutput out, java.lang.Class clazz)
Constructs an object which can write signed integer values to a DataOutput object.- Parameters:
out
- destination streamclazz
- primitive numeric type for output
-
-