public class BinGrid extends Object
Constructor and Description |
---|
BinGrid(int xsize,
int ysize)
Constructs a new grid.
|
Modifier and Type | Method and Description |
---|---|
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.
|
public BinGrid(int xsize, int ysize)
xsize
- number of bins (pixels) in X directionysize
- number of bins (pixels) in Y directionpublic 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 colourspublic double[] getSums()
getBytes(double, double, boolean)
-
X values change most rapidly and Y values decrease.Copyright © 2025 Central Laboratory of the Research Councils. All Rights Reserved.