uk.ac.starlink.ttools.plot2
Class Scaling

java.lang.Object
  extended by uk.ac.starlink.ttools.plot2.Scaling

@Equality
public abstract class Scaling
extends Object

Defines a policy for scaling values to a fixed interval.

Since:
22 Jan 2015
Author:
Mark Taylor

Field Summary
static Scaling AUTO
          Asinh-based scaling with default parameters.
static Scaling LINEAR
          Linear scaling.
static Scaling LOG
          Logarithmic scaling.
static Scaling SQRT
          Square root scaling.
static Scaling SQUARE
          Square scaling.
 
Constructor Summary
protected Scaling(String name, String description, boolean isLogLike)
          Constructor.
 
Method Summary
static Scaling createAsinhScaling(String name, double delta)
          Constructs an asinh-based scaling.
static Scaler createRangeScaler(Scaling scaling, Range range)
          Utility method to return a scaler based on a Range object.
abstract  Scaler createScaler(double lo, double hi)
          Returns a scaler instance that can scale input values in a given range.
 String getDescription()
          Returns a short description of this scaling.
 String getName()
          Returns the name of this scaling.
static Scaling[] getStretchOptions()
          Returns a list of standard options for colour map stretch.
 boolean isLogLike()
          Indicates whether this scaling is logarithmic.
static Scaling subrangeScaling(Scaling scaling, Subrange subrange)
          Adjusts a scaling by applying a fractional subrange to the scaler inputs before scaling is applied, so that the input range is subranged, rather than the output range.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LINEAR

public static final Scaling LINEAR
Linear scaling.


LOG

public static final Scaling LOG
Logarithmic scaling.


SQRT

public static final Scaling SQRT
Square root scaling.


SQUARE

public static final Scaling SQUARE
Square scaling.


AUTO

public static final Scaling AUTO
Asinh-based scaling with default parameters.

Constructor Detail

Scaling

protected Scaling(String name,
                  String description,
                  boolean isLogLike)
Constructor.

Parameters:
name - scaling name
description - short description of scaling rule
isLogLike - whether the scaling is logarithmic, for instance should be displayed on a log axis
Method Detail

getName

public String getName()
Returns the name of this scaling.

Returns:
name

getDescription

public String getDescription()
Returns a short description of this scaling.

Returns:
short text description

isLogLike

public boolean isLogLike()
Indicates whether this scaling is logarithmic. If so, it should be displayed on logarithmic axis, and can't cope with negative values.

Returns:
true for basically logarithmic, false of (perhaps distorted) linear

createScaler

public abstract Scaler createScaler(double lo,
                                    double hi)
Returns a scaler instance that can scale input values in a given range. The given bounds define the range of input values that will be mapped to the fixed (0..1) output range. Input values outside that range will in general result in clipping, so for the returned scaler s:
    s.scaleValue(x) == s.scaleValue(lo) for x<lo
    s.scaleValue(x) == s.scaleValue(hi) for x>hi
 

Parameters:
lo - lower bound of unclipped input data value
hi - upper bound of unclipped input data value
Returns:
instance

toString

public String toString()
Overrides:
toString in class Object

getStretchOptions

public static final Scaling[] getStretchOptions()
Returns a list of standard options for colour map stretch.

Returns:
standard stretch options

subrangeScaling

public static Scaling subrangeScaling(Scaling scaling,
                                      Subrange subrange)
Adjusts a scaling by applying a fractional subrange to the scaler inputs before scaling is applied, so that the input range is subranged, rather than the output range. For linear scaling the two things would be the same, but not in general.

Parameters:
scaling - base scaling
subrange - fractional subrange to apply to input values
Returns:
subranged scaling

createRangeScaler

public static Scaler createRangeScaler(Scaling scaling,
                                       Range range)
Utility method to return a scaler based on a Range object.

Parameters:
scaling - scaling
range - value range
Returns:
scaler

createAsinhScaling

public static Scaling createAsinhScaling(String name,
                                         double delta)
Constructs an asinh-based scaling.

Parameters:
name - scaling name
delta - output difference for lower-end input unit difference
Returns:
scaling


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