jview
Class JDataModelDisplay

java.lang.Object
  extended by util.PropertyContainer
      extended by util.PropertyResources
          extended by util.PropertyBundles
              extended by jview.AbstractDisplayable
                  extended by jview.JSplittedDataDisplay
                      extended by jview.JDataModelDisplay
All Implemented Interfaces:
PropertyChangeListener, Cloneable, EventListener, DataCanvasProviding, DataObserver, Displayable, EclecticPropertyListener, Initializable, LocalizedSupplying, PropertySupplying, ResourceSupplying

public class JDataModelDisplay
extends JSplittedDataDisplay
implements EclecticPropertyListener

This frame works together with a DataModel and allows displaying of the original data, the model fit and the residuals. It works utilizing a JSplittedDataDisplay, placing the measures plus model in the master panel, and showing the residuals in the bottom slave panel. Additionally, the user may adjust some of the model parameters, those given in #KEY_ADJUSTABLE, while those denoted in #KEY_FIXED cannot be altered. Changing the parameters is accomplished by spinners, the step-size is regulated by the errors of the model parameters, if known, #setInitialModel, and by #KEY_ADJUSTABLESTEP. Transfer functions for x, y and the residual allow more flexibility.


Nested Class Summary
 
Nested classes/interfaces inherited from class jview.JSplittedDataDisplay
JSplittedDataDisplay.Show
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
private static int DEFFITPOINTS
          Default property value.
private  DataModel display
          The data model to display.
private  Function efunc
          Transfer function for err(y), normally d(yfunc)/d(y).
static String KEY_DATASET
          The set name of the data in the master canvas.
static String KEY_ERRFUNCTION
          How to transfer the error of the dependant y values from the model.
static String KEY_FITPOINTS
          Number of points in the fit.
static String KEY_FITSET
          If set, the set name of the fit in the master canvas.
static String KEY_RESIDUALSET
          If set, the set name of the fit in the master canvas.
static String KEY_RMSFUNCTION
          How to transfer the residuals of the measurement.
static String KEY_XFITMAX
          For the fit, the maximum xvector to use .
static String KEY_XFITMIN
          For the fit, the minimum xvector to use .
static String KEY_XFUNCTION
          How to transfer the independant ('x') values from the model.
static String KEY_YFUNCTION
          How to transfer the dependant ('y') values from the model.
private  List<Variable> modelfit
          The soultion to the model, i.e.
private  Function rfunc
          Transfer function for residuals.
private  List<Object> tagging
          The tagging of the data model, null if not applicable.
private  Multidimensional xfunc
          Transfer function for x.
private  Function yfunc
          Transfer function for y.
 
Fields inherited from class jview.JSplittedDataDisplay
KEY_CONTINUOUS, KEY_LINKDELETE, KEY_MASTERCANVAS, KEY_MASTERWEIGHT, KEY_ONETOUCH, KEY_SLAVECANVAS, KEY_TOPBOTTOM, KEY_TRANSFER
 
Fields inherited from class jview.AbstractDisplayable
KEY_COMPONENTNAME, KEY_ICON, KEY_INSETS
 
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
JDataModelDisplay(Map<String,String> prop)
          Constructs a display that shows the original data, the fit and the residual.
 
Method Summary
 void init()
          Defaults the transfer function or constructs them with an empty constructor.
 boolean isInterested(String property)
          We return true on MODELFITTER, MODELDATA, MODELSOLUTION, MODELPARAMETER.
 void propertyChange(PropertyChangeEvent pce)
          We listen to changes in the fitter (erease all), in the data (replot data), the fitted model (replot fit and residual) and in the model parameters (replot fit and residual).
private  boolean setModelData(DataModel dm)
          We set a new data model here.
private  boolean setModelFitting(ModelFitting model)
          Sets the model fitter associated with this panel.
private  boolean setModelParameter(Variable c)
          This sets a single model parameter to a new value.
private  boolean setModelSolution(List<Variable> newfit)
          This sets the solution to the model using some outside fitter.
private  boolean setModelTagging(Object[] tags)
          Sets the tagging of the data model if the tagging length equals the data model measure counts.
private  boolean updateFit()
          We take the existing fit and step through the measurement space.
private  boolean updateMeasures()
          We take the existing data model and convert it into a displayable set of data.
private  boolean updateResidual()
          We take the exisiting fit and calculate the residuals of the model to the measured data.
 
Methods inherited from class jview.JSplittedDataDisplay
dataChanged, getComposingCanvases, getMainCanvas, getMasterCanvas, getRepresentation, getSlaveCanvas
 
Methods inherited from class jview.AbstractDisplayable
getComponentName, getIcon, getIcon
 
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

KEY_DATASET

public static final String KEY_DATASET
The set name of the data in the master canvas.

See Also:
Constant Field Values

KEY_FITSET

public static final String KEY_FITSET
If set, the set name of the fit in the master canvas.

See Also:
Constant Field Values

KEY_RESIDUALSET

public static final String KEY_RESIDUALSET
If set, the set name of the fit in the master canvas.

See Also:
Constant Field Values

KEY_XFUNCTION

public static final String KEY_XFUNCTION
How to transfer the independant ('x') values from the model.

See Also:
Constant Field Values

KEY_YFUNCTION

public static final String KEY_YFUNCTION
How to transfer the dependant ('y') values from the model.

See Also:
Constant Field Values

KEY_ERRFUNCTION

public static final String KEY_ERRFUNCTION
How to transfer the error of the dependant y values from the model.

See Also:
Constant Field Values

KEY_RMSFUNCTION

public static final String KEY_RMSFUNCTION
How to transfer the residuals of the measurement.

See Also:
Constant Field Values

KEY_XFITMIN

public static final String KEY_XFITMIN
For the fit, the minimum xvector to use .

See Also:
Constant Field Values

KEY_XFITMAX

public static final String KEY_XFITMAX
For the fit, the maximum xvector to use .

See Also:
Constant Field Values

KEY_FITPOINTS

public static final String KEY_FITPOINTS
Number of points in the fit.

See Also:
Constant Field Values

DEFFITPOINTS

private static final int DEFFITPOINTS
Default property value.

See Also:
Constant Field Values

display

private DataModel display
The data model to display.


tagging

private List<Object> tagging
The tagging of the data model, null if not applicable.


modelfit

private List<Variable> modelfit
The soultion to the model, i.e. the best fit.


xfunc

private Multidimensional xfunc
Transfer function for x.


yfunc

private Function yfunc
Transfer function for y.


efunc

private Function efunc
Transfer function for err(y), normally d(yfunc)/d(y).


rfunc

private Function rfunc
Transfer function for residuals.

Constructor Detail

JDataModelDisplay

public JDataModelDisplay(Map<String,String> prop)
Constructs a display that shows the original data, the fit and the residual.

Method Detail

init

public void init()
Defaults the transfer function or constructs them with an empty constructor.

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

propertyChange

public void propertyChange(PropertyChangeEvent pce)
We listen to changes in the fitter (erease all), in the data (replot data), the fitted model (replot fit and residual) and in the model parameters (replot fit and residual). Note that a data replot can also be required on model and parameter changes, if this has an effect on the transfer functions. All this different action fork to appropriate private methods.

Specified by:
propertyChange in interface PropertyChangeListener

isInterested

public boolean isInterested(String property)
We return true on MODELFITTER, MODELDATA, MODELSOLUTION, MODELPARAMETER.

Specified by:
isInterested in interface EclecticPropertyListener
Parameters:
property - The property name to query.
Returns:
True, if this listener would like to listen to this property.

setModelFitting

private boolean setModelFitting(ModelFitting model)
Sets the model fitter associated with this panel. A new fitter means that all display data has to be ereased, this includes the fit and the residual, but also the data. The latter one is restored by getting the data out of the new model fitter, which is assumed to be correct, except if null.


setModelData

private boolean setModelData(DataModel dm)
We set a new data model here. The model is cached for further fit updates and parameter updates to be available, but here we only update the measurement display.


setModelTagging

private boolean setModelTagging(Object[] tags)
Sets the tagging of the data model if the tagging length equals the data model measure counts.


setModelSolution

private boolean setModelSolution(List<Variable> newfit)
This sets the solution to the model using some outside fitter. We redo the fitting and the residuals, if applicable. If any of the transfer function xfunc, yfunc or errfunc depend on any of the model parameters, we redo the measure plot as well.


setModelParameter

private boolean setModelParameter(Variable c)
This sets a single model parameter to a new value. If the parameter is part of the current model fit, we update our copy of the fit. We check, if the parameter registers to any of the transfer function and replot the measures, the fit and the residuals. If not, we only replot fit and residual, but only if the parameter is part of the model.


updateMeasures

private boolean updateMeasures()
We take the existing data model and convert it into a displayable set of data. This data vector is than put on the canvas.


updateFit

private boolean updateFit()
We take the existing fit and step through the measurement space. Several caveats apply:


updateResidual

private boolean updateResidual()
We take the exisiting fit and calculate the residuals of the model to the measured data. This is done by evaluating the model on all sampling points, calculating the difference between the measurement and the model and transfering this difference with the rfunc transfer function, if it exists, otherwise the derivative of the yfunc is used.