Package uk.ac.starlink.ttools.plot2
Class HistoRanger
- java.lang.Object
-
- uk.ac.starlink.ttools.plot2.HistoRanger
-
- All Implemented Interfaces:
Ranger
public class HistoRanger extends java.lang.Object implements Ranger
Histogram-capable Ranger implementation. Evenly sampled values from the input data stream are stored so that scaling based on the detailed distribution of the data, rather than just its minimum and maximum values, can be achieved.- Since:
- 21 Mar 2019
- Author:
- Mark Taylor
-
-
Constructor Summary
Constructors Constructor Description HistoRanger(int nStore, int nQuantile)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static boolean
canScaleHistograms(Span span)
Indicates whether a given span can be used to scale histograms.Span
createSpan()
Returns an object characterising the range of data submitted so far.void
submitDatum(double d)
Accepts a data value.
-
-
-
Constructor Detail
-
HistoRanger
public HistoRanger(int nStore, int nQuantile)
Constructor. The number of samples collected and the number of quantiles can both be configured. The sample count defines the memory footprint of this object, which ought to be short lived, while the quantile count defines the memory footprint of any span objects created, which may be long-lived.- Parameters:
nStore
- maximum number of samples to storenQuantile
- maximum number of quantiles on which to base scaling
-
-
Method Detail
-
submitDatum
public void submitDatum(double d)
Description copied from interface:Ranger
Accepts a data value.- Specified by:
submitDatum
in interfaceRanger
- Parameters:
d
- datum
-
createSpan
public Span createSpan()
Description copied from interface:Ranger
Returns an object characterising the range of data submitted so far. This should not be called while another thread might be callingRanger.submitDatum(double)
.- Specified by:
createSpan
in interfaceRanger
- Returns:
- span of accumulated data
-
canScaleHistograms
public static boolean canScaleHistograms(Span span)
Indicates whether a given span can be used to scale histograms. Iff true, the span'sSpan.createScaler(uk.ac.starlink.ttools.plot2.Scaling, uk.ac.starlink.ttools.plot2.Subrange)
method will work with a Scaling argument likeScaling.HISTO
. This method relies on this class's knowledge of its implementation details.- Parameters:
span
- span instance to test- Returns:
- true iff span is histogram-capable
-
-