|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.ac.starlink.ttools.plot.BinGrid
public class BinGrid
Stores a grid of bins which contain sums, which may be simple counts or weighted sums. This is effectively the data model for a two-dimensional possibly weighted histogram or, to put it another way, it's an image.
Constructor Summary | |
---|---|
BinGrid(int xsize,
int ysize)
Constructs a new grid. |
Method Summary | |
---|---|
byte[] |
getBytes(double loCut,
double hiCut,
boolean log)
Returns an array of bytes representing the values in this grid. |
double |
getCut(double frac)
Returns the cut value associated with a given fractional value (between 0 and 1). |
double |
getMaxSum()
Returns the largest value which exists in any of the bins. |
double |
getMinSum()
Returns the smallest value which exists in any of the bins. |
int |
getSizeX()
Returns the number of bins (pixels) in the X direction. |
int |
getSizeY()
Returns the number of bins (pixels) in the Y direction. |
double |
getSum(int ix,
int iy)
Returns the sum in a given bin (value at a given pixel). |
double[] |
getSums()
Returns the raw histogram data held by this grid. |
void |
recalculate()
Recalculates invariants. |
void |
submitDatum(int ix,
int iy,
double weight)
Adds a data point to this histogram. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BinGrid(int xsize, int ysize)
xsize
- number of bins (pixels) in X directionysize
- number of bins (pixels) in Y directionMethod Detail |
---|
public int getSizeX()
public int getSizeY()
public double getSum(int ix, int iy)
ix
- x coordinateiy
- y coordinatepublic double getMaxSum()
public double getMinSum()
public double getCut(double frac)
frac=0.25
you'll get the first
quartile of sum values currently in the histogram.
frac
- fraction for which cut is required (0..1)
frac
of the bins have occupanciespublic void submitDatum(int ix, int iy, double weight)
(ix,iy)
is incremented by weight
.
ix
- X grid coordinateiy
- Y grid coordinateweight
- weightpublic void recalculate()
public byte[] getBytes(double loCut, double hiCut, boolean log)
loCut
will get a result value of 0, any ones above hiCut
will get a result value of 255.
The ordering of pixels is that X values change most rapidly
and Y values decrease. This is the order suitable for AWT images.
Note the values must be interpreted as unsigned 8-bit values (value = 0x000000ff & (int)getBytes()[i]).
loCut
- lowest distinguished sum valuehiCut
- highest distinguished sum valuelog
- true iff you want logarithmic scalling of the colours
public double[] getSums()
getBytes(double, double, boolean)
-
X values change most rapidly and Y values decrease.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |