jview
Class UserDrivenFitting

java.lang.Object
  extended by util.PropertyContainer
      extended by util.PropertyResources
          extended by util.PropertyBundles
              extended by jview.UserDrivenFitting
All Implemented Interfaces:
PropertyChangeListener, Cloneable, EventListener, EclecticPropertyListener, BeanSupport, Initializable, LocalizedSupplying, PropertySupplying, ResourceSupplying

public class UserDrivenFitting
extends PropertyBundles
implements EclecticPropertyListener, BeanSupport

A small class that handles user clicks in an extrema-selectable canvas and converts them to initial conditions or constant selection of a model fitter. It bridges the gap for models that can not be automatically fitted, i.e. that need user input for pre-selecting a starting range of a parameter. It is used in Fourier applications, where the user selects a frequency out of a periodogramm, which is than funneld to an orbit solver or a multiple frequency fit to the data. The result of this fitting is normally displayed in a JFitResidualFrame or JFitResidualDisplay, which should register as property change listener to this component. A non-null KEY_LISTENERFRAME can be used to construct an individual model handler (a JFitResidualFrame) for this class. As usual, such a attached frame can be retrieved with PropertyContainer.getAsObject(java.lang.String), using #ATTACHED


Nested Class Summary
static class UserDrivenFitting.PeriodError
           
static class UserDrivenFitting.PeriodExtrema
           
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
private  Multidimensional error
          The function to calculate a model parameter error from the extrema.
private  Multidimensional func
          The function to calculate a model parameter from the extrema select.
static String KEY_EXTREMAERROR
          How to transfer the selected extrema to a model variable.
static String KEY_EXTREMAFUNCTION
          How to transfer the selected extrema to a model variable.
static String KEY_EXTREMANAME
          How to transfer the selected extrema to a model variable.
static String KEY_EXTREMAUNIT
          How to transfer the selected extrema to a model variable.
static String KEY_LISTENERFRAME
          The key to an individual listener frame.
private  ModelFitting model
          The model fitter used to calculate new fits.
static String MODELPARAMETER
          Property to listen to for model soultion changes.
static String MODELSOLUTION
          Property to listen to for model soultion changes.
private  PropertyChangeSupport pipe
          Used for property change events.
 
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.BeanSupport
CASTING
 
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
UserDrivenFitting(Map<String,String> pp)
          We can handle extremal selects only if we have at least the parameter name that is going to be selected.
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener pcl)
          Adds, if new, this property change listeners.
 void addPropertyChangeListener(String p, PropertyChangeListener pcl)
          Adds, if new, this property change listeners.
 void init()
          We initalize our extram converting function.
 boolean isInterested(String in)
          We are interested in the model fitter, the model data and the extrema.
 void propertyChange(PropertyChangeEvent pce)
          If we receive a property change event that the fitdisplay is interested in, we pass it along.
 void removePropertyChangeListener(PropertyChangeListener pcl)
          Removes this property change listeners.
 void removePropertyChangeListener(String p, PropertyChangeListener pcl)
          Removes this property change listeners.
private  void select(Vector3D parabola)
          The user selected an extremum.
 
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

MODELSOLUTION

public static final String MODELSOLUTION
Property to listen to for model soultion changes.

See Also:
Constant Field Values

MODELPARAMETER

public static final String MODELPARAMETER
Property to listen to for model soultion changes.

See Also:
Constant Field Values

KEY_LISTENERFRAME

public static final String KEY_LISTENERFRAME
The key to an individual listener frame.

See Also:
Constant Field Values

KEY_EXTREMANAME

public static final String KEY_EXTREMANAME
How to transfer the selected extrema to a model variable.

See Also:
Constant Field Values

KEY_EXTREMAFUNCTION

public static final String KEY_EXTREMAFUNCTION
How to transfer the selected extrema to a model variable.

See Also:
Constant Field Values

KEY_EXTREMAERROR

public static final String KEY_EXTREMAERROR
How to transfer the selected extrema to a model variable.

See Also:
Constant Field Values

KEY_EXTREMAUNIT

public static final String KEY_EXTREMAUNIT
How to transfer the selected extrema to a model variable.

See Also:
Constant Field Values

pipe

private PropertyChangeSupport pipe
Used for property change events.


func

private Multidimensional func
The function to calculate a model parameter from the extrema select.


error

private Multidimensional error
The function to calculate a model parameter error from the extrema.


model

private ModelFitting model
The model fitter used to calculate new fits.

Constructor Detail

UserDrivenFitting

public UserDrivenFitting(Map<String,String> pp)
We can handle extremal selects only if we have at least the parameter name that is going to be selected.

Method Detail

init

public void init()
We initalize our extram converting function. If none are given, we use the x coordinate of the smoothed parabola as the parameter value and convert the FWHM of the parabola to a sigma of a gaussian.

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

isInterested

public boolean isInterested(String in)
We are interested in the model fitter, the model data and the extrema. If we receive an extrema-selection, we either calculate a new fit or generate a new fit constant.

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

propertyChange

public void propertyChange(PropertyChangeEvent pce)
If we receive a property change event that the fitdisplay is interested in, we pass it along. Additionally, we record the fitter on MODELFITTER properties and we do a fit on EXTREMASELECT.

Specified by:
propertyChange in interface PropertyChangeListener

select

private void select(Vector3D parabola)
The user selected an extremum. We convert this into a Variable using our multidimensional transfer functions func and error, together with the name of the variable KEY_EXTREMANAME and possibly its unit KEY_EXTREMAUNIT. If this variable is a constant to the model, we generate a parameter changed event and pass that along to possible listeners. If the variable is an initial condition, we fit the entire model and pass a model solution event.


addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener pcl)
Adds, if new, this property change listeners.

Specified by:
addPropertyChangeListener in interface BeanSupport

addPropertyChangeListener

public void addPropertyChangeListener(String p,
                                      PropertyChangeListener pcl)
Adds, if new, this property change listeners.

Specified by:
addPropertyChangeListener in interface BeanSupport

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener pcl)
Removes this property change listeners.

Specified by:
removePropertyChangeListener in interface BeanSupport

removePropertyChangeListener

public void removePropertyChangeListener(String p,
                                         PropertyChangeListener pcl)
Removes this property change listeners.

Specified by:
removePropertyChangeListener in interface BeanSupport