jview
Class JPhasePlot

java.lang.Object
  extended by util.PropertyContainer
      extended by util.PropertyResources
          extended by util.PropertyBundles
              extended by util.rmi.RmiPropertyContainer
                  extended by util.rmi.AbstractRmiCaster
                      extended by util.rmi.AbstractRmiDataSink
                          extended by jview.JDataSink
                              extended by jview.JPhasePlot
All Implemented Interfaces:
Cloneable, Remote, EventListener, DataObserver, Displayable, ExitCleaning, Initializable, LocalizedSupplying, PropertySupplying, ResourceSupplying, RmiCaster, RmiDataSink, RmiPropertyBearing, RmiVariableDepending, DataSink, VariableDepending

public class JPhasePlot
extends JDataSink
implements RmiVariableDepending, VariableDepending, DataObserver

A phase plot is a data sink that displays data with time as the independant variable in a phased plot. We also listen to a Variable with names defined in Phasing.


Nested Class Summary
static class JPhasePlot.Plot
          Reads a data file and plots the specified columns with the given phase and t0.
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
static String AMPLITUDE
          The RMS label string.
static String DATATYPE
          The type of data I can work on, or null if unknown.
private static String DEFCANVASDEFAULT
          Default property value.
private static String DEFCANVASDELIM
           
private static String DEFCANVASKEY
           
private static int DEFDATAINDEX
          Default property value.
private static String DEFEQUAL
          Default property value.
private static int DEFFITPOINTS
          Default property value.
private static double DEFOVERLAP
          Default property value.
private static double DEFPERIOD
          Default property value.
private static double DEFPERIODRANGE
          Default property value.
private static double DEFPHIRANGE
          Default property value.
private static String DEFPOPUPACTIONS
          Default property value.
private static String DEFPOPUPCURSOR
           
private static String DEFSETCURSOR
          Default property value.
private static boolean DEFSHOWFIT
          Default property value.
private static double DEFSTARTPHI
          Default property value.
private static double DEFT0
          Default property value.
private static int DEFTIMEINDEX
          Default property value.
private  PhaseRegression fit
          The data I receive is also used in a phase fit (P=const)..
private static String FITTING
          How my fitting set is named.
private static String FITTINGCOLOR
          How my fitting set is colored .
private static String FITTINGSHAPE
          How my fitting set is named.
private  JLabel jamplitude
          Changing label with the current amplitude value.
private  JLabel joff
          Changing label with the current offset value.
private  JSpinner joutlier
          The spinner that displays the outlier multiplier.
private  JLabel jperiod
          Changing label with the current period value.
private  JLabel jrms
          Changing label with the current rms value.
private  JLabel jt0
          Changing label with the current t0 value.
static String KEY_DATAINDEX
          The index in the data-sink vector that is the measurement.
static String KEY_EQUAL
          The string to use for the labels as the equal sign.
static String KEY_ERRORINDEX
          The index in the data-sink vector that is the error, if we have one.
static String KEY_FITPOINTS
          Number of points in the fit, higher values are more smooth.
static String KEY_OVERLAP
          The overlap of the phase plot, in phases (data is shown twice).
static String KEY_PERIOD
          The period of the system.
static String KEY_PERIODRANGE
          The period range of the system.
static String KEY_PHIRANGE
          The period range of the system.
static String KEY_SHOWFIT
          If true, the fit to the data is shown.
static String KEY_STARTPHI
          The phase lag of the system.
static String KEY_T0
          The t0 of the system.
static String KEY_TIMEINDEX
          The index in the data-sink vector that is the time.
private  List<Object> keyed
          This is the list of keys from timed that belong to phased data.
private  VectorG modelfit
          The last solution to the phase regression.
static String OFFSET
          The RMS label string.
private  double orgper
          The original period set in the properties, restored on data clear.
private  double orgt0
          The original t0 set in the properties, restored on data clear.
private static String OVERLAP
          How my overplotting set is named.
private static String OVERLAPCOLOR
          How my overplotting set is colored.
private static String OVERLAPSHAPE
          How my overplotting set is shaped.
private  List<VectorG> phased
          This is the data we plot, i.e.
private  JTunableSlider pslider
          The slider where the user might adjust the period.
static String RMS
          The RMS label string.
private  Map<Object,VectorG> temporal
          All data found to be removed is temporaly stored here for reput.
private  Map<Object,VectorG> timed
          We bunker the original data.
private  JTunableSlider tslider
          The slider where the user might adjust the zero point.
private static String UNDEF
          The string to be displayed on undefined .
 
Fields inherited from class jview.JDataSink
DEFCURSOR, DEFSET, DEFSHAPE, KEY_CANVASDEFAULT, KEY_CANVASDELIM, KEY_CANVASFILE, KEY_CANVASKEY, KEY_POPUPACTIONS, KEY_POPUPCURSOR, KEY_SETCURSOR
 
Fields inherited from class util.rmi.AbstractRmiDataSink
KEY_BIND
 
Fields inherited from class util.rmi.AbstractRmiCaster
ALTERNATEHOST, ALTERNATEPORT, KEY_BINDNAME, KEY_EXPORTPORT, KEY_REGISTRYHOST, KEY_REGISTRYPORT
 
Fields inherited from class util.PropertyBundles
KEY_LOCALECOUNTRY, KEY_LOCALELANGUAGE, KEY_RESOURCEBUNDLES
 
Fields inherited from class util.PropertyResources
KEY_NOINITONCREATE, localurl, locate, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_URL, urlset
 
Fields inherited from class util.PropertyContainer
KEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATOR
 
Fields inherited from interface util.ResourceSupplying
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME
 
Fields inherited from interface util.PropertySupplying
CONFIG, KEY_CLASS
 
Constructor Summary
JPhasePlot(Map<String,String> prop)
          We construct a phase plot and defer the construction of the data canvas to the parental method.
 
Method Summary
 boolean addData(Map<Object,VectorG> d)
          We set the mapping of data points.
private  boolean applyTimedToCanvas()
          We apply the entire data map to the plotting canvas, taking the period and the t0 from my properties.
private  boolean applyTimedToCanvas(double p, double t0, double phi0)
          We apply the entire data map to the plotting canvas.
private  boolean applyTimedToFit()
          We convert our entire data into a data model for the phase fit.
 boolean clearData()
          We clear all data.
 void dataChanged(DataChangeEvent dce)
          This event is received, if the user manipulated the data.
private  double fitShift(double p, double t0)
          We have a prescribed zero point in time.
protected  String getDrawingSets()
          We add the overlap in the same color as the main data, the fit is in cyan.
protected  String getDrawingShapes()
          We add the overlap in the same shape as the main data, the fit is a shallow line.
 Component getRepresentation()
          We return a panel that has a horizontal slider for the period and a vertical one for T0.
 int highlightOutliers(double maxdev)
          We highlight all outliers from the spinner value.
 void init()
          We initialize the phase-regression, which calculates amplitude, offset and phase delay if data are fed in.
 boolean metaData(Map<String,? extends Serializable> indices)
          We set the meta data.
 boolean rmiSetVariable(Variable to)
          We register an outside variable.
 boolean setVariable(Variable to)
          Local version of setting a variable.
private  VectorG solveFit(double p)
          We solve the phase regression and return the phase shift of the solution.
private  boolean updateConstants(double p, double t0, double phi0)
          We do not reconstruct the phased array, just update the x coordinates of the plot data.
private  boolean updateFit(double p, double t0, double phi0)
          We update our fit by solving for amplitude, phase offset and data offset.
private  boolean updateOverlap()
          We update the overlap, i.e.
 
Methods inherited from class jview.JDataSink
acceptsData, addData, getCanvas, getCursorClasses, getHighlighted, getHighlighted, getIcon, highlight, highlight, rmiAddData, rmiAddData, rmiClearData, rmiMetaData, setData, setData
 
Methods inherited from class util.rmi.AbstractRmiDataSink
rmiAcceptsData, rmiSetData, rmiSetData
 
Methods inherited from class util.rmi.AbstractRmiCaster
bindAlternate, bindToRegistry, bindToRegistry, bindToRegistry, casterExit, casterExit, exit, getBindName, getBindName, isValid, unbindFromRegistry, unbindFromRegistry
 
Methods inherited from class util.rmi.RmiPropertyContainer
containsRemoteProperty, getRemoteProperties, getRemoteProperty, setRemoteProperty
 
Methods inherited from class util.PropertyBundles
clone, getLocalized, getLocalized, getLocalizedString, getLocalizedString, loadResource
 
Methods inherited from class util.PropertyResources
createFrom, createFrom, createFrom, getApplet, getAsResources, getLocalClassLoader, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, keyCreate, keyCreate, reload, setApplet
 
Methods inherited from class util.PropertyContainer
augment, augment, augment, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, isNew, parseObject, reload, removeProperty, rescanned, setObject, setProperties, setProperty, stringProperties, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface util.ResourceSupplying
getResource, getResourceAsStream, getResources
 
Methods inherited from interface util.PropertySupplying
defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, parseObject, removeProperty, setObject, setProperty, stringProperties
 

Field Detail

DATATYPE

public static final String DATATYPE
The type of data I can work on, or null if unknown.

See Also:
Constant Field Values

AMPLITUDE

public static final String AMPLITUDE
The RMS label string.

See Also:
Constant Field Values

OFFSET

public static final String OFFSET
The RMS label string.

See Also:
Constant Field Values

RMS

public static final String RMS
The RMS label string.

See Also:
Constant Field Values

KEY_EQUAL

public static final String KEY_EQUAL
The string to use for the labels as the equal sign.

See Also:
Constant Field Values

KEY_TIMEINDEX

public static final String KEY_TIMEINDEX
The index in the data-sink vector that is the time.

See Also:
Constant Field Values

KEY_DATAINDEX

public static final String KEY_DATAINDEX
The index in the data-sink vector that is the measurement.

See Also:
Constant Field Values

KEY_ERRORINDEX

public static final String KEY_ERRORINDEX
The index in the data-sink vector that is the error, if we have one.

See Also:
Constant Field Values

KEY_PERIOD

public static final String KEY_PERIOD
The period of the system. If unset, no plotting until set.

See Also:
Constant Field Values

KEY_T0

public static final String KEY_T0
The t0 of the system.

See Also:
Constant Field Values

KEY_STARTPHI

public static final String KEY_STARTPHI
The phase lag of the system. Calculated from data. Changes with t0.

See Also:
Constant Field Values

KEY_PERIODRANGE

public static final String KEY_PERIODRANGE
The period range of the system. Can be high, slider is tunable.

See Also:
Constant Field Values

KEY_PHIRANGE

public static final String KEY_PHIRANGE
The period range of the system. Can be high, slider is tunable.

See Also:
Constant Field Values

KEY_OVERLAP

public static final String KEY_OVERLAP
The overlap of the phase plot, in phases (data is shown twice).

See Also:
Constant Field Values

KEY_SHOWFIT

public static final String KEY_SHOWFIT
If true, the fit to the data is shown.

See Also:
Constant Field Values

KEY_FITPOINTS

public static final String KEY_FITPOINTS
Number of points in the fit, higher values are more smooth.

See Also:
Constant Field Values

OVERLAP

private static final String OVERLAP
How my overplotting set is named.

See Also:
Constant Field Values

OVERLAPCOLOR

private static final String OVERLAPCOLOR
How my overplotting set is colored.

See Also:
Constant Field Values

OVERLAPSHAPE

private static final String OVERLAPSHAPE
How my overplotting set is shaped.

See Also:
Constant Field Values

FITTING

private static final String FITTING
How my fitting set is named.

See Also:
Constant Field Values

FITTINGCOLOR

private static final String FITTINGCOLOR
How my fitting set is colored .

See Also:
Constant Field Values

FITTINGSHAPE

private static final String FITTINGSHAPE
How my fitting set is named.

See Also:
Constant Field Values

UNDEF

private static final String UNDEF
The string to be displayed on undefined .

See Also:
Constant Field Values

DEFEQUAL

private static final String DEFEQUAL
Default property value.

See Also:
Constant Field Values

DEFTIMEINDEX

private static final int DEFTIMEINDEX
Default property value.

See Also:
Constant Field Values

DEFDATAINDEX

private static final int DEFDATAINDEX
Default property value.

See Also:
Constant Field Values

DEFPERIOD

private static final double DEFPERIOD
Default property value.

See Also:
Constant Field Values

DEFT0

private static final double DEFT0
Default property value.

See Also:
Constant Field Values

DEFSTARTPHI

private static final double DEFSTARTPHI
Default property value.

See Also:
Constant Field Values

DEFPERIODRANGE

private static final double DEFPERIODRANGE
Default property value.

See Also:
Constant Field Values

DEFPHIRANGE

private static final double DEFPHIRANGE
Default property value.

See Also:
Constant Field Values

DEFOVERLAP

private static final double DEFOVERLAP
Default property value.

See Also:
Constant Field Values

DEFSHOWFIT

private static final boolean DEFSHOWFIT
Default property value.

See Also:
Constant Field Values

DEFFITPOINTS

private static final int DEFFITPOINTS
Default property value.

See Also:
Constant Field Values

DEFSETCURSOR

private static final String DEFSETCURSOR
Default property value.

See Also:
Constant Field Values

DEFPOPUPACTIONS

private static final String DEFPOPUPACTIONS
Default property value.

See Also:
Constant Field Values

DEFPOPUPCURSOR

private static final String DEFPOPUPCURSOR
See Also:
Constant Field Values

DEFCANVASDEFAULT

private static final String DEFCANVASDEFAULT
Default property value.

See Also:
Constant Field Values

DEFCANVASDELIM

private static final String DEFCANVASDELIM
See Also:
Constant Field Values

DEFCANVASKEY

private static final String DEFCANVASKEY
See Also:
Constant Field Values

timed

private Map<Object,VectorG> timed
We bunker the original data.


temporal

private Map<Object,VectorG> temporal
All data found to be removed is temporaly stored here for reput.


phased

private List<VectorG> phased
This is the data we plot, i.e. y as in timed, but x as phase.


keyed

private List<Object> keyed
This is the list of keys from timed that belong to phased data.


fit

private PhaseRegression fit
The data I receive is also used in a phase fit (P=const)..


modelfit

private VectorG modelfit
The last solution to the phase regression.


pslider

private JTunableSlider pslider
The slider where the user might adjust the period.


tslider

private JTunableSlider tslider
The slider where the user might adjust the zero point.


jperiod

private JLabel jperiod
Changing label with the current period value.


jt0

private JLabel jt0
Changing label with the current t0 value.


jamplitude

private JLabel jamplitude
Changing label with the current amplitude value.


joff

private JLabel joff
Changing label with the current offset value.


jrms

private JLabel jrms
Changing label with the current rms value.


joutlier

private JSpinner joutlier
The spinner that displays the outlier multiplier.


orgper

private double orgper
The original period set in the properties, restored on data clear.


orgt0

private double orgt0
The original t0 set in the properties, restored on data clear.

Constructor Detail

JPhasePlot

public JPhasePlot(Map<String,String> prop)
           throws RemoteException
We construct a phase plot and defer the construction of the data canvas to the parental method.

Throws:
RemoteException
Method Detail

init

public void init()
We initialize the phase-regression, which calculates amplitude, offset and phase delay if data are fed in.

Specified by:
init in interface Initializable
Overrides:
init in class JDataSink

getRepresentation

public Component getRepresentation()
We return a panel that has a horizontal slider for the period and a vertical one for T0. On top we present the current valid period and T0.

Specified by:
getRepresentation in interface Displayable
Overrides:
getRepresentation in class JDataSink

rmiSetVariable

public boolean rmiSetVariable(Variable to)
                       throws RemoteException
We register an outside variable. If it is one of the Phasing variables, we update our sliders accordingly. Note that the fitting procedure (also issued on slider rest) produces the amplitude, offset and a phase shift, also named t0, which is in this content than a time-lag between this (photometric?) curve and an outside (spectroscopic?) zero point.

Specified by:
rmiSetVariable in interface RmiVariableDepending
Throws:
RemoteException

getDrawingSets

protected String getDrawingSets()
We add the overlap in the same color as the main data, the fit is in cyan.

Overrides:
getDrawingSets in class JDataSink

getDrawingShapes

protected String getDrawingShapes()
We add the overlap in the same shape as the main data, the fit is a shallow line.

Overrides:
getDrawingShapes in class JDataSink

setVariable

public boolean setVariable(Variable to)
Local version of setting a variable. jperiod = new JLabel(getProperty(KEY_PERIOD)); jt0 = new JLabel(getProperty(KEY_STARTPHI));

Specified by:
setVariable in interface VariableDepending

dataChanged

public void dataChanged(DataChangeEvent dce)
This event is received, if the user manipulated the data. Only events of add and delete are relevant, clear and new are put by myself. We update the timed map and refit.

Specified by:
dataChanged in interface DataObserver

clearData

public boolean clearData()
We clear all data.

Specified by:
clearData in interface DataSink
Overrides:
clearData in class JDataSink
Returns:
True, if at least a single data point has been deleted.

metaData

public boolean metaData(Map<String,? extends Serializable> indices)
We set the meta data. Recognized keys are: All of this values have default settings, so the canvas might also work without an explicit call to this method.

Specified by:
metaData in interface DataSink
Overrides:
metaData in class JDataSink
Returns:
True, as all necessary values have default.

addData

public boolean addData(Map<Object,VectorG> d)
We set the mapping of data points. Additionally, the fit is prepared for a phase regression model.

Specified by:
addData in interface DataSink

highlightOutliers

public int highlightOutliers(double maxdev)
We highlight all outliers from the spinner value.


applyTimedToFit

private boolean applyTimedToFit()
We convert our entire data into a data model for the phase fit. timed must not be null.


applyTimedToCanvas

private boolean applyTimedToCanvas()
We apply the entire data map to the plotting canvas, taking the period and the t0 from my properties.


applyTimedToCanvas

private boolean applyTimedToCanvas(double p,
                                   double t0,
                                   double phi0)
We apply the entire data map to the plotting canvas.


updateOverlap

private boolean updateOverlap()
We update the overlap, i.e. from the non-null phased array we copy those at phases < overlap or phases > 1- overlap to a second plot list and add them as the OVERLAP style, which is in the default setup the generic style.


updateConstants

private boolean updateConstants(double p,
                                double t0,
                                double phi0)
We do not reconstruct the phased array, just update the x coordinates of the plot data.


solveFit

private VectorG solveFit(double p)
We solve the phase regression and return the phase shift of the solution.


fitShift

private double fitShift(double p,
                        double t0)
We have a prescribed zero point in time. This means that the phase shift of the fit has to be re-interprated.


updateFit

private boolean updateFit(double p,
                          double t0,
                          double phi0)
We update our fit by solving for amplitude, phase offset and data offset. This fit is then displayed together with the data in the FITTING style, if KEY_SHOWFIT points to true.