Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

PyFunctionRep Class Reference

#include <PyFunctionRep.h>

Collaboration diagram for PyFunctionRep:

Collaboration graph
[legend]
List of all members.

Detailed Description

This class is the public Python interface wrap for the FunctionRep class.

Its purpose to to lock the application thread, when needed, before invoking methods in the FunctionRep.

Requests:
@@ Return covariance matrix.

Todo:
Could make this a derived class of FunctionRep so that methods that do not need wrapping could be called directly.

Author:
James Chiang <jchiang@slac.stanford.edu>

Paul F. Kunz <Paul_Kunz@slac.stanford.edu>

Definition at line 40 of file PyFunctionRep.h.

Public Member Functions

void addTo (QtDisplay *display)
 Adds the function on to the display.
const std::vector< std::vector<
double > > & 
covarianceMatrix ()
 Returns the covariance matrix from the last fit.
QtDisplaycreateResidualsDisplay () const
 Returns an XY Plot of the residuals between the function and the data.
int degreesOfFreedom ()
 Returns the number of degrees-of-freedom.
bool fitFunction ()
 Fits the function to the target DataRep.
const std::stringgetFitterName () const
 Returns the name of the Fitter.
DataRepgetRep () const
 Returns the wrapped FunctionRep object.
double objectiveValue ()
 Returns the value of objective value.
double operator() (double x)
 Returns the function value at a given x.
const std::vector< double > & parameters () const
 Returns the current values of the parameters.
const std::vector< std::string > & parmNames () const
 Returns the names of the parameters.
const std::vector< double > & principleErrors () const
 Returns the principle error values associated with the parameters.
 PyFunctionRep (FunctionBase *function, PyDataRep *rep)
 PyFunctionRep (const std::string &function_name, PyDataRep *rep)
 Constructor.
void setFitRange (double low, double high)
 Sets the cut to limit range of fitting.
void setFitRangeEnabled (bool yes=true)
 Sets use of a fitting range on or off.
void setFitter (const std::string &name)
 Sets the Fitter with name in the FitterFactory.
void setFixedFlags (const std::vector< int > &flags)
 Set the fixed flags of the parameters.
void setParameters (const std::vector< double > &params)
 Set the parameter values.

Private Attributes

QApplicationm_app
 The application instance.
FunctionRepm_rep
 The wrapped FunctionRep object.
PlotterBasem_target
 The PlotterBase on which the FunctionRep is displayed.


Constructor & Destructor Documentation

PyFunctionRep::PyFunctionRep const std::string function_name,
PyDataRep rep
 

Constructor.

Definition at line 175 of file PyFunctionRep.cxx.

References FunctionController::instance(), m_app, m_rep, and m_target.

PyFunctionRep::PyFunctionRep FunctionBase function,
PyDataRep rep
 

Definition at line 189 of file PyFunctionRep.cxx.

References FunctionController::instance(), m_app, m_rep, and m_target.


Member Function Documentation

void PyFunctionRep::addTo QtDisplay display  ) 
 

Adds the function on to the display.

Definition at line 208 of file PyFunctionRep.cxx.

References FunctionController::addFunction(), QtDisplay::display(), FunctionController::instance(), m_rep, and m_target.

Referenced by hippodraw::Python::export_Function().

const vector< vector< double > > & PyFunctionRep::covarianceMatrix  ) 
 

Returns the covariance matrix from the last fit.

Definition at line 304 of file PyFunctionRep.cxx.

References FunctionController::instance(), m_app, and m_target.

QtDisplay * PyFunctionRep::createResidualsDisplay  )  const
 

Returns an XY Plot of the residuals between the function and the data.

Definition at line 358 of file PyFunctionRep.cxx.

References FunctionController::instance(), and m_target.

Referenced by hippodraw::Python::export_Function().

int PyFunctionRep::degreesOfFreedom  ) 
 

Returns the number of degrees-of-freedom.

Definition at line 317 of file PyFunctionRep.cxx.

References FunctionController::getDegreesOfFreedom(), FunctionController::instance(), QApplication::lock(), m_app, m_target, and QApplication::unlock().

Referenced by hippodraw::Python::export_Function().

bool PyFunctionRep::fitFunction  ) 
 

Fits the function to the target DataRep.

Fits the function to this object's target DataRep. Uses the FunctionController::fitFunction member function to apply the application logic.

Definition at line 254 of file PyFunctionRep.cxx.

References FunctionController::instance(), QApplication::lock(), m_app, m_rep, m_target, and QApplication::unlock().

Referenced by hippodraw::Python::export_Function().

const std::string & PyFunctionRep::getFitterName  )  const
 

Returns the name of the Fitter.

Definition at line 351 of file PyFunctionRep.cxx.

References m_rep.

Referenced by hippodraw::Python::export_Function().

DataRep * PyFunctionRep::getRep  )  const
 

Returns the wrapped FunctionRep object.

Definition at line 203 of file PyFunctionRep.cxx.

References m_rep.

Referenced by QtDisplay::addDataRep().

double PyFunctionRep::objectiveValue  ) 
 

Returns the value of objective value.

Bug:
This function only works correctly if there is only one DataRep contained by the plotter.
The constructor of this class should remember which DataRep object the function is attached to.

Definition at line 288 of file PyFunctionRep.cxx.

References FunctionController::getObjectiveValue(), FunctionController::instance(), QApplication::lock(), m_app, m_target, and QApplication::unlock().

Referenced by hippodraw::Python::export_Function().

double PyFunctionRep::operator() double  x  ) 
 

Returns the function value at a given x.

Definition at line 266 of file PyFunctionRep.cxx.

References FunctionController::getComposite(), FunctionRep::getFunction(), FunctionController::instance(), m_rep, and m_target.

const vector< double > & PyFunctionRep::parameters  )  const
 

Returns the current values of the parameters.

Todo:
Enable access to parameters of composite functions via function indexes.
Do this for parameters(), setParameters(), and setFixedFlags() methods.

Definition at line 229 of file PyFunctionRep.cxx.

References QApplication::lock(), m_app, m_rep, FunctionRep::parameters(), and QApplication::unlock().

Referenced by hippodraw::Python::export_Function().

const vector< std::string > & PyFunctionRep::parmNames  )  const
 

Returns the names of the parameters.

Definition at line 219 of file PyFunctionRep.cxx.

References QApplication::lock(), m_app, m_rep, FunctionRep::parmNames(), and QApplication::unlock().

Referenced by hippodraw::Python::export_Function().

const vector< double > & PyFunctionRep::principleErrors  )  const
 

Returns the principle error values associated with the parameters.

Definition at line 238 of file PyFunctionRep.cxx.

References QApplication::lock(), m_app, m_rep, and QApplication::unlock().

Referenced by hippodraw::Python::export_Function().

void PyFunctionRep::setFitRange double  low,
double  high
 

Sets the cut to limit range of fitting.

Definition at line 369 of file PyFunctionRep.cxx.

References m_rep.

Referenced by hippodraw::Python::export_Function().

void PyFunctionRep::setFitRangeEnabled bool  yes = true  ) 
 

Sets use of a fitting range on or off.

Definition at line 378 of file PyFunctionRep.cxx.

References m_rep.

Referenced by hippodraw::Python::export_Function().

void PyFunctionRep::setFitter const std::string name  ) 
 

Sets the Fitter with name in the FitterFactory.

Definition at line 343 of file PyFunctionRep.cxx.

References FunctionController::instance(), and m_rep.

Referenced by hippodraw::Python::export_Function().

void PyFunctionRep::setFixedFlags const std::vector< int > &  flags  ) 
 

Set the fixed flags of the parameters.

Definition at line 332 of file PyFunctionRep.cxx.

References QApplication::lock(), m_app, m_rep, and FunctionRep::setFixedFlags().

Referenced by hippodraw::Python::export_Function().

void PyFunctionRep::setParameters const std::vector< double > &  params  ) 
 

Set the parameter values.

Definition at line 247 of file PyFunctionRep.cxx.

References QApplication::lock(), m_app, m_rep, and FunctionRep::setParameters().

Referenced by hippodraw::Python::export_Function().


Member Data Documentation

QApplication* PyFunctionRep::m_app [private]
 

The application instance.

Definition at line 46 of file PyFunctionRep.h.

Referenced by covarianceMatrix(), degreesOfFreedom(), fitFunction(), objectiveValue(), parameters(), parmNames(), principleErrors(), PyFunctionRep(), setFixedFlags(), and setParameters().

FunctionRep* PyFunctionRep::m_rep [private]
 

The wrapped FunctionRep object.

Definition at line 49 of file PyFunctionRep.h.

Referenced by addTo(), fitFunction(), getFitterName(), getRep(), operator()(), parameters(), parmNames(), principleErrors(), PyFunctionRep(), setFitRange(), setFitRangeEnabled(), setFitter(), setFixedFlags(), and setParameters().

PlotterBase* PyFunctionRep::m_target [private]
 

The PlotterBase on which the FunctionRep is displayed.

Definition at line 52 of file PyFunctionRep.h.

Referenced by addTo(), covarianceMatrix(), createResidualsDisplay(), degreesOfFreedom(), fitFunction(), objectiveValue(), operator()(), and PyFunctionRep().


The documentation for this class was generated from the following files:
Generated for HippoDraw-1.14.8.5 by doxygen 1.4.3