export_Fitter.cxx
Go to the documentation of this file.
1 
12 #ifdef _MSC_VER
13 // nonstandard extension used 'extern' before...
14 # pragma warning(disable:4231)
15 
16 // needs to have dll-interface used by client
17 # pragma warning(disable:4251)
18 
19 // non dll-interface struct
20 # pragma warning(disable:4275)
21 
22 // 'int' : forcing value to bool 'true' or 'false' (performance warning)
23 # pragma warning(disable:4800)
24 #endif
25 
26 // include first to avoid _POSIX_C_SOURCE warning.
27 #include <boost/python.hpp>
28 
29 #include "functions/FunctionBase.h"
30 #include "minimizers/Fitter.h"
31 #include "minimizers/StatedFCN.h"
32 
33 using std::vector;
34 using namespace boost::python;
35 
36 namespace hippodraw {
37 namespace Python {
38 
39 void
41 {
42  class_ < Fitter, bases<>,
43  Fitter, boost::noncopyable >
44  ( "Fitter",
45  "Provides an interface to objective function minimizers.",
46  no_init )
47 
48  .add_property ( "degreesOfFreedom",
49  &Fitter::calcDegreesOfFreedom )
50 
51  .add_property ( "objectiveValue",
52  &Fitter::objectiveValue )
53 
54  .def ( "name", &Fitter::name,
55  return_value_policy < copy_const_reference > (),
56  "name () -> string\n"
57  "\n"
58  "Returns the minimizer name." )
59 
60  .def ( "getFCN", &Fitter::getFCN,
61  return_value_policy < reference_existing_object > (),
62  "getFCN () -> FCNBase\n"
63  "\n"
64  "Returns the objective function." )
65 
66  .def ( "minimize", &Fitter::calcBestFit,
67  "minimize () -> Boolean\n"
68  "\n"
69  "Attempts to do a minimization, returns True if successful." )
70 
71  .def ( "setFixedFlags", &Fitter::setFixedFlags,
72  "setFixedFlags ( sequence ) -> None\n"
73  "\n"
74  "Sets which parameters that should be fixed during a fit. A\n"
75  "`1' in the sequence indicates corresponding parameters is fixed." )
76 
77  .def ( "setLimits",
78  ( void ( Fitter::* ) // function pointer cast
79  ( unsigned int, double, double ) ) // signature
80  &Fitter::setLimits )
81 
82  .def ( "setLimits",
83  ( void ( Fitter::* ) // function pointer cast
84  ( const std::string &, double, double ) ) // signature
85  &Fitter::setLimits,
86  "setLimits ( name, low, high ) -> None\n"
87  "setLimits ( index, low, high ) -> None\n"
88  "\n"
89  "Sets the limits on a model function parameter. Only minimizers\n"
90  "based on Minuit support this feature, others throw an exception." )
91 
92  .def ( "setStepSize",
93  ( void ( Fitter::* ) // function pointer cast
94  ( unsigned int, double ) ) // signature
95  &Fitter::setStepSize )
96 
97  .def ( "setStepSize",
98  ( void ( Fitter::* ) // function pointer cast
99  ( const std::string &, double ) ) // signature
100  &Fitter::setStepSize,
101  "setStepSize ( name, value ) -> None\n"
102  "setStepSize ( index, value ) -> None\n"
103  "\n"
104  "Sets the step size for the model function parameter. Only\n"
105  "minimizers based on Minuit support this function, others\n"
106  "throw an exception." )
107 
108  ;
109 }
110 
111 } // namespace Python
112 } // namespace hippodraw

Generated for HippoDraw Class Library by doxygen