PyFunctionRep Class Reference

#include <PyFunctionRep.h>

Collaboration diagram for PyFunctionRep:

Collaboration graph
PlotterBaseObserverDataRepProjectorBaseObservableDataSourceSizePointAxisModelBaseRangeRectCutRangeRepColorFunctionRepRepBaseErrorBarRepPointRepBase
[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 41 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::string & getFitterName () const
 Returns the name of the Fitter.
hippodraw::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)
 Constructor taking function and no target.
 PyFunctionRep (FunctionBase *function, PyDataRep *rep)
 Constructor taking function and target DataRep.
 PyFunctionRep (const std::string &function_name, PyDataRep *rep)
 Constructor taking function name and target DataRep.
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

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


Constructor & Destructor Documentation

PyFunctionRep ( const std::string &  function_name,
PyDataRep rep 
)

Constructor taking function name and target DataRep.

Definition at line 178 of file PyFunctionRep.cxx.

References FunctionController::instance(), PyApp::lock(), PyFunctionRep::m_rep, PyFunctionRep::m_target, and PyApp::unlock().

PyFunctionRep ( FunctionBase function,
PyDataRep rep 
)

Constructor taking function and target DataRep.

Definition at line 194 of file PyFunctionRep.cxx.

References FunctionController::instance(), PyApp::lock(), PyFunctionRep::m_rep, PyFunctionRep::m_target, and PyApp::unlock().

PyFunctionRep ( FunctionBase function  ) 

Constructor taking function and no target.

Definition at line 211 of file PyFunctionRep.cxx.

References FunctionController::instance(), PyApp::lock(), PyFunctionRep::m_rep, PyFunctionRep::m_target, and PyApp::unlock().


Member Function Documentation

void addTo ( QtDisplay display  ) 

Adds the function on to the display.

Definition at line 231 of file PyFunctionRep.cxx.

References FunctionController::addFunction(), QtDisplay::display(), FunctionController::instance(), PyApp::lock(), PyFunctionRep::m_rep, PyFunctionRep::m_target, and PyApp::unlock().

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

const vector< vector< double > > & covarianceMatrix (  ) 

Returns the covariance matrix from the last fit.

Definition at line 334 of file PyFunctionRep.cxx.

References FunctionController::instance(), PyApp::lock(), PyFunctionRep::m_target, and PyApp::unlock().

QtDisplay * createResidualsDisplay (  )  const

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

Definition at line 388 of file PyFunctionRep.cxx.

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

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

int degreesOfFreedom (  ) 

Returns the number of degrees-of-freedom.

Definition at line 347 of file PyFunctionRep.cxx.

References FunctionController::getDegreesOfFreedom(), FunctionController::instance(), PyApp::lock(), PyFunctionRep::m_target, and PyApp::unlock().

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

bool 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 283 of file PyFunctionRep.cxx.

References FunctionController::instance(), PyApp::lock(), PyFunctionRep::m_rep, PyFunctionRep::m_target, and PyApp::unlock().

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

const std::string & getFitterName (  )  const

Returns the name of the Fitter.

Definition at line 381 of file PyFunctionRep.cxx.

References PyFunctionRep::m_rep.

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

DataRep * getRep (  )  const

Returns the wrapped FunctionRep object.

Definition at line 226 of file PyFunctionRep.cxx.

References PyFunctionRep::m_rep.

Referenced by QtDisplay::addDataRep().

double objectiveValue (  ) 

Returns the value of objective value.

Definition at line 317 of file PyFunctionRep.cxx.

References FunctionController::getObjectiveValue(), FunctionController::instance(), PyApp::lock(), PyFunctionRep::m_target, and PyApp::unlock().

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

double operator() ( double  x  ) 

Returns the function value at a given x.

Definition at line 295 of file PyFunctionRep.cxx.

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

const vector< double > & 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 258 of file PyFunctionRep.cxx.

References PyApp::lock(), PyFunctionRep::m_rep, FunctionRep::parameters(), and PyApp::unlock().

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

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

Returns the names of the parameters.

Definition at line 248 of file PyFunctionRep.cxx.

References PyApp::lock(), PyFunctionRep::m_rep, FunctionRep::parmNames(), and PyApp::unlock().

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

const vector< double > & principleErrors (  )  const

Returns the principle error values associated with the parameters.

Definition at line 267 of file PyFunctionRep.cxx.

References PyApp::lock(), PyFunctionRep::m_rep, and PyApp::unlock().

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

void setFitRange ( double  low,
double  high 
)

Sets the cut to limit range of fitting.

Definition at line 400 of file PyFunctionRep.cxx.

References PyFunctionRep::m_rep.

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

void setFitRangeEnabled ( bool  yes = true  ) 

Sets use of a fitting range on or off.

Definition at line 409 of file PyFunctionRep.cxx.

References PyFunctionRep::m_rep.

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

void setFitter ( const std::string &  name  ) 

Sets the Fitter with name in the FitterFactory.

Definition at line 373 of file PyFunctionRep.cxx.

References FunctionController::instance(), and PyFunctionRep::m_rep.

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

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

Set the fixed flags of the parameters.

Definition at line 362 of file PyFunctionRep.cxx.

References PyApp::lock(), PyFunctionRep::m_rep, FunctionRep::setFixedFlags(), and PyApp::unlock().

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

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

Set the parameter values.

Definition at line 276 of file PyFunctionRep.cxx.

References PyApp::lock(), PyFunctionRep::m_rep, FunctionRep::setParameters(), and PyApp::unlock().

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


Member Data Documentation

FunctionRep* m_rep [private]

The wrapped FunctionRep object.

Definition at line 47 of file PyFunctionRep.h.

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

PlotterBase* m_target [private]

The PlotterBase on which the FunctionRep is displayed.

Definition at line 50 of file PyFunctionRep.h.

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


The documentation for this class was generated from the following files:
Generated for HippoDraw Class Library by doxygen